-
-
Notifications
You must be signed in to change notification settings - Fork 622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Mean Average Precision #2130
base: master
Are you sure you want to change the base?
Mean Average Precision #2130
Conversation
We already discussed a plan one week ago : (1) remove The first thing you had to do was having a test, yet I don't see any test. |
@gucifer It misses tests, from unitary to ddp. |
__all__ = ["MeanAveragePrecision"] | ||
|
||
|
||
def _iou(y: torch.Tensor, y_pred: torch.Tensor, crowd: List) -> torch.Tensor: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this function tested ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compare it against pycocotools iou function in test?
y_ignore = y_img["ignore"][y_ind] if "ignore" in y_img else torch.zeros(len(y_ind)) | ||
y_area = y_img["area"][y_ind] if "area" in y_img else (y_img["bbox"][:, 2] * y_img["bbox"][:, 3])[y_ind] | ||
|
||
ious = _iou(y_bbox, sorted_y_pred_bbox, crowd).to(self._device) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don’t see why y_pred’s boxes should be sorted by score. Moreover, that is not mentioned in the iou method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iou method is generic, for 'a' y_bbox and 'b' y_pred_bbox it return a matrix of size 'a x b' containing all the respective ious. We are passing it sorted list because in eval_image function we are sorting y_preds according to confidence as well for greedy matching.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it should be done in the method instead of here ?
I move to draft instead of PR. A lot of work remaining. Maybe it could worth to discuss, implement and test on our side to create a new clean PR. We will see after GSoC. |
@reinit__is_reduced | ||
def update(self, outputs: Tuple[Dict, Dict]) -> None: | ||
|
||
for output in outputs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
outputs
is defined as a tuple but seems considered as a list.
|
||
y_pred_img, y_img = output | ||
|
||
if y_img["image_id"] != y_pred_img["image_id"]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test is required.
if y_img["image_id"] != y_pred_img["image_id"]: | ||
raise ValueError("Ground Truth and Predictions should be for the same image.") | ||
|
||
if y_img["image_id"] in self.image_ids: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test is required
y_id, y_area, y_ignore, y_crowd = y | ||
y_pred_id, y_pred_area, y_pred_score = y_pred | ||
|
||
if len(y_id) == 0 and len(y_pred_id) == 0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A test is required
Fixes #{520}
Description:
Created a COCO Style Implementation for mAP metric. Both of them are calculated at once since both require similar calculation and have similar use case. The overall implementation is complicated so any advice to simplify it is appreciated.
Check list: