Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
2301_77200941
mindspore
提交
7ae7505c
M
mindspore
项目概览
2301_77200941
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
mindspore
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
7ae7505c
编写于
8月 10, 2020
作者:
Z
zhouyaqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
move argmax from host to device
上级
34864fbc
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
4 deletion
+6
-4
model_zoo/official/cv/deeplabv3/src/deeplabv3.py
model_zoo/official/cv/deeplabv3/src/deeplabv3.py
+3
-0
model_zoo/official/cv/deeplabv3/src/losses.py
model_zoo/official/cv/deeplabv3/src/losses.py
+2
-0
model_zoo/official/cv/deeplabv3/src/miou_precision.py
model_zoo/official/cv/deeplabv3/src/miou_precision.py
+1
-4
未找到文件。
model_zoo/official/cv/deeplabv3/src/deeplabv3.py
浏览文件 @
7ae7505c
...
...
@@ -381,6 +381,7 @@ class DeepLabV3(nn.Cell):
self
.
concat
=
P
.
Concat
(
axis
=
2
)
self
.
expand_dims
=
P
.
ExpandDims
()
self
.
reduce_mean
=
P
.
ReduceMean
()
self
.
argmax
=
P
.
Argmax
(
axis
=
1
)
self
.
sample_common
=
P
.
ResizeBilinear
((
int
(
feature_shape
[
2
]),
int
(
feature_shape
[
3
])),
align_corners
=
True
)
...
...
@@ -419,6 +420,8 @@ class DeepLabV3(nn.Cell):
logits_i
=
self
.
expand_dims
(
logits_i
,
2
)
logits
=
self
.
concat
((
logits
,
logits_i
))
logits
=
self
.
reduce_mean
(
logits
,
2
)
if
not
self
.
training
:
logits
=
self
.
argmax
(
logits
)
return
logits
...
...
model_zoo/official/cv/deeplabv3/src/losses.py
浏览文件 @
7ae7505c
...
...
@@ -42,6 +42,8 @@ class OhemLoss(nn.Cell):
self
.
loss_weight
=
1.0
def
construct
(
self
,
logits
,
labels
):
if
not
self
.
training
:
return
0
logits
=
self
.
transpose
(
logits
,
(
0
,
2
,
3
,
1
))
logits
=
self
.
reshape
(
logits
,
(
-
1
,
self
.
num
))
labels
=
F
.
cast
(
labels
,
mstype
.
int32
)
...
...
model_zoo/official/cv/deeplabv3/src/miou_precision.py
浏览文件 @
7ae7505c
...
...
@@ -50,10 +50,7 @@ class MiouPrecision(Metric):
raise
ValueError
(
'Need 2 inputs (y_pred, y), but got {}'
.
format
(
len
(
inputs
)))
predict_in
=
self
.
_convert_data
(
inputs
[
0
])
label_in
=
self
.
_convert_data
(
inputs
[
1
])
if
predict_in
.
shape
[
1
]
!=
self
.
_num_class
:
raise
ValueError
(
'Class number not match, last input data contain {} classes, but current data contain {} '
'classes'
.
format
(
self
.
_num_class
,
predict_in
.
shape
[
1
]))
pred
=
np
.
argmax
(
predict_in
,
axis
=
1
)
pred
=
predict_in
label
=
label_in
if
len
(
label
.
flatten
())
!=
len
(
pred
.
flatten
()):
print
(
'Skipping: len(gt) = {:d}, len(pred) = {:d}'
.
format
(
len
(
label
.
flatten
()),
len
(
pred
.
flatten
())))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录