当前位置:网站首页>[paddlepaddle] paddedetection face recognition custom data set
[paddlepaddle] paddedetection face recognition custom data set
2022-07-05 18:02:00 【mtl1994】
【PaddlePaddle】 PaddleDetection Face recognition Custom datasets
Use paddleDetection Face recognition is realized
List of articles
# Preface
Use paddleDetection Face recognition
brief introduction
PaddleDetection Development kit of flying propeller target detection , It aims to help developers complete the construction of detection model faster and better 、 Training 、 Optimize and deploy the whole development process .
PaddleDetection A variety of mainstream target detection algorithms are modularized , Provides a wealth of data enhancement strategies 、 Network module components ( Such as backbone network )、 Loss function, etc , It integrates model compression and cross platform high-performance deployment capabilities .
After a long period of industrial practice ,PaddleDetection Have a smooth 、 Excellent use experience , Industrial quality inspection 、 Remote sensing image detection 、 There's no patrol 、 The new retail 、 Internet 、 It is widely used by developers in more than ten industries such as scientific research .
characteristic
- The model is rich : contain object detection 、 Instance segmentation 、 Face detection etc. 100+ Pre training models , It covers a variety of Global champion programme
- Simple to use : Modular design , Decouple the various network components , Developers can easily build 、 Try various detection models and optimization strategies , Get high performance quickly 、 Customized Algorithm .
- Open end to end : Enhanced from data 、 networking 、 Training 、 Compress 、 Deploy end-to-end connection , And fully support Cloud / Border Multi architecture 、 Multi device deployment .
- High performance : High performance kernel based on propeller , Model training speed and video memory occupation advantages are obvious . Support FP16 Training , Support multi machine training .
One 、 Data set production
1. collecting data
Collect and run the following code from the local camera , It can also be obtained from other places
# -*- coding: utf-8 -*-
####### Run locally !!!!!!!!!
import cv2
import os
path = "./pictures/" # Image saving path
if not os.path.exists(path):
os.makedirs(path)
cap = cv2.VideoCapture(0)
i = 0
while (1):
ret, frame = cap.read()
k = cv2.waitKey(1)
if k == 27:
break
elif k == ord('s'):
cv2.imwrite(path + str(i) + '.jpg', frame)
print("save" + str(i) + ".jpg")
i += 1
cv2.imshow("capture", frame)
cap.release()
cv2.destroyAllWindows()
2. mark
open labelimg
1. Open the picture folder
2. Click on change_save_dir choice xml Save the path
3. mark
Two 、 download
# Download propeller
https://www.paddlepaddle.org.cn/
# download paddleDetection
# pip install paddledet
pip install paddledet==2.1.0 -i https://mirror.baidu.com/pypi/simple
# Download and use the configuration files and code samples in the source code
git clone https://github.com/PaddlePaddle/PaddleDetection.git
cd PaddleDetection
# Install other dependencies
pip install -r requirements.txt
3、 ... and 、 Training
1. Modify the configuration file
# Use ssd_mobilenet
#vim configs/ssd/ssd_mobilenet_v1_voc.yml
# Mainly modify the data set location
TrainReader:
inputs_def:
image_shape: [3, 300, 300]
fields: ['image', 'gt_bbox', 'gt_class']
dataset:
!VOCDataSet
anno_path: trainval.txt
dataset_dir: /home/aiuser/mtl/data/face_demo/VOCdevkit
EvalReader:
inputs_def:
image_shape: [3, 300, 300]
fields: ['image', 'gt_bbox', 'gt_class', 'im_shape', 'im_id', 'is_difficult']
dataset:
!VOCDataSet
dataset_dir: /home/aiuser/mtl/data/face_demo/VOCdevkit
anno_path: val.txt
TestReader:
inputs_def:
image_shape: [3,300,300]
fields: ['image', 'im_id', 'im_shape']
dataset:
!ImageFolder
dataset_dir: /home/aiuser/mtl/data/face_demo/VOCdevkit
anno_path: label_list.txt
Full profile
architecture: SSD
pretrain_weights: https://paddlemodels.bj.bcebos.com/object_detection/ssd_mobilenet_v1_coco_pretrained.tar
use_gpu: true
max_iters: 2800
snapshot_iter: 2000
log_iter: 1
metric: VOC
map_type: 11point
save_dir: output
weights: output/ssd_mobilenet_v1_voc/model_final
# 20(label_class) + 1(background)
num_classes: 25
SSD:
backbone: MobileNet
multi_box_head: MultiBoxHead
output_decoder:
background_label: 0
keep_top_k: 200
nms_eta: 1.0
nms_threshold: 0.45
nms_top_k: 400
score_threshold: 0.01
MobileNet:
norm_decay: 0.
conv_group_scale: 1
conv_learning_rate: 0.1
extra_block_filters: [[256, 512], [128, 256], [128, 256], [64, 128]]
with_extra_blocks: true
MultiBoxHead:
aspect_ratios: [[2.], [2., 3.], [2., 3.], [2., 3.], [2., 3.], [2., 3.]]
base_size: 300
flip: true
max_ratio: 90
max_sizes: [[], 150.0, 195.0, 240.0, 285.0, 300.0]
min_ratio: 20
min_sizes: [60.0, 105.0, 150.0, 195.0, 240.0, 285.0]
offset: 0.5
LearningRate:
schedulers:
- !PiecewiseDecay
milestones: [10000, 15000, 20000, 25000]
values: [0.001, 0.0005, 0.00025, 0.0001, 0.00001]
OptimizerBuilder:
optimizer:
momentum: 0.0
type: RMSPropOptimizer
regularizer:
factor: 0.00005
type: L2
TrainReader:
inputs_def:
image_shape: [3, 300, 300]
fields: ['image', 'gt_bbox', 'gt_class']
dataset:
!VOCDataSet
anno_path: trainval.txt
dataset_dir: /home/aiuser/mtl/data/face_demo/VOCdevkit
use_default_label: false
sample_transforms:
- !DecodeImage
to_rgb: true
- !RandomDistort
brightness_lower: 0.875
brightness_upper: 1.125
is_order: true
- !RandomExpand
fill_value: [127.5, 127.5, 127.5]
- !RandomCrop
allow_no_crop: false
- !NormalizeBox {}
- !ResizeImage
interp: 1
target_size: 300
use_cv2: false
- !RandomFlipImage
is_normalized: true
- !Permute {}
- !NormalizeImage
is_scale: false
mean: [127.5, 127.5, 127.5]
std: [127.502231, 127.502231, 127.502231]
batch_size: 4
shuffle: true
drop_last: true
worker_num: 8
bufsize: 16
use_process: true
EvalReader:
inputs_def:
image_shape: [3, 300, 300]
fields: ['image', 'gt_bbox', 'gt_class', 'im_shape', 'im_id', 'is_difficult']
dataset:
!VOCDataSet
dataset_dir: /home/aiuser/mtl/data/face_demo/VOCdevkit
anno_path: val.txt
use_default_label: false
sample_transforms:
- !DecodeImage
to_rgb: true
- !NormalizeBox {}
- !ResizeImage
interp: 1
target_size: 300
use_cv2: false
- !Permute {}
- !NormalizeImage
is_scale: false
mean: [127.5, 127.5, 127.5]
std: [127.502231, 127.502231, 127.502231]
batch_size: 4
worker_num: 8
bufsize: 16
use_process: false
TestReader:
inputs_def:
image_shape: [3,300,300]
fields: ['image', 'im_id', 'im_shape']
dataset:
!ImageFolder
dataset_dir: /home/aiuser/mtl/data/face_demo/VOCdevkit
anno_path: label_list.txt
use_default_label: false
sample_transforms:
- !DecodeImage
to_rgb: true
- !ResizeImage
interp: 1
max_size: 0
target_size: 300
use_cv2: true
- !Permute {}
- !NormalizeImage
is_scale: false
mean: [127.5, 127.5, 127.5]
std: [127.502231, 127.502231, 127.502231]
batch_size: 1
2. Start training
python -u tools/train.py -c configs/ssd/ssd_mobilenet_v1_voc.yml -o --eval
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-qhhnrgL3-1656931184790)(C:\Users\e9\AppData\Roaming\Typora\typora-user-images\image-20210712141658919.png)]
3. The export model
python tools/export_model.py -c configs/ssd/ssd_mobilenet_v1_voc.yml --output_dir=./inference_model
Four 、 Use
python -u deploy/python/infer.py --model_dir D:/Paddle/PaddleDetection/PaddleDetection/output/ssd_mobilenet_v1_voc/ssd_mobilenet_v1_voc
nfigs/ssd/ssd_mobilenet_v1_voc.yml --output_dir=./inference_model ```
Four 、 Use
python -u deploy/python/infer.py --model_dir D:/Paddle/PaddleDetection/PaddleDetection/output/ssd_mobilenet_v1_voc/ssd_mobilenet_v1_voc
# summary
边栏推荐
猜你喜欢

「运维有小邓」用于云应用程序的单点登录解决方案

Six bad safety habits in the development of enterprise digitalization, each of which is very dangerous!

IDC report: Tencent cloud database ranks top 2 in the relational database market!

吳恩達團隊2022機器學習課程,來啦

Leetcode daily question: the first unique character in the string

ISPRS2022/雲檢測:Cloud detection with boundary nets基於邊界網的雲檢測

图扑软件数字孪生 | 基于 BIM 技术的可视化管理系统
![含重复元素取不重复子集[如何取子集?如何去重?]](/img/b2/d019c3f0b85a6c0d334a092fa6c23c.png)
含重复元素取不重复子集[如何取子集?如何去重?]

Why is all (()) true and any (()) false?

What are the changes in the 2022 PMP Exam?
随机推荐
Isprs2022 / Cloud Detection: Cloud Detection with Boundary nets Boundary Networks Based Cloud Detection
[BeanShell] there are many ways to write data locally
FCN: Fully Convolutional Networks for Semantic Segmentation
南京大学:新时代数字化人才培养方案探讨
检查命名空间和类
Binder开辟线程数过多导致主线程ANR异常
Thesis reading_ Chinese NLP_ LTP
MATLAB查阅
Please tell me why some tables can find data by writing SQL, but they can't be found in the data map, and the table structure can't be found
Configure pytorch environment in Anaconda - win10 system (small white packet meeting)
Read libco save and restore the on-site assembly code
"Xiaodeng in operation and maintenance" is a single sign on solution for cloud applications
修复漏洞 - mysql 、es
怎么选择外盘期货平台最正规安全?
What are the requirements for PMP certification? How much is it?
Clickhouse (03) how to install and deploy Clickhouse
Xiaobai getting started with NAS - quick building private cloud tutorial series (I) [easy to understand]
Matlab built-in function how different colors, matlab subsection function different colors drawing
热通孔的有效放置如何改善PCB设计中的热管理?
ISPRS2020/云检测:Transferring deep learning models for cloud detection between Landsat-8 and Proba-V