Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PaddlePaddle
PaddleX
提交
829431c5
P
PaddleX
项目概览
PaddlePaddle
/
PaddleX
通知
136
Star
4
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
43
列表
看板
标记
里程碑
合并请求
5
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
P
PaddleX
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
43
Issue
43
列表
看板
标记
里程碑
合并请求
5
合并请求
5
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
829431c5
编写于
6月 18, 2020
作者:
F
FlyingQianMM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
reset pretrained weights url
上级
2707e76f
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
24 addition
and
34 deletion
+24
-34
Applications/HumanSeg/README.md
Applications/HumanSeg/README.md
+12
-12
Applications/HumanSeg/data/download_data.py
Applications/HumanSeg/data/download_data.py
+0
-2
Applications/HumanSeg/pretrain_weights/download_pretrain_weights.py
...ns/HumanSeg/pretrain_weights/download_pretrain_weights.py
+11
-19
paddlex/cv/models/utils/pretrain_weights.py
paddlex/cv/models/utils/pretrain_weights.py
+1
-1
未找到文件。
Applications/HumanSeg/README.md
浏览文件 @
829431c5
...
...
@@ -18,10 +18,10 @@ pip install paddlex -i https://mirror.baidu.com/pypi/simple
## 预训练模型
HumanSeg开放了在大规模人像数据上训练的两个预训练模型,满足多种使用场景的需求
| 模型类型 | Checkpoint | Inference Model | Quant Inference Model | 备注 |
| 模型类型 | Checkpoint
Parameter
| Inference Model | Quant Inference Model | 备注 |
| --- | --- | --- | ---| --- |
| HumanSeg-server |
[
humanseg_server_
ckpt
](
https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_server_ckpt.zip
)
|
[
humanseg_server_inference
](
https://paddleseg
.bj.bcebos.com/humanseg/models/humanseg_server_inference.zip
)
| -- | 高精度模型,适用于服务端GPU且背景复杂的人像场景, 模型结构为Deeplabv3+/Xcetion65, 输入大小(512, 512) |
| HumanSeg-mobile |
[
humanseg_mobile_
ckpt
](
https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_mobile_ckpt.zip
)
|
[
humanseg_mobile_inference
](
https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_mobile_inference.zip
)
|
[
humanseg_mobile_quant
](
https://paddleseg
.bj.bcebos.com/humanseg/models/humanseg_mobile_quant.zip
)
| 轻量级模型, 适用于移动端或服务端CPU的前置摄像头场景,模型结构为HRNet_w18_samll_v1,输入大小(192, 192) |
| HumanSeg-server |
[
humanseg_server_
params
](
https://paddlex.bj.bcebos.com/humanseg/models/humanseg_server.pdparams
)
|
[
humanseg_server_inference
](
https://paddlex
.bj.bcebos.com/humanseg/models/humanseg_server_inference.zip
)
| -- | 高精度模型,适用于服务端GPU且背景复杂的人像场景, 模型结构为Deeplabv3+/Xcetion65, 输入大小(512, 512) |
| HumanSeg-mobile |
[
humanseg_mobile_
params
](
https://paddlex.bj.bcebos.com/humanseg/models/humanseg_mobile.pdparams
)
|
[
humanseg_mobile_inference
](
https://paddlex.bj.bcebos.com/humanseg/models/humanseg_mobile_inference.zip
)
|
[
humanseg_mobile_quant
](
https://paddlex
.bj.bcebos.com/humanseg/models/humanseg_mobile_quant.zip
)
| 轻量级模型, 适用于移动端或服务端CPU的前置摄像头场景,模型结构为HRNet_w18_samll_v1,输入大小(192, 192) |
模型性能
...
...
@@ -32,11 +32,11 @@ HumanSeg开放了在大规模人像数据上训练的两个预训练模型,满
|humanseg_mobile_inference | 5.8 M | 42.35ms |
|humanseg_mobile_quant | 1.6M | 24.93ms |
计算耗时运行环境: 小米,cpu:骁龙855, 内存:6GB, 图片大小:192
*
192
)
计算耗时运行环境: 小米,cpu:骁龙855, 内存:6GB, 图片大小:192
*
192
**NOTE:**
其中Checkpoint为模型权重,用于Fine-tuning场景。
其中Checkpoint
Parameter
为模型权重,用于Fine-tuning场景。
*
Inference Model和Quant Inference Model为预测部署模型,包含
`__model__`
计算图结构、
`__params__`
模型参数和
`model.yaml`
基础的模型配置信息。
...
...
@@ -58,10 +58,10 @@ python data/download_data.py
结合DIS(Dense Inverse Search-basedmethod)光流算法预测结果与分割结果,改善视频流人像分割
```
bash
# 通过电脑摄像头进行实时分割处理
python video_infer.py
--model_dir
pretrain_weights/humanseg_
lit
e_inference
python video_infer.py
--model_dir
pretrain_weights/humanseg_
mobil
e_inference
# 对人像视频进行分割处理
python video_infer.py
--model_dir
pretrain_weights/humanseg_
lit
e_inference
--video_path
data/video_test.mp4
python video_infer.py
--model_dir
pretrain_weights/humanseg_
mobil
e_inference
--video_path
data/video_test.mp4
```
视频分割结果如下:
...
...
@@ -71,13 +71,13 @@ python video_infer.py --model_dir pretrain_weights/humanseg_lite_inference --vid
根据所选背景进行背景替换,背景可以是一张图片,也可以是一段视频。
```
bash
# 通过电脑摄像头进行实时背景替换处理, 也可通过'--background_video_path'传入背景视频
python bg_replace.py
--model_dir
pretrain_weights/humanseg_
lit
e_inference
--background_image_path
data/background.jpg
python bg_replace.py
--model_dir
pretrain_weights/humanseg_
mobil
e_inference
--background_image_path
data/background.jpg
# 对人像视频进行背景替换处理, 也可通过'--background_video_path'传入背景视频
python bg_replace.py
--model_dir
pretrain_weights/humanseg_
lit
e_inference
--video_path
data/video_test.mp4
--background_image_path
data/background.jpg
python bg_replace.py
--model_dir
pretrain_weights/humanseg_
mobil
e_inference
--video_path
data/video_test.mp4
--background_image_path
data/background.jpg
# 对单张图像进行背景替换
python bg_replace.py
--model_dir
pretrain_weights/humanseg_
lit
e_inference
--image_path
data/human_image.jpg
--background_image_path
data/background.jpg
python bg_replace.py
--model_dir
pretrain_weights/humanseg_
mobil
e_inference
--image_path
data/human_image.jpg
--background_image_path
data/background.jpg
```
...
...
@@ -100,14 +100,14 @@ python train.py --model_type HumanSegMobile \
--data_dir
data/mini_supervisely
\
--train_list
data/mini_supervisely/train.txt
\
--val_list
data/mini_supervisely/val.txt
\
--pretrain_weights
pretrain_weights/humanseg_mobile_
ckpt
\
--pretrain_weights
pretrain_weights/humanseg_mobile_
params
\
--batch_size
8
\
--learning_rate
0.001
\
--num_epochs
10
\
--image_shape
192 192
```
其中参数含义如下:
*
`--model_type`
: 模型类型,可选项为:HumanSegServer
、HumanSegMobile和HumanSegLit
e
*
`--model_type`
: 模型类型,可选项为:HumanSegServer
和HumanSegMobil
e
*
`--save_dir`
: 模型保存路径
*
`--data_dir`
: 数据集路径
*
`--train_list`
: 训练集列表路径
...
...
Applications/HumanSeg/data/download_data.py
浏览文件 @
829431c5
...
...
@@ -16,8 +16,6 @@ import sys
import
os
LOCAL_PATH
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
TEST_PATH
=
os
.
path
.
join
(
LOCAL_PATH
,
"../../../"
,
"test"
)
sys
.
path
.
append
(
TEST_PATH
)
import
paddlex
as
pdx
...
...
Applications/HumanSeg/pretrain_weights/download_pretrain_weights.py
浏览文件 @
829431c5
...
...
@@ -17,32 +17,24 @@ import sys
import
os
LOCAL_PATH
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
))
TEST_PATH
=
os
.
path
.
join
(
LOCAL_PATH
,
"../../../"
,
"test"
)
sys
.
path
.
append
(
TEST_PATH
)
import
paddlex
as
pdx
import
paddlehub
as
hub
model_urls
=
{
"humanseg_server_ckpt"
:
"https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_server_ckpt.zip"
,
"humanseg_server_inference"
:
"https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_server_inference.zip"
,
"humanseg_mobile_ckpt"
:
"https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_mobile_ckpt.zip"
,
"humanseg_mobile_inference"
:
"https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_mobile_inference.zip"
,
"humanseg_mobile_quant"
:
"https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_mobile_quant.zip"
,
"humanseg_lite_ckpt"
:
"https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_lite_ckpt.zip"
,
"humanseg_lite_inference"
:
"https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_lite_inference.zip"
,
"humanseg_lite_quant"
:
"https://paddleseg.bj.bcebos.com/humanseg/models/humanseg_lite_quant.zip"
,
"PaddleX_HumanSeg_Server_Params"
:
"https://bj.bcebos.com/paddlex/models/humanseg/humanseg_server_params.tar"
,
"PaddleX_HumanSeg_Server_Inference"
:
"https://bj.bcebos.com/paddlex/models/humanseg/humanseg_server_inference.tar"
,
"PaddleX_HumanSeg_Mobile_Params"
:
"https://bj.bcebos.com/paddlex/models/humanseg/humanseg_mobile_params.tar"
,
"PaddleX_HumanSeg_Mobile_Inference"
:
"https://bj.bcebos.com/paddlex/models/humanseg/humanseg_mobile_inference.tar"
,
"PaddleX_HumanSeg_Mobile_Quant"
:
"https://bj.bcebos.com/paddlex/models/humanseg/humanseg_mobile_quant.tar"
}
if
__name__
==
"__main__"
:
for
model_name
,
url
in
model_urls
.
items
():
pdx
.
utils
.
download_and_decompress
(
url
=
url
,
path
=
LOCAL_PATH
)
print
(
"Pretrained Model download success!"
)
paddlex/cv/models/utils/pretrain_weights.py
浏览文件 @
829431c5
...
...
@@ -81,7 +81,7 @@ coco_pretrain = {
'YOLOv3_MobileNetV1_COCO'
:
'https://paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v1.tar'
,
'YOLOv3_MobileNetV3_large_COCO'
:
'https://
paddlemodels.bj.bcebos.com/object_detection/yolov3_mobilenet_v3.pdparams
'
,
'https://
bj.bcebos.com/paddlex/models/yolov3_mobilenet_v3.tar
'
,
'YOLOv3_ResNet34_COCO'
:
'https://paddlemodels.bj.bcebos.com/object_detection/yolov3_r34.tar'
,
'YOLOv3_ResNet50_vd_COCO'
:
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录