A method, system, terminal and storage medium for detecting reflection symmetry of a two-dimensional image
The ReResNet model, optimized through deep learning and rotation loss mechanism, combines asymmetric region denoising and rotation loss to solve the problem of image reflection symmetry detection under the influence of background noise, achieving high-precision symmetry axis detection, and is suitable for complex scenes and rotated images.
Patent Information
- Application Number
- CN202511187887.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-25
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2045-08-25
AI Technical Summary
Existing image reflection symmetry detection methods are often affected by background noise, resulting in low detection accuracy and an inability to accurately predict the axis of symmetry of two-dimensional images.
Deep learning methods are employed, combining an asymmetric region denoising module and a rotation loss mechanism with a ReResNet model for image preprocessing and feature extraction. The asymmetric region denoising feature map and rotation loss are used to optimize the model, and binary mask fusion and probabilistic Hough transform are performed to detect the image reflection symmetry axis.
It improves the accuracy of image reflection symmetry detection, can adapt to image reflection symmetry detection in complex scenes, realizes symmetry detection of images with transformations such as rotation and flipping, and enhances the robustness of the model and the accuracy of symmetry axis prediction.
Smart Images

Figure CN120707619B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of image processing technology, and in particular to a method, system, terminal, and computer-readable storage medium for detecting the reflection symmetry of two-dimensional images. Background Technology
[0002] In the field of computer vision, reflection symmetry refers to the geometric property that structures in an image appear as mirror images about a specific straight line (axis of symmetry). Image reflection symmetry detection is of great value in computer vision and is applied in multiple fields such as image compression and object recognition.
[0003] However, existing image reflection symmetry detection methods are often affected by background noise, resulting in low accuracy of the image reflection symmetry detection results and an inability to accurately predict the axis of symmetry of two-dimensional images.
[0004] Therefore, existing technologies still need to be improved and developed. Summary of the Invention
[0005] The main objective of this invention is to provide a method, system, terminal, and computer-readable storage medium for detecting the reflection symmetry of two-dimensional images. This invention aims to solve the problem that existing image reflection symmetry detection methods are often affected by background noise, resulting in low accuracy of the obtained image reflection symmetry detection results and an inability to accurately predict the axis of symmetry of two-dimensional images.
[0006] To achieve the above objectives, the present invention provides a method for detecting the reflection symmetry of a two-dimensional image, the method comprising the following steps:
[0007] Obtain the original images from the preset dataset, and perform preprocessing and asymmetric region denoising on the original images to obtain asymmetric region denoising feature maps;
[0008] The original image is rotated to obtain the target rotated image score map;
[0009] Calculate the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and obtain the reflection symmetry axis prediction feature map based on the rotation loss;
[0010] The image reflection symmetry axis is obtained by performing binary mask fusion and probabilistic Hough transform on the predicted feature map of the reflection symmetry axis.
[0011] Optionally, in the two-dimensional image reflection symmetry detection method, the preprocessing includes symmetry axis annotation processing and data augmentation processing;
[0012] The process of acquiring the original image from the preset dataset and performing preprocessing and asymmetric region denoising on the original image to obtain asymmetric region denoising features specifically includes:
[0013] Each original image in the preset dataset is obtained, and each original image is subjected to symmetry axis annotation and data augmentation to obtain the target dataset;
[0014] The data augmentation process includes rotation, scaling, translation, cropping, and padding.
[0015] A preset symmetry detection model is determined, and the target dataset is input into the preset symmetry detection model to output a symmetry axis score map;
[0016] The target dataset is encoded to obtain a feature map;
[0017] The symmetry axis score map and the feature map are subjected to asymmetric region denoising processing to obtain an asymmetric region denoised feature map.
[0018] Optionally, the two-dimensional image reflection symmetry detection method, wherein performing asymmetric region denoising processing on the symmetry axis score map and the feature map to obtain an asymmetric region denoised feature map specifically includes:
[0019] The symmetry axis score map and the feature map are sequentially input into the convolutional layer and ReLU layer of the preset symmetry detection model. The convolutional layer and the ReLU layer perform dot product multiplication on the symmetry axis score map and the feature map to obtain the multiplication result.
[0020] The multiplication result is smoothed using the Softmax function to obtain a smoothed result.
[0021] The smoothing result is then fed back into the convolutional layer and the ReLU layer to output the denoised feature map of the asymmetric region.
[0022] Optionally, the two-dimensional image reflection symmetry detection method, wherein rotating the original image to obtain a target rotated image score map specifically includes:
[0023] The original image is rotated by a preset angle to obtain a rotated image;
[0024] The original image and the rotated image are input into the preset symmetry detection model to output a target rotated image score map, wherein the target rotated image score map includes the original image score map and the rotated image score map.
[0025] Optionally, the two-dimensional image reflection symmetry detection method, wherein calculating the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and obtaining the reflection symmetry axis prediction feature map based on the rotation loss, specifically includes:
[0026] The asymmetric region denoising feature map is rotated by the preset angle to obtain a rotated asymmetric region denoising feature map.
[0027] Calculate the rotation loss between the target rotated image score map and the denoised feature map of the rotated asymmetric region, and optimize the preset symmetry detection model based on the rotation loss to obtain the target symmetry detection model;
[0028] Obtain the reflection symmetry axis prediction feature map output by the target symmetry detection model.
[0029] Optionally, the two-dimensional image reflection symmetry detection method, wherein performing binary mask fusion processing and probabilistic Hough transform processing on the predicted feature map of the reflection symmetry axis to obtain the image reflection symmetry axis specifically includes:
[0030] The predicted feature map of the reflection symmetry axis is subjected to grayscale conversion to obtain a grayscale image;
[0031] The grayscale image is subjected to dynamic threshold segmentation to obtain a binary mask;
[0032] The probabilistic Hough transform method is used to detect the set of line segments on the binary mask to obtain multiple axes of symmetry.
[0033] The image reflection symmetry axis is obtained by selecting the symmetry axis with the highest matching degree among multiple symmetry axes.
[0034] Optionally, in the two-dimensional image reflection symmetry detection method, the expression for the image reflection symmetry axis is:
[0035] ;
[0036] in, The image reflection symmetry axis, For calculation The maximum value, Here is the Hough accumulator matrix. These are multiple axes of symmetry obtained through the probabilistic Hough transform method. for The first in One axis of symmetry axis of symmetry The diameter of the stage, axis of symmetry The angle of the order.
[0037] Furthermore, to achieve the above objectives, the present invention also provides a reflection symmetry detection system for two-dimensional images, wherein the reflection symmetry detection system for two-dimensional images includes:
[0038] The asymmetric region denoising module is used to acquire the original image from the preset dataset, and to preprocess and perform asymmetric region denoising on the original image to obtain an asymmetric region denoising feature map.
[0039] A rotation processing module is used to rotate the original image to obtain a target rotated image score map;
[0040] The rotation loss calculation module is used to calculate the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and to obtain the reflection symmetry axis prediction feature map based on the rotation loss;
[0041] The image reflection symmetry axis generation module is used to perform binary mask fusion processing and probabilistic Hough transform processing on the predicted feature map of the reflection symmetry axis to obtain the image reflection symmetry axis.
[0042] In this invention, original images from a preset dataset are acquired, and preprocessed and subjected to asymmetric region denoising to obtain an asymmetric region denoising feature map. The original images are then rotated to obtain a target rotated image score map. The rotation loss between the target rotated image score map and the asymmetric region denoising feature map is calculated, and a reflection symmetry axis prediction feature map is obtained based on the rotation loss. Finally, the reflection symmetry axis prediction feature map is subjected to binary mask fusion and probabilistic Hough transform processing to obtain the image reflection symmetry axis. This invention, by performing asymmetric region denoising on a preset dataset to obtain an asymmetric region denoising feature map, constructing a target rotated image score map, calculating the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and then optimizing the symmetry detection model based on the rotation loss, can effectively improve the accuracy of the image reflection symmetry axis output. Attached Figure Description
[0043] Figure 1 This is a flowchart of a preferred embodiment of the two-dimensional image reflection symmetry detection method of the present invention;
[0044] Figure 2 This is a schematic diagram of the overall implementation process of the reflection symmetry detection method for two-dimensional images according to a preferred embodiment of the present invention.
[0045] Figure 3 This is a structural diagram of a preferred embodiment of the two-dimensional image reflection symmetry detection system of the present invention;
[0046] Figure 4This is a structural diagram of a preferred embodiment of the terminal of the present invention. Detailed Implementation
[0047] To make the objectives, technical solutions, and advantages of this invention clearer and more explicit, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
[0048] In computer vision, reflection symmetry refers to the geometric property that structures in an image mirror each other about a specific straight line (axis of symmetry). Image reflection symmetry detection is of great value in computer vision and has applications in various fields such as image compression, object recognition, and medical diagnosis. For example, in medical image analysis, detecting the reflection symmetry of human organs can assist doctors in diagnosing diseases; in image compression, image symmetry can be used to compress images, effectively reducing the amount of data.
[0049] Image reflection symmetry detection methods are mainly divided into two categories: sparse prediction based on keypoint matching and dense prediction based on score maps using deep learning. Sparse prediction based on keypoint matching detects symmetry by finding keypoint pairs that satisfy predefined symmetry constraints. This method calculates a candidate axis of symmetry for each pair of matching feature points in the image, and the perpendicular bisector of the midpoint of the pair is a candidate axis of symmetry. However, it relies on handcrafted features and is sensitive to background noise, making it difficult to adapt to scenarios where the appearance of the target changes due to factors such as lighting, viewing angle, and occlusion. Deep learning-based symmetry detection techniques predict the symmetry of the image by using a neural network to measure the symmetry of each pixel. However, this type of method can misidentify the background as the axis of symmetry due to background noise causing ghosting near the axis of symmetry. Furthermore, when detecting the axis of symmetry in rotated images, most models suffer from rotational invariance, meaning they cannot accurately predict the axis of symmetry for images rotated at different angles.
[0050] To address the aforementioned issues, this invention proposes an image reflection symmetry detection method based on asymmetric region denoising and rotational equivariance, which is particularly suitable for image reflection symmetry detection tasks in complex scenes.
[0051] This invention differs from existing image reflection symmetry detection methods by utilizing deep learning, employing an asymmetric region denoising module and a rotation loss mechanism to achieve high-precision symmetry detection. Furthermore, it can also perform symmetry detection on images subjected to rotation and flipping, and calculate the image's axis of symmetry from the symmetry score map.
[0052] The preferred embodiment of the present invention describes a method for detecting the reflection symmetry of two-dimensional images, such as... Figure 1As shown, the reflection symmetry detection method for two-dimensional images includes the following steps:
[0053] Step S10: Obtain the original images from the preset dataset, and perform preprocessing and asymmetric region denoising on the original images to obtain an asymmetric region denoising feature map. The preprocessing includes symmetry axis annotation and data augmentation.
[0054] In real-world scenarios, images exhibit various forms of symmetry. Symmetry is generally defined using mathematical expressions, and can be categorized into three types: mirror symmetry (also known as reflection symmetry), rotational symmetry, and translational symmetry. This invention primarily aims to detect the reflection symmetry of images.
[0055] Specifically, each original image in the preset dataset is acquired, and each original image is subjected to symmetry axis annotation processing and data augmentation processing to obtain the target dataset; wherein, the data augmentation processing includes rotation processing, scaling processing, translation processing, cropping processing and padding processing; a preset symmetry detection model is determined, and the target dataset is input into the preset symmetry detection model to output the symmetry axis score map.
[0056] First, asymmetric region denoising is performed on the image: existing image reflection symmetry detection methods contain irregular noise in the background class of the predicted image obtained after multiple training iterations, which interferes with the detection of the background class. To address this problem, this invention proposes asymmetric region denoising, the specific implementation process of which is as follows:
[0057] The dataset used in this invention is an open-source image dataset. Symmetry axes are labeled in each image in the dataset (the labeling process is: for each symmetry axis in the image, label the coordinates of the two endpoints of the symmetry axis and store them in a JSON file). Data augmentation methods such as rotation, scaling, translation, cropping, and padding are applied (which can increase the size and diversity of the dataset and enhance the robustness of subsequent models). Then, it is input into the ReResNet framework (i.e., the preset symmetry detection model in this invention) of the isovariant ResNet50 (a deep convolutional neural network architecture). The predefined network structure of ReResNet is used to load pre-trained weights for training.
[0058] ResNet is a residual network widely used as a backbone network for computer vision tasks. ResNet is equivariant to translation (i.e., if the input is translated, the feature map is also translated), but it is not equivariant to rotation. ReResNet is a modification of ResNet. The basic architecture remains the same, but the convolutional modules are replaced with equivariant convolutions (using group convolutions instead of standard convolutions), which gives ReResNet the ability to deform with rotation.
[0059] The training process is as follows: The basic framework ReResNet is a pre-trained model (the ReResNet model can be pre-trained on the ImageNet-1K dataset, which is a large image dataset containing 1.2 million images covering 1000 categories). First, the pre-trained ReResNet model is initialized. The ReResNet model is trained for 100 epochs using the Adam optimizer (the Adam optimizer is an optimization algorithm with an adaptive learning rate, which is particularly suitable for gradient descent problems in machine learning and deep learning) with a learning rate of 0.001 and a batch size of 16. The ReResNet model runs on four NVIDIA GeForce RTX A100 (a data center GPU) graphics cards.
[0060] The target dataset is encoded to obtain a feature map; the symmetry axis score map and the feature map are sequentially input into the convolutional layer and ReLU layer of the preset symmetry detection model, and the symmetry axis score map and the feature map are multiplied by the convolutional layer and the ReLU layer to obtain a multiplication result; the multiplication result is smoothed by the Softmax function to obtain a smoothed result; the smoothed result is input again into the convolutional layer and the ReLU layer to output the denoised feature map of the asymmetric region.
[0061] like Figure 2 As shown, for each image in the preset dataset, the above process yields a preliminary symmetry axis score map. This allows us to pinpoint the specific region where the axis of symmetry is located. At this point, the symmetry axis score diagram... The background class contains many ambiguous features. To determine a more accurate axis of symmetry, the symmetry axis score map is used. and the feature map obtained by encoding (i.e., the feature map obtained after the images in the target dataset are encoded) Figure 2 Feature map in Perform dot product multiplication to obtain the denoised feature map of the asymmetric region. .
[0062] In this process, the present invention sets up an asymmetric region denoising module, which is represented as follows: ,but The implementation can be represented as Among them, the score diagram of the axis of symmetry. This is equivalent to weighting, or the symmetry axis score plot. In a graph, the foreground region (i.e., the symmetrical region) will have a larger weight than the background region, so a symmetry axis score map is used. Using it as a weight allows the original features to focus more on the axis of symmetry region and ignore the background, thereby eliminating artifacts and noise interference.
[0063] The asymmetric region noise reduction module set in this invention In the middle, the feature map is first... And the score chart of the axis of symmetry After being processed by convolutional layers and ReLU layers respectively, the feature map is now... The extracted features are represented by the symmetry axis score map. The weights represent the symmetrical regions to be focused on, therefore the feature map... And the score chart of the axis of symmetry Performing dot products is equivalent to adding weights to the features, allowing us to focus more on symmetrical regions, thereby achieving noise reduction. Feature map And the score chart of the axis of symmetry The result of multiplication is often too large, so the Softmax function is needed to smooth it. Finally, it is processed by convolutional layers and ReLU layers to obtain the final prediction result.
[0064] Understandably, the whole The process can be represented as:
[0065] ;
[0066] in, for The process of denoising asymmetric regions, feature maps And the score chart of the axis of symmetry for Input, It is an exponential function. For feature map (here) , , These are the image height, image width, and number of image channels of the feature map, respectively. The score diagram for the axis of symmetry (here) , , These are the image height, image width, and number of image channels of the symmetry axis score map, respectively.
[0067] Step S20: Rotate the original image to obtain the target rotated image score map.
[0068] Furthermore, after denoising the asymmetric regions, rotation loss needs to be applied. In the preset dataset, the axis of symmetry of most images is vertical or horizontal. If a rotated image is given, and its axis of symmetry is not vertical or horizontal, the network cannot distinguish the rotated image and find it difficult to detect the true axis of symmetry because the features of the image after a specific rotation angle have not been extracted.
[0069] To address the aforementioned problems, this invention employs a dual-branch design and introduces additional rotation loss to simultaneously extract image information from both unrotated and rotated images, thereby achieving rotational isovariability.
[0070] Specifically, the original image is rotated by a preset angle to obtain a rotated image; the original image and the rotated image are input into the preset symmetry detection model to output a target rotated image score map, wherein the target rotated image score map includes the original image score map and the rotated image score map.
[0071] This invention defines rotational isotropy over a group (including the input group and the output group), assuming the input group is represented as... , acting on ( For the input space, is a function The domain, Accept from (taking elements as input), the output group is represented as , acting on ( The output space represents the function. The range of values). If a learnable function A substance is said to have strict equivariance if it meets the following conditions:
[0072] ;
[0073] in, For group elements, , Representing mathematical groups, yes A specific element in the array represents a specific symmetry transformation operation, such as "rotate 90 degrees" or "translate 3 pixels to the right". , For input data, It is input After function The result of the processing This indicates that the group element should be considered first. Obtain the corresponding first transformation function Then, this first transformation function is applied to the specific input data. This indicates that the group element should be considered first. Obtain the corresponding second transformation function Then apply this second transformation function to the function. exist Output results superior.
[0074] Given an original image (i.e., the original image in the preset dataset), this image has not undergone any rotation transformation. Furthermore, the original image is then subjected to a preset angle. random rotation (where, The value range is from 0 degrees to 45 degrees. The unrotated image (i.e., the original image) and the rotated image (i.e., the rotated image in this invention) are used as two inputs. These two inputs are simultaneously passed through a preset symmetry detection model to obtain the prediction result (i.e., the target rotated image score map in this invention, including the original image score map and the rotated image score map). The two inputs share weights and can be used for subsequent loss calculation to predict the axis of symmetry.
[0075] Step S30: Calculate the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and obtain the reflection symmetry axis prediction feature map based on the rotation loss.
[0076] Specifically, the asymmetric region denoising feature map is rotated by the preset angle to obtain a rotated asymmetric region denoising feature map; the rotation loss between the target rotated image score map and the rotated asymmetric region denoising feature map is calculated, and the preset symmetry detection model is optimized based on the rotation loss to obtain a target symmetry detection model; the reflection symmetry axis prediction feature map output by the target symmetry detection model is obtained.
[0077] For the target rotation image score map The goal is to increase its similarity to the ground truth (the actual result). In addition, the asymmetric region denoising feature map will be processed... After rotating by the same angle (i.e., the preset angle in this invention), a noise reduction feature map of the rotationally asymmetric region is obtained. Compare this with the target rotated image score obtained through the rotation branch described above. Compare and calculate the rotation loss (because the denoised feature map of the asymmetric region after rotation). And the target rotation image score after rotation and branching. The result is the same image predicted, so the results of both are equivalent. Similarly, for and We also hope to increase the similarity between the two. The specific implementation process is expressed as follows:
[0078] ;
[0079] in, Represents the parameters of the network. Indicates taking parameters The minimum value, It means that it has not been done. The output of the module's model, Indicates the true result. Indicates the process The output of the module's model, It is the least 2 norm.
[0080] The second input image (i.e., the denoising feature map of the asymmetric region) Preset angle The random rotation is due to the use of Combining rotational isovariant convolution with these two methods can achieve... This effect can cover all angles of an image, thereby improving the accuracy of symmetry axis detection in rotated images.
[0081] Meanwhile, compared to single input, the present invention uses a dual input of original and rotated images, which enables the model to extract features from the rotated image. By comparing the two, the model can learn the differences between the original and rotated images, allowing the model to use richer features in symmetry detection and enhancing the model's predictive ability.
[0082] Symmetry detection is used to represent the foreground class of the symmetry axis and the background class of the asymmetric region, and pixel-level binary classification is used to detect the symmetry axis. Since the symmetry axis region occupies only a small portion, and there is an imbalance between the asymmetric regions, a focus loss can be used to balance the proportions of these two classes. That is, the calculation of the rotation loss in this invention is based on the focus loss, and the expression for the focus loss calculation is as follows:
[0083] ;
[0084] in, Indicates focal loss. To express summation, This represents the focusing parameter, used to adjust the ratio of simple samples to difficult-to-classify samples. Parameters representing the equilibrium symmetric and asymmetric regions, It is the confidence level of symmetry.
[0085] Furthermore, and The expression is as follows: ;
[0086] ;
[0087] in, Indicates the prediction result. It represents the true value (the true predicted image, also referring to the true axis of symmetry). As the weight, the present invention preferably sets it to 0.75 to make the proportion of positive samples large (i.e., to make the proportion of the axis of symmetry large). Different, then They are different.
[0088] Therefore, regarding the prediction results and the true value Its focal loss is,
[0089] ;
[0090] for and This invention defines the difference as rotational loss:
[0091] ;
[0092] in, The original image score map and the rotated image score map are obtained by using focus loss.
[0093] like Figure 2 As shown, Figure 2 In The original loss is obtained by applying focus loss to the original image score map; Figure 2 In The rotation loss is calculated using the focal loss method on the target rotated image score map; Figure 2 In The score maps of the original rotated image and the rotated image are obtained by calculating the focal loss. and These are all feature maps that have not undergone asymmetric region denoising. The focus loss is calculated on this feature map. and The difference is: It is an image without rotation. It is a rotated image.
[0094] This invention learns the difference between rotated and original images by optimizing the rotation loss, making the model rotationally equivariant, enabling it to be used for image prediction after rotation, and enhancing the robustness of image reflection symmetry detection.
[0095] Step S40: Perform binary mask fusion processing and probabilistic Hough transform processing on the predicted feature map of the reflection symmetry axis to obtain the image reflection symmetry axis.
[0096] Furthermore, after the rotation loss is calculated, the entire model can be optimized based on the rotation loss, and the predicted feature map of the reflection symmetry axis of the model output can be obtained. Then, the symmetry axis can be drawn based on the binary mask fusion processing and the probabilistic Hough transform processing.
[0097] This invention proposes a symmetry axis visualization method based on binary mask fusion and probabilistic Hough transform, which can accurately draw the symmetry axis from the reflection symmetry axis prediction feature map to the original image.
[0098] Specifically, the predicted feature map of the reflection symmetry axis is subjected to grayscale conversion to obtain a grayscale image; the grayscale image is then subjected to dynamic thresholding to obtain a binary mask; a set of line segments is detected on the binary mask using the probabilistic Hough transform method to obtain multiple symmetry axes; the symmetry axis with the highest matching degree among the multiple symmetry axes is selected to obtain the image reflection symmetry axis. The expression for the image reflection symmetry axis is:
[0099] ;
[0100] in, The image reflection symmetry axis, For calculation The maximum value, Here is the Hough accumulator matrix. These are multiple axes of symmetry obtained through the probabilistic Hough transform method. for The first in One axis of symmetry axis of symmetry The diameter of the stage, axis of symmetry The angle of the order.
[0101] The first step is the preprocessing of the reflection symmetry axis prediction feature map: 1. Convert the reflection symmetry axis prediction map output by the model into a grayscale image (this can be done using the cvtColor function in Python) to eliminate color interference. 2. Use dynamic thresholding to segment the grayscale image to generate a binary mask for the symmetry axis region, thereby highlighting the high-confidence symmetry region (where the pixel value of the grayscale image is between 0 and 255; in this invention, if the pixel value in the image is ≥127, then this value is set to 255), and suppressing background noise (similarly, if the pixel value in the image is <127, then this value is set to 0). That is, after processing, only pixels with values of 255 and 0 exist, where the pixel value of 255 is the determined symmetry region.
[0102] The expression for the preprocessing of the reflection symmetry axis prediction feature map is as follows:
[0103] ;
[0104] This is the binary mask obtained after processing. The grayscale image obtained after grayscale processing of the feature map predicted for the reflection symmetry axis. The threshold is preferably set to 127, which means that if the value of a pixel in the image is ≥127, then this value is set to 255, and if the value of a pixel in the image is <127, then this value is set to 0.
[0105] Furthermore, after the preprocessing of the reflection symmetry axis prediction feature map is completed, the symmetry axis geometric detection is performed. The specific process is as follows: the probabilistic Hough transform is used on the grayscale image to detect the set of line segments on the binary mask. However, there are multiple symmetry axes obtained by the Hough transform. In this invention, the first detected line is selected as the main symmetry axis, which is often the line with the highest matching degree (i.e., the image reflection symmetry axis in this invention).
[0106] The expression processed by the Hough transform is as follows:
[0107] ;
[0108] in, It is the Hough transform function.
[0109] Furthermore, based on the set of possible straight lines obtained from the probabilistic Hough transform, the image reflection symmetry axis can be obtained, and its expression is:
[0110] .
[0111] Beneficial effects:
[0112] 1. Sparse prediction methods based on keypoint matching are typically suitable for simple, symmetrical image scenes. However, in the real world, images involve variations in lighting, viewpoint, and occlusion. Therefore, this invention utilizes deep learning to better handle these variations, enabling the detection algorithm to be applied to more diverse scenarios.
[0113] 2. Targets in images may appear in various poses, including rotation and flipping, and their axes of symmetry are not absolutely vertical or horizontal. By detecting targets in rotated and flipped images, this invention can be applied to a wider range of scenarios.
[0114] 3. This invention combines dynamic threshold segmentation and probabilistic Hough transform to transform the symmetry score map output by the deep model into a geometric straight line, thereby realizing the visualization of the symmetry axis.
[0115] The innovative aspects of this invention are as follows:
[0116] 1. This invention proposes a symmetric region denoising method, which can increase the weight of symmetric regions and remove background noise and artifact interference, thereby detecting the symmetric axis region.
[0117] 2. This invention introduces image rotation and rotation loss calculation to increase the similarity between the score image after rotation and the score image after rotation branching, and to mine the relevant features between the original image and the rotated image, thereby determining the symmetry of the image after transformations such as flipping and rotation.
[0118] 3. This invention is based on a symmetry score map, processes the image according to a threshold, and then uses Hough transform to detect straight lines based on a voting mechanism. It can process the position of the axis of symmetry in the output image based on the symmetry score map and Hough transform.
[0119] Furthermore, such as Figure 3 As shown, based on the above-described method for detecting the reflection symmetry of two-dimensional images, this invention also provides a system for detecting the reflection symmetry of two-dimensional images, wherein the system comprises:
[0120] The asymmetric region denoising module 51 is used to acquire the original image in the preset dataset, and to preprocess and perform asymmetric region denoising on the original image to obtain an asymmetric region denoising feature map.
[0121] Rotation processing module 52 is used to rotate the original image to obtain a target rotated image score map;
[0122] The rotation loss calculation module 53 is used to calculate the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and to obtain the reflection symmetry axis prediction feature map based on the rotation loss.
[0123] The image reflection symmetry axis generation module 54 is used to perform binary mask fusion processing and probabilistic Hough transform processing on the predicted feature map of the reflection symmetry axis to obtain the image reflection symmetry axis.
[0124] Furthermore, such as Figure 4 As shown, based on the above-mentioned two-dimensional image reflection symmetry detection method and system, the present invention also provides a terminal, which includes a processor 10, a memory 20 and a display 30. Figure 4 Only some of the terminal components are shown; however, it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0125] In some embodiments, the memory 20 may be an internal storage unit of the terminal, such as a hard disk or memory. In other embodiments, the memory 20 may be an external storage device of the terminal, such as a plug-in hard disk, smart media card (SMC), secure digital card (SD), flash card, etc. Further, the memory 20 may include both internal and external storage devices. The memory 20 is used to store application software and various types of data installed on the terminal, such as the program code installed on the terminal. The memory 20 can also be used to temporarily store data that has been output or will be output. In one embodiment, the memory 20 stores a two-dimensional image reflection symmetry detection program 40, which can be executed by the processor 10 to implement the two-dimensional image reflection symmetry detection method of this application.
[0126] In some embodiments, the processor 10 may be a central processing unit (CPU), a microprocessor, or other data processing chip, used to run program code stored in the memory 20 or process data, such as executing a reflection symmetry detection method for the two-dimensional image.
[0127] In some embodiments, the display 30 may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, or an OLED (Organic Light-Emitting Diode) touchscreen. The display 30 is used to display information on the terminal and to display a visual user interface.
[0128] In one embodiment, the steps of the two-dimensional image reflection symmetry detection method are implemented when the processor 10 executes the reflection symmetry detection program 40 of the two-dimensional image in the memory 20.
[0129] In summary, this invention provides a method, system, and terminal for detecting the reflection symmetry of two-dimensional images. The method includes: acquiring an original image from a preset dataset, and performing preprocessing and asymmetric region denoising on the original image to obtain an asymmetric region denoising feature map; rotating the original image to obtain a target rotated image score map; calculating the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and obtaining a reflection symmetry axis prediction feature map based on the rotation loss; and performing binary mask fusion and probabilistic Hough transform processing on the reflection symmetry axis prediction feature map to obtain the image reflection symmetry axis. This invention, by performing asymmetric region denoising on a preset dataset to obtain an asymmetric region denoising feature map, constructing a target rotated image score map, calculating the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and then optimizing the symmetry detection model based on the rotation loss, can effectively improve the accuracy of the image reflection symmetry axis output.
[0130] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal that includes that element.
[0131] Of course, those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware (such as a processor, controller, etc.). The program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The computer-readable storage medium can be a memory, magnetic disk, optical disk, etc.
[0132] It should be understood that the application of the present invention is not limited to the examples above. Those skilled in the art can make improvements or modifications based on the above description, and all such improvements and modifications should fall within the protection scope of the appended claims.
Claims
1. A method for detecting reflection symmetry in a two-dimensional image, characterized in that, The reflection symmetry detection method for the two-dimensional image includes: Obtain the original images from the preset dataset, and perform preprocessing and asymmetric region denoising on the original images to obtain asymmetric region denoising feature maps; The preprocessing includes symmetry axis annotation processing and data augmentation processing; The process of acquiring the original image from the preset dataset and performing preprocessing and asymmetric region denoising on the original image to obtain asymmetric region denoising features specifically includes: Each original image in the preset dataset is obtained, and each original image is subjected to symmetry axis annotation and data augmentation to obtain the target dataset; The data augmentation process includes rotation, scaling, translation, cropping, and padding. A preset symmetry detection model is determined, and the target dataset is input into the preset symmetry detection model to output a symmetry axis score map; The target dataset is encoded to obtain a feature map; The symmetry axis score map and the feature map are subjected to asymmetric region denoising processing to obtain an asymmetric region denoised feature map. The original image is rotated to obtain the target rotated image score map; Calculate the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and obtain the reflection symmetry axis prediction feature map based on the rotation loss; The image reflection symmetry axis is obtained by performing binary mask fusion and probabilistic Hough transform on the predicted feature map of the reflection symmetry axis. The step of performing binary mask fusion and probabilistic Hough transform processing on the predicted feature map of the reflection symmetry axis to obtain the image reflection symmetry axis specifically includes: The predicted feature map of the reflection symmetry axis is subjected to grayscale conversion to obtain a grayscale image; The grayscale image is subjected to dynamic threshold segmentation to obtain a binary mask; The probabilistic Hough transform method is used to detect the set of line segments on the binary mask to obtain multiple axes of symmetry. The image reflection symmetry axis is obtained by selecting the symmetry axis with the highest matching degree among multiple symmetry axes.
2. The method for detecting reflection symmetry in two-dimensional images according to claim 1, characterized in that, The step of performing asymmetric region denoising processing on the symmetry axis score map and the feature map to obtain an asymmetric region denoised feature map specifically includes: The symmetry axis score map and the feature map are sequentially input into the convolutional layer and ReLU layer of the preset symmetry detection model. The convolutional layer and the ReLU layer perform dot product multiplication on the symmetry axis score map and the feature map to obtain the multiplication result. The multiplication result is smoothed using the Softmax function to obtain a smoothed result. The smoothing result is then fed back into the convolutional layer and the ReLU layer to output the denoised feature map of the asymmetric region.
3. The method for detecting reflection symmetry in two-dimensional images according to claim 1, characterized in that, The step of rotating the original image to obtain the target rotated image score map specifically includes: The original image is rotated by a preset angle to obtain a rotated image; The original image and the rotated image are input into the preset symmetry detection model to output a target rotated image score map, wherein the target rotated image score map includes the original image score map and the rotated image score map.
4. The method for detecting reflection symmetry in two-dimensional images according to claim 3, characterized in that, The calculation of the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and the obtaining of the reflection symmetry axis prediction feature map based on the rotation loss, specifically includes: The asymmetric region denoising feature map is rotated by the preset angle to obtain a rotated asymmetric region denoising feature map. Calculate the rotation loss between the target rotated image score map and the denoised feature map of the rotated asymmetric region, and optimize the preset symmetry detection model based on the rotation loss to obtain the target symmetry detection model; Obtain the reflection symmetry axis prediction feature map output by the target symmetry detection model.
5. The method for detecting reflection symmetry in a two-dimensional image according to claim 1, characterized in that, The expression for the image reflection symmetry axis is: ; in, The image reflection symmetry axis, For calculation The maximum value, Here is the Hough accumulator matrix. These are multiple axes of symmetry obtained through the probabilistic Hough transform method. for The first in One axis of symmetry axis of symmetry The diameter of the stage, axis of symmetry The angle of the order.
6. A reflection symmetry detection system for two-dimensional images, characterized in that, The two-dimensional image reflection symmetry detection system is applied to the two-dimensional image reflection symmetry detection method according to any one of claims 1-5, wherein the two-dimensional image reflection symmetry detection system comprises: The asymmetric region denoising module is used to acquire the original image from the preset dataset, and to preprocess and perform asymmetric region denoising on the original image to obtain an asymmetric region denoising feature map. A rotation processing module is used to rotate the original image to obtain a target rotated image score map; The rotation loss calculation module is used to calculate the rotation loss between the target rotated image score map and the asymmetric region denoising feature map, and to obtain the reflection symmetry axis prediction feature map based on the rotation loss; The image reflection symmetry axis generation module is used to perform binary mask fusion processing and probabilistic Hough transform processing on the predicted feature map of the reflection symmetry axis to obtain the image reflection symmetry axis.
7. A terminal, characterized in that, The terminal includes: a memory, a processor, and a two-dimensional image reflection symmetry detection program stored in the memory and executable on the processor. When the two-dimensional image reflection symmetry detection program is executed by the processor, it implements the steps of the two-dimensional image reflection symmetry detection method as described in any one of claims 1-5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a reflection symmetry detection program for a two-dimensional image, which, when executed by a processor, implements the steps of the reflection symmetry detection method for a two-dimensional image as described in any one of claims 1-5.
Citation Information
Patent Citations
Non-local mean image denoising method combined with structure information
CN102117482A
Learning device, symmetry evaluation device, learning method, and recording medium
WO2023188171A1