Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: module 'albumentations.augmentations.functional' has no attribute 'scale' #57

Open
thatsdone opened this issue Nov 25, 2021 · 3 comments

Comments

@thatsdone
Copy link

DESCRIPTION

vedaseg train fails getting AttributeError: module 'albumentations.augmentations.functional' has no attribute 'scale'.

REPRODUCE PROCEDURE

Use current PiPy version of albumentation and execute training.
I'm using the following versions of software stacks.

docker image: pytorch/pytorch:1.7.1-cuda11.0-cudnn8-devel
torch: 1.7.1
torchvision: 0.8.2
conda: 4.10.3
Python: 3.8.10 conda origin
imgaug: 0.4.0
albumentation: 1.1.0 PyPi current version

ANALYSYS and SUGGESTED RESOLUTION

It looks like scale() method in albumentations.augmentations.functional does not exist in albumentations 1.1.0 any longer.
The method exists at least until 0.5.1, and after downgrading albumentations train process worked.

Thus, I think nowadays it's better to write albumentations version in requirements.txt:

albumentations==0.5.1

rather than:

albumentations>=0.4.1

LOG

The below is an exerption from the stack trace I got.

Original Traceback (most recent call last):
  File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/torch/utils/data/_utils/worker.py", line 198, in _worker_loop
    data = fetcher.fetch(index)
  File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in fetch
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/torch/utils/data/_utils/fetch.py", line 44, in <listcomp>
    data = [self.dataset[idx] for idx in possibly_batched_index]
  File "/work/vedaseg/tools/../vedaseg/datasets/voc.py", line 39, in __getitem__
    image, mask = self.process(img, [mask])
  File "/work/vedaseg/tools/../vedaseg/datasets/base.py", line 16, in process
    augmented = self.transform(image=image, masks=masks)
  File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/albumentations/core/composition.py", line 210, in __call__
    data = t(force_apply=force_apply, **data)
  File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/albumentations/core/transforms_interface.py", line 97, in __call__
    return self.apply_with_params(params, **kwargs)
  File "/root/miniconda3/envs/py38/lib/python3.8/site-packages/albumentations/core/transforms_interface.py", line 112, in apply_with_params
    res[key] = target_function(arg, **dict(params, **target_dependencies))
  File "/work/vedaseg/tools/../vedaseg/transforms/transforms.py", line 22, in apply
    return F.scale(image, scale, interpolation=self.interpolation)
AttributeError: module 'albumentations.augmentations.functional' has no attribute 'scale'
@DarthThomas
Copy link
Contributor

Hi Thatsdone,

Thanks a lot for your input! I'll look into it and update

@thatsdone
Copy link
Author

Hi,

According to requirements.txt format specification:
https://www.python.org/dev/peps/pep-0440/#version-specifiers

Writing

albumentations>=0.4.1,<1.0.0

should work, if we want to take care of old pipy index mirror site users, I think.

Masanori

DarthThomas added a commit to DarthThomas/vedaseg that referenced this issue Nov 29, 2021
Add upper limit to albumentations due to issue Media-Smart#57.
@DarthThomas
Copy link
Contributor

Hi Masanori,

Thanks again!!!!
I'll try to remove this 'scale' dependency when I got time so that we no longer need to put this restrain anymore.

Tianhe

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants