Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
正统之独孤求败
mindspore
提交
b096a6cb
M
mindspore
项目概览
正统之独孤求败
/
mindspore
与 Fork 源项目一致
Fork自
MindSpore / mindspore
通知
1
Star
0
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 搜索 >>
提交
b096a6cb
编写于
7月 29, 2020
作者:
Z
zhouyaqiang
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
support multy node training and remove code
上级
924a34ac
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
6 addition
and
80 deletion
+6
-80
model_zoo/official/cv/deeplabv3/README.md
model_zoo/official/cv/deeplabv3/README.md
+1
-2
model_zoo/official/cv/deeplabv3/scripts/run_distribute_train.sh
...zoo/official/cv/deeplabv3/scripts/run_distribute_train.sh
+5
-2
model_zoo/official/cv/deeplabv3/src/remove_gt_colormap.py
model_zoo/official/cv/deeplabv3/src/remove_gt_colormap.py
+0
-76
未找到文件。
model_zoo/official/cv/deeplabv3/README.md
浏览文件 @
b096a6cb
...
...
@@ -5,8 +5,7 @@ This is an example of training DeepLabV3 with PASCAL VOC 2012 dataset in MindSpo
## Requirements
-
Install
[
MindSpore
](
https://www.mindspore.cn/install/en
)
.
-
Download the VOC 2012 dataset for training.
-
We need to run
`./src/remove_gt_colormap.py`
to remove the label colormap.
-
Download the VOC 2012 dataset for training.
```
bash
python remove_gt_colormap.py
--original_gt_folder
GT_FOLDER
--output_dir
OUTPUT_DIR
...
...
model_zoo/official/cv/deeplabv3/scripts/run_distribute_train.sh
浏览文件 @
b096a6cb
...
...
@@ -26,6 +26,7 @@ DATA_DIR=$2
export
MINDSPORE_HCCL_CONFIG_PATH
=
$1
export
RANK_TABLE_FILE
=
$1
export
RANK_SIZE
=
8
export
DEVICE_NUM
=
8
PATH_CHECKPOINT
=
""
if
[
$#
==
3
]
then
...
...
@@ -37,11 +38,13 @@ avg_core_per_rank=`expr $cores \/ $RANK_SIZE`
core_gap
=
`
expr
$avg_core_per_rank
\-
1
`
echo
"avg_core_per_rank"
$avg_core_per_rank
echo
"core_gap"
$core_gap
for
((
i
=
0
;
i<RANK_SIZE
;
i++
))
export
SERVER_ID
=
0
rank_start
=
$((
DEVICE_NUM
*
SERVER_ID
))
for
((
i
=
0
;
i<DEVICE_NUM
;
i++
))
do
start
=
`
expr
$i
\*
$avg_core_per_rank
`
export
DEVICE_ID
=
$i
export
RANK_ID
=
$
i
export
RANK_ID
=
$
((
rank_start
+
i
))
export
DEPLOY_MODE
=
0
export
GE_USE_STATIC_MEMORY
=
1
end
=
`
expr
$start
\+
$core_gap
`
...
...
model_zoo/official/cv/deeplabv3/src/remove_gt_colormap.py
已删除
100644 → 0
浏览文件 @
924a34ac
# Copyright 2020 The Huawei Authors All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Removes the color map from segmentation annotations.
Removes the color map from the ground truth segmentation annotations and save
the results to output_dir.
"""
import
glob
import
argparse
import
os.path
import
numpy
as
np
from
PIL
import
Image
def
_remove_colormap
(
filename
):
"""Removes the color map from the annotation.
Args:
filename: Ground truth annotation filename.
Returns:
Annotation without color map.
"""
return
np
.
array
(
Image
.
open
(
filename
))
def
_save_annotation
(
annotation
,
filename
):
"""Saves the annotation as png file.
Args:
annotation: Segmentation annotation.
filename: Output filename.
"""
pil_image
=
Image
.
fromarray
(
annotation
.
astype
(
dtype
=
np
.
uint8
))
pil_image
.
save
(
filename
,
'PNG'
)
def
main
():
parser
=
argparse
.
ArgumentParser
(
description
=
"Demo of argparse"
)
parser
.
add_argument
(
'--original_gt_folder'
,
type
=
str
,
default
=
'./VOCdevkit/VOC2012/SegmentationClass'
,
help
=
'Original ground truth annotations.'
)
parser
.
add_argument
(
'--segmentation_format'
,
type
=
str
,
default
=
'png'
,
help
=
'Segmentation format.'
)
parser
.
add_argument
(
'--output_dir'
,
type
=
str
,
default
=
'./VOCdevkit/VOC2012/SegmentationClassRaw'
,
help
=
'folder to save modified ground truth annotations.'
)
args
=
parser
.
parse_args
()
# Create the output directory if not exists.
if
not
os
.
path
.
isdir
(
args
.
output_dir
):
os
.
mkdir
(
args
.
output_dir
)
annotations
=
glob
.
glob
(
os
.
path
.
join
(
args
.
original_gt_folder
,
'*.'
+
args
.
segmentation_format
))
for
annotation
in
annotations
:
raw_annotation
=
_remove_colormap
(
annotation
)
filename
=
os
.
path
.
basename
(
annotation
)[:
-
4
]
_save_annotation
(
raw_annotation
,
os
.
path
.
join
(
args
.
output_dir
,
filename
+
'.'
+
args
.
segmentation_format
))
if
__name__
==
'__main__'
:
main
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录