Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
s920243400
PaddleDetection
提交
2cd40bdd
P
PaddleDetection
项目概览
s920243400
/
PaddleDetection
与 Fork 源项目一致
Fork自
PaddlePaddle / PaddleDetection
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
2cd40bdd
编写于
3月 30, 2022
作者:
S
shangliang Xu
提交者:
GitHub
3月 30, 2022
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix one_hot error (#5532)
上级
eb8e1541
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
13 addition
and
4 deletion
+13
-4
ppdet/modeling/assigners/atss_assigner.py
ppdet/modeling/assigners/atss_assigner.py
+5
-1
ppdet/modeling/assigners/task_aligned_assigner.py
ppdet/modeling/assigners/task_aligned_assigner.py
+5
-1
ppdet/modeling/heads/ppyoloe_head.py
ppdet/modeling/heads/ppyoloe_head.py
+2
-1
ppdet/modeling/losses/detr_loss.py
ppdet/modeling/losses/detr_loss.py
+1
-1
未找到文件。
ppdet/modeling/assigners/atss_assigner.py
浏览文件 @
2cd40bdd
...
...
@@ -199,7 +199,11 @@ class ATSSAssigner(nn.Layer):
gt_bboxes
.
reshape
([
-
1
,
4
]),
assigned_gt_index
.
flatten
(),
axis
=
0
)
assigned_bboxes
=
assigned_bboxes
.
reshape
([
batch_size
,
num_anchors
,
4
])
assigned_scores
=
F
.
one_hot
(
assigned_labels
,
self
.
num_classes
)
assigned_scores
=
F
.
one_hot
(
assigned_labels
,
self
.
num_classes
+
1
)
ind
=
list
(
range
(
self
.
num_classes
+
1
))
ind
.
remove
(
bg_index
)
assigned_scores
=
paddle
.
index_select
(
assigned_scores
,
paddle
.
to_tensor
(
ind
),
axis
=-
1
)
if
pred_bboxes
is
not
None
:
# assigned iou
ious
=
batch_iou_similarity
(
gt_bboxes
,
pred_bboxes
)
*
mask_positive
...
...
ppdet/modeling/assigners/task_aligned_assigner.py
浏览文件 @
2cd40bdd
...
...
@@ -143,7 +143,11 @@ class TaskAlignedAssigner(nn.Layer):
gt_bboxes
.
reshape
([
-
1
,
4
]),
assigned_gt_index
.
flatten
(),
axis
=
0
)
assigned_bboxes
=
assigned_bboxes
.
reshape
([
batch_size
,
num_anchors
,
4
])
assigned_scores
=
F
.
one_hot
(
assigned_labels
,
num_classes
)
assigned_scores
=
F
.
one_hot
(
assigned_labels
,
num_classes
+
1
)
ind
=
list
(
range
(
num_classes
+
1
))
ind
.
remove
(
bg_index
)
assigned_scores
=
paddle
.
index_select
(
assigned_scores
,
paddle
.
to_tensor
(
ind
),
axis
=-
1
)
# rescale alignment metrics
alignment_metrics
*=
mask_positive
max_metrics_per_instance
=
alignment_metrics
.
max
(
axis
=-
1
,
keepdim
=
True
)
...
...
ppdet/modeling/heads/ppyoloe_head.py
浏览文件 @
2cd40bdd
...
...
@@ -331,7 +331,8 @@ class PPYOLOEHead(nn.Layer):
assigned_bboxes
/=
stride_tensor
# cls loss
if
self
.
use_varifocal_loss
:
one_hot_label
=
F
.
one_hot
(
assigned_labels
,
self
.
num_classes
)
one_hot_label
=
F
.
one_hot
(
assigned_labels
,
self
.
num_classes
+
1
)[...,
:
-
1
]
loss_cls
=
self
.
_varifocal_loss
(
pred_scores
,
assigned_scores
,
one_hot_label
)
else
:
...
...
ppdet/modeling/losses/detr_loss.py
浏览文件 @
2cd40bdd
...
...
@@ -80,7 +80,7 @@ class DETRLoss(nn.Layer):
target_label
=
target_label
.
reshape
([
bs
,
num_query_objects
])
if
self
.
use_focal_loss
:
target_label
=
F
.
one_hot
(
target_label
,
self
.
num_classes
+
1
)[
:,
:
,
:
-
1
]
self
.
num_classes
+
1
)[
...
,
:
-
1
]
return
{
'loss_class'
:
self
.
loss_coeff
[
'class'
]
*
sigmoid_focal_loss
(
logits
,
target_label
,
num_gts
/
num_query_objects
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录