Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
27号BigBang
Mask_RCNN
提交
356e258f
M
Mask_RCNN
项目概览
27号BigBang
/
Mask_RCNN
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
Mask_RCNN
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
356e258f
编写于
12月 07, 2017
作者:
P
pferriere@hotmail.com
提交者:
Waleed
12月 10, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Tested on Win/Ubu with notebook/cmd line
上级
6142baaa
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
10 addition
and
8 deletion
+10
-8
coco.py
coco.py
+10
-8
未找到文件。
coco.py
浏览文件 @
356e258f
...
...
@@ -100,6 +100,7 @@ class CocoDataset(utils.Dataset):
return_coco: If True, returns the COCO object.
auto_download: Automatically download and unzip MS-COCO images and annotations
"""
if
auto_download
==
True
:
self
.
auto_download
(
dataset_dir
,
subset
,
year
)
...
...
@@ -159,7 +160,7 @@ class CocoDataset(utils.Dataset):
imgDir
=
"{}/{}{}"
.
format
(
dataDir
,
dataType
,
dataYear
)
imgZipFile
=
"{}/{}{}.zip"
.
format
(
dataDir
,
dataType
,
dataYear
)
imgURL
=
"http://images.cocodataset.org/zips/{}{}.zip"
.
format
(
dataType
,
dataYear
)
print
(
"Image paths:"
);
print
(
imgDir
);
print
(
imgZipFile
);
print
(
imgURL
)
#
print ("Image paths:"); print (imgDir); print (imgZipFile); print (imgURL)
# Create main folder if it doesn't exist yet
if
not
os
.
path
.
exists
(
dataDir
):
...
...
@@ -176,7 +177,7 @@ class CocoDataset(utils.Dataset):
with
zipfile
.
ZipFile
(
imgZipFile
,
"r"
)
as
zip_ref
:
zip_ref
.
extractall
(
dataDir
)
print
(
"... done unzipping"
)
#
print ("Will use images in " + imgDir)
print
(
"Will use images in "
+
imgDir
)
# Setup annotations data paths
annDir
=
"{}/annotations"
.
format
(
dataDir
)
...
...
@@ -418,8 +419,9 @@ if __name__ == '__main__':
help
=
'Images to use for evaluation (default=500)'
)
parser
.
add_argument
(
'--download'
,
required
=
False
,
default
=
False
,
metavar
=
"<auto download>"
,
help
=
'Automatically download and unzip MS-COCO files (default=False)'
)
metavar
=
"<True|False>"
,
help
=
'Automatically download and unzip MS-COCO files (default=False)'
,
type
=
bool
)
args
=
parser
.
parse_args
()
print
(
"Command: "
,
args
.
command
)
print
(
"Model: "
,
args
.
model
)
...
...
@@ -470,13 +472,13 @@ if __name__ == '__main__':
# Training dataset. Use the training set and 35K from the
# validation set, as as in the Mask RCNN paper.
dataset_train
=
CocoDataset
()
dataset_train
.
load_coco
(
args
.
dataset
,
"train"
)
dataset_train
.
load_coco
(
args
.
dataset
,
"valminusminival"
)
dataset_train
.
load_coco
(
args
.
dataset
,
"train"
,
year
=
args
.
year
,
auto_download
=
args
.
download
)
dataset_train
.
load_coco
(
args
.
dataset
,
"valminusminival"
,
year
=
args
.
year
,
auto_download
=
args
.
download
)
dataset_train
.
prepare
()
# Validation dataset
dataset_val
=
CocoDataset
()
dataset_val
.
load_coco
(
args
.
dataset
,
"minival"
)
dataset_val
.
load_coco
(
args
.
dataset
,
"minival"
,
year
=
args
.
year
,
auto_download
=
args
.
download
)
dataset_val
.
prepare
()
# *** This training schedule is an example. Update to your needs ***
...
...
@@ -507,7 +509,7 @@ if __name__ == '__main__':
elif
args
.
command
==
"evaluate"
:
# Validation dataset
dataset_val
=
CocoDataset
()
coco
=
dataset_val
.
load_coco
(
args
.
dataset
,
"minival"
,
return_coco
=
True
)
coco
=
dataset_val
.
load_coco
(
args
.
dataset
,
"minival"
,
year
=
args
.
year
,
return_coco
=
True
,
auto_download
=
args
.
download
)
dataset_val
.
prepare
()
print
(
"Running COCO evaluation on {} images."
.
format
(
args
.
limit
))
evaluate_coco
(
model
,
dataset_val
,
coco
,
"bbox"
,
limit
=
int
(
args
.
limit
))
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录