albumentations icon indicating copy to clipboard operation
albumentations copied to clipboard

KeyError: 'image' when augment image sequence

Open ray-lee-94 opened this issue 2 years ago • 0 comments

🐛 Bug

To Reproduce

Steps to reproduce the behavior:

import albumentations
import numpy as np
seq = albumentations.Compose(
    [albumentations.ColorJitter(p=0.2)]
)

image1 = np.zeros((256, 256, 3), dtype=np.uint8)
image2 = np.zeros((256, 256, 3), dtype=np.uint8)
img_list = [image1, image2]
for i in range(10):
    out = seq(images=img_list)["images"]

Expected behavior

get the augmented image sequence, but get this error

  File "test.py", line 11, in <module>
    out = seq(images=img_list)["images"]
  File "site-packages/albumentations/core/composition.py", line 210, in __call__
    data = t(force_apply=force_apply, **data)
  File "site-packages/albumentations/core/transforms_interface.py", line 97, in __call__
    return self.apply_with_params(params, **kwargs)
  File "python3.6/site-packages/albumentations/core/transforms_interface.py", line 106, in apply_with_params
    params = self.update_params(params, **kwargs)
  File "python3.6/site-packages/albumentations/core/transforms_interface.py", line 156, in update_params
    params.update({"cols": kwargs["image"].shape[1], "rows": kwargs["image"].shape[0]})
KeyError: 'image'

Environment

  • Albumentations version (e.g., 0.1.8): 1.1.0
  • Python version (e.g., 3.7): 3.6.9
  • OS (e.g., Linux): Ubuntu 18.0.4
  • How you installed albumentations (conda, pip, source): pip
  • Any other relevant information: numpy=1.19.5

Additional context

ray-lee-94 avatar Mar 04 '22 09:03 ray-lee-94