Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
阿飞的客栈
Mask_RCNN
提交
1b3f08eb
M
Mask_RCNN
项目概览
阿飞的客栈
/
Mask_RCNN
与 Fork 源项目一致
从无法访问的项目Fork
通知
7
Star
0
Fork
1
代码
文件
提交
分支
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,发现更多精彩内容 >>
提交
1b3f08eb
编写于
4月 02, 2018
作者:
W
Waleed Abdulla
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Convert config.BACKBONE_SHAPES to a function.
上级
a243f78d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
18 addition
and
8 deletion
+18
-8
config.py
config.py
+0
-6
model.py
model.py
+18
-2
未找到文件。
config.py
浏览文件 @
1b3f08eb
...
...
@@ -169,12 +169,6 @@ class Config(object):
self
.
IMAGE_SHAPE
=
np
.
array
(
[
self
.
IMAGE_MAX_DIM
,
self
.
IMAGE_MAX_DIM
,
3
])
# Compute backbone size from input image size
self
.
BACKBONE_SHAPES
=
np
.
array
(
[[
int
(
math
.
ceil
(
self
.
IMAGE_SHAPE
[
0
]
/
stride
)),
int
(
math
.
ceil
(
self
.
IMAGE_SHAPE
[
1
]
/
stride
))]
for
stride
in
self
.
BACKBONE_STRIDES
])
# Image meta data length
# See compose_image_meta() for details
self
.
IMAGE_META_SIZE
=
1
+
3
+
3
+
4
+
1
+
self
.
NUM_CLASSES
...
...
model.py
浏览文件 @
1b3f08eb
...
...
@@ -73,6 +73,20 @@ class BatchNorm(KL.BatchNormalization):
return
super
(
self
.
__class__
,
self
).
call
(
inputs
,
training
=
training
)
def
compute_backbone_shapes
(
config
,
image_shape
):
"""Computes the width and height of each stage of the backbone network.
Returns:
[N, (height, width)]. Where N is the number of stages
"""
# Currently supports ResNet only
assert
config
.
BACKBONE
in
[
"resnet50"
,
"resnet101"
]
return
np
.
array
(
[[
int
(
math
.
ceil
(
image_shape
[
0
]
/
stride
)),
int
(
math
.
ceil
(
image_shape
[
1
]
/
stride
))]
for
stride
in
config
.
BACKBONE_STRIDES
])
############################################################
# Resnet Graph
############################################################
...
...
@@ -1663,9 +1677,10 @@ def data_generator(dataset, config, shuffle=True, augment=False, augmentation=No
# Anchors
# [anchor_count, (y1, x1, y2, x2)]
backbone_shapes
=
compute_backbone_shapes
(
config
,
config
.
IMAGE_SHAPE
)
anchors
=
utils
.
generate_pyramid_anchors
(
config
.
RPN_ANCHOR_SCALES
,
config
.
RPN_ANCHOR_RATIOS
,
config
.
BACKBONE_SHAPES
,
backbone_shapes
,
config
.
BACKBONE_STRIDES
,
config
.
RPN_ANCHOR_STRIDE
)
...
...
@@ -1897,9 +1912,10 @@ class MaskRCNN():
mrcnn_feature_maps
=
[
P2
,
P3
,
P4
,
P5
]
# Generate Anchors
backbone_shapes
=
compute_backbone_shapes
(
config
,
config
.
IMAGE_SHAPE
)
self
.
anchors
=
utils
.
generate_pyramid_anchors
(
config
.
RPN_ANCHOR_SCALES
,
config
.
RPN_ANCHOR_RATIOS
,
config
.
BACKBONE_SHAPES
,
backbone_shapes
,
config
.
BACKBONE_STRIDES
,
config
.
RPN_ANCHOR_STRIDE
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录