Remove instances that have an area ratio smaller than `bbox_area_threshold`.
(self, sample, image_size)
| 493 | return resized_sample |
| 494 | |
| 495 | def remove_tiny_instances(self, sample, image_size): |
| 496 | """ Remove instances that have an area ratio smaller than `bbox_area_threshold`. |
| 497 | """ |
| 498 | filtered_sample = [] |
| 499 | for instance in sample: |
| 500 | min_h, min_w, max_h, max_w = self.get_bbox(instance) |
| 501 | bbox_area_ratio = (max_h - min_h) * (max_w - min_w) / (image_size[0] * image_size[1]) |
| 502 | if bbox_area_ratio < self.bbox_area_threshold: |
| 503 | continue |
| 504 | filtered_sample.append(instance) |
| 505 | return filtered_sample |
| 506 | |
| 507 | def hflip(self, sample, width): |
| 508 | """ Horizontal flipping the instances in a sample. |