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

computing precision and recall #853

Closed
Nocoffeeanymore opened this issue Aug 27, 2020 · 9 comments
Closed

computing precision and recall #853

Nocoffeeanymore opened this issue Aug 27, 2020 · 9 comments
Labels
question Further information is requested Stale

Comments

@Nocoffeeanymore
Copy link

❔Question

Why does author set a pr_score=0.1 and utilize "np.interp(-pr_score, -conf[i], precision[:, 0])" to compute precision as well as recall?
Could anyone give me some help? Thanks.

Additional context

@Nocoffeeanymore Nocoffeeanymore added the question Further information is requested label Aug 27, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Aug 27, 2020

Hello @Nocoffeeanymore, thank you for your interest in our work! Please visit our Custom Training Tutorial to get started, and see our Jupyter Notebook Open In Colab, Docker Image, and Google Cloud Quickstart Guide for example environments.

If this is a bug report, please provide screenshots and minimum viable code to reproduce your issue, otherwise we can not help you.

If this is a custom model or data training question, please note Ultralytics does not provide free personal support. As a leader in vision ML and AI, we do offer professional consulting, from simple expert advice up to delivery of fully customized, end-to-end production solutions for our clients, such as:

  • Cloud-based AI systems operating on hundreds of HD video streams in realtime.
  • Edge AI integrated into custom iOS and Android apps for realtime 30 FPS video inference.
  • Custom data training, hyperparameter evolution, and model exportation to any destination.

For more information please visit https://www.ultralytics.com.

@glenn-jocher
Copy link
Member

@Nocoffeeanymore you can set it to any value you want.

@Nocoffeeanymore
Copy link
Author

Nocoffeeanymore commented Aug 27, 2020

Thank you very much.
# Sort by objectness
i = np.argsort(-conf)
tp, conf, pred_cls = tp[i], conf[i], pred_cls[i]
r[ci] = np.interp(-pr_score, -conf[i], recall[:, 0]) # r at pr_score, negative x, xp because xp decreases
Maybe the second conf[i] is not monotonically decreasing. Then it becomes difficult to understand.

@glenn-jocher
Copy link
Member

@Nocoffeeanymore conf is already sorted here.

@github-actions
Copy link
Contributor

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@diego0718
Copy link

Hi all,

How can i modify the train script to compute the precision vs recall curve and graph it ?

@glenn-jocher
Copy link
Member

@diego0718 that's a good question. This should really be a training output.

All the required plotting code is here, you simply uncomment this to produce a PR curve:

yolov5/utils/general.py

Lines 295 to 304 in 9eae82e

# Plot
# fig, ax = plt.subplots(1, 1, figsize=(5, 5))
# ax.plot(recall, precision)
# ax.set_xlabel('Recall')
# ax.set_ylabel('Precision')
# ax.set_xlim(0, 1.01)
# ax.set_ylim(0, 1.01)
# fig.tight_layout()
# fig.savefig('PR_curve.png', dpi=300)

TODO: autogenerate PR curve on final test.py run.

@glenn-jocher
Copy link
Member

@diego0718 PR has been submitted for this feature addition, please review and comment at #1107

@diego0718
Copy link

@diego0718 that's a good question. This should really be a training output.

All the required plotting code is here, you simply uncomment this to produce a PR curve:

yolov5/utils/general.py

Lines 295 to 304 in 9eae82e

# Plot
# fig, ax = plt.subplots(1, 1, figsize=(5, 5))
# ax.plot(recall, precision)
# ax.set_xlabel('Recall')
# ax.set_ylabel('Precision')
# ax.set_xlim(0, 1.01)
# ax.set_ylim(0, 1.01)
# fig.tight_layout()
# fig.savefig('PR_curve.png', dpi=300)

TODO: autogenerate PR curve on final test.py run.

Thank u Glen for rapid response. Good work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested Stale
Projects
None yet
Development

No branches or pull requests

3 participants