-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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 target_confidence_assign_op #7921
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个Op是需要backward。需要对confidece传播梯度。
同理,target_location_assign也是需要的~
"GTLabels", | ||
"(LoDTensor, default LoDTensor<int>), The input ground-truth labels."); | ||
AddInput("MatchIndices", | ||
"(LoDTensor, default LoDTensor<int>), The input matched indices, " |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LoDTensor -> Tensor
public: | ||
TargetConfidenceAssignOpMaker(OpProto* proto, OpAttrChecker* op_checker) | ||
: OpProtoAndCheckerMaker(proto, op_checker) { | ||
AddInput("Conf", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the NMS Op, I use the name score
. We can unify the name. Score
or Conf
, which is better? (I also can change my PR, just unify here)
"When it's equal to -1, it doesn't match any entity."); | ||
AddInput("NegIndices", | ||
"(LoDTensor, default LoDTensor<int>), The input negative example " | ||
"indics."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type error: indics -> indices
: OpProtoAndCheckerMaker(proto, op_checker) { | ||
AddInput("Conf", | ||
"(Tensor, default Tensor<float>), The input confidence " | ||
"predictions."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to give shape.
"indics."); | ||
AddOutput("ConfGT", | ||
"(LoDTensor), The output ground-truth labels filtered by " | ||
"MatchIndices and append NegIndices examples."); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这句话的语法不同,谁append?
|
||
#pragma once | ||
#include "paddle/framework/eigen.h" | ||
#include "paddle/framework/op_registry.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kernel only supports CPU, the code in .h file can be moved to .cc file.
void Compute(const framework::ExecutionContext& ctx) const override { | ||
auto* in_conf = ctx.Input<framework::Tensor>("Conf"); | ||
auto* in_gt_labels = ctx.Input<framework::LoDTensor>("GTLabels"); | ||
auto* in_match_indices = ctx.Input<framework::LoDTensor>("MatchIndices"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LoDTensor -> Tensor
int gt_start = gt_lod[0][n]; | ||
int gt_offset = gt_start + idx; | ||
int label = gt_labels(gt_offset); | ||
conf_gt(count) = label; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 72 - line 75可合并:
为了方便 line 36可以取出最后一个level的,这些op里只支持一层LoD,取之前应该check下 n_gt_labels->lod().size() == 1UL
auto gt_lod = in_gt_labels->lod().back();
conf_gt(count) = gt_labels(gt_lod[0] + idx);
conf_gt(count) = label; | ||
for (int c = 0; c < class_num; ++c) { | ||
conf_pred(count, c) = conf(n, p, c); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
连续赋值用 std::copy
conf_gt(count) = background_label_id; | ||
for (int c = 0; c < class_num; ++c) { | ||
conf_pred(count, c) = conf(n, idx, c); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上~
Since you haven't replied for a long time, we have closed this issue/pr. |
resolve #7844