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 target_confidence_assign_op #7921

Closed
wants to merge 1 commit into from

Conversation

wanghaox
Copy link
Contributor

resolve #7844

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.

这个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, "
Copy link
Contributor

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",
Copy link
Contributor

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.");
Copy link
Contributor

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.");
Copy link
Contributor

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.");
Copy link
Contributor

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"
Copy link
Contributor

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");
Copy link
Contributor

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;
Copy link
Contributor

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);
}
Copy link
Contributor

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);
}
Copy link
Contributor

Choose a reason for hiding this comment

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

同上~

@paddle-bot-old paddle-bot-old bot closed this May 22, 2020
@paddle-bot-old
Copy link

Since you haven't replied for a long time, we have closed this issue/pr.
If the problem is not solved or there is a follow-up one, please reopen it at any time and we will continue to follow up.
由于您长期未回复,我们将关闭这个issue/pr。
若问题未解决或有后续问题,请随时重新打开,我们会继续跟进。

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 target_confidence_assign_op
2 participants