当前位置:网站首页>Mask wearing detection method based on yolov5
Mask wearing detection method based on yolov5
2022-07-01 22:24:00 【Short section senior】
pick want
Wearing masks correctly is of great significance to effectively reduce the infection of covid-19 among people at this stage . be based on YOLOv5 Excellent performance in the field of image recognition and detection , This paper is based on YOLOv5 Automatic wear detection method for mask wear . First, find and collect pictures of people wearing masks in different scenes from the Internet and real life, about 500 Zhang Bing built his own dataset , And then use it YOLOv5 Model framework , Modify its relevant configuration files and detection parameters , And adopt data enhancement and Dropout Technology prevents overfitting . The experimental results verify YOLOv5 Superior performance in image recognition task of model crowd wearing masks , On test set YOLOv5s The accuracy of model recognition is as high as 85.45%.
key word Image recognition ; Mask wearing test ;YOLOv5; Feature learning ;
introduction
since 2019 Since then , Novel coronavirus pneumonia attacks the world , It affects people's life safety , China has taken strong and effective prevention and control measures , It has achieved great success in fighting COVID-19 , But we still can't relax , In the crowded airport , Stations and markets, etc , There is a risk of transmission if you are careless . Wearing masks correctly is one of the effective measures to effectively reduce the infection between personnel at this stage , Wearing a mask for detection also requires certain detection technology , At present, the efficiency of mask wearing detection is low due to the influence of the surrounding complex environment , Lead to missed inspection and other conditions . In order to achieve better detection effect , This paper mainly uses YOLOv5 Research on network model in lightweight mask wearing Detection Algorithm .
1 Data preprocessing
1.1 Data collection
The wearing image of crowd masks is 2022 year 5 month 23 Japan , Three students in this group took pictures on the Internet and in the real scene with their mobile phones , total 1027 A picture . The original image resolution obtained by different acquisition devices is different , When modeling data, scale to 324×324 Size specification
surface 1 Data collection information
Number Camera resolution Mobile phone model Number of images
1 2532 x 1170 Iphone12 250
2 2532 x 1170 IPhone13 325
3 4000 x 3000 Xiaomi 10S 301
(a) Mask wearing style
(b) Types of masks
chart 1. Mask wearing style data display
1.2 Data to enhance
In order to improve the generalization ability of convolutional neural network model , Wear the image on each mask by rotating 、 translation 、 Distortion 、 The zoom 、 Traditional digital image processing methods such as flipping perform random transformation to expand the number of samples . Some samples of a mask image after data enhancement are shown in the figure 2 Shown , The mask wearing image generated by random transformation greatly expands the data set , Make the sample more widely distributed .
chart 2 Some image samples after data enhancement
2 Test model
In this paper YOLOv5 Build a target mask detection model , It uses multiple residual components to deepen the network model , Directly increase the ability of network feature extraction and feature fusion .
2.1 Network structure
The recognition model constructed in this paper is mainly YOLOv5s, It is small and light , Fast features , Suitable for fast and accurate identification tasks . Model diagram 3-1.
The model input image is set to 324×324 Three channel color image , The residual structure contains bottleneck residual modules in turn 、 Conventional residual module ×2、 Bottleneck residual module 、 Conventional residual module ×3、 Bottleneck residual module 、 Conventional residual module ×22、 Bottleneck residual module 、 Conventional residual module ×2. Its internal convolution kernel setting is slightly adjusted . Last , After the network full connection layer Softmax The classifier outputs the classification probability of each category .
chart 3-1YOLOv5 Identify the network diagram
3 experiment
3.1 Experimental setup
In the experiment of image detection , The effects of different network architectures under different parameters are tested . Method of transforming model structure : change YOLOv5 There are three models in , Observe the accuracy of the three models under the same parameters .
The experimental programming development environment is PyCharm Community Edition 2021.1, The computing device is a personal computer , CPU by Intel Core i7-1065G7, The main frequency is 1.30GHz, Internal 8GB, The graphics card is NVIDIA GeForce MX230, To display as 4GB. The division ratio of training data and test data is 9:1.
3.2 experimental result
3.2.1 The best experimental results
First , Merge the mask image data set of all people together , Random stratified sampling 90% As a training set , rest 10% As a testing machine , Read in randomly out of order , Each iteration in the training process is randomly disrupted once , Training 5 Time , Verify once after each training , The data enhancement method is to move up, down, left and right randomly 20 Pixel ,x Axis random reflection . The recognition accuracy is shown in the table 3 Shown . among YOLOv5x The training set has the highest accuracy, but the training takes time 132 branch 51 second , YOLOv5l Training time consuming 105 branch 43 second ,YOLOv5s Training time consuming 78 branch 34 second . From the perspective of resource consumption and income ratio ,YOLOv5s Strong performance .YOLOv5x The generalization ability is poor , There is a problem of over fitting and the training process oscillates seriously .
surface 3. The best recognition result
The algorithm name Training accuracy Test accuracy
YOLOv5x 100 97.87
YOLOv5l 99.87 95.55
YOLOv5s 98.32 94.68
4 Conclusion
In this paper YOLOv5 The detection network model establishes the detection model of people wearing masks , It is used to automatically detect the wearing of masks of mobile people in different scenes . First , Search in Baidu gallery on the Internet 151 An image of the wearing of masks , Then, images of the wearing of masks were taken from different scenes around the crowd 876 Zhang . A total of 1027 Zhang . And manually mark the wearing of masks ; And then YOLOv5 Model architecture , Migration learns a convolutional neural network , The recognition accuracy on the test set can reach 98%, In different scenes , For different angles , Different types of masks have high recognition accuracy , Overall good performance , It has certain practical significance for the prevention and control of COVID-19 .
In order to improve the accuracy of large-scale crowd mask wearing detection in large scenes 、 Timeliness and robustness , The next step will continue to optimize the network structure and parameters , Add convolution model , Improve the overall accuracy , Transform data set content , The idea of hierarchical representation combined with feature learning , Transfer features 、 Feature learning and artificial features are combined to build a deep learning model that is easy to train .
ginseng Examination writing offer
[1] Wang Liru . be based on YOLOv5s Mask wearing test [J]. Tibetan science and Technology ,2022(05):65-67.
[2] Zhang Luyao , Hanwha . be based on YOLOv5s Whether to wear a mask on your face [J]. Intelligent computers and applications ,2021,11(09):196-199.
[3] Tan Shilei , Don't xiongbo , Lugonglin , Talk about Xiaohu . be based on YOLOv5 The personnel of the network model wear masks for real-time monitoring [J]. Laser magazine ,2021,42(02):147-150.
[4] Wang Feng . improvement yolov5 Artificial intelligence detection and recognition algorithm for wearing masks and helmets [J]. Architecture and budget ,2020(11):67-69.
[5] Wang Xinran , Tianqichuan , Zhang Dong . A review of research on face mask wearing detection [J]. Computer engineering
Welcome to join me for wechat exchange and discussion ( Please note csdn Add )
边栏推荐
猜你喜欢
随机推荐
Make a three digit number of all daffodils "recommended collection"
JS how to get a list of elements in a collection object
Qtreeview+qabstractitemmodel custom model: the third of a series of tutorials [easy to understand]
matlab遍历图像、字符串数组等基本操作
[STM32] stm32cubemx tutorial II - basic use (new projects light up LED lights)
Design and practice of new generation cloud native database
pytest合集(2)— pytest運行方式
一次调试去了解redis集群的slot机制
【商业终端仿真解决方案】上海道宁为您带来Georgia介绍、试用、教程
[live broadcast review] the first 8 live broadcasts of battle code Pioneer have come to a perfect end. Please look forward to the next one!
Application of real estate management based on 3D GIS
[noip2013] building block competition [noip2018] road laying greed / difference
I received a letter from CTO inviting me to interview machine learning engineer
String type conversion BigDecimal, date type
统计字符中每个字符出现的个数
MySQL series transaction log redo log learning notes
微信小程序,连续播放多段视频。合成一个视频的样子,自定义视频进度条
AirServer手机第三方投屏电脑软件
Do you want to make up for the suspended examination in the first half of the year? Including ten examinations for supervision engineers, architects, etc
K-means based user portrait clustering model