aleju / imgaug

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

AttributeError: module 'numpy' has no attribute 'float128' #304

Open GewelsJI opened 5 years ago

GewelsJI commented 5 years ago

My laptop is Windows10 OS and with i5-8300H and with 1050 GPU

When I run this script:

aug_17 = iaa.Grayscale(alpha=1.0)

img = cv2.imread("img.jpg")
print(type(img))
print(img.dtype)
img = aug_17.augment_image(img)
cv2.imwrite("img17.png", img)

I got this error:

<class 'numpy.ndarray'>
uint8
Traceback (most recent call last):
  File "D:/1-ResearchFile/0_Mypaper_SOD-Benchmark/4_Analysis/7_imgaug/experiment/experiments-1.py", line 46, in <module>
    img = aug_17.augment_image(img)
  File "C:\Users\Gepeng-Ji\Anaconda3\envs\keras\lib\site-packages\imgaug\augmenters\meta.py", line 407, in augment_image
    return self.augment_images([image], hooks=hooks)[0]
  File "C:\Users\Gepeng-Ji\Anaconda3\envs\keras\lib\site-packages\imgaug\augmenters\meta.py", line 540, in augment_images
    hooks=hooks
  File "C:\Users\Gepeng-Ji\Anaconda3\envs\keras\lib\site-packages\imgaug\augmenters\color.py", line 582, in _augment_images
    result[i] = blend.blend_alpha(img_to_cs, image, alpha, self.eps)
  File "C:\Users\Gepeng-Ji\Anaconda3\envs\keras\lib\site-packages\imgaug\augmenters\blend.py", line 98, in blend_alpha
    assert image_fg.dtype not in [np.float128]
AttributeError: module 'numpy' has no attribute 'float128'

please help me ! thx @aleju

dade68 commented 5 years ago

i also encountered this problem

dade68 commented 5 years ago

well, it's so lucky that it works when i comment out line 98 and 99 in blend.py. maybe you can have a try

GewelsJI commented 5 years ago

I solve this problem when I use the same code in the Linux OS. maybe you can have another try! @dade68

aleju commented 5 years ago

Are you using the library version from pypi or from master? Afaik that problem is already fixed in master.

dade68 commented 5 years ago

from pypi

GewelsJI commented 5 years ago

from pypi @aleju

steermomo commented 5 years ago

It seems that on Windows machine, numpy has no attribute 'float128'.

aleju commented 5 years ago

There is now a new version on pypi that includes the float128 fix. Try pip install --upgrade imgaug and the error should be gone.

GewelsJI commented 5 years ago

thx! I have fixed this problem last week. thx again