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
How can I find the Average Precision and Average Recall from the eval.py file? #352
Comments
I meet the same problem, have you solved it? Thank you very much |
I have solved but it was long time ago. I don't remember but tell me more about the problem you are getting? I have used custom data in VOC format. |
Does rec[-1] and prec[-1] are the final average Recall and Precision ? |
After this Link I have added this code.
And also define rec = [] and prec = [] Than you can print
|
wow!thank you! It works!
…---Original---
From: "ATRI SAXENA"<notifications@github.com>
Date: Mon, Apr 27, 2020 02:18 AM
To: "amdegroot/ssd.pytorch"<ssd.pytorch@noreply.github.com>;
Cc: "Comment"<comment@noreply.github.com>;"skylineJLU"<1457013276@qq.com>;
Subject: Re: [amdegroot/ssd.pytorch] How can I find the Average Precision and Average Recall from the eval.py file? (#352)
After this Link I have added this code.
rec += [rec] prec += [prec]
And also define rec = [] and prec = []
Than you can print
print('Average Recall = {:.4f}'.format(np.mean(rec))) print('Average Precision = {:.4f}'.format(np.mean(prec)))
`for i, cls in enumerate(labelmap):
filename = get_voc_results_file_template(set_type, cls)
rec, prec, ap = voc_eval( filename, annopath, imgsetpath.format(set_type), cls, cachedir, ovthresh=0.5, use_07_metric=use_07_metric) aps += [ap] rec += [rec] prec += [prec] print('AP for {} = {:.4f}'.format(cls, ap)) with open(os.path.join(output_dir, cls + '_pr.pkl'), 'wb') as f: pickle.dump({'rec': rec, 'prec': prec, 'ap': ap}, f) print('Mean AP = {:.4f}'.format(np.mean(aps))) print('Average Recall = {:.4f}'.format(np.mean(rec))) print('Average Precision = {:.4f}'.format(np.mean(prec)))`
The whole loop will be something like this.
If you are using Custom dataset than you need more changes.
If this solves tells me.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
I think I might miss your reply before |
Yeah, I replied last night. I was little busy. Great, it helped you. |
As many people looking to find the Average Recall and Precision like in issue amdegroot#352 It's better we should add this in evaluation code.
Have you solved the problem? I encountered the same problem as you.
This will work, but I’m not sure if it’s right. What do you think? |
I want to find the Average Recall and Precision values. I have tried, printing these value Code link
rec = tp / float(npos) prec = tp / np.maximum(tp + fp, np.finfo(np.float64).eps)
But it is printing long list of values which i am not able to get.
The text was updated successfully, but these errors were encountered: