Ice sculpture facility detection method for ice and snow block based on YOLOv7
Through the detection method of ice sculpture facilities in ice and snow blocks based on YOLOv7, the problems of strong subjectivity and low efficiency of traditional manual detection methods are solved, and the rapid, accurate detection and real-time monitoring of ice sculptures are achieved.
Patent Information
- Application Number
- CN202411914418.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-24
- Publication Date
- 2025-04-11
AI Technical Summary
Traditional ice sculpture detection methods rely on manual visual inspection, which has problems such as strong subjectivity, low efficiency and difficulty in capturing small defects.
Using the YOLOv7-based ice sculpture facility detection method, the YOLOv7 network is enhanced and optimized, the convolutional attention module and GELU activation function are introduced, and the CBAM attention module is added to improve detection performance and feature extraction capabilities.
It realizes rapid and accurate detection of ice sculptures, can efficiently detect the outline and detailed characteristics of the ice sculptures, and monitor the status of the ice sculptures in real time to ensure the accuracy and stability of the inspection.
Smart Images

Figure CN119810421A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of image processing, and in particular is a method for detecting ice sculpture facilities in an ice and snow block based on YOLOv7. Background Art
[0002] As a unique visual art form, ice sculpture has gained widespread attention and popularity around the world in recent years. Ice sculptures are popular in festivals, exhibitions and entertainment venues for their exquisite details and unique visual effects. However, ice sculptures face many technical challenges in the production and display process, one of which is the real-time monitoring and evaluation of the status of ice sculptures.
[0003] With the rapid development of computer vision and artificial intelligence technology, target detection algorithms have been widely used in various fields. The YOLO series of target detection algorithms have performed well in real-time detection tasks with their high efficiency and accuracy. As the latest version of the YOLO series, YOLOv7 further optimizes the detection speed and model structure while maintaining high accuracy, making it very suitable for real-time monitoring and detection tasks.
[0004] The traditional ice sculpture detection method mainly relies on manual visual inspection. Although this method is intuitive, it has many shortcomings. First, manual visual inspection relies on the experience and technical level of the inspectors, is highly subjective, and is easily affected by factors such as ambient light and observation angle. Secondly, the manual inspection process is time-consuming and cannot achieve rapid evaluation of a large number of ice sculptures. In addition, manual inspection is difficult to capture tiny cracks and defects inside the ice sculptures, which may cause damage to the ice sculptures in the later stage. Therefore, a detection method for ice sculpture facilities in ice and snow blocks based on YOLOv7 is proposed. Summary of the invention
[0005] In order to make up for the deficiencies of the prior art and solve at least one technical problem raised in the background technology, the present invention proposes a method for detecting ice sculpture facilities in ice and snow blocks based on YOLOv7.
[0006] The technical solution adopted by the present invention to solve the technical problem is: a method for detecting ice sculpture facilities in an ice and snow block based on YOLOv7 according to the present invention comprises the following steps:
[0007] S1: Obtain images of ice sculptures and perform data augmentation;
[0008] S2: Construct a Yolo format dataset from the collected data set; annotate each target in the collected image with its category and size information; finally, convert the annotated xml file into a format that can be recognized by the Yolo target detection algorithm;
[0009] S3: Optimize the YOLOv7 network; replace the CBS module in the YOLOv7 algorithm with the improved CBG module; this improvement enables the model to capture the detailed features of ice sculptures more accurately; introduce the convolutional attention module; through this improvement; the model can pay more attention to the key areas of ice sculptures, thereby improving the detection performance; for the problem that the SiLU activation function cannot meet the requirements for ice sculpture feature extraction, the GELU activation function is introduced; and the ability to extract ice sculpture detection features is enhanced;
[0010] S4: Added CBAM fusion to YOLOv7 algorithm to improve the detection performance of small target ice sculptures;
[0011] S5: The preprocessed image is fed into a modified YOLOv7 model that has been specially trained to recognize and locate ice sculptures.
[0012] Preferably, the method for acquiring the ice sculpture image dataset in S1 is as follows: the ice sculpture facility image dataset is obtained through field collection; the obtained ice sculpture dataset is divided into a training set, a validation set and a test set; specifically; 60% is divided into a training set; 20% of the data is divided into a validation set; and 20% of the data is divided into a test set.
[0013] Preferably, Figure 1-Figure 5 As shown, the SiLU activation function is used in the original algorithm for optimizing the YOLOv7 network in S3.
[0014] Preferably, Figure 1-Figure 5 As shown, the S4 is added with a CBAM attention module; the CBAM attention module is composed of two sub-modules: a channel attention module CAM and a spatial attention module SAM; the channel attention module learns the importance of each channel in a specific task; by calculating the weight of the channel; strengthens the feature channels that are useful for the current task while suppressing irrelevant features; improves the model's perception of discriminative features; the spatial attention module calculates the importance weight of each pixel point; to adaptively adjust the feature responses at different positions in the image; the network model learns the importance of different positions in the image; weights the feature maps of the spatial dimension; with high target positioning accuracy; so as to better capture the position and features of the target.
[0015] Beneficial effects of the present invention:
[0016] The present invention provides a method for detecting ice sculpture facilities in ice and snow blocks based on YOLOv7. By using the YOLOv7 algorithm, the method can achieve rapid and accurate detection of ice sculptures, solving the problems of strong subjectivity, low efficiency and difficulty in capturing tiny defects in traditional manual visual detection. Through data enhancement and YOLOv7 model recognition, the method can not only efficiently detect the outline and detailed features of ice sculptures, but also monitor the status of ice sculptures in real time, ensuring the accuracy and stability of detection, and has broad application prospects. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] The drawings described herein are used to provide further understanding of the present invention and constitute a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.
[0018] In the attached picture:
[0019] Figure 1 is a flow chart of the method of the present invention;
[0020] Figure 2 It is the CBAM attention module diagram in the present invention;
[0021] Figure 3 It is an optimized YOLOv7 network model diagram;
[0022] Figure 4 It is the GELU activation function graph;
[0023] Figure 5 This is the structural diagram of the CBG module. DETAILED DESCRIPTION
[0024] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] Specific examples are given below.
[0026] See also Figure 1-Figure 5 The present invention provides a method for detecting ice sculpture facilities in ice and snow blocks based on YOLOv7.
[0027] Working principle:
[0028] Step 1: Obtain the image of the ice sculpture and perform data enhancement;
[0029] Step 2: Construct a Yolo format dataset from the collected data set, annotate the collected images according to their category and size information, and finally convert the annotated xml file into the txt format required by the Yolo target detection algorithm;
[0030] Step 3: Optimize the YOLOv7 network and replace the CBS module in the YOLOv7 algorithm with the improved CBG module. This improvement introduces the convolutional attention module, which enables the model to more accurately capture the detailed features of ice sculptures. Through this improvement, the model can pay more attention to the key areas of ice sculptures, thereby improving detection performance. In view of the problem that the SiLU activation function cannot meet the requirements for ice sculpture feature extraction, the GELU activation function is introduced to enhance the ability to extract ice sculpture detection features;
[0031] Step 4: CBAM is added to the YOLOv7 algorithm to improve YOLOv7's ability to focus on features of different dimensions and optimize the network's detection performance for small target ice sculptures.
[0032] Step 5: Input the preprocessed image into the improved YOLOv7 model. The model is trained to identify and locate the details and feature information of ice sculptures.
[0033] The ice sculpture facility image dataset is obtained through field collection, and the obtained ice sculpture dataset is divided into training set, validation set and test set. Specifically, 60% is divided into training set, 20% of the data is divided into validation set, and 20% of the data is divided into test set.
[0034] The SiLU activation function is used in the original algorithm for optimizing the YOLOv7 network. The specific function form of the SiLU activation function and its derivative is shown in the formula:
[0035] SiLU(x)&=x*Sigmoid(x)
[0036] SiLU′(x)%=SiLU(x)+Sigmoid(x)*(1-SiLU(x))
[0037] Like the Sigmoid function, the SiLU activation function is a smooth and stable function that allows the input to be negative and has the characteristics of continuous differentiation.
[0038] In the task of ice sculpture detection, this paper chooses to use the GELU activation function instead of the original SiLU activation function. The GELU activation function image is as shown in the attached manual. Figure 4 :
[0039] The functional form of GELU is:
[0040] f(x)=x*Φ(x)
[0041] Among them, Φ(x) is the cumulative distribution function of the standard normal distribution. The cumulative distribution function Φ(x) can be expressed as:
[0042]
[0043] Here, erf() is the error function, defined as:
[0044]
[0045] By replacing the SiLU activation function used in the CBS module in the YOLOv7 algorithm backbone network with the GELU activation function, the feature extraction capability is improved, the model stability is better, and the model accuracy is improved. The structure diagram of the CBG module after the CBS module is improved is shown in the attached manual. Figure 5 As shown,
[0046] The CBAM attention module is composed of two submodules: the channel attention module CAM and the spatial attention module SAM. The channel attention module learns the importance of each channel in a specific task. By calculating the weight of the channel, it strengthens the feature channels that are useful for the current task while suppressing irrelevant features, thereby improving the model's perception of discriminative features. The spatial attention module calculates the importance weight of each pixel to adaptively adjust the feature response at different positions in the image. The network model learns the importance of different positions in the image and weights the feature map of the spatial dimension to better capture the position and features of the target with high target positioning accuracy. Through the combination of these two attention mechanisms, the features in the channel and spatial dimensions are simultaneously focused on and weighted according to their importance. This can improve the model's ability to perceive features, enabling the model to better learn useful feature representations, thereby improving the perception and representation capabilities of the network model.
[0047] 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, and the above embodiments and descriptions are only for explaining the principles of the present invention. Without departing from the spirit and scope of the present invention, the present invention may have various changes and improvements, and these changes and improvements all fall within the scope of the present invention to be protected.
Claims
1. A method for detecting ice sculpture facilities in ice and snow blocks based on YOLOv7; characterized in that: The following steps are involved: S1: Get the image of the ice sculpture; And perform data enhancement; S2: Construct a Yolo format dataset from the collected data set; annotate each target in the collected image with its category and size information; finally, convert the annotated xml file into a format that can be recognized by the Yolo target detection algorithm; S3: Optimize the YOLOv7 network; replace the CBS module in the YOLOv7 algorithm with the improved CBG module; this improvement enables the model to capture the detailed features of ice sculptures more accurately; introduce the convolutional attention module; through this improvement; the model can pay more attention to the key areas of ice sculptures, thereby improving the detection performance; for the problem that the SiLU activation function cannot meet the requirements for ice sculpture feature extraction, the GELU activation function is introduced; and the ability to extract ice sculpture detection features is enhanced; S4: Added CBAM fusion to YOLOv7 algorithm to improve the detection performance of small target ice sculptures; S5: The preprocessed image is fed into a modified YOLOv7 model that has been specially trained to recognize and locate ice sculptures.
2. According to claim 1, a method for detecting ice sculpture facilities in ice and snow blocks based on YOLOv7; characterized in that: The method for obtaining the ice sculpture image dataset in S1 is as follows: the ice sculpture facility image dataset is obtained through field collection; the obtained ice sculpture dataset is divided into a training set, a validation set and a test set; specifically; 60% is divided into a training set; 20% of the data is divided into a validation set; and 20% of the data is divided into a test set.
3. The method for detecting ice sculpture facilities in ice and snow blocks based on YOLOv7 according to claim 1; characterized in that: The SiLU activation function is used in the original algorithm for optimizing the YOLOv7 network in S3.
4. The method for detecting ice sculpture facilities in ice and snow blocks based on YOLOv7 according to claim 1; characterized in that: The CBAM attention module is added to S4; The CBAM attention module is composed of two sub-modules: the channel attention module CAM and the spatial attention module SAM; the channel attention module learns the importance of each channel in a specific task; by calculating the weight of the channel; strengthening the feature channels that are useful for the current task while suppressing irrelevant features; improving the model's perception of discriminative features; the spatial attention module calculates the importance weight of each pixel; to adaptively adjust the feature responses at different positions in the image; the network model learns the importance of different positions in the image; weights the feature maps of the spatial dimension; with high target positioning accuracy; so as to better capture the position and features of the target.