fasterrcnn-pytorch-training-pipeline icon indicating copy to clipboard operation
fasterrcnn-pytorch-training-pipeline copied to clipboard

RuntimeWarning: invalid value encountered in power img = np.power(img, gamma)

Open utility-aagrawal opened this issue 2 years ago • 1 comments

Hi,

I get the following error when I train with --use-train-aug: image

It stems from albumentaions' gamma correction method - Numpy can't handle a fractional power of a negative number (see this - https://github.com/numpy/numpy/issues/20186)

Note that I don't have negative pixel values. My input is in pascal_voc format and I think some zero pixel values are changing to very small negative values during normalization due to floating point error.

I was able to suppress this error by changing normalized pixel values to zero during gamma correction/transformation but would like to hear your suggestion on this. Added the following code block before np.power statement in albumentaions' gamma correction method:

img[img < 0] = 0

Thanks!

utility-aagrawal avatar Aug 15 '23 15:08 utility-aagrawal

It may be dataset specific. Kind of hard to say much here actually. In fact, this is the first time I am seeing this error. Still, will try to research more.

sovit-123 avatar Aug 15 '23 16:08 sovit-123