Paperspace / DataAugmentationForObjectDetection

Data Augmentation For Object Detection
https://blog.paperspace.com/data-augmentation-for-bounding-boxes/
MIT License
1.13k stars 318 forks source link

Rotation and Shearing giving faulty results #3

Closed ogencoglu closed 5 years ago

ogencoglu commented 6 years ago

According to the examples in the readme, rotation and shearing are not correctly implemented. Any update in progress?

ayooshkathuria commented 6 years ago

What exactly in the ReadMe points toward an incorrect implementation of rotation and shearing?

ogencoglu commented 5 years ago

The bounding boxes in your examples are simply wrong after shearing and rotation.

airman00 commented 5 years ago

@ogencoglu This can happen if you are using Python 2

In data_aug.py your scale factor should be float, but in Python 2 they will be treated as Integers

Just change the scale_factor code in data_aug.py as follows:'

Instead of

        scale_factor_x = img.shape[1] / w
        scale_factor_y = img.shape[0] / h

Do this

        scale_factor_x = 1.0* img.shape[1] / w
        scale_factor_y = 1.0*img.shape[0] / h
danieltanasec commented 5 years ago

I can also confirm that shear and rotation don't work properly on python 3. I think the problem is due to resize to fit the original image dimensions