Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
27号BigBang
Mask_RCNN
提交
2aa62a39
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 搜索 >>
提交
2aa62a39
编写于
12月 08, 2017
作者:
P
Phil Ferriere
提交者:
Waleed
12月 10, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
PEP8 compliant
上级
356e258f
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
16 addition
and
15 deletion
+16
-15
coco.py
coco.py
+16
-15
未找到文件。
coco.py
浏览文件 @
2aa62a39
...
...
@@ -64,6 +64,7 @@ DEFAULT_DATASET_YEAR = "2014"
# Configurations
############################################################
class
CocoConfig
(
Config
):
"""Configuration for training on MS COCO.
Derives from the base Config class and overrides values specific
...
...
@@ -101,7 +102,7 @@ class CocoDataset(utils.Dataset):
auto_download: Automatically download and unzip MS-COCO images and annotations
"""
if
auto_download
==
True
:
if
auto_download
is
True
:
self
.
auto_download
(
dataset_dir
,
subset
,
year
)
coco
=
COCO
(
"{}/annotations/instances_{}{}.json"
.
format
(
dataset_dir
,
subset
,
year
))
...
...
@@ -160,7 +161,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
):
...
...
@@ -169,15 +170,15 @@ class CocoDataset(utils.Dataset):
# Download images if not available locally
if
not
os
.
path
.
exists
(
imgDir
):
os
.
makedirs
(
imgDir
)
print
(
"Downloading images to "
+
imgZipFile
+
" ..."
)
print
(
"Downloading images to "
+
imgZipFile
+
" ..."
)
with
urllib
.
request
.
urlopen
(
imgURL
)
as
resp
,
open
(
imgZipFile
,
'wb'
)
as
out
:
shutil
.
copyfileobj
(
resp
,
out
)
print
(
"... done downloading."
)
print
(
"Unzipping "
+
imgZipFile
)
with
zipfile
.
ZipFile
(
imgZipFile
,
"r"
)
as
zip_ref
:
print
(
"... done downloading."
)
print
(
"Unzipping "
+
imgZipFile
)
with
zipfile
.
ZipFile
(
imgZipFile
,
"r"
)
as
zip_ref
:
zip_ref
.
extractall
(
dataDir
)
print
(
"... done unzipping"
)
print
(
"Will use images in "
+
imgDir
)
print
(
"... done unzipping"
)
print
(
"Will use images in "
+
imgDir
)
# Setup annotations data paths
annDir
=
"{}/annotations"
.
format
(
dataDir
)
...
...
@@ -196,22 +197,22 @@ class CocoDataset(utils.Dataset):
annFile
=
"{}/instances_{}{}.json"
.
format
(
annDir
,
dataType
,
dataYear
)
annURL
=
"http://images.cocodataset.org/annotations/annotations_trainval{}.zip"
.
format
(
dataYear
)
unZipDir
=
dataDir
# print
("Annotations paths:"); print (annDir); print (annFile); print (annZipFile); print
(annURL)
# print
("Annotations paths:"); print(annDir); print(annFile); print(annZipFile); print
(annURL)
# Download annotations if not available locally
if
not
os
.
path
.
exists
(
annDir
):
os
.
makedirs
(
annDir
)
if
not
os
.
path
.
exists
(
annFile
):
if
not
os
.
path
.
exists
(
annZipFile
):
print
(
"Downloading zipped annotations to "
+
annZipFile
+
" ..."
)
print
(
"Downloading zipped annotations to "
+
annZipFile
+
" ..."
)
with
urllib
.
request
.
urlopen
(
annURL
)
as
resp
,
open
(
annZipFile
,
'wb'
)
as
out
:
shutil
.
copyfileobj
(
resp
,
out
)
print
(
"... done downloading."
)
print
(
"Unzipping "
+
annZipFile
)
with
zipfile
.
ZipFile
(
annZipFile
,
"r"
)
as
zip_ref
:
print
(
"... done downloading."
)
print
(
"Unzipping "
+
annZipFile
)
with
zipfile
.
ZipFile
(
annZipFile
,
"r"
)
as
zip_ref
:
zip_ref
.
extractall
(
unZipDir
)
print
(
"... done unzipping"
)
print
(
"Will use annotations in "
+
annFile
)
print
(
"... done unzipping"
)
print
(
"Will use annotations in "
+
annFile
)
def
load_mask
(
self
,
image_id
):
"""Load instance masks for the given image.
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录