当前位置:网站首页>[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
边栏推荐
- “12306” 的架构到底有多牛逼?
- 论文阅读_中文NLP_LTP
- Image classification, just look at me!
- Matlab built-in function how different colors, matlab subsection function different colors drawing
- Star ring technology data security management platform defender heavy release
- Disabling and enabling inspections pycharm
- 最大人工岛[如何让一个连通分量的所有节点都记录总节点数?+给连通分量编号]
- Sophon KG升级3.1:打破数据间壁垒,解放企业生产力
- EasyCVR平台通过接口编辑通道出现报错“ID不能为空”,是什么原因?
- 星环科技数据安全管理平台 Defensor重磅发布
猜你喜欢
华夏基金:基金行业数字化转型实践成果分享
FCN: Fully Convolutional Networks for Semantic Segmentation
Nanjing University: Discussion on the training program of digital talents in the new era
Career advancement Guide: recommended books for people in big factories
Leetcode exercise - 206 Reverse linked list
U-Net: Convolutional Networks for Biomedical Images Segmentation
Sophon base 3.1 launched mlops function to provide wings for the operation of enterprise AI capabilities
Cmake tutorial step1 (basic starting point)
星环科技数据安全管理平台 Defensor重磅发布
南京大学:新时代数字化人才培养方案探讨
随机推荐
Delete some elements in the array
Redis基础
U-Net: Convolutional Networks for Biomedical Images Segmentation
“12306” 的架构到底有多牛逼?
深拷贝与浅拷贝【面试题3】
GIMP 2.10教程「建议收藏」
Find the first k small element select_ k
Xiaobai getting started with NAS - quick building private cloud tutorial series (I) [easy to understand]
Clickhouse (03) how to install and deploy Clickhouse
How to modify MySQL fields as self growing fields
Gimp 2.10 tutorial "suggestions collection"
钉钉开放平台小程序API的缓存接口都有哪些内容?
Easynmon Usage Summary
Cmake tutorial step5 (add system self-test)
Access the database and use redis as the cache of MySQL (a combination of redis and MySQL)
tkinter窗口预加载
寻找第k小元素 前k小元素 select_k
Size_ T is unsigned
ISPRS2020/云检测:Transferring deep learning models for cloud detection between Landsat-8 and Proba-V
Elk log analysis system