-
-
Save arunm8489/af81a9cf8e6ecabba6b8bf45ca968384 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| for i in range(idx): | |
| #Get the IOUs of all boxes that come after the one we are looking at the loop | |
| try: | |
| ious = bounding_box_iou(image_pred_class[i].unsqueeze(0), image_pred_class[i+1:]) | |
| except ValueError: | |
| break | |
| except IndexError: | |
| break | |
| #Zero out all the detections that have IoU > treshhold | |
| iou_mask = (ious < nms_conf).float().unsqueeze(1) | |
| image_pred_class[i+1:] *= iou_mask | |
| #Remove the non-zero entries | |
| non_zero_ind = torch.nonzero(image_pred_class[:,4]).squeeze() | |
| image_pred_class = image_pred_class[non_zero_ind].view(-1,7) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment