A table tennis detection method based on improved YOLO V4 algorithm

By improving the YOLO V4 algorithm, combined with image acquisition and deep learning technology, the problem of traditional table tennis detection methods being sensitive to light and environment is solved, achieving higher recognition accuracy and stability.

CN113963299BInactive Publication Date: 2024-08-27DALIAN NATIONALITIES UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111249456.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-26
Publication Date
2024-08-27
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Traditional table tennis detection methods are sensitive to lighting conditions and dynamic environments, resulting in low recognition accuracy and stability.

Method used

Using the improved YOLO V4 algorithm, methods of image acquisition, data preprocessing, network improvement and training models are used, including binocular cameras to acquire video data, data annotation, improvement and simplified structure of YOLO V4 network, and transfer learning training using TensorFlow. Improve the robustness of identification.

Benefits of technology

It effectively reduces the impact on lighting conditions and dynamic environment, and significantly improves the recognition accuracy and stability of table tennis detection.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113963299B
    Figure CN113963299B
Patent Text Reader

Abstract

The present invention relates to the technical field of video image recognition, and in particular to a table tennis detection method based on an improved YOLO V4 algorithm, comprising the following steps: S1: image acquisition, S2: data preprocessing, S3: improving a YOLO V4 network, and S4: training a network model. The method is less affected by lighting conditions and dynamic environments, thereby effectively improving recognition accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of video image recognition, and in particular to a table tennis detection method based on an improved YOLO V4 algorithm. Background Art

[0002] Table tennis is our national sport. Its wide participation has led to the rapid development of table tennis-related sports industries in my country. Among them, automatic table tennis ball pickers, table tennis intelligent ball serving machines, and table tennis robots have also made great progress. The first step for them to work properly is how to detect table tennis balls. The most commonly used table tennis ball detection methods are the following three: frame difference method, background subtraction method, and optical flow method. Their main advantages are that the algorithm implementation is relatively simple and the complexity of program design is low. The frame difference method uses pixel-based time difference between two or three adjacent frames in the image sequence to extract the moving area in the image through closed value conversion, and then determine the position of the moving target. The background subtraction method first constructs an image, subtracts the current image from the background image, obtains a differential image, and then performs target segmentation according to the set threshold. The optical flow method uses the changes in pixels in the image sequence in the time domain and the correlation between adjacent frames to find the corresponding relationship between the previous frame and the current frame, thereby calculating the motion information of objects between adjacent frames. However, the disadvantages are also very obvious. These traditional methods are particularly sensitive to lighting conditions and dynamic environments, which also results in low recognition accuracy and stability. Summary of the invention

[0003] The purpose of the present invention is to solve the defects of the traditional table tennis recognition method and propose a table tennis detection method based on the improved YOLO V4 algorithm.

[0004] To achieve the above purpose, the technical solution adopted by the present invention is: a table tennis detection method based on an improved YOLO V4 algorithm, comprising the following steps:

[0005] S1. Image acquisition: using a binocular camera, the entire process of playing table tennis was recorded and collected at a frequency of 40-60 Hz, and 30-50 minutes of video data were collected;

[0006] S2. Data preprocessing: Use Python program to process the video into image sequences to obtain the original data set. Use the general labeling software labelimg labeling tool to label the obtained images containing table tennis balls. After labeling, convert the PASCAL format file into a YOLO format file to complete the data set production.

[0007] S3, improve the YOLO V4 network;

[0008] S4. Train the network model.

[0009] Preferably, the improvement in step S3 includes:

[0010] A1. Extract the coordinates of all bounding boxes;

[0011] A2. Calculate the width and height of the bounding box based on the coordinates of the four regression boxes output in step A1.

[0012] A3. Anchor box initialization: First, initialize an anchor box, then calculate the next anchor box, select the anchor box using the roulette method, and repeat this process until the initial values ​​of K anchor boxes are selected.

[0013] A4. Calculate the IOU value of each bounding box and each anchor box, where IOU is the intersection-over-union ratio of the predicted bounding box and the actual physical location;

[0014] A5, classification operation. Through step A4, the error of each bounding box with respect to each anchor box can be obtained. The anchor box with the smallest error is selected and assigned to the corresponding bounding box category.

[0015] A6. Update the anchor box. After the previous step, determine which bounding boxes belong to the anchor box, and then calculate the width and height of these bounding boxes as the new size of the anchor box.

[0016] Preferably, the improvement in step S3 includes: simplifying the YOLO V4 network structure: the entire network includes the BackBone backbone network, Neck and Prediction of yolov4, and each part of the network is simplified, corresponding to the simplified backbone network, FPN layer, and Prediction.

[0017] Preferably, the simplified YOLO V4 network structure is as follows: in the structure diagram, a 416*416 image is input, and two DarknetConv2D_BN_Leaky operations with a step size of 2 are performed to compress the height and width of the image twice to obtain a feature layer, and then two Resblock_body operations are performed to further compress the image; then another DarknetConv2D_BN_Leaky operation is performed to obtain a valid feature layer, and after being processed by the backbone feature network, the 26*26 feature layer is passed to the FPN layer; the FPN layer convolves and upsamples the 26*26 feature layer to convert the input image into a 52*52 feature layer, and then splices and convolves with the 52*52 feature layer processed by the backbone network; after FPN, two valid feature layers with higher semantic information are obtained, and then two YOLO Heads are used for prediction.

[0018] Preferably, the deep learning framework used in step S4 is TensorFlow, and the specific training steps are as follows:

[0019] B1. Modify the configuration files: create a new data\voc-pingpong.names file, a new data\voc-pingpang.data file, and a new cfg\yolov4-pingpong.cfg; patch = 16 subdivisions = 8 max_batches = 2000 steps = 1600, 1800;

[0020] B2. Training data set: Using the transfer learning algorithm, download the pre-trained weight file yolov4.conv.137, the recognition accuracy and loss decrease, and the effect diagram of table tennis recognition is obtained.

[0021] Compared with the prior art, the present invention has the following beneficial effects:

[0022] This method is less affected by lighting conditions and dynamic environment, thereby effectively improving the recognition accuracy and stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] Figure 1 This is a schematic diagram of image acquisition in step S1 of a table tennis detection method based on an improved YOLO V4 algorithm of the present invention;

[0024] Figure 2 The content of the annotation file in step S2 of the table tennis detection method based on the improved YOLO V4 algorithm of the present invention;

[0025] Figure 3A traditional YOLO V4 framework structure principle diagram of a table tennis detection method based on an improved YOLO V4 algorithm of the present invention;

[0026] Figure 4 The improved YOLO V4 framework structure principle diagram of a table tennis detection method based on an improved YOLO V4 algorithm of the present invention;

[0027] Figure 5 A schematic diagram of the recognition accuracy and loss reduction of a training data set of a table tennis detection method based on an improved YOLO V4 algorithm of the present invention;

[0028] Figure 6 This is an effect diagram of table tennis recognition of a table tennis detection method based on an improved YOLO V4 algorithm of the present invention. DETAILED DESCRIPTION

[0029] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art may think of other obvious variations.

[0030] The technical solution adopted by the table tennis detection method based on the improved YOLO V4 algorithm of the present invention comprises the following steps:

[0031] Step 1: Image acquisition. Using a binocular camera, the entire process of playing table tennis was recorded and collected at a frequency of 40-60Hz, and 30-50 minutes of video data were collected. Figure 1 shown.

[0032] Step 2: Data preprocessing. Use Python to process the video into a sequence of images to obtain the original data set. Use the universal labeling software labelimg to label the images of the table tennis balls. After labeling, convert the PASCAL file into a YOLO file to complete the data set. The content of the labeling file is as follows: Figure 2 shown.

[0033] Step 3: Improve the existing YOLO V4 network.

[0034] The traditional YOLO V4 framework structure is as follows Figure 3As shown in the figure, the network structure is mainly divided into three parts, namely the BackBone backbone network, the Neck part and the Prediction part. The BackBone backbone network has 5 CSP modules. When the input image is 608*608, the change rule of its feature map is: 608->304->152->76->38->19. After 5 CSP modules, a feature map of size 19*19 is obtained, and the Mish activation function and CSPDarknet53 structure are used in Backbone. The advantages of the CSPDarknet53 structure are also obvious. It can enhance the learning ability of CNN, maintain accuracy while being lightweight, and reduce computing bottlenecks and memory costs. The Neck part structure mainly adopts the SPP module and FPN+PAN. There is a Yolov3_spp version in the C++ code folder of YOLOV4, which uses the maximum pooling method of k={1*1, 5*5, 9*9, 13*13}, and then performs Concat operation on feature maps of different scales. PAN is an innovation of PANet in the field of image segmentation. FPN is top-down, and the high-level feature information is transmitted and fused by upsampling to obtain a feature map that can be predicted. In addition to this, a bottom-up feature pyramid is added behind FPN. The FPN layer conveys strong semantic features from top to bottom, and the feature pyramid conveys strong positioning features from bottom to top, and parameters of different detection layers are aggregated from different backbone layers. The biggest advantage of the Prediction part is the use of CIOU_Loss. The development process of Bounding BoxRegeression Loss in recent years is as follows: Smooth L1 Loss->Iou Loss(2016)->GIoULoss(2019)->DIoU Loss(2020)->CIoU Loss(2020). DIoU_Loss takes into account the overlapping area and the center point distance. When the target wraps the prediction box, the distance between the two boxes is directly measured, so DIoU_Loss converges faster, but it does not take into account the aspect ratio. The formulas in front of CIoU_Loss and DIoU_Loss are the same, the difference is that an influencing factor is added to take into account the aspect ratio of the prediction box and the target box. In this way, CIoU_Loss takes into account the three important geometric factors that the target regression function should consider: overlapping area, center point distance, and aspect ratio. In the above operation layer, the DarknetConv2D_BN_Leaky module is composed of DarknetConv2D, BN layer and Leaky activation function stacked together. The Resblock_body module mainly uses the residual network and CSP. The structural diagram of this part is as follows Figure 4As shown in the figure: first, the base layer is split into two parts according to the channels dimension, then one part is retained and the other part is subjected to the residual network, and finally the final result of part2 is fused with part1 again. In summary, the residual features are fused twice.

[0035] The improved YOLO V4 network algorithm is as follows:

[0036] First, use the k-means++ algorithm to cluster the bounding box (regression box). The steps are as follows: ① Extract the coordinates of all bounding boxes;

[0037] ② According to the coordinate results of the four regression boxes output in step ①, calculate the width and height of the bounding box;

[0038] ③ Anchor box initialization. First, initialize an anchor box, then calculate the next anchor box, select the anchor box using the roulette method, and repeat this process until the initial values ​​of K anchor boxes are selected;

[0039] ④ Calculate the IOU value of each bounding box and each anchor box, where IOU is the intersection-over-union ratio of the predicted bounding box and the actual physical position;

[0040] ⑤ Classification operation: Through step ④, the error of each bounding box for each anchor box can be obtained, and the anchor box with the smallest error is selected and assigned to the corresponding bounding box classification;

[0041] ⑥Anchor box update: After the previous step, determine which bounding boxes belong to the anchor box, and then calculate the width and height of these bounding boxes as the new size of the anchor box.

[0042] Secondly, simplify the YOLO V4 network structure: In order to solve the problem that the traditional YOLO V4 algorithm has too much computational complexity and is difficult to use for real-time implementation, the YOLO V4 network is simplified, which greatly improves the recognition speed of table tennis while basically ensuring the recognition effect.

[0043] The improved YOLO V4 framework structure diagram is as follows Figure 4As shown, the entire network still uses the BackBone backbone network, Neck and Prediction similar to the traditional yolov4. Each part of the network has been simplified, corresponding to the simplified backbone network, FPN layer, and Prediction. The following is an explanation of the simplified structure: Figure 4 As shown in the figure, the structure diagram assumes that the input is a 416*416 image, performs two DarknetConv2D_BN_Leaky operations with a step size of 2, compresses the height and width of the image twice, obtains a feature layer, and then performs two Resblock_body operations to further compress the image. Then, perform another DarknetConv2D_BN_Leaky operation to obtain a valid feature layer, and after being processed by the backbone feature network, the 26*26 feature layer is passed to the FPN layer.

[0044] The FPN layer convolves and upsamples the 26*26 feature layer, converting the input image into a 52*52 feature layer, which is then concatenated and convolved with the 52*52 feature layer processed by the backbone network. After FPN, two effective feature layers with higher semantic information are obtained, and then two YOLO Heads are used for prediction (Prediction layer).

[0045] Step 4: Train the network model. The deep learning framework used in the present invention is TensorFlow, and the training can be divided into two steps:

[0046] ①Modify the configuration file: create a new data\voc-pingpong.names file; create a new data\voc-pingpang.data file; create a new cfg\yolov4-pingpong.cfg; patch = 16subdivisions = 8max_batches = 2000steps = 1600, 1800;

[0047] ②Training data set: Using the transfer learning algorithm, download the pre-trained weight file yolov4.conv.137 (yolov4 official comes with a trained open source weight file), the recognition accuracy and loss drop as follows Figure 5 As shown, the effect diagram of table tennis recognition is as follows Figure 6 shown.

[0048] In the present invention, the terms "install", "connect", "connect", "fix" and the like should be understood in a broad sense. For example, "connect" can be a fixed connection, a detachable connection, or an integral connection; it can be a direct connection or an indirect connection through an intermediate medium. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0049] In the description of this specification, if the terms "one embodiment", "some embodiments", "specific embodiments" and the like appear, it means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner.

[0050] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. The present invention may be subject to various changes and improvements without departing from the spirit and scope of the present invention. These changes and improvements fall within the scope of the present invention. The scope of protection claimed by the present invention is defined by the attached claims and their equivalents.

Claims

1. A table tennis detection method based on an improved YOLO V4 algorithm, characterized in that: The following steps are involved: S1. Image acquisition: using a binocular camera, the entire process of playing table tennis was recorded and collected at a frequency of 40-60 Hz, and 30-50 minutes of video data were collected; S2. Data preprocessing: Use Python program to process the video into image sequences to obtain the original data set. Use the general labeling software labelimg labeling tool to label the obtained images containing table tennis balls. After labeling, convert the PASCAL format file into a YOLO format file to complete the data set production. S3, improve the YOLO V4 network; S4, training network model; The improvements in step S3 include: A1. Extract the coordinates of all bounding boxes; A2. Calculate the width and height of the bounding box based on the coordinates of the four regression boxes output in step A1. A3. Anchor box initialization: First, initialize an anchor box, then calculate the next anchor box, select the anchor box using the roulette wheel method, and repeat this process until the initial values ​​of K anchor boxes are selected. A4. Calculate the IOU value of each bounding box and each anchor box, where IOU is the intersection-over-union ratio of the predicted bounding box and the actual physical location; A5, classification operation. Through step A4, the error of each bounding box with respect to each anchor box can be obtained. The anchor box with the smallest error is selected and assigned to the corresponding bounding box category. A6. Update the anchor box. After the previous step, determine which bounding boxes belong to the anchor box, and then find the width and height of these bounding boxes as the new size of the anchor box. The improvements in step S3 include: simplifying the YOLO V4 network structure: the entire network includes the BackBone backbone network, Neck and Prediction of yolov4, and each part of the network is simplified, corresponding to the simplified backbone network, FPN layer and Prediction respectively; The simplified YOLO V4 network structure is as follows: in the structure diagram, a 416*416 image is input, and two DarknetConv2D_BN_Leaky operations with a step size of 2 are performed to compress the height and width of the image twice to obtain a feature layer, and then two Resblock_body operations are performed to further compress the image; then another DarknetConv2D_BN_Leaky operation is performed to obtain a valid feature layer, and after being processed by the backbone feature network, the 26*26 feature layer is passed to the FPN layer; the FPN layer convolves and upsamples the 26*26 feature layer to convert the input image into a 52*52 feature layer, and then concatenates and convolves with the 52*52 feature layer processed by the backbone network; after FPN, two valid feature layers with higher semantic information are obtained, and then two YOLO Heads are used for prediction.

2. A table tennis detection method based on an improved YOLO V4 algorithm according to claim 1, characterized in that: The deep learning framework used in step S4 is TensorFlow, and the specific training steps are as follows: B1. Modify the configuration files: create data\voc-pingpong.names file, create data\voc-pingpang.data file, create cfg\yolov4-pingpong.cfg; patch=16 subdivisions=8 max_batches = 2000 steps=1600, 1800; B2. Training data set: Using the transfer learning algorithm, download the pre-trained weight file yolov4.conv.137, the recognition accuracy and loss decrease, and the effect diagram of table tennis recognition is obtained.