Open monkeyDemon opened 5 years ago
I find that this error is cause by the code located at 65-70 lines of augmenter.py in function transform().
elif aug_type == "brighten":
X_aug = iaa.Add(
(int(-40 * magnitude), int(40 * magnitude)), per_channel=0.5
).augment_images(
X
) # brighten
The use of iaa.Add will cause X_aug out of the range [0,255], just add one line can fix the problem.
elif aug_type == "brighten":
X_aug = iaa.Add(
(int(-40 * magnitude), int(40 * magnitude)), per_channel=0.5
).augment_images(
X
) # brighten
np.clip(X_aug, 0, 255, out=X_aug)
Now my puzzle is that the transform() is a very important function, and if it has a bug, the whole program does not work properly,so the author won't miss it. So why did I encounter this mistake? Does it matter if I use Python 2 but not Python3?
I also encounter the same error with TF 1.13.1, python 3.5 (after patching all f-string formating), imgaug 0.3.0 (latest version at this time). I apply your patch but I got another error that I will try to fix soon.
ValueError: Got dtype 'float32', which is a forbidden dtype (bool, uint16, uint32, uint64, uint128, uint256, int32, int64, int128, int256, float16, float32, float64, float96, float128, float256).
Line 108 of augmenter.py
: .AddToHueAndSaturation
It seems line 133 of augmenter.py
, when we call _X = denormalize(X)
, X isn't normalized ! In fact, it has been dived by 255 twice. Try to do : (X 255) 255 and we will get the data in 0-255 scale.
I write a simple script like this:
after run it, about one minute, I got a AssertionError:
The code that throw Error is:
It seems the code after data-augmentation is out of range [0,255].
So if the function augment_by_policy() in augmenter.py has some bug?