AttributeError: module 'albumentations.augmentations.functional' has no attribute 'scale'
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'