A method and apparatus for determining the inverted bar based on classification and feature contrast.
By using a classification and feature contrast-based method, and leveraging a camera and a ResNet network to determine the fall of a pole, this method solves the problem of inaccurate detection in existing technologies and achieves efficient and accurate pole fall detection.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-24
- Publication Date
- 2026-03-10
AI Technical Summary
Existing technologies struggle to quickly and accurately detect whether athletes are committing violations by knocking down poles during pole maneuvers, especially when the poles are falling or heading towards the camera, which can easily lead to undetected or misjudged actions.
A classification and feature contrast-based approach is adopted. The coordinates of the pole are detected by a camera and the image is cropped. A classification model trained by a ResNet network is used to determine whether there is a pole or not. The similarity of image feature values is calculated to determine whether the pole is overturned.
It improves the detection efficiency and accuracy of pole fall judgment, and can quickly and accurately identify pole fall situations.
Smart Images

Figure CN118747858B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application relates to a method and device for judging a fallen pole based on classification and feature contrast. BACKGROUND
[0002] Existing pole-winding projects such as football pole-winding, basketball pole-winding and snake-shaped running are compulsory projects in the middle school entrance examination, and are very helpful for improving the body balance ability and sensitivity of middle school students, and how to quickly and accurately detect whether the athlete has the violation behavior of knocking down the pole in the movement process is the first goal of AI sports; the existing conventional method is: the height-width ratio of the pole in the front and rear frames is compared to judge whether the pole has the phenomenon of falling down; when the pole falls down or falls down towards the camera direction, the pole cannot be detected, so that it is impossible to judge whether it is a fallen pole or misjudgment. SUMMARY
[0003] The technical problem to be solved by the application is to provide a method and device for judging a fallen pole based on classification and feature contrast, which improves the detection efficiency and detection accuracy.
[0004] In a first aspect, the application provides a method for judging a fallen pole based on classification and feature contrast, comprising a camera, specifically comprising the following steps:
[0005] Step 1: detecting the pole in the image according to a target detection model, fixing the detection frame of the pole in the image, obtaining the coordinates of the pole in the image, and cutting and obtaining image A to obtain the feature value f1 of image A;
[0006] Step 2: the camera obtains a video stream, each frame of image is input into a classification model to judge whether there is a pole or not, if it is judged that there is a pole, the next frame of judgment is continued until the detection is completed; if it is judged that there is no pole, step 3 is entered;
[0007] Step 3: according to the coordinates, image B is obtained from the image of the frame, and then the feature value f2 of image B is obtained;
[0008] Step 4: similarity calculation is performed on f1 and f2 to obtain a comparison value S;
[0009] Step 5: when S is greater than a set threshold value, it is judged that there is a pole; otherwise, it is judged that there is no pole; step 2 is entered until the detection is completed.
[0010] In a second aspect, the application provides a device for judging a fallen pole based on classification and feature contrast, comprising a camera, specifically comprising the following modules:
[0011] The initialization module detects the poles in the image based on the target detection model, fixes the detection box of the poles in the image, obtains the coordinates of the poles in the image, and crops the image A to obtain the feature value f1 of image A.
[0012] In the initial judgment module, the camera acquires the video stream, and each frame of the image is input into the classification model to determine whether it belongs to a pole or not. If it is determined to be a pole, the judgment of the next frame continues until the detection is completed; if it is determined to be a pole, the module for obtaining feature values is entered.
[0013] The feature value acquisition module acquires image B from the image of the frame based on the coordinates, and then acquires the feature value f2 of image B;
[0014] The similarity calculation module calculates the similarity between f1 and f2 and obtains the comparison value S.
[0015] The re-judgment module determines that a pole exists if S is greater than the set threshold; otherwise, it determines that there is no pole. It then enters the initial judgment module and continues until the detection is complete.
[0016] One or more technical solutions provided in the embodiments of the present invention have at least the following technical effects or advantages:
[0017] This application provides a method and apparatus for judging a fallen pole based on classification and feature contrast, which can quickly judge the situation of a fallen pole and greatly improve the accuracy.
[0018] The above description is merely an overview of the technical solution of the present invention. In order to better understand the technical means of the present invention and to implement it in accordance with the contents of the specification, and in order to make the above and other objects, features and advantages of the present invention more apparent and understandable, specific embodiments of the present invention are described below. Attached Figure Description
[0019] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0020] Figure 1 This is a flowchart of the method in Embodiment 1 of the present invention;
[0021] Figure 2 This is a schematic diagram of the device in Embodiment 2 of the present invention. Detailed Implementation
[0022] Example 1
[0023] like Figure 1 As shown, this embodiment provides a method for determining a fallen lever based on classification and feature contrast, including: a camera, and specifically including the following steps:
[0024] Step 1: Detect the pole in the image using the target detection model, fix the detection box of the pole in the image, and obtain the coordinates of the pole in the image. These coordinates include the coordinates of the upper left and lower right corners of the pole in the image, or the coordinates of the upper right and lower left corners. Based on the coordinates, crop image A from the image and obtain the feature value f1 of image A. The f1 feature value includes: color features, texture features, shape features, and spatial relationship features of image A. This target detection model is an existing module.
[0025] Step 2: The camera acquires the video stream. If a human body is present in the frame, the frame is deleted. Then, each frame is input into the classification model to determine whether it has a pole or not. If it is determined to have a pole, the next frame is processed until all frames are detected. If it is determined to be without a pole, proceed to Step 3. The classification model is prepared based on manually labeled image data of two categories: images with poles and images without poles. A ResNet network is used to learn and train the data to obtain the final classification model.
[0026] Step 3: Based on the coordinates, obtain image B from the image of this frame, and then obtain the feature value f2 of image B;
[0027] Step 4: Calculate the similarity between f1 and f2 to obtain the comparison value S. The similarity calculation uses cosine similarity.
[0028] Step 5: When S is greater than the set threshold, it is determined that there is a rod; otherwise, it is determined that there is no rod; proceed to step 2 until the detection is completed.
[0029] Based on the same inventive concept, this application also provides an apparatus corresponding to the method in Embodiment 1, as detailed in Embodiment 2.
[0030] Example 2
[0031] like Figure 2 As shown, this embodiment provides a device for judging the inverted lever based on classification and feature contrast, including: a camera, specifically including the following modules:
[0032] The initialization module detects poles in the image using a target detection model, fixes the detection box for the poles in the image, and obtains the coordinates of the poles in the image. These coordinates include the coordinates of the top-left and bottom-right corners of the poles, or the top-right and bottom-left corners. Based on these coordinates, image A is cropped from the image, and the feature value f1 of image A is obtained. The f1 feature value includes the color features, texture features, shape features, and spatial relationship features of image A. The target detection model is an existing module.
[0033] In the initial judgment module, the camera acquires the video stream. If a human body is present in the frame, the frame is deleted. Then, each frame is input into the classification model to determine whether it has a pole or not. If it is determined to have a pole, the judgment of the next frame continues until the detection is completed. If it is determined to be without a pole, the module for obtaining feature values is entered. The classification model is prepared based on manually labeled image data of two categories: images with poles and images without poles. A ResNet network is used to learn and train the data to obtain the final classification model.
[0034] The feature value acquisition module acquires image B from the image of the frame based on the coordinates, and then acquires the feature value f2 of image B;
[0035] The similarity calculation module performs similarity calculation on f1 and f2 to obtain a comparison value S. The similarity calculation uses cosine similarity.
[0036] The re-judgment module determines that a pole exists if S is greater than the set threshold; otherwise, it determines that there is no pole. It then enters the initial judgment module and continues until the detection is complete.
[0037] Since the apparatus described in Embodiment 2 of the present invention is an apparatus used to implement the method of Embodiment 1 of the present invention, those skilled in the art can understand the specific structure and variations of the apparatus based on the method described in Embodiment 1 of the present invention, and therefore will not be described again here. All apparatuses used in the method of Embodiment 1 of the present invention fall within the scope of protection of the present invention.
[0038] While specific embodiments of the present invention have been described above, those skilled in the art should understand that the specific embodiments described are merely illustrative and not intended to limit the scope of the present invention. Equivalent modifications and variations made by those skilled in the art in accordance with the spirit of the present invention should be covered within the scope of protection of the claims of the present invention.
Claims
1. A method of inverted pole determination based on classification and feature contrast, characterized by, The application relates to a rod detection method and device. The application relates to a rod detection method and device. Step 1: detecting a rod in an image according to a target detection model, fixing the rod in a detection frame in the image, obtaining the coordinates of the rod in the image, cutting and obtaining image A, and obtaining the feature value f1 of the image A; Step 2: a camera obtains a video stream, each frame of image is input into a classification model to judge whether the frame of image belongs to a frame with a rod or a frame without a rod, if the frame with a rod is judged, the judgment of the next frame is continued until the detection is completed, if the frame without a rod is judged, step 3 is entered; Step 3: according to the coordinates, image B is obtained from the frame of image, and then the feature value f2 of the image B is obtained; Step 4: similarity calculation is carried out on f1 and f2 to obtain a comparison value S; Step 5: when S is greater than a set threshold value, it is judged that there is a rod, otherwise, it is judged that there is no rod, and the initial judgment module is entered until the detection is completed.
2. The method of claim 1, wherein, The step 1 is specifically as follows: a rod in an image is detected according to a target detection model, the rod is fixed in a detection frame in the image, the coordinates of the rod in the image are obtained, the coordinates include a left upper corner coordinate point and a right lower corner coordinate point of the rod in the image or a right upper corner coordinate point and a left lower corner coordinate point, image A is cut and obtained from the image according to the coordinates, and the feature value f1 of the image A is obtained.
3. The method of claim 1 or 2, wherein, The feature value f1 includes color features, texture features, shape features and spatial relationship features of the image A.
4. The method of claim 1, wherein, The step 2 is specifically as follows: a camera obtains a video stream, if a human body exists in a frame of video, the frame is deleted, then each frame of image is input into a classification model to judge whether the frame of image belongs to a frame with a rod or a frame without a rod, if the frame with a rod is judged, the judgment of the next frame is continued until the detection is completed, if the frame without a rod is judged, step 3 is entered, the classification model is prepared according to artificial labeling of two types of picture data with a rod and without a rod, ResNet network is selected to learn and train the data, and finally the classification model is obtained.
5. The method of claim 1, wherein, The similarity calculation adopts cosine similarity.
6. An apparatus for inverted pole determination based on classification and feature contrast, the apparatus comprising: The application relates to a rod detection method and device. The application relates to a rod detection method and device. An initialization module detects a rod in an image according to a target detection model, fixes the rod in a detection frame in the image, obtains the coordinates of the rod in the image, cuts and obtains image A, and obtains the feature value f1 of the image A; An initial judgment module obtains a video stream through a camera, inputs each frame of image into a classification model to judge whether the frame of image belongs to a frame with a rod or a frame without a rod, if the frame with a rod is judged, the judgment of the next frame is continued until the detection is completed, if the frame without a rod is judged, a feature value obtaining module is entered; The feature value obtaining module obtains image B from the frame of image according to the coordinates, and then obtains the feature value f2 of the image B; A similarity calculation module carries out similarity calculation on f1 and f2 to obtain a comparison value S; A rejudgment module is used for judging whether there is a rod when S is greater than a set threshold value, otherwise, it is judged that there is no rod, and the initial judgment module is entered until the detection is completed.
7. The apparatus for inverted pole determination based on classification and feature contrast according to claim 6, wherein, The initialization module specifically comprises: detecting a rod in an image according to a target detection model, fixing the rod in a detection frame in the image, obtaining coordinates of the rod in the image, the coordinates comprising a top-left corner coordinate point and a bottom-right corner coordinate point of the rod in the image or a top-right corner coordinate point and a bottom-left corner coordinate point of the rod in the image; and cutting and obtaining an image A from the image according to the coordinates, and obtaining a feature value f1 of the image A.
8. The apparatus for determining an inverted rod based on classification and feature contrast according to claim 6 or 7, characterized in that, The feature value f1 comprises a color feature, a texture feature, a shape feature and a spatial relationship feature of the image A.
9. The apparatus for inverted pole determination based on classification and feature contrast of claim 6, wherein, The initial judgment module specifically comprises: a camera obtaining a video stream, if a human body exists in a video frame, the frame is deleted; then each frame of image is input into a classification model to judge whether there is a rod or not, if it is judged that there is a rod, the next frame is judged until the detection is completed; if it is judged that there is no rod, a feature value module is entered; the classification model is prepared according to two types of picture data of having a rod and not having a rod by manual labeling, ResNet network is selected to learn and train the data, and finally the classification model is obtained.
10. The apparatus for inverted pole determination based on classification and feature contrast of claim 6, wherein, The similarity calculation adopts cosine similarity.
Citation Information
Patent Citations
The invention discloses a lLarge-scale distribution line disaster first-aid repair image recognition method based on deep learning
CN109614969A
Coal mine drill rod counting method based on target detection and computer readable medium
CN114821453A