aleju / imgaug

Image augmentation for machine learning experiments.
http://imgaug.readthedocs.io
MIT License
14.43k stars 2.44k forks source link

apply_lut, contrast.py openCV error #803

Open taroko-mooncake opened 2 years ago

taroko-mooncake commented 2 years ago

I get the following error when trying to run an augmentation from imgaug. It appears to be an error with the openCV function being called in contrast.py

cv2.error: OpenCV(4.5.4) :-1: error: (-5:Bad argument) in function 'LUT'

File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 771, in augment_image return self.augment_images([image], hooks=hooks)[0] File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 825, in augment_images hooks=hooks File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 645, in augment_batch_ hooks=hooks) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 3127, in _augment_batch_ hooks=hooks File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 645, in augment_batch_ hooks=hooks) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 3127, in _augment_batch_ hooks=hooks File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 645, in augment_batch_ hooks=hooks) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 3406, in _augment_batch_ hooks=hooks File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 645, in augment_batch_ hooks=hooks) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/contrast.py", line 88, in _augment_batch_ image_aug = self.func(*args) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/contrast.py", line 256, in adjust_contrast_sigmoid arr_aug = ia.apply_lut(arr, table) File "/usr/local/lib/python3.6/site-packages/imgaug/imgaug.py", line 2180, in apply_lut return apply_lut_(np.copy(image), table) File "/usr/local/lib/python3.6/site-packages/imgaug/imgaug.py", line 2272, in apply_lut_ image = cv2.LUT(image, table, dst=image) | Traceback (most recent call last): File "/opt/ml/code/mrcnn/model.py", line 1899, in data_generator use_mini_mask=config.USE_MINI_MASK) File "/opt/ml/code/mrcnn/model.py", line 1277, in load_image_gt image = det.augment_image(image) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 771, in augment_image return self.augment_images([image], hooks=hooks)[0] File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 825, in augment_images hooks=hooks File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 645, in augment_batch_ hooks=hooks) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 3127, in _augment_batch_ hooks=hooks File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 645, in augment_batch_ hooks=hooks) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 3127, in _augment_batch_ hooks=hooks File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 645, in augment_batch_ hooks=hooks) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 3406, in _augment_batch_ hooks=hooks File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/meta.py", line 645, in augment_batch_ hooks=hooks) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/contrast.py", line 88, in _augment_batch_ image_aug = self.func(*args) File "/usr/local/lib/python3.6/site-packages/imgaug/augmenters/contrast.py", line 256, in adjust_contrast_sigmoid arr_aug = ia.apply_lut(arr, table) File "/usr/local/lib/python3.6/site-packages/imgaug/imgaug.py", line 2180, in apply_lut return apply_lut_(np.copy(image), table) File "/usr/local/lib/python3.6/site-packages/imgaug/imgaug.py", line 2272, in apply_lut_ image = cv2.LUT(image, table, dst=image)