Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
27号BigBang
Mask_RCNN
提交
c8bb1af5
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 搜索 >>
提交
c8bb1af5
编写于
12月 11, 2017
作者:
P
Phil Ferriere
提交者:
Waleed Abdulla
12月 19, 2017
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Automatically download trained model file
上级
2aa62a39
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
40 addition
and
13 deletion
+40
-13
demo.ipynb
demo.ipynb
+6
-4
inspect_model.ipynb
inspect_model.ipynb
+5
-4
inspect_weights.ipynb
inspect_weights.ipynb
+5
-2
train_shapes.ipynb
train_shapes.ipynb
+6
-3
utils.py
utils.py
+18
-0
未找到文件。
demo.ipynb
浏览文件 @
c8bb1af5
...
...
@@ -45,10 +45,11 @@
"# Directory to save logs and trained model\n",
"MODEL_DIR = os.path.join(ROOT_DIR, \"logs\")\n",
"\n",
"# Path to trained weights file\n",
"# Download this file and place in the root of your \n",
"# project (See README file for details)\n",
"# Local path to trained weights file\n",
"COCO_MODEL_PATH = os.path.join(ROOT_DIR, \"mask_rcnn_coco.h5\")\n",
"# Download COCO trained weights from Releases if needed\n",
"if not os.path.exists(COCO_MODEL_PATH):\n",
" utils.download_trained_weights(COCO_MODEL_PATH)\n",
"\n",
"# Directory of images to run detection on\n",
"IMAGE_DIR = os.path.join(ROOT_DIR, \"images\")"
...
...
@@ -144,6 +145,7 @@
"cell_type": "code",
"execution_count": 3,
"metadata": {
"collapsed": true,
"scrolled": false
},
"outputs": [],
...
...
@@ -282,7 +284,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.
5
.2"
"version": "3.
6
.2"
}
},
"nbformat": 4,
inspect_model.ipynb
浏览文件 @
c8bb1af5
...
...
@@ -49,10 +49,11 @@
"# Directory to save logs and trained model\n",
"MODEL_DIR = os.path.join(ROOT_DIR, \"logs\")\n",
"\n",
"# Path to trained weights file\n",
"# Download this file and place in the root of your \n",
"# project (See README file for details)\n",
"# Local path to trained weights file\n",
"COCO_MODEL_PATH = os.path.join(ROOT_DIR, \"mask_rcnn_coco.h5\")\n",
"# Download COCO trained weights from Releases if needed\n",
"if not os.path.exists(COCO_MODEL_PATH):\n",
" utils.download_trained_weights(COCO_MODEL_PATH)\n",
"\n",
"# Path to Shapes trained weights\n",
"SHAPES_MODEL_PATH = os.path.join(ROOT_DIR, \"mask_rcnn_shapes.h5\")"
...
...
@@ -1377,7 +1378,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.
5
.2"
"version": "3.
6
.2"
}
},
"nbformat": 4,
inspect_weights.ipynb
浏览文件 @
c8bb1af5
...
...
@@ -44,8 +44,11 @@
"# Directory to save logs and trained model\n",
"MODEL_DIR = os.path.join(ROOT_DIR, \"logs\")\n",
"\n",
"#
Path to COCO trained weights
\n",
"#
Local path to trained weights file
\n",
"COCO_MODEL_PATH = os.path.join(ROOT_DIR, \"mask_rcnn_coco.h5\")\n",
"# Download COCO trained weights from Releases if needed\n",
"if not os.path.exists(COCO_MODEL_PATH):\n",
" utils.download_trained_weights(COCO_MODEL_PATH)\n",
"\n",
"# Path to Shapes trained weights\n",
"SHAPES_MODEL_PATH = os.path.join(ROOT_DIR, \"mask_rcnn_shapes.h5\")"
...
...
@@ -266,7 +269,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.
5
.2"
"version": "3.
6
.2"
}
},
"nbformat": 4,
train_shapes.ipynb
浏览文件 @
c8bb1af5
...
...
@@ -51,8 +51,11 @@
"# Directory to save logs and trained model\n",
"MODEL_DIR = os.path.join(ROOT_DIR, \"logs\")\n",
"\n",
"# Path to COCO trained weights\n",
"COCO_MODEL_PATH = os.path.join(ROOT_DIR, \"mask_rcnn_coco.h5\")"
"# Local path to trained weights file\n",
"COCO_MODEL_PATH = os.path.join(ROOT_DIR, \"mask_rcnn_coco.h5\")\n",
"# Download COCO trained weights from Releases if needed\n",
"if not os.path.exists(COCO_MODEL_PATH):\n",
" utils.download_trained_weights(COCO_MODEL_PATH)"
]
},
{
...
...
@@ -1024,7 +1027,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.
5
.2"
"version": "3.
6
.2"
}
},
"nbformat": 4,
...
...
utils.py
浏览文件 @
c8bb1af5
...
...
@@ -16,6 +16,11 @@ import tensorflow as tf
import
scipy.misc
import
skimage.color
import
skimage.io
import
urllib.request
import
shutil
# URL from which to download the latest COCO trained weights
COCO_MODEL_URL
=
"https://github.com/matterport/Mask_RCNN/releases/download/v2.0/mask_rcnn_coco.h5"
############################################################
...
...
@@ -688,3 +693,16 @@ def batch_slice(inputs, graph_fn, batch_size, names=None):
result
=
result
[
0
]
return
result
def
download_trained_weights
(
coco_model_path
,
verbose
=
1
):
"""Download COCO trained weights from Releases.
coco_model_path: local path of COCO trained weights
"""
if
verbose
>
0
:
print
(
"Downloading pretrained model to "
+
coco_model_path
+
" ..."
)
with
urllib
.
request
.
urlopen
(
COCO_MODEL_URL
)
as
resp
,
open
(
coco_model_path
,
'wb'
)
as
out
:
shutil
.
copyfileobj
(
resp
,
out
)
if
verbose
>
0
:
print
(
"... done downloading pretrained model!"
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录