rodrigo2019 / keras_yolo2

MIT License
46 stars 15 forks source link

Removing boxes outside of image #20

Closed Fafa87 closed 4 years ago

Fafa87 commented 4 years ago

It seems to me that in preprocessing we can get problems if after augmentations some boxes are fully outside of the image:

            bbs = BoundingBoxesOnImage(bbs, shape=image.shape)
            image, bbs = self._aug_pipe(image=image, bounding_boxes=bbs)
            bbs = bbs.remove_out_of_image().clip_out_of_image()

            if len(all_objs) != 0:
                for i in range(len(bbs.bounding_boxes)):
                    all_objs[i]['xmin'] = bbs.bounding_boxes[i].x1
                    all_objs[i]['xmax'] = bbs.bounding_boxes[i].x2
                    all_objs[i]['ymin'] = bbs.bounding_boxes[i].y1
                    all_objs[i]['ymax'] = bbs.bounding_boxes[i].y2

If len(bbs) != len(all_objs) then it may be catastrofic as objects can change classes, etc. as we replace coordinates on other box instances.

rodrigo2019 commented 4 years ago

I agree with you, but I checked the augmentation and I didn't see any augmentation that create this situation, the augmentation in this repo is not so heavy, I also tried to train with heavir augmentation and I got worst results.