Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleDetection
提交
c7a19f16
P
PaddleDetection
项目概览
PaddlePaddle
/
PaddleDetection
大约 1 年 前同步成功
通知
695
Star
11112
Fork
2696
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
184
列表
看板
标记
里程碑
合并请求
40
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleDetection
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
184
Issue
184
列表
看板
标记
里程碑
合并请求
40
合并请求
40
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
c7a19f16
编写于
7月 19, 2021
作者:
S
shangliang Xu
提交者:
GitHub
7月 19, 2021
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix some code (#3710)
上级
b33838c0
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
7 addition
and
11 deletion
+7
-11
ppdet/modeling/heads/detr_head.py
ppdet/modeling/heads/detr_head.py
+1
-2
ppdet/modeling/initializer.py
ppdet/modeling/initializer.py
+1
-3
ppdet/modeling/losses/detr_loss.py
ppdet/modeling/losses/detr_loss.py
+2
-2
ppdet/modeling/transformers/detr_transformer.py
ppdet/modeling/transformers/detr_transformer.py
+2
-2
ppdet/modeling/transformers/utils.py
ppdet/modeling/transformers/utils.py
+1
-2
未找到文件。
ppdet/modeling/heads/detr_head.py
浏览文件 @
c7a19f16
...
...
@@ -16,13 +16,12 @@ from __future__ import absolute_import
from
__future__
import
division
from
__future__
import
print_function
import
math
import
paddle
import
paddle.nn
as
nn
import
paddle.nn.functional
as
F
from
ppdet.core.workspace
import
register
import
pycocotools.mask
as
mask_util
from
..initializer
import
*
from
..initializer
import
linear_init_
__all__
=
[
'DETRHead'
]
...
...
ppdet/modeling/initializer.py
浏览文件 @
c7a19f16
...
...
@@ -50,9 +50,7 @@ def _no_grad_normal_(tensor, mean=0., std=1.):
def
_no_grad_fill_
(
tensor
,
value
=
0.
):
with
paddle
.
no_grad
():
v
=
paddle
.
rand
(
shape
=
tensor
.
shape
,
dtype
=
tensor
.
dtype
)
v
[...]
=
value
tensor
.
set_value
(
v
)
tensor
.
set_value
(
paddle
.
full_like
(
tensor
,
value
,
dtype
=
tensor
.
dtype
))
return
tensor
...
...
ppdet/modeling/losses/detr_loss.py
浏览文件 @
c7a19f16
...
...
@@ -21,7 +21,7 @@ import paddle.nn as nn
import
paddle.nn.functional
as
F
from
ppdet.core.workspace
import
register
from
.iou_loss
import
GIoULoss
from
..transformers
import
bbox_cxcywh_to_xyxy
,
bbox_overlaps
,
sigmoid_focal_loss
from
..transformers
import
bbox_cxcywh_to_xyxy
,
sigmoid_focal_loss
__all__
=
[
'DETRLoss'
]
...
...
@@ -211,7 +211,7 @@ class DETRLoss(nn.Layer):
num_gts
=
paddle
.
clip
(
num_gts
/
paddle
.
distributed
.
get_world_size
(),
min
=
1
).
item
()
except
:
num_gts
=
max
(
num_gts
,
1
)
num_gts
=
max
(
num_gts
.
item
()
,
1
)
total_loss
=
dict
()
total_loss
.
update
(
self
.
_get_loss_class
(
logits
[
-
1
],
gt_class
,
match_indices
,
...
...
ppdet/modeling/transformers/detr_transformer.py
浏览文件 @
c7a19f16
...
...
@@ -23,8 +23,8 @@ import paddle.nn.functional as F
from
ppdet.core.workspace
import
register
from
..layers
import
MultiHeadAttention
,
_convert_attention_mask
from
.position_encoding
import
PositionEmbedding
from
.utils
import
*
from
..initializer
import
*
from
.utils
import
_get_clones
from
..initializer
import
linear_init_
,
conv_init_
,
xavier_uniform_
,
normal_
__all__
=
[
'DETRTransformer'
]
...
...
ppdet/modeling/transformers/utils.py
浏览文件 @
c7a19f16
...
...
@@ -54,5 +54,4 @@ def sigmoid_focal_loss(logit, label, normalizer=1.0, alpha=0.25, gamma=2.0):
if
alpha
>=
0
:
alpha_t
=
alpha
*
label
+
(
1
-
alpha
)
*
(
1
-
label
)
loss
=
alpha_t
*
loss
return
loss
.
mean
(
1
).
sum
()
/
normalizer
if
normalizer
>
1.
else
loss
.
mean
(
1
).
sum
()
return
loss
.
mean
(
1
).
sum
()
/
normalizer
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录