vedaseg icon indicating copy to clipboard operation
vedaseg copied to clipboard

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

Open thatsdone opened this issue 3 years ago • 3 comments

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'

thatsdone avatar Nov 25 '21 14:11 thatsdone

Hi Thatsdone,

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

DarthThomas avatar Nov 26 '21 09:11 DarthThomas

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

thatsdone avatar Nov 27 '21 05:11 thatsdone

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

DarthThomas avatar Nov 29 '21 03:11 DarthThomas