Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleHub
提交
a8c87185
P
PaddleHub
项目概览
PaddlePaddle
/
PaddleHub
大约 1 年 前同步成功
通知
282
Star
12117
Fork
2091
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
200
列表
看板
标记
里程碑
合并请求
4
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleHub
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
200
Issue
200
列表
看板
标记
里程碑
合并请求
4
合并请求
4
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a8c87185
编写于
4月 29, 2020
作者:
W
wuzewu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update detection demo
上级
7e967e03
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
8 addition
and
9 deletion
+8
-9
demo/object_detection/predict_yolo.py
demo/object_detection/predict_yolo.py
+5
-6
demo/object_detection/train_faster_rcnn.py
demo/object_detection/train_faster_rcnn.py
+2
-2
demo/object_detection/train_yolo.py
demo/object_detection/train_yolo.py
+1
-1
未找到文件。
demo/object_detection/predict_yolo.py
浏览文件 @
a8c87185
...
...
@@ -12,21 +12,21 @@ from paddlehub.dataset.base_cv_dataset import ObjectDetectionDataset
# yapf: disable
parser
=
argparse
.
ArgumentParser
(
__doc__
)
parser
.
add_argument
(
"--use_gpu"
,
type
=
ast
.
literal_eval
,
default
=
True
,
help
=
"Whether use GPU for fine-tuning."
)
parser
.
add_argument
(
"--checkpoint_dir"
,
type
=
str
,
default
=
"
ssd_finetune_ckpt"
,
help
=
"Path to save log data."
)
parser
.
add_argument
(
"--checkpoint_dir"
,
type
=
str
,
default
=
"
yolo_finetune_ckpt"
,
help
=
"Path to save log data."
)
parser
.
add_argument
(
"--batch_size"
,
type
=
int
,
default
=
8
,
help
=
"Total examples' number in batch for training."
)
parser
.
add_argument
(
"--module"
,
type
=
str
,
default
=
"
ssd_vgg16_512_coco2017"
,
help
=
"Module used as feature extractor."
)
parser
.
add_argument
(
"--module"
,
type
=
str
,
default
=
"
yolov3_darknet53_coco2017"
,
help
=
"Module used as feature extractor."
)
parser
.
add_argument
(
"--dataset"
,
type
=
str
,
default
=
"coco_10"
,
help
=
"Dataset to finetune."
)
# yapf: enable.
def
predict
(
args
):
module
=
hub
.
Module
(
name
=
args
.
module
)
dataset
=
hub
.
dataset
.
Coco10
(
'
ssd
'
)
dataset
=
hub
.
dataset
.
Coco10
(
'
yolo
'
)
print
(
"dataset.num_labels:"
,
dataset
.
num_labels
)
# define batch reader
data_reader
=
ObjectDetectionReader
(
dataset
=
dataset
,
model_type
=
'
ssd
'
)
data_reader
=
ObjectDetectionReader
(
dataset
=
dataset
,
model_type
=
'
yolo
'
)
input_dict
,
output_dict
,
program
=
module
.
context
(
trainable
=
True
)
feed_list
=
[
input_dict
[
"image"
].
name
,
input_dict
[
"im_size"
].
name
]
...
...
@@ -41,12 +41,11 @@ def predict(args):
checkpoint_dir
=
args
.
checkpoint_dir
,
strategy
=
hub
.
finetune
.
strategy
.
DefaultFinetuneStrategy
())
task
=
hub
.
SSD
Task
(
task
=
hub
.
YOLO
Task
(
data_reader
=
data_reader
,
num_classes
=
dataset
.
num_labels
,
feed_list
=
feed_list
,
feature
=
feature
,
multi_box_head_config
=
module
.
multi_box_head_config
,
config
=
config
)
data
=
[
...
...
demo/object_detection/train_faster_rcnn.py
浏览文件 @
a8c87185
...
...
@@ -46,11 +46,11 @@ def finetune(args):
]
feature
=
[
output_dict
[
'head_feat'
],
output_dict
[
'rpn_cls_loss'
],
output_dict
[
'head_feat
ures
'
],
output_dict
[
'rpn_cls_loss'
],
output_dict
[
'rpn_reg_loss'
],
output_dict
[
'generate_proposal_labels'
]
]
pred_feature
=
[
pred_output_dict
[
'head_feat'
],
pred_output_dict
[
'rois'
]]
pred_feature
=
[
pred_output_dict
[
'head_feat
ures
'
],
pred_output_dict
[
'rois'
]]
config
=
hub
.
RunConfig
(
log_interval
=
10
,
...
...
demo/object_detection/train_yolo.py
浏览文件 @
a8c87185
...
...
@@ -32,7 +32,7 @@ def finetune(args):
input_dict
,
output_dict
,
program
=
module
.
context
(
trainable
=
True
)
feed_list
=
[
input_dict
[
"image"
].
name
,
input_dict
[
"im_size"
].
name
]
feature
=
output_dict
[
'
head
_features'
]
feature
=
output_dict
[
'
body
_features'
]
config
=
hub
.
RunConfig
(
log_interval
=
10
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录