Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
models
提交
4195df96
M
models
项目概览
PaddlePaddle
/
models
大约 1 年 前同步成功
通知
222
Star
6828
Fork
2962
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
602
列表
看板
标记
里程碑
合并请求
255
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
M
models
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
602
Issue
602
列表
看板
标记
里程碑
合并请求
255
合并请求
255
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4195df96
编写于
11月 26, 2019
作者:
W
wangguanzhong
提交者:
GitHub
11月 26, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Revert "change fluid.layers.data to fluid.data (#3966)" (#3990)
This reverts commit
fba30199
.
上级
11ed966b
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
29 addition
and
31 deletion
+29
-31
PaddleCV/PaddleDetection/docs/EXPORT_MODEL.md
PaddleCV/PaddleDetection/docs/EXPORT_MODEL.md
+2
-4
PaddleCV/PaddleDetection/ppdet/data/data_feed.py
PaddleCV/PaddleDetection/ppdet/data/data_feed.py
+12
-12
PaddleCV/PaddleDetection/ppdet/modeling/model_input.py
PaddleCV/PaddleDetection/ppdet/modeling/model_input.py
+15
-15
未找到文件。
PaddleCV/PaddleDetection/docs/EXPORT_MODEL.md
浏览文件 @
4195df96
...
@@ -14,14 +14,14 @@
...
@@ -14,14 +14,14 @@
使用
[
训练/评估/推断
](
GETTING_STARTED_cn.md
)
中训练得到的模型进行试用,脚本如下
使用
[
训练/评估/推断
](
GETTING_STARTED_cn.md
)
中训练得到的模型进行试用,脚本如下
```
bash
```
bash
# 导出FasterRCNN模型
# 导出FasterRCNN模型
, 模型中data层默认的shape为3x800x1333
python tools/export_model.py
-c
configs/faster_rcnn_r50_1x.yml
\
python tools/export_model.py
-c
configs/faster_rcnn_r50_1x.yml
\
--output_dir
=
./inference_model
\
--output_dir
=
./inference_model
\
-o
weights
=
output/faster_rcnn_r50_1x/model_final
\
-o
weights
=
output/faster_rcnn_r50_1x/model_final
\
```
```
-
预测模型会导出到
`inference_model/faster_rcnn_r50_1x`
目录下,模型名和参数名分别为
`__model__`
和
`__params__`
。
预测模型会导出到
`inference_model/faster_rcnn_r50_1x`
目录下,模型名和参数名分别为
`__model__`
和
`__params__`
。
## 设置导出模型的输入大小
## 设置导出模型的输入大小
...
@@ -46,5 +46,3 @@ python tools/export_model.py -c configs/ssd/ssd_mobilenet_v1_voc.yml \
...
@@ -46,5 +46,3 @@ python tools/export_model.py -c configs/ssd/ssd_mobilenet_v1_voc.yml \
-o
weights
=
https://paddlemodels.bj.bcebos.com/object_detection/ssd_mobilenet_v1_voc.tar
\
-o
weights
=
https://paddlemodels.bj.bcebos.com/object_detection/ssd_mobilenet_v1_voc.tar
\
SSDTestFeed.image_shape
=[
3,300,300]
SSDTestFeed.image_shape
=[
3,300,300]
```
```
-
保存FPN系列模型时,需要保证上下采样维度一致,因此image_shape须设置为32的倍数
PaddleCV/PaddleDetection/ppdet/data/data_feed.py
浏览文件 @
4195df96
...
@@ -452,7 +452,7 @@ class FasterRCNNTrainFeed(DataFeed):
...
@@ -452,7 +452,7 @@ class FasterRCNNTrainFeed(DataFeed):
'image'
,
'im_info'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'image'
,
'im_info'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_crowd'
'is_crowd'
],
],
image_shape
=
[
None
,
3
,
None
,
None
],
image_shape
=
[
3
,
800
,
1333
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
RandomFlipImage
(
prob
=
0.5
),
RandomFlipImage
(
prob
=
0.5
),
...
@@ -504,7 +504,7 @@ class FasterRCNNEvalFeed(DataFeed):
...
@@ -504,7 +504,7 @@ class FasterRCNNEvalFeed(DataFeed):
COCO_VAL_IMAGE_DIR
).
__dict__
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
,
'gt_box'
,
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
],
'gt_label'
,
'is_difficult'
],
image_shape
=
[
None
,
3
,
None
,
None
],
image_shape
=
[
3
,
800
,
1333
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
NormalizeImage
(
mean
=
[
0.485
,
0.456
,
0.406
],
NormalizeImage
(
mean
=
[
0.485
,
0.456
,
0.406
],
...
@@ -551,7 +551,7 @@ class FasterRCNNTestFeed(DataFeed):
...
@@ -551,7 +551,7 @@ class FasterRCNNTestFeed(DataFeed):
dataset
=
SimpleDataSet
(
COCO_VAL_ANNOTATION
,
dataset
=
SimpleDataSet
(
COCO_VAL_ANNOTATION
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
],
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
],
image_shape
=
[
None
,
3
,
None
,
None
],
image_shape
=
[
3
,
800
,
1333
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
NormalizeImage
(
mean
=
[
0.485
,
0.456
,
0.406
],
NormalizeImage
(
mean
=
[
0.485
,
0.456
,
0.406
],
...
@@ -598,7 +598,7 @@ class MaskRCNNTrainFeed(DataFeed):
...
@@ -598,7 +598,7 @@ class MaskRCNNTrainFeed(DataFeed):
'image'
,
'im_info'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'image'
,
'im_info'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_crowd'
,
'gt_mask'
'is_crowd'
,
'gt_mask'
],
],
image_shape
=
[
None
,
3
,
None
,
None
],
image_shape
=
[
3
,
800
,
1333
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
RandomFlipImage
(
prob
=
0.5
,
is_mask_flip
=
True
),
RandomFlipImage
(
prob
=
0.5
,
is_mask_flip
=
True
),
...
@@ -644,7 +644,7 @@ class MaskRCNNEvalFeed(DataFeed):
...
@@ -644,7 +644,7 @@ class MaskRCNNEvalFeed(DataFeed):
dataset
=
CocoDataSet
(
COCO_VAL_ANNOTATION
,
dataset
=
CocoDataSet
(
COCO_VAL_ANNOTATION
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
],
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
],
image_shape
=
[
None
,
3
,
None
,
None
],
image_shape
=
[
3
,
800
,
1333
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
NormalizeImage
(
mean
=
[
0.485
,
0.456
,
0.406
],
NormalizeImage
(
mean
=
[
0.485
,
0.456
,
0.406
],
...
@@ -696,7 +696,7 @@ class MaskRCNNTestFeed(DataFeed):
...
@@ -696,7 +696,7 @@ class MaskRCNNTestFeed(DataFeed):
dataset
=
SimpleDataSet
(
COCO_VAL_ANNOTATION
,
dataset
=
SimpleDataSet
(
COCO_VAL_ANNOTATION
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
],
fields
=
[
'image'
,
'im_info'
,
'im_id'
,
'im_shape'
],
image_shape
=
[
None
,
3
,
None
,
None
],
image_shape
=
[
3
,
800
,
1333
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
NormalizeImage
(
NormalizeImage
(
...
@@ -740,7 +740,7 @@ class SSDTrainFeed(DataFeed):
...
@@ -740,7 +740,7 @@ class SSDTrainFeed(DataFeed):
def
__init__
(
self
,
def
__init__
(
self
,
dataset
=
VocDataSet
().
__dict__
,
dataset
=
VocDataSet
().
__dict__
,
fields
=
[
'image'
,
'gt_box'
,
'gt_label'
],
fields
=
[
'image'
,
'gt_box'
,
'gt_label'
],
image_shape
=
[
None
,
3
,
300
,
300
],
image_shape
=
[
3
,
300
,
300
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
,
with_mixup
=
False
),
DecodeImage
(
to_rgb
=
True
,
with_mixup
=
False
),
NormalizeBox
(),
NormalizeBox
(),
...
@@ -799,7 +799,7 @@ class SSDEvalFeed(DataFeed):
...
@@ -799,7 +799,7 @@ class SSDEvalFeed(DataFeed):
dataset
=
VocDataSet
(
VOC_VAL_ANNOTATION
).
__dict__
,
dataset
=
VocDataSet
(
VOC_VAL_ANNOTATION
).
__dict__
,
fields
=
[
'image'
,
'im_shape'
,
'im_id'
,
'gt_box'
,
fields
=
[
'image'
,
'im_shape'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
],
'gt_label'
,
'is_difficult'
],
image_shape
=
[
None
,
3
,
300
,
300
],
image_shape
=
[
3
,
300
,
300
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
,
with_mixup
=
False
),
DecodeImage
(
to_rgb
=
True
,
with_mixup
=
False
),
NormalizeBox
(),
NormalizeBox
(),
...
@@ -844,7 +844,7 @@ class SSDTestFeed(DataFeed):
...
@@ -844,7 +844,7 @@ class SSDTestFeed(DataFeed):
def
__init__
(
self
,
def
__init__
(
self
,
dataset
=
SimpleDataSet
(
VOC_VAL_ANNOTATION
).
__dict__
,
dataset
=
SimpleDataSet
(
VOC_VAL_ANNOTATION
).
__dict__
,
fields
=
[
'image'
,
'im_id'
,
'im_shape'
],
fields
=
[
'image'
,
'im_id'
,
'im_shape'
],
image_shape
=
[
None
,
3
,
300
,
300
],
image_shape
=
[
3
,
300
,
300
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
ResizeImage
(
target_size
=
300
,
use_cv2
=
False
,
interp
=
1
),
ResizeImage
(
target_size
=
300
,
use_cv2
=
False
,
interp
=
1
),
...
@@ -890,7 +890,7 @@ class YoloTrainFeed(DataFeed):
...
@@ -890,7 +890,7 @@ class YoloTrainFeed(DataFeed):
def
__init__
(
self
,
def
__init__
(
self
,
dataset
=
CocoDataSet
().
__dict__
,
dataset
=
CocoDataSet
().
__dict__
,
fields
=
[
'image'
,
'gt_box'
,
'gt_label'
,
'gt_score'
],
fields
=
[
'image'
,
'gt_box'
,
'gt_label'
,
'gt_score'
],
image_shape
=
[
None
,
3
,
608
,
608
],
image_shape
=
[
3
,
608
,
608
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
,
with_mixup
=
True
),
DecodeImage
(
to_rgb
=
True
,
with_mixup
=
True
),
MixupImage
(
alpha
=
1.5
,
beta
=
1.5
),
MixupImage
(
alpha
=
1.5
,
beta
=
1.5
),
...
@@ -962,7 +962,7 @@ class YoloEvalFeed(DataFeed):
...
@@ -962,7 +962,7 @@ class YoloEvalFeed(DataFeed):
COCO_VAL_IMAGE_DIR
).
__dict__
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
fields
=
[
'image'
,
'im_size'
,
'im_id'
,
'gt_box'
,
fields
=
[
'image'
,
'im_size'
,
'im_id'
,
'gt_box'
,
'gt_label'
,
'is_difficult'
],
'gt_label'
,
'is_difficult'
],
image_shape
=
[
None
,
3
,
608
,
608
],
image_shape
=
[
3
,
608
,
608
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
ResizeImage
(
target_size
=
608
,
interp
=
2
),
ResizeImage
(
target_size
=
608
,
interp
=
2
),
...
@@ -1018,7 +1018,7 @@ class YoloTestFeed(DataFeed):
...
@@ -1018,7 +1018,7 @@ class YoloTestFeed(DataFeed):
dataset
=
SimpleDataSet
(
COCO_VAL_ANNOTATION
,
dataset
=
SimpleDataSet
(
COCO_VAL_ANNOTATION
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
COCO_VAL_IMAGE_DIR
).
__dict__
,
fields
=
[
'image'
,
'im_size'
,
'im_id'
],
fields
=
[
'image'
,
'im_size'
,
'im_id'
],
image_shape
=
[
None
,
3
,
608
,
608
],
image_shape
=
[
3
,
608
,
608
],
sample_transforms
=
[
sample_transforms
=
[
DecodeImage
(
to_rgb
=
True
),
DecodeImage
(
to_rgb
=
True
),
ResizeImage
(
target_size
=
608
,
interp
=
2
),
ResizeImage
(
target_size
=
608
,
interp
=
2
),
...
...
PaddleCV/PaddleDetection/ppdet/modeling/model_input.py
浏览文件 @
4195df96
...
@@ -25,16 +25,16 @@ __all__ = ['create_feed']
...
@@ -25,16 +25,16 @@ __all__ = ['create_feed']
# yapf: disable
# yapf: disable
feed_var_def
=
[
feed_var_def
=
[
{
'name'
:
'im_info'
,
'shape'
:
[
None
,
3
],
'dtype'
:
'float32'
,
'lod_level'
:
0
},
{
'name'
:
'im_info'
,
'shape'
:
[
3
],
'dtype'
:
'float32'
,
'lod_level'
:
0
},
{
'name'
:
'im_id'
,
'shape'
:
[
None
,
1
],
'dtype'
:
'int32'
,
'lod_level'
:
0
},
{
'name'
:
'im_id'
,
'shape'
:
[
1
],
'dtype'
:
'int32'
,
'lod_level'
:
0
},
{
'name'
:
'gt_box'
,
'shape'
:
[
None
,
4
],
'dtype'
:
'float32'
,
'lod_level'
:
1
},
{
'name'
:
'gt_box'
,
'shape'
:
[
4
],
'dtype'
:
'float32'
,
'lod_level'
:
1
},
{
'name'
:
'gt_label'
,
'shape'
:
[
None
,
1
],
'dtype'
:
'int32'
,
'lod_level'
:
1
},
{
'name'
:
'gt_label'
,
'shape'
:
[
1
],
'dtype'
:
'int32'
,
'lod_level'
:
1
},
{
'name'
:
'is_crowd'
,
'shape'
:
[
None
,
1
],
'dtype'
:
'int32'
,
'lod_level'
:
1
},
{
'name'
:
'is_crowd'
,
'shape'
:
[
1
],
'dtype'
:
'int32'
,
'lod_level'
:
1
},
{
'name'
:
'gt_mask'
,
'shape'
:
[
None
,
2
],
'dtype'
:
'float32'
,
'lod_level'
:
3
},
{
'name'
:
'gt_mask'
,
'shape'
:
[
2
],
'dtype'
:
'float32'
,
'lod_level'
:
3
},
{
'name'
:
'is_difficult'
,
'shape'
:
[
None
,
1
],
'dtype'
:
'int32'
,
'lod_level'
:
1
},
{
'name'
:
'is_difficult'
,
'shape'
:
[
1
],
'dtype'
:
'int32'
,
'lod_level'
:
1
},
{
'name'
:
'gt_score'
,
'shape'
:
[
None
,
1
],
'dtype'
:
'float32'
,
'lod_level'
:
0
},
{
'name'
:
'gt_score'
,
'shape'
:
[
1
],
'dtype'
:
'float32'
,
'lod_level'
:
0
},
{
'name'
:
'im_shape'
,
'shape'
:
[
None
,
3
],
'dtype'
:
'float32'
,
'lod_level'
:
0
},
{
'name'
:
'im_shape'
,
'shape'
:
[
3
],
'dtype'
:
'float32'
,
'lod_level'
:
0
},
{
'name'
:
'im_size'
,
'shape'
:
[
None
,
2
],
'dtype'
:
'int32'
,
'lod_level'
:
0
},
{
'name'
:
'im_size'
,
'shape'
:
[
2
],
'dtype'
:
'int32'
,
'lod_level'
:
0
},
]
]
# yapf: enable
# yapf: enable
...
@@ -52,10 +52,10 @@ def create_feed(feed, use_pyreader=True, sub_prog_feed=False):
...
@@ -52,10 +52,10 @@ def create_feed(feed, use_pyreader=True, sub_prog_feed=False):
# tensor padding with 0 is used instead of LoD tensor when
# tensor padding with 0 is used instead of LoD tensor when
# num_max_boxes is set
# num_max_boxes is set
if
getattr
(
feed
,
'num_max_boxes'
,
None
)
is
not
None
:
if
getattr
(
feed
,
'num_max_boxes'
,
None
)
is
not
None
:
feed_var_map
[
'gt_label'
][
'shape'
]
=
[
None
,
feed
.
num_max_boxes
]
feed_var_map
[
'gt_label'
][
'shape'
]
=
[
feed
.
num_max_boxes
]
feed_var_map
[
'gt_score'
][
'shape'
]
=
[
None
,
feed
.
num_max_boxes
]
feed_var_map
[
'gt_score'
][
'shape'
]
=
[
feed
.
num_max_boxes
]
feed_var_map
[
'gt_box'
][
'shape'
]
=
[
None
,
feed
.
num_max_boxes
,
4
]
feed_var_map
[
'gt_box'
][
'shape'
]
=
[
feed
.
num_max_boxes
,
4
]
feed_var_map
[
'is_difficult'
][
'shape'
]
=
[
None
,
feed
.
num_max_boxes
]
feed_var_map
[
'is_difficult'
][
'shape'
]
=
[
feed
.
num_max_boxes
]
feed_var_map
[
'gt_label'
][
'lod_level'
]
=
0
feed_var_map
[
'gt_label'
][
'lod_level'
]
=
0
feed_var_map
[
'gt_score'
][
'lod_level'
]
=
0
feed_var_map
[
'gt_score'
][
'lod_level'
]
=
0
feed_var_map
[
'gt_box'
][
'lod_level'
]
=
0
feed_var_map
[
'gt_box'
][
'lod_level'
]
=
0
...
@@ -113,7 +113,7 @@ def create_feed(feed, use_pyreader=True, sub_prog_feed=False):
...
@@ -113,7 +113,7 @@ def create_feed(feed, use_pyreader=True, sub_prog_feed=False):
feed
.
fields
=
feed
.
fields
+
[
box_name
]
feed
.
fields
=
feed
.
fields
+
[
box_name
]
feed_var_map
[
box_name
]
=
sub_prog_feed
feed_var_map
[
box_name
]
=
sub_prog_feed
feed_vars
=
OrderedDict
([(
key
,
fluid
.
data
(
feed_vars
=
OrderedDict
([(
key
,
fluid
.
layers
.
data
(
name
=
feed_var_map
[
key
][
'name'
],
name
=
feed_var_map
[
key
][
'name'
],
shape
=
feed_var_map
[
key
][
'shape'
],
shape
=
feed_var_map
[
key
][
'shape'
],
dtype
=
feed_var_map
[
key
][
'dtype'
],
dtype
=
feed_var_map
[
key
][
'dtype'
],
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录