Conversation
Codecov Report
@@ Coverage Diff @@
## master #1056 +/- ##
==========================================
- Coverage 85.96% 85.89% -0.08%
==========================================
Files 283 283
Lines 5943 5954 +11
==========================================
+ Hits 5109 5114 +5
- Misses 834 840 +6
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
|
I had such a use case, but cannot this be done with: inference_metric = COCOMetric(print_summary=True)
inference_metric.accumulate(preds)
inference_metric_result = inference_metric.finalize() |
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
|
||
| # YOLACT has mask_head and segm_head | ||
| if getattr(model, "mask_head"): | ||
| if getattr(model, "mask_head", False): |
There was a problem hiding this comment.
why did we set this one to False?
same thing for line 86
There was a problem hiding this comment.
It's a bit confusing. I had a discussion with Dickson in his PR. I had the reaction as you.
Right now, there is a bug because False is missing
If False is missing it will add mask_head even for retinanet model for example.
The way to read is if model has a mask_head the statement is True otherwise set it to False.
There was a problem hiding this comment.
Sorry man.
I still don't get it.
If False is missing it will add mask_head
But that's what we want. No?
Here how I understand the following statement:
if getattr(model, "mask_head"): layers += [model.mask_head]if the model object has a "mask_head" attribute then add model.mask_head to the layers list.
What am I missing?
What is False needed?
There was a problem hiding this comment.
The False is the default value of getattr if the object does not have the attribute, otherwise, an AttributeError will be raise if no default is provided. We should change getattr for hasattr as it is the function intended for the usecase.
There was a problem hiding this comment.
Ah, alright! Got it. Thanks Frederik.
Yeah, I guess it is the same. Just wrapping everything into a function call. |
|
I didn't try that but I think it's better to have one simple and convenient method: No cognitive overload. |
|
But looking at it again, it's the same number of lines of code and the to me this approach is explicit enough and I have used it before |
|
I think the proposal from Farid is good, I would just rename |
|
I agree with @fstroth on everything he says. Indeed a function named As for @potipot 's point, why don't we add those 3 lines to the inference_metric = COCOMetric(print_summary=True)
inference_metric.accumulate(preds)
inference_metric_result = inference_metric.finalize() |
|
There is some user interest in this PR. What do we need to do to get this merged? |
I added some convenient methods to easily calculate the COCO metric at inference when ground truth records are available
Get the COCO metric from the Predictions object:
You call also separately pass the ground_truth and the predictions: