Filter stick target identification method and system based on YOLOv8

By adopting the YOLOv8-based object detection model and an improved NMS algorithm in the filter rod object detection, the problem of low accuracy and time-consuming filter rod detection in the prior art is solved, and high accuracy and high efficiency filter rod detection is achieved.

CN119649010APending Publication Date: 2025-03-18CHINA TOBACCO GUANGDONG IND
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411861134.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The existing filter rod object detection methods have problems such as low detection accuracy, poor real-time performance, and insufficient generalization ability when positioning and tracking the filter rod.

Method used

The object detection model based on YOLOv8 is adopted, combined with the NMS algorithm improved based on the neighborhood search algorithm, the filter rod image is inference prediction and filtered, and the coordinate value of the filter rod is output.

Benefits of technology

Improves the accuracy of filter rod detection, reduces time-consuming and improves production efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119649010A_ABST
    Figure CN119649010A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of image recognition, and discloses a YOLOv8-based filter stick target recognition method, which comprises the following steps: S1, constructing a YOLOv8-based target detection model; s2, obtaining a to-be-recognized filter stick image; s3, performing reasoning prediction on the filter stick image obtained in the step S2 by using the target detection model obtained in the step S1 to obtain coordinates of all points on the filter stick image and corresponding confidence scores; and S4, according to the coordinates of each point on the filter stick image and the corresponding confidence score, performing screening processing by using an NMS algorithm improved based on a neighborhood search algorithm, and outputting the coordinate value of the filter stick. According to the recognition method, the accuracy of filter stick detection is improved, time consumption is reduced, and the production efficiency is improved. The invention also provides an identification system for realizing the method.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of image recognition, and in particular to a filter rod target recognition method and system based on YOLOv8. Background Art

[0002] In the tobacco production process, the quality control of filter rods is crucial. Traditional filter rod target detection methods rely on manual inspection, which is not only inefficient but also prone to missed detection and false detection. In recent years, with the development of computer vision technology, target detection technology has provided new solutions for automated detection. However, existing methods still have some shortcomings when dealing with filter rod positioning and tracking in specific industrial scenarios, such as low detection accuracy, poor real-time performance, and insufficient generalization ability.

[0003] In terms of filter rod target recognition, deep learning-related methods include a circular object recognition and counting detection algorithm that combines machine vision and deep learning, and a cigarette filter rod counting method based on AA R2Unet and HMM, with an algorithm accuracy of about 98.7%. However, there is less work on filter rod recognition using yolov8. In the nms after filter rod recognition, the traditional nms uses frame-by-frame comparison, with a time complexity of O(n 2 ), which is slightly time-consuming. Summary of the invention

[0004] The object of the present invention is to provide a filter rod target recognition method and system based on YOLOv8 with high accuracy and low time consumption.

[0005] In order to achieve the above object, the present invention provides a filter rod target recognition method based on YOLOv8, comprising the following steps:

[0006] S1: Build a target detection model based on YOLOv8;

[0007] S2: Acquire the filter rod image to be identified;

[0008] S3: using the target detection model obtained in step S1 to perform inference prediction on the filter stick image obtained in step S2, and obtain the coordinates of each point on the filter stick image and the corresponding confidence score;

[0009] S4: According to the coordinates of each point on the filter rod image and the corresponding confidence score, the NMS algorithm improved based on the neighborhood search algorithm is used for screening and processing, and the coordinate value of the filter rod is output.

[0010] As a preferred solution, step S1 includes:

[0011] S101: Collect a large number of filter rod images, perform data annotation and data preprocessing, and convert them into YOLO format to generate a data set;

[0012] S102: Select the YOLOv8 framework, perform training, verification and testing through the data set, and generate a target detection model.

[0013] As a preferred solution, in step S101, a 48MP pixel camera is used to collect 25 photos of filter rods in the filter rod library of the cigarette making machine; the LabelMe tool is used to annotate the images and mark the filter rods; data preprocessing includes eliminating incorrectly labeled and invalidly labeled filter rod data, randomly expanding the filter rod images up, down, left, and right, unifying the size to 128px*128px, and performing data cleaning and data enhancement operations.

[0014] As a preferred solution, in step S102, yolov8x of the YOLOv8 framework is selected as the target detection model; the batch size is set to 2048; and the A100 GPU is used for training.

[0015] As a preferred solution, step S2 includes:

[0016] S201: Obtain the video in the filter rod box or filter rod library, and split it into each frame image;

[0017] S202: Preprocess the image to obtain the filter rod image to be identified.

[0018] As a preferred solution, in step S2, the video is composed of a series of frames. Given a definition V as a video, which is a collection of n images I, then

[0019] In step S3, after the target detection model inference prediction, for each frame image I k You can get a list of triplets, where w and h are image I and k Width and height

[0020]

[0021] Based on set A, construct a set P, set S, and mapping f as follows

[0022]

[0023] f k :P k →S k f k (x i ,y i )=s i

[0024] And define a matrix

[0025] Where x is the horizontal coordinate in the image, y is the vertical coordinate in the image, and s is the confidence score;

[0026] In step S4, for the set P k All the points in the circle generate the corresponding grid point set C k,i ,have

[0027]

[0028] For all (x i ,y i )∈P k ,have And define all (x * ,y * ) is the set Q k ; then Q * = {Q1,Q2,…,Q k ,…,Q m}, set Q * For the set P * = {P1,P2,…,P k ,…,P m} after NMS operation, there are

[0029] g:P k →Q k g(P i )=Q i

[0030] The mapping g is the NMS algorithm improved based on the neighborhood search algorithm.

[0031] As a preferred solution, step S4 includes:

[0032] S401: Generate an empty list L4;

[0033] S402: Traverse each frame image I k , get each frame image I k A triple list of k , this list is the coordinates predicted by step S3 and is also the set of all coordinate values ​​to be operated. The triple list A k Contains each coordinate (x i ,y i ) and its corresponding confidence score s i , where the list P k Represents a list of coordinates, using list S k Indicates the confidence score corresponding to each coordinate;

[0034] S403: Generate a coordinate table L1, where the coordinates (x, y) in the table satisfy x 2+y 2 ≤r, where r <x<h-r,r<y<w-r, r is set manually;

[0035] S404: Generate a two-dimensional all-zero matrix M with a width and height equal to the width w and height h of the image;

[0036] S405: Check list P k Traverse and use the traversed coordinate point C ki (x ki ,y ki ) and its corresponding confidence score s ki , let the coordinates of matrix M be C ki The value of s ki ;

[0037] S406: Check list P again k Traverse and traverse the coordinate point C ki (x ki ,y ki );

[0038] S407: Each time a coordinate point C is traversed ki , perform a traversal of list L1, and traverse all coordinate points D of table L1 ki , plus the coordinate point C ki Then we get list L2; assuming that the coordinate point C ki =(x ki ,y ki ), and the coordinate points traversed from table L1 are

[0039] L1={(x′ k1 ,y′ k2 ),(x′ k1 ,y′ k2 ),…,(x′ kn ,y′ kn )},

[0040] After adding, we get:

[0041] L2={(x ki +x′ k1 ,y ki +y′ k2 ),(x ki +x′ k1 ,y ki +y′ k2 ),…,(x ki +x′ kn ,y ki +y′ kn )};

[0042] S408: Generate an empty list L3 first; traverse L2 to obtain the coordinate point D ki , to find the coordinate point D in matrix M ki If the value is positive, add the coordinate to list L3;

[0043] S409: Traverse the L3 list and retrieve the coordinate value with the largest confidence score The coordinate point E ki Add to list L4; add all the coordinate values ​​D corresponding to the matrix M in the list L3 ki The value of is assigned to 0;

[0044] S410: After traversing L1, the generated L4 is used as the output, and the generated L4 is used as the coordinate value of the filter rod of the image Ik.

[0045] As a preferred solution, in step 406, the coordinates on the image to be identified that exceed the range of the filter box are removed according to the range of the filter box, including: drawing a segmentation line according to the range of the filter box, determining the horizontal coordinate and the vertical coordinate of the segmentation line, and listing the P k The coordinates whose horizontal or vertical coordinates are greater than the dividing line are eliminated.

[0046] As a preferred solution, in step S406, the coordinates on the image to be identified that deviate too much from the filter rod color are eliminated based on color, including: obtaining the filter rod color, defining a color range, reading the image data and comparing the filter rod color using the color range near the coordinate point, and those with too large deviations can be eliminated.

[0047] The present invention also provides a filter rod target recognition system based on YOLOv8, comprising:

[0048] Model building module, used to build a YOLOv8-based object detection model;

[0049] An image acquisition module, used for acquiring the filter rod image to be identified;

[0050] An inference prediction module is used to use the target detection model obtained by the model building module to perform inference prediction on the filter stick image obtained by the image acquisition module to obtain the coordinates of each point on the filter stick image and the corresponding confidence score;

[0051] The screening module is used to perform screening processing according to the coordinates of each point on the filter rod image and the corresponding confidence score using the NMS algorithm improved based on the neighborhood search algorithm, and output the coordinate value of the filter rod.

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

[0053] The present invention uses the YOLOv8-based target detection model to infer the coordinates of each point on the image and the corresponding confidence score, and then uses the NMS algorithm improved by the neighborhood search algorithm to remove overlapping bounding boxes, thereby improving the accuracy of filter rod detection, reducing time consumption, and improving production efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 It is a flow chart of a filter rod target recognition method based on YOLOv8 in an embodiment of the present invention.

[0055] Figure 2 It is a schematic diagram of removing coordinates according to the filter rod box range and color in step S406 of an embodiment of the present invention.

[0056] Figure 3 3 is a recognition result diagram of the filter rod target recognition method based on YOLOv8 in an embodiment of the present invention.

[0057] Figure 4 It is a principle block diagram of a filter rod target recognition system based on YOLOv8 in an embodiment of the present invention. DETAILED DESCRIPTION

[0058] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.

[0059] Embodiment 1

[0060] like Figure 1 As shown, a filter rod target recognition method based on YOLOv8 in a preferred embodiment of the present invention comprises the following steps:

[0061] S1: Build a target detection model based on YOLOv8;

[0062] S2: Acquire the filter rod image to be identified;

[0063] S3: using the target detection model obtained in step S1 to perform inference prediction on the filter stick image obtained in step S2, and obtain the coordinates of each point on the filter stick image and the corresponding confidence score;

[0064] S4: According to the coordinates of each point on the filter rod image and the corresponding confidence score, the NMS algorithm improved based on the neighborhood search algorithm is used for screening and processing, and the coordinate value of the filter rod is output.

[0065] This embodiment uses the YOLOv8-based target detection model to infer the coordinates of each point on the image and the corresponding confidence score, and then uses the NMS algorithm improved by the neighborhood search algorithm to remove overlapping bounding boxes, thereby improving the accuracy of filter rod detection, reducing time consumption, and improving production efficiency.

[0066] Specifically, step S1 includes:

[0067] S101: Collect a large number of filter rod images, perform data annotation and data preprocessing, and convert them into YOLO format to generate a data set; this embodiment collects filter rod images from a filter rod production line, and the data set contains 93,107 high-quality images of ordinary filter rods.

[0068] In step S101, a 48MP pixel camera is used to collect 25 photos of filter rods in the filter rod library of the cigarette making machine; the LabelMe tool is used to annotate the images and mark the filter rods; data preprocessing includes removing the wrongly labeled and invalidly labeled filter rod data, randomly expanding the filter rod images up and down, left and right, unifying the size to 128px*128px, and performing data cleaning and data enhancement operations.

[0069] S102: Select the YOLOv8 framework, train, verify and test the data set to generate a target detection model. In step S102, select yolov8x of the YOLOv8 framework as the target detection model; set the batch size to 2048; and use the A100 GPU for training.

[0070] In addition, step S2 includes:

[0071] S201: Obtain the video in the filter rod box or filter rod library, and split it into each frame image;

[0072] S202: Preprocess the image to obtain the filter rod image to be identified.

[0073] This embodiment is to identify the filter rods in the production video, specifically, to identify the filter rods for each frame of the video.

[0074] Embodiment 2

[0075] The difference between this embodiment and the first embodiment is that, based on the first embodiment, this embodiment further explains step S4.

[0076] In step S2, the video is composed of a series of frames. Given the definition V as a video, which is a collection of n images I, then

[0077] In step S3, after the target detection model inference prediction, for each frame image I k You can get a list of triplets, where w and h are image I and k Width and height

[0078]

[0079] Based on set A, construct a set P, set S, and mapping f as follows

[0080]

[0081] f k :P k →S k f k (x i ,y i )=s i

[0082] And define a matrix

[0083] Where x is the horizontal coordinate in the image, y is the vertical coordinate in the image, and s is the confidence score;

[0084] In step S4, for the set P k All the points in the circle generate the corresponding grid point set C k,i ,have

[0085]

[0086] For all (x i ,y i )∈P k ,have And define all (x * ,y * ) is the set Q k Then Q * = {Q1,Q2,…,Q k ,…,Q m}, set Q * For the set P * = {P1,P2,…,P k ,…,P m} after NMS operation, there are

[0087] g:P k →Q k g(P i )=Q i

[0088] The mapping g is the NMS algorithm improved based on the neighborhood search algorithm.

[0089] Specifically, step S4 includes:

[0090] S401: Generate an empty list L4;

[0091] S402: Traverse each frame image I k , get each frame image Ik A triple list of k , this list is the coordinates predicted by step S3 and is also the set of all coordinate values ​​to be operated. The triple list A k Contains each coordinate (x i ,y i ) and its corresponding confidence score s i , where the list P k Represents a list of coordinates, using list S k Indicates the confidence score corresponding to each coordinate;

[0092] S403: Generate a coordinate table L1, where the coordinates (x, y) in the table satisfy x 2 +y 2 ≤r, where r <x<h-r,r<y<w-r, r is set manually; r is the cross-sectional radius of the filter rod. The filter rod is a cylinder with a circular cross section. r is set based on measurement, experience, standards, etc.

[0093] S404: Generate a two-dimensional all-zero matrix M with a width and height equal to the width w and height h of the image;

[0094] S405: Check list P k Traverse and use the traversed coordinate point C ki (x ki ,y ki ) and its corresponding confidence score s ki , let the coordinates of matrix M be C ki The value of s ki ;

[0095] S406: Check list P again k Traverse and traverse the coordinate point C ki (x ki ,y ki );

[0096] S407: Each time a coordinate point C is traversed ki , perform a traversal of list L1, and traverse all coordinate points D of table L1 ki , plus the coordinate point C ki Then we get list L2. Assume that the coordinate point C ki =(x ki ,y ki ), and the coordinate points traversed from table L1 are

[0097] L1={(x′ k1 ,y′ k2 ),(x′ k1 ,y′ k2 ),…,(x′ kn,y′ kn )},

[0098] After adding, we get:

[0099] L2={(x ki +x′ k1 ,y ki +y′ k2 ),(x ki +x′ k1 ,y ki +y′ k2 ),…,(x ki +x′ kn ,y ki +y′ kn )};

[0100] The coordinate table L1 of step S403 is used as the base file of step S407. When a coordinate point C is selected in step S406, ki (x ki ,y ki ), with coordinate point C ki (x ki ,y ki ) is the center of the circle, r is the radius, a bounding box is generated, and all coordinate points within the bounding box are obtained to form a list L2;

[0101] S408: Generate an empty list L3 first; traverse L2 to obtain the coordinate point D ki , to find the coordinate point D in matrix M ki The value of (the confidence score assigned in step S405) is added to the list L3 if the value is positive.

[0102] S409: Traverse the L3 list and retrieve the coordinate value with the largest confidence score The coordinate point E ki Add to list L4; add all the coordinate values ​​D corresponding to the matrix M in the list L3 ki The value of is assigned to 0;

[0103] S410: After traversing L1, the generated L4 is used as the output, and the generated L4 is used as the coordinate value of the filter rod of the image Ik.

[0104] The above x is the horizontal coordinate of the midpoint of the image, and y is the vertical coordinate of the midpoint of the image, and different subscripts are given after being screened out in each step.

[0105] Non-Maximum Suppression (NMS) is a technique for removing redundant bounding boxes. When an object is surrounded by multiple overlapping prediction boxes, NMS can help select the best box, thereby improving the quality of the detection results. The traditional NMS technique compares the prediction boxes pairwise using the IoU (Intersection over Union), with a time complexity of O(n 2 ), when the number of coordinate points is large, it will take a long time.

[0106] In this embodiment, the time required for the table lookup process is first analyzed, where the number of integer coordinate points within a circle of a given radius r is N(r), which is proportional to the area of ​​the circle πr. 2 The relationship is N(r)=E(r)+πr 2 , where E(r) is the error term, and there is no exact solution yet. The best solution is that Mr. Chen Jingrun has proved a lower bound of E(r) Where ε is any constant greater than 0. The time complexity of traversing the coordinate point list P1 is O(n), so the time complexity of this algorithm is O(N(r)*n). In this practice, the maximum value of r is generally set to no more than 20, and the corresponding N(r) value is 1257, while n is basically more than three or four thousand in each frame. Even in the case of thin cigarette filters, the corresponding n value is close to tens of thousands, but the r value is lower, avoiding excessive computing time. Therefore, the modified algorithm greatly speeds up the speed of nms.

[0107] Tested on a computer with AMD Ryren7 3700X CPU and 16G memory, for an image containing 17910 frames, the traditional NMS algorithm takes about 15 seconds per frame on average, and the total time consumption is about 3.1 days. The improved NMS algorithm takes about 0.5 seconds per frame on average, and the total time consumption is about 2.5 hours. The speed is increased by nearly 30 times.

[0108] Therefore, this embodiment utilizes the uniform appearance of the filter rod, that is, the cross-sectional radius of the filter rod, and uses a neighborhood search algorithm combined with a list of grid points within the circle to compress the time complexity to O(n), greatly reducing time consumption and improving efficiency.

[0109] The other steps of this embodiment are the same as those of the first embodiment and will not be described again here.

[0110] Embodiment 3

[0111] The difference between this embodiment and the second embodiment is that, based on the third embodiment, this embodiment further illustrates step S406.

[0112] In step 406, the coordinates of the image to be identified that are beyond the range of the filter box are removed according to the range of the filter box, including: drawing a segmentation line according to the range of the filter box, determining the horizontal coordinate and the vertical coordinate of the segmentation line, and listing the P k The coordinates whose horizontal or vertical coordinates are greater than the dividing line are removed, such as Figure 2 In order to prevent the recognition of the parts outside the filter rod box and the filter rod box, the present embodiment will draw a dividing line, frame the range where the filter rod is located, and remove the coordinates beyond the range, which is conducive to improving efficiency and accuracy.

[0113] In addition, in step S406, the coordinates on the image to be identified that deviate too much from the color of the filter rod are eliminated based on color, including: obtaining the color of the filter rod, defining a color range, reading the image data and using the color range near the coordinate point to compare the color of the filter rod, and those with too large deviations can be eliminated. Because the base color of the filter rod is basically white, and the paper box is dark brown, the coordinate points can be eliminated based on color, so that the number of coordinate points traversed in subsequent steps is small, further improving efficiency. The target detection model based on YOLOv8 is used to infer and predict the image to be identified to obtain the coordinates and confidence scores of each point, and at the same time read the image data to obtain the color of each coordinate point, set the range according to the color of the filter rod, and in step S406, the list P is compared. k During the traversal stage, those with excessive color deviation will be removed.

[0114] like Figure 3 As shown in the figure, sum refers to the total number of recognitions, TP (True Positives) refers to the number of correct recognitions, FP (False Positives) refers to the number of incorrect recognitions, FN (False Negatives) refers to the number of correct but unrecognized, precision refers to the accuracy of recognition, and recall refers to the correct recall rate. Figure 3 It can be seen that the method of this embodiment has a high recognition accuracy.

[0115] The other steps of this embodiment are the same as those of the second embodiment and will not be described again here.

[0116] Embodiment 4

[0117] like Figure 4 As shown, an embodiment of the present invention provides a filter rod target recognition system based on YOLOv8, including:

[0118] Model building module, used to build a YOLOv8-based object detection model;

[0119] An image acquisition module, used for acquiring the filter rod image to be identified;

[0120] An inference prediction module is used to use the target detection model obtained by the model building module to perform inference prediction on the filter stick image obtained by the image acquisition module to obtain the coordinates of each point on the filter stick image and the corresponding confidence score;

[0121] The screening module is used to perform screening processing according to the coordinates of each point on the filter rod image and the corresponding confidence score using the NMS algorithm improved based on the neighborhood search algorithm, and output the coordinate value of the filter rod.

[0122] In summary, the embodiment of the present invention provides a filter stick target recognition method based on YOLOv8, which uses the YOLOv8-based target detection model to infer the coordinates of each point on the image and the corresponding confidence score, and then uses the NMS algorithm improved by the neighborhood search algorithm to remove overlapping bounding boxes, thereby improving the accuracy of filter stick detection, reducing time consumption, and improving production efficiency. The embodiment of the present invention also provides a recognition system for implementing the above method.

[0123] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and substitutions can be made without departing from the technical principles of the present invention. These improvements and substitutions should also be regarded as the scope of protection of the present invention.

Claims

1. A filter rod target recognition method based on YOLOv8, characterized in that: The steps include: S1: Build a target detection model based on YOLOv8; S2: Acquire the filter rod image to be identified; S3: using the target detection model obtained in step S1 to perform inference prediction on the filter stick image obtained in step S2, and obtain the coordinates of each point on the filter stick image and the corresponding confidence score; S4: According to the coordinates of each point on the filter rod image and the corresponding confidence score, the NMS algorithm improved based on the neighborhood search algorithm is used for screening and processing, and the coordinate value of the filter rod is output.

2. The filter rod target recognition method based on YOLOv8 according to claim 1, characterized in that: Step S1 includes: S101: Collect a large number of filter rod images, perform data annotation and data preprocessing, and convert them into YOLO format to generate a data set; S102: Select the YOLOv8 framework, perform training, verification and testing through the data set, and generate a target detection model.

3. The filter rod target recognition method based on YOLOv8 according to claim 2, characterized in that: In step S101, a 48MP pixel camera is used to collect 25 photos of filter rods in the filter rod library of the cigarette making machine; the LabelMe tool is used to annotate the images and mark the filter rods; data preprocessing includes removing the wrongly labeled and invalidly labeled filter rod data, randomly expanding the filter rod images up and down, left and right, unifying the size to 128px*128px, and performing data cleaning and data enhancement operations.

4. The filter rod target recognition method based on YOLOv8 according to claim 2, characterized in that: In step S102, yolov8x of the YOLOv8 framework is selected as the target detection model; the batch size is set to 2048; and the A100 GPU is used for training.

5. The filter rod target recognition method based on YOLOv8 according to claim 1, characterized in that: Step S2 includes: S201: Obtain the video in the filter rod box or filter rod library, and split it into each frame image; S202: Preprocess the image to obtain the filter rod image to be identified.

6. The filter rod target recognition method based on YOLOv8 according to claim 4, characterized in that: In step S2, the video is composed of a series of frames. Given the definition V as a video, which is a collection of n images I, then In step S3, after the target detection model inference prediction, for each frame image I k You can get a list of triplets, where w and h are image I and k Width and height Based on set A, construct a set P, set S, and mapping f as follows f k :P k →S k f k (x i ,y i )=s i And define a matrix M k Where x is the horizontal coordinate in the image, y is the vertical coordinate in the image, and s is the confidence score; In step S4, for the set P k All the points in the circle generate the corresponding grid point set C k,i ,have For all (x i ,y i )∈P k ,have And define all (x * ,y * ) is the set Q k ; then Q * = {Q1,Q2,…,Q k ,…,Q m }, set Q * For the set P * = {P1,P2,…,P k ,…,P m } after NMS operation, there are g:P k →Q k g(P i )=Q i The mapping g is the NMS algorithm improved based on the neighborhood search algorithm.

7. The filter rod target recognition method based on YOLOv8 according to claim 6, characterized in that: Step S4 includes: S401: Generate an empty list L4; S402: Traverse each frame image I k , get each frame image I k A triple list of k , this list is the coordinates predicted by step S3 and is also the set of all coordinate values ​​to be operated. The triple list A k Contains each coordinate (x i ,y i ) and its corresponding confidence score s i , where the list P k Represents a list of coordinates, using list S k Indicates the confidence score corresponding to each coordinate; S403: Generate a coordinate table L1, where the coordinates (x, y) in the table satisfy x 2 +y 2 ≤r, where r is set manually; S404: Generate a two-dimensional all-zero matrix M with a width and height equal to the width w and height h of the image; S405: Check list P k Traverse and use the traversed coordinate point C ki (x ki ,y ki ) and its corresponding confidence score s ki , let the coordinates of matrix M be C ki The value of s ki ; S406: Check list P again k Traverse and traverse the coordinate point C ki (x ki ,y ki ); S407: Each time a coordinate point C is traversed ki , perform a traversal of list L1, and traverse all coordinate points D of table L1 ki , plus the coordinate point C ki Then we get list L2; assuming that the coordinate point C ki =(x ki ,y ki ), and the coordinate points traversed from table L1 are L1={(x′ k1 ,and' k2 ),(x′ k1 ,and' k2 ),…,(x′ kn ,and' kn )}, After adding, we get: L2={(x ki +x′ k1 ,and ki +y′ k2 ),(x ki +x′ k1 ,and ki +y′ k2 ),…,(x ki +x′ kn ,and ki +y′ kn )}; S408: Generate an empty list L3 first; traverse L2 to obtain the coordinate point D ki , to find the coordinate point D in matrix M ki If the value is positive, add the coordinate to list L3; S409: Traverse the L3 list and retrieve the coordinate value with the largest confidence score The coordinate point E ki Add to list L4; add all the coordinate values ​​D corresponding to the matrix M in the list L3 ki The value of is assigned to 0; S410: After traversing L1, the generated L4 is used as the output, and the generated L4 is used as the coordinate value of the filter rod of the image Ik.

8. The filter rod target recognition method based on YOLOv8 according to claim 5, characterized in that: In step 406, the coordinates of the image to be identified that are beyond the range of the filter box are removed according to the range of the filter box, including: drawing a segmentation line according to the range of the filter box, determining the horizontal coordinate and the vertical coordinate of the segmentation line, and listing the P k The coordinates whose horizontal or vertical coordinates are greater than the dividing line are eliminated.

9. The filter rod target recognition method based on YOLOv8 according to claim 5, characterized in that: In step S406, the coordinates on the image to be identified that deviate too much from the filter rod color are eliminated based on color, including: obtaining the filter rod color, defining a color range, reading the image data and comparing the filter rod color using the color range near the coordinate point, and those with too much deviation can be eliminated.

10. A filter rod target recognition system based on YOLOv8, characterized in that: include: Model building module, used to build a YOLOv8-based object detection model; An image acquisition module, used for acquiring the filter rod image to be identified; An inference prediction module is used to use the target detection model obtained by the model building module to perform inference prediction on the filter stick image obtained by the image acquisition module to obtain the coordinates of each point on the filter stick image and the corresponding confidence score; The screening module is used to perform screening processing according to the coordinates of each point on the filter rod image and the corresponding confidence score using the NMS algorithm improved based on the neighborhood search algorithm, and output the coordinate value of the filter rod.