Method and device for judging rod falling based on classification and feature contrast
By using a method based on classification and feature contrast, using a camera to detect the coordinates and feature values of the pole, and combining the target detection model and the classification model, the problem of misjudgment and efficiency in inverted pole detection in the existing technology is solved, and efficient and accurate inverted poles are achieved. judge.
Patent Information
- Application Number
- CN202410652226.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2024-10-08
- Estimated Expiration
- 2044-05-24
AI Technical Summary
The existing inverted pole detection method is difficult to accurately determine whether the pole has fallen during the movement, and there are misjudgments and undetectable situations, which affects the detection efficiency and accuracy.
A method based on classification and feature contrast is used to detect the coordinates of the pole through the camera, obtain the feature value of the image, and determine whether there is an inverted pole phenomenon through similarity calculation. The target detection model and the classification model are combined, and the cosine similarity is used to calculate the comparison value. to determine the presence or absence of the pole.
It improves the efficiency and accuracy of inverted stick detection, can quickly and accurately judge the inverted stick situation, and significantly improves the accuracy of detection.
Smart Images

Figure CN118747858A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a method and a device for judging a pole fall based on classification and feature contrast. Background Art
[0002] Existing pole-circling events such as football, basketball, and serpentine running are essential items for the high school entrance examination, which are of great help to improve the body balance and sensitivity of middle school students. How to quickly and accurately detect whether the athlete has violated the rules by knocking down the pole during the exercise is the first goal of AI sports. The existing conventional practice is to compare the aspect ratio of the pole in the previous and next frames to determine whether the pole has fallen. When the pole falls or falls towards the camera, the pole may not be detected, resulting in an inability to determine whether it is a fallen pole or a misjudgment. Summary of the invention
[0003] The technical problem to be solved by the present invention is to provide a method and device for pole fall judgment based on classification and feature contrast, thereby improving detection efficiency and detection accuracy.
[0004] In a first aspect, the present invention provides a method for judging a pole fall based on classification and feature contrast, comprising: a camera, specifically comprising the following steps:
[0005] Step 1: Detect the pole in the image according to the target detection model, fix the detection frame of the pole in the image, obtain the coordinates of the pole in the image, crop and obtain image A, and obtain the feature value f1 of image A;
[0006] Step 2: The camera obtains the video stream and inputs each frame of the image into the classification model to determine whether there is a pole or no pole. If it is determined that there is a pole, the next frame will be judged until the detection is completed; if it is determined that there is no pole, it will proceed to step 3;
[0007] Step 3: According to the coordinates, obtain image B from the image of the frame, and then obtain the feature value f2 of image B;
[0008] Step 4: Calculate the similarity between f1 and f2 to obtain a comparison value S;
[0009] Step 5: When S is greater than the set threshold, it is determined that there is a pole; otherwise, it is determined that there is no pole; go to step 2 until the detection is completed.
[0010] In a second aspect, the present invention provides a device for judging a pole fall based on classification and feature contrast, comprising: a camera, specifically comprising the following modules:
[0011] Initialization module, detects the pole in the image according to the target detection model, fixes the detection frame of the pole in the image, obtains the coordinates of the pole in the image, and crops to obtain image A, and obtains the feature value f1 of image A;
[0012] In the initial judgment module, the camera obtains the video stream and inputs each frame of the image into the classification model to determine whether there is a pole or not. If it is judged to be a pole, the judgment of the next frame will continue until the detection is completed; if it is judged to be no pole, the module of obtaining feature values will be entered;
[0013] The feature value acquisition module acquires image B from the image of the frame according to the coordinates, and then acquires the feature value f2 of image B;
[0014] The similarity calculation module calculates the similarity between f1 and f2 to obtain a comparison value S;
[0015] Re-judgment module, when S is greater than the set threshold, it is judged that there is a pole; otherwise it is judged that there is no pole; enter the initial judgment module until the detection is completed.
[0016] One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages:
[0017] The embodiment of the present application provides a method and device for judging a pole fall based on classification and feature contrast, which can quickly judge the pole fall situation and greatly improve the accuracy.
[0018] The above description is only an overview of the technical solution of the present invention. In order to more clearly understand the technical means of the present invention, it can be implemented according to the contents of the specification. In order to make the above and other purposes, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.
[0020] Figure 1 is a flow chart of the method in Embodiment 1 of the present invention;
[0021] Figure 2 It is a schematic diagram of the structure of the device in the second embodiment of the present invention. DETAILED DESCRIPTION
[0022] Embodiment 1
[0023] like Figure 1 As shown, this embodiment provides a method for pole fall judgment based on classification and feature contrast, including: a camera, specifically including the following steps:
[0024] Step 1: Detect the pole in the image according to the target detection model, fix the detection frame of the pole in the image, obtain the coordinates of the pole in the image, and the coordinates include the upper left corner coordinate point and the lower right corner coordinate point, or the upper right corner coordinate point and the lower left corner coordinate point of the pole in the image; crop the image A from the image according to the coordinates, and obtain the feature value f1 of the image A, and the f1 feature value includes: color feature, texture feature, shape feature and spatial relationship feature of the image A; the target detection model is an existing module;
[0025] Step 2, the camera acquires the video stream, and if there is a human body in the frame, the frame is deleted; then each frame of the image is input into the classification model to determine whether it is with a pole or without a pole. If it is determined to be with a pole, the judgment of the next frame continues until the detection is completed; if it is determined to be without a pole, the process proceeds to step 3; the classification model is to prepare two types of image data, one with a pole and one without a pole, based on manual annotation, and the ResNet network is selected to learn and train the data, and finally the classification model is obtained;
[0026] Step 3: According to the coordinates, obtain image B from the image of the frame, and then obtain the feature value f2 of image B;
[0027] Step 4: perform similarity calculation on f1 and f2 to obtain a comparison value S, wherein the similarity calculation adopts cosine similarity;
[0028] Step 5: When S is greater than the set threshold, it is determined that there is a pole; otherwise, it is determined that there is no pole; go to step 2 until the detection is completed.
[0029] Based on the same inventive concept, the present application also provides a device corresponding to the method in Example 1, see Example 2 for details.
[0030] Embodiment 2
[0031] like Figure 2 As shown, in this embodiment, a device for judging a pole fall based on classification and feature contrast is provided, including: a camera, specifically including the following modules:
[0032] An initialization module detects the pole in the image according to the target detection model, fixes the detection frame of the pole in the image, obtains the coordinates of the pole in the image, and the coordinates include the upper left corner coordinate point and the lower right corner coordinate point, or the upper right corner coordinate point and the lower left corner coordinate point of the pole in the image; cuts the image A from the image according to the coordinates, and obtains the feature value f1 of the image A, and the f1 feature value includes: color features, texture features, shape features and spatial relationship features of the image A; the target detection model is an existing module;
[0033] In the initial judgment module, the camera obtains the video stream. If there is a human body in the frame, the frame is deleted; then each frame of the image is input into the classification model to determine whether it is with a pole or without a pole. If it is judged to be with a pole, the judgment of the next frame will continue until the detection is completed; if it is judged to be without a pole, the feature value acquisition module will be entered; the classification model is to prepare two types of image data with poles and without poles according to manual annotation, and the ResNet network is selected to learn and train the data to finally obtain the classification model;
[0034] The feature value acquisition module acquires image B from the image of the frame according to the coordinates, and then acquires the feature value f2 of image B;
[0035] A similarity calculation module performs similarity calculation on f1 and f2 to obtain a comparison value S, wherein the similarity calculation adopts cosine similarity;
[0036] Re-judgment module, when S is greater than the set threshold, it is judged that there is a pole; otherwise it is judged that there is no pole; enter the initial judgment module until the detection is completed.
[0037] 9. The device for judging fallen poles based on classification and feature contrast according to claim 6, characterized in that the initial judgment module is specifically:
[0038] 10. The device for judging fallen poles based on classification and feature contrast according to claim 1, characterized in that:
[0039] Since the device introduced in the second embodiment of the present invention is a device used to implement the method of the first embodiment of the present invention, those skilled in the art can understand the specific structure and deformation of the device based on the method introduced in the first embodiment of the present invention, so it is not described here in detail. All devices used in the method of the first embodiment of the present invention belong to the scope of protection of the present invention.
[0040] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.
Claims
1. A method for judging pole fall based on classification and feature contrast, characterized in that: include: The camera specifically includes the following steps: Step 1: Detect the pole in the image according to the target detection model, fix the detection frame of the pole in the image, obtain the coordinates of the pole in the image, crop and obtain image A, and obtain the feature value f1 of image A; Step 2: The camera obtains the video stream and inputs each frame of the image into the classification model to determine whether there is a pole or no pole. If it is determined that there is a pole, the next frame will be judged until the detection is completed; if it is determined that there is no pole, it will proceed to step 3; Step 3: According to the coordinates, obtain image B from the image of the frame, and then obtain the feature value f2 of image B; Step 4: Calculate the similarity between f1 and f2 to obtain a comparison value S; Step 5: When S is greater than the set threshold, it is determined that there is a pole; otherwise, it is determined that there is no pole; go to step 2 until the detection is completed.
2. The method for judging pole fall based on classification and feature contrast according to claim 1, characterized in that: The step 1 specifically includes: detecting the pole in the image according to the target detection model, fixing the detection frame of the pole in the image, obtaining the coordinates of the pole in the image, the coordinates including the upper left corner coordinate point and the lower right corner coordinate point, or the upper right corner coordinate point and the lower left corner coordinate point of the pole in the image; cropping the image A from the image according to the coordinates, and obtaining the feature value f1 of the image A.
3. A method for judging pole fall based on classification and feature contrast according to claim 1 or 2, characterized in that: The f1 feature value includes: color feature, texture feature, shape feature and spatial relationship feature of image A.
4. The method for judging pole fall based on classification and feature contrast according to claim 1, characterized in that: The step 2 is specifically as follows: the camera obtains the video stream, and if there is a human body in the frame, the frame is deleted; then each frame of the image is input into the classification model to determine whether there is a pole or no pole. If it is determined that there is a pole, the judgment of the next frame continues until the detection is completed; if it is determined that there is no pole, step 3 is entered; the classification model is prepared according to manual labeling of two types of image data, one with poles and one without poles, and the ResNet network is selected to learn and train the data to finally obtain the classification model.
5. The method for judging pole fall based on classification and feature contrast according to claim 1, characterized in that: The similarity calculation adopts cosine similarity.
6. A device for judging pole fall based on classification and feature contrast, characterized in that: include: The camera includes the following modules: Initialization module, detects the pole in the image according to the target detection model, fixes the detection frame of the pole in the image, obtains the coordinates of the pole in the image, and crops to obtain image A, and obtains the feature value f1 of image A; In the initial judgment module, the camera obtains the video stream and inputs each frame of the image into the classification model to determine whether there is a pole or not. If it is judged to be a pole, the judgment of the next frame will continue until the detection is completed; if it is judged to be no pole, the module of obtaining feature values will be entered; The feature value acquisition module acquires the image B from the image of the frame according to the coordinates, and then acquires the feature value f2 of the image B; The similarity calculation module calculates the similarity between f1 and f2 to obtain a comparison value S; Re-judgment module, when S is greater than the set threshold, it is judged that there is a pole; otherwise it is judged that there is no pole; enter the initial judgment module until the detection is completed.
7. The device for judging pole fall based on classification and feature contrast according to claim 6, characterized in that: The initialization module specifically includes: detecting the pole in the image according to the target detection model, fixing the detection frame of the pole in the image, obtaining the coordinates of the pole in the image, which include the upper left corner coordinate point and the lower right corner coordinate point, or the upper right corner coordinate point and the lower left corner coordinate point of the pole in the image; cropping the image A from the image according to the coordinates, and obtaining the feature value f1 of the image A.
8. The device for judging fallen poles based on classification and feature contrast according to claim 6 or 7, characterized in that: The f1 feature value includes: color feature, texture feature, shape feature and spatial relationship feature of image A.
9. The device for judging pole fall based on classification and feature contrast according to claim 6, characterized in that: The initial judgment module is specifically as follows: the camera obtains the video stream, and if there is a human body in the frame, the frame is deleted; then each frame of the image is input into the classification model to determine whether there is a pole or not. If it is judged to be with a pole, the judgment of the next frame will continue until the detection is completed; if it is judged to be without a pole, the feature value acquisition module is entered; the classification model prepares two types of image data with poles and without poles based on manual annotation, selects the ResNet network to learn and train the data, and finally obtains the classification model.
10. The device for judging pole fall based on classification and feature contrast according to claim 1, characterized in that: The similarity calculation adopts cosine similarity.
Citation Information
Patent Citations
Image based method for identifying railway overhead-contact system bolt support identifying information
CN102902974A
The invention discloses a lLarge-scale distribution line disaster first-aid repair image recognition method based on deep learning
CN109614969A
Game plug-in detection method and device, computer and readable storage medium
CN111298446A
Garbage visual identification method and device based on deep learning and classification recovery device
CN111498331A
Coal mine drill rod counting method based on target detection and computer readable medium
CN114821453A
