DataAugmentationForObjectDetection icon indicating copy to clipboard operation
DataAugmentationForObjectDetection copied to clipboard

Numpy divide error in RandomRotate and RandomShear

Open pigubaoza opened this issue 7 years ago • 1 comments

Using RandomRotate, I get the following error: TypeError: ufunc 'true_divide' output (typecode 'd') could not be coerced to provided output parameter (typecode 'l') according to the casting rule ''same_kind''

I was able to fix the line: new_bbox[:,:4] /= [scale_factor_x, scale_factor_y, scale_factor_x, scale_factor_y] to np.true_divide(new_bbox[:,:4], [scale_factor_x, scale_factor_y, scale_factor_x, scale_factor_y], out=new_bbox[:,:4], casting='unsafe')

The same problem occurs when using RandomShear, for both ufunc true_divide and ufunc add, however, I am unable to fix it by using np.add and np.true_divide. The resulting bounding boxes are incorrect.

pigubaoza avatar Nov 21 '18 08:11 pigubaoza

If you are using Python 2.x, try it with Python 3.x . The resulting bounding boxes were incorrect with python 2.x but with python 3.x they are correct 😀

vbsilva avatar Mar 08 '19 14:03 vbsilva