Skip to content
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

Add mAP Metrics and validation #89

Merged
merged 12 commits into from
Apr 18, 2021
Merged

Add mAP Metrics and validation #89

merged 12 commits into from
Apr 18, 2021

Conversation

zhiqwang
Copy link
Owner

@zhiqwang zhiqwang commented Apr 12, 2021

Fixing #59

  • Add mAP metric computation for COCO datasets

@zhiqwang zhiqwang added the enhancement New feature or request label Apr 12, 2021
@codecov
Copy link

codecov bot commented Apr 12, 2021

Codecov Report

❗ No coverage uploaded for pull request base (master@2125d06). Click here to learn what that means.
The diff coverage is 70.73%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #89   +/-   ##
=========================================
  Coverage          ?   81.80%           
=========================================
  Files             ?        8           
  Lines             ?      775           
  Branches          ?        0           
=========================================
  Hits              ?      634           
  Misses            ?      141           
  Partials          ?        0           
Flag Coverage Δ
unittests 81.80% <70.73%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
test/test_engine.py 91.60% <63.63%> (ø)
test/test_data_pipeline.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 2125d06...70febca. Read the comment docs.

@zhiqwang zhiqwang merged commit 5a56c16 into master Apr 18, 2021
@zhiqwang zhiqwang deleted the coco-validation branch April 18, 2021 13:42
@zhiqwang zhiqwang mentioned this pull request Apr 18, 2021
7 tasks
@masahi
Copy link

masahi commented Aug 18, 2021

Hi @zhiqwang, do you happen to have a script to evaluate yolo5 on coco 2017 dataset? I also want to evaluate torchvision faster rcnn on the same dataset. I'm working on accuracy validation of TVM fp16 quantization.

@zhiqwang
Copy link
Owner Author

Hi @masahi , I have the evaluate script on COCO2017, I need to clean it and expect to upload it tomorrow.

@masahi
Copy link

masahi commented Aug 19, 2021

@zhiqwang I was able to get reasonably looking numbers by modifying the input path to the data loader in test_vanilla_coco_evaluator at https://github.com/zhiqwang/yolov5-rt-stack/blob/947956f3c472bd4395272e261fe6f9d46bfd8b61/test/test_engine.py#L95 to point to my downloaded coco val 2017. Was that how you did it?

Another question: I tried to use the same eval script to test torchvision fasterrcnn. But I hit an error at this line https://github.com/zhiqwang/yolov5-rt-stack/blob/f4f2e6aebec97d72ec40051aac31f217fcf01ea0/yolort/data/coco_eval.py#L201 because the label there is 86 and contiguous_to_json_category has only 80 elements. Why is contiguous_to_json_category required? If I remove self.contiguous_to_json_category and directly use label[k], I got an accuracy number for faster rcnn, but it looks too good.

@zhiqwang
Copy link
Owner Author

zhiqwang commented Aug 19, 2021

Hi @masahi ,

Check #148 for the coco metrics evaluation CLI. And I add a data preprare function in there. Let's move the disscussion there.

https://github.com/zhiqwang/yolov5-rt-stack/blob/e1efb7c7fb88713c1d8db21584b32f09152f6283/tools/eval_metric.py#L45-L64

Why is contiguous_to_json_category required?

This is because the original categories number of COCO is 90, check the id in https://github.com/zhiqwang/yolov5-rt-stack/blob/f34194c/yolort/utils/builtin_meta.py for more details. On the other hand, ultralytics use a continuous map to [1-80] to train their model.

I changed the contiguous_to_json_category to category_id_maps in #148

https://github.com/zhiqwang/yolov5-rt-stack/blob/e1efb7c7fb88713c1d8db21584b32f09152f6283/yolort/data/coco_eval.py#L72-L77

and use --eval_type to control whether to switch this mapping.

https://github.com/zhiqwang/yolov5-rt-stack/blob/e1efb7c7fb88713c1d8db21584b32f09152f6283/tools/eval_metric.py#L93-L105

@zhiqwang zhiqwang added the dependencies Pull requests that update a dependency file label Sep 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants