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 DetectionMAPEvaluator #2467

Merged
merged 3 commits into from
Jun 23, 2017
Merged

Add DetectionMAPEvaluator #2467

merged 3 commits into from
Jun 23, 2017

Conversation

pkuyym
Copy link
Contributor

@pkuyym pkuyym commented Jun 14, 2017

resolves #2466

@pkuyym pkuyym requested a review from qingqing01 June 14, 2017 14:20
@pkuyym pkuyym changed the title Add DetectionMAPEvaluator. Add DetectionMAPEvaluator Jun 14, 2017
map<size_t, vector<NormalizedBBox>> bboxes;
for (int i = labelIndex[n]; i < labelIndex[n + 1]; ++i) {
vector<NormalizedBBox> bbox;
getBBoxFromLabelData(cpuLabel_->getData() + i * 6, 1, bbox);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

和layout相关6,7常量后续的PR需要重新设计,避免固定死,这里标记下

++n;
}
++imgId;
if (imgId > batchSize) break;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

什么时候imgId > batchSize?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrite this part.


// calcTFPos
calcTFPos(
batchSize, allGTBBoxes, allDetectBBoxes, &allTruePos_, &allFalsePos_);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

allTruePos_,allFalsePos_都已经是成员变量了,这里也不用当做参数传吧

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


map<size_t, size_t> numPos_;
map<size_t, vector<pair<real, size_t>>> allTruePos_;
map<size_t, vector<pair<real, size_t>>> allFalsePos_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

对变量增加注释~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


std::string getTypeImpl() const { return "detection_map"; }

real getValueImpl() const { return calcMAP() * 100; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

100放到calcMAP()里吧,这样130行也不用乘了~

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

ap_type="11point",
name=None):
"""
Detection mAP Evaluator. It will print mean Average Precision for detection.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mean Average Precision -> mean Average Precision(mAP)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"""
Detection mAP Evaluator. It will print mean Average Precision for detection.

The detection mAP Evaluator according to the detection_output's output count
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

count-> counts

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Detection mAP Evaluator. It will print mean Average Precision for detection.

The detection mAP Evaluator according to the detection_output's output count
the true positive and the false positive bbox and integral them to get the
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

integral -> integrates

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是积分哈

"""
Detection mAP Evaluator. It will print mean Average Precision for detection.

The detection mAP Evaluator according to the detection_output's output count
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

according to the detection_output's output

based on the output detection_output layer.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

:type overlap_threshold: float
:param background_id: The background class index.
:type background_id: int
:param evaluate_difficult: Wether evaluate a difficult ground truth.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wether - Whether

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor Author

@pkuyym pkuyym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Follow comments.


std::string getTypeImpl() const { return "detection_map"; }

real getValueImpl() const { return calcMAP() * 100; }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


map<size_t, size_t> numPos_;
map<size_t, vector<pair<real, size_t>>> allTruePos_;
map<size_t, vector<pair<real, size_t>>> allFalsePos_;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.


// calcTFPos
calcTFPos(
batchSize, allGTBBoxes, allDetectBBoxes, &allTruePos_, &allFalsePos_);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

ap_type="11point",
name=None):
"""
Detection mAP Evaluator. It will print mean Average Precision for detection.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"""
Detection mAP Evaluator. It will print mean Average Precision for detection.

The detection mAP Evaluator according to the detection_output's output count
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

"""
Detection mAP Evaluator. It will print mean Average Precision for detection.

The detection mAP Evaluator according to the detection_output's output count
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Detection mAP Evaluator. It will print mean Average Precision for detection.

The detection mAP Evaluator according to the detection_output's output count
the true positive and the false positive bbox and integral them to get the
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里是积分哈

:type overlap_threshold: float
:param background_id: The background class index.
:type background_id: int
:param evaluate_difficult: Wether evaluate a difficult ground truth.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

@@ -21,7 +21,8 @@
"chunk_evaluator", "sum_evaluator", "column_sum_evaluator",
"value_printer_evaluator", "gradient_printer_evaluator",
"maxid_printer_evaluator", "maxframe_printer_evaluator",
"seqtext_printer_evaluator", "classification_error_printer_evaluator"
"seqtext_printer_evaluator", "classification_error_printer_evaluator",
"detection_map_evaluator"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

++n;
}
++imgId;
if (imgId > batchSize) break;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rewrite this part.

Copy link
Contributor

@qingqing01 qingqing01 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@pkuyym pkuyym merged commit f551c27 into PaddlePaddle:develop Jun 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add DetectionMAPEvaluator
2 participants