Rotating target detection method, device, electronic device and medium based on rotating axis
Through the representation method based on the rotation axis, the multi-solution and periodic ambiguity problems in rotating target detection are solved, more stable and accurate rotating target detection is achieved, and the learning efficiency and detection accuracy of the model are improved.
Patent Information
- Application Number
- CN202510833357.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-20
- Publication Date
- 2025-09-16
- Estimated Expiration
- 2045-06-20
AI Technical Summary
The existing rotating target detection methods have the problems of multi-solution and periodic ambiguity of rotation angles, which affect the stability and convergence speed of model training, and lack the ability to directly model the spatial orientation information of the target box.
A rotation axis-based representation method is adopted. By obtaining the image to be detected and inputting it into a pre-trained target detection model, the normalized rotation axis representation prediction result is output and converted into a predicted size tensor, including the center point coordinates, width, height and rotation angle. The normalized rotation axis representation annotation results in the training dataset are used for iterative training, and the orthogonality constraint and cosine distance loss function are introduced to optimize the model parameters.
The stability and accuracy of rotating target detection are improved, the model's ability to learn the spatial features of rotating targets is enhanced, and the accuracy and generalization ability of detection are improved.
Smart Images

Figure CN120355905B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of rotating target recognition, and in particular to a rotating target detection method, device, electronic equipment and medium based on a rotating axis. Background Art
[0002] With the advancement of computer vision technology, rotated object detection is gaining increasing attention in applications such as remote sensing imagery, scene text recognition, and industrial visual inspection. Compared to traditional horizontal object bounding boxes, rotated object bounding boxes can more accurately fit objects with arbitrary orientations, thereby improving detection accuracy and robustness.
[0003] In related technologies, such as Figure 5 The rotating target box shown is usually modeled using a five-tuple representation method, that is, a five-dimensional tensor is used to represent the position and direction of the rotating target box. The five-tuple representation method includes the position of the center point E of the rotating target , the width of the rotation target box , the height of the rotation target box and rotation angle ,in, is the upper left corner of the image. Although this representation is simple in structure, it still has certain limitations in actual detection tasks. On the one hand, the rotation angle The periodic characteristics of the bounding box (such as the equivalence of 0° and 360°) and the multiple solutions for representing the same box at different angles can introduce ambiguity to the task, affecting the stability and convergence of model training. Furthermore, this representation lacks the ability to directly model the spatial orientation of the target box, hindering the model's explicit perception of the shape and orientation of the rotated target. Summary of the Invention
[0004] The present invention aims to at least partially address one of the technical problems in the related art. To this end, the present invention provides a method, apparatus, electronic device, and medium for detecting a rotating target based on a rotation axis, thereby avoiding the multiple interpretations and periodic ambiguity caused by the rotation angle, and improving the stability of the rotating target representation and the detection accuracy.
[0005] To achieve the above objectives, a first embodiment of the present invention provides a rotating target detection method based on a rotation axis, comprising:
[0006] Acquire an image to be detected, input the image to be detected into a pre-trained object detection model, and output a normalized rotation axis representation prediction result of a rotated object box in the image to be detected; wherein the object detection model is trained based on the normalized rotation axis representation annotation result in a training data set; the normalized rotation axis representation annotation result is a representation vector obtained by performing rotation axis representation and normalization processing on the rotated object box in the training data set;
[0007] The normalized rotation axis representation prediction result is converted into a corresponding predicted size tensor; the predicted size tensor includes the center point coordinates, width, height and rotation angle of the rotated target box in the image to be detected.
[0008] In addition, the method of the above embodiment of the present invention may also have the following additional technical features:
[0009] According to one embodiment of the present invention, the training process of the target detection model includes:
[0010] Constructing the training data set, and annotating the rotation target frame based on the rotation axis representation to obtain a rotation axis representation annotation result;
[0011] Normalizing the rotation axis representation labeling result to obtain the normalized rotation axis representation labeling result;
[0012] The training data set is input into the target detection model, and the target detection model is iteratively trained using the normalized rotation axis representation annotation result as a label.
[0013] According to one embodiment of the present invention, the rotation axis representation includes the center point coordinates of the rotating target frame, a first rotation axis vector and a second rotation axis vector; the first rotation axis vector represents a vector in the direction of the high side with the center point as the starting point, and the vector length is half of the high side length; the second rotation axis vector represents a vector in the direction of the wide side with the center point as the starting point, and the vector length is half of the wide side length.
[0014] According to one embodiment of the present invention, inputting the training data set into the target detection model and iteratively training the target detection model using the normalized rotation axis representation annotation result as a label includes:
[0015] Denormalize the output of the target detection model to obtain the rotation axis representation prediction result in the training phase;
[0016] The loss function value between the rotation axis representation prediction result and the rotation axis representation annotation result in the training phase is calculated, and the model parameters are back-propagated and optimized based on the loss function value.
[0017] According to one embodiment of the present invention, calculating the loss function value between the rotation axis representation prediction result and the rotation axis representation annotation result in the training phase includes:
[0018] The cosine distance between the first rotation axis vector and the second rotation axis vector in the rotation axis representation prediction result in the training phase is calculated, and a loss function is constructed based on the cosine distance.
[0019] According to one embodiment of the present invention, the loss function is used to ensure that the first rotation axis vector and the second rotation axis vector predicted by the target detection model satisfy an orthogonality constraint.
[0020] According to one embodiment of the present invention, converting the normalized rotation axis representation prediction result into a corresponding prediction size tensor includes:
[0021] Performing a denormalization process on the normalized rotation axis representation prediction result to obtain a corresponding rotation axis representation prediction result;
[0022] The spatial position relationship of the prediction results is represented based on the rotation axis and converted into the prediction size tensor.
[0023] To achieve the above objectives, a second embodiment of the present invention provides a rotating target detection device based on a rotating axis, comprising:
[0024] A model processing module is configured to obtain an image to be detected, input the image to be detected into a pre-trained target detection model, and output a normalized rotation axis representation prediction result of a rotated target box in the image to be detected; wherein the target detection model is trained based on the normalized rotation axis representation annotation result in a training data set; the normalized rotation axis representation annotation result is a representation vector obtained by performing rotation axis representation and normalization processing on the rotated target box in the training data set;
[0025] A data processing module is used to convert the normalized rotation axis representation prediction result into a corresponding predicted size tensor; the predicted size tensor includes the center point coordinates, width, height and rotation angle of the rotating target box in the image to be detected.
[0026] To achieve the above-mentioned purpose, an embodiment of the third aspect of the present invention proposes an electronic device, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the steps of the above-mentioned rotating target detection method based on the rotating axis are implemented.
[0027] To achieve the above-mentioned purpose, an embodiment of the fourth aspect of the present invention proposes a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned rotating target detection method based on a rotating axis when the computer program is executed.
[0028] The rotating target detection method, device, electronic device and medium based on the rotation axis of the embodiments of the present invention input the image to be detected into the target detection model trained based on the normalized rotation axis representation annotation result, and output the normalized rotation axis representation prediction result of the rotating target box in the image to be detected, and then convert the prediction result into a predicted size tensor including the center point coordinates, width, height and rotation angle, thereby realizing accurate characterization of the rotating target in a structured manner, improving the representation ability and learning stability of the model in the rotating target detection task, and helping to improve the generalization ability and detection accuracy of the target detection model in multi-scale rotating target scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 1 is a flow chart of a rotating target detection method based on a rotating axis in one embodiment;
[0030] Figure 2 A flowchart illustrating a training process of an object detection model in one embodiment;
[0031] Figure 3 A schematic diagram of a loss function value calculation process for an object detection model in one embodiment;
[0032] Figure 4 FIG1 is a schematic diagram of a process flow for normalizing the rotation axis representation in one embodiment;
[0033] Figure 5 is a schematic diagram of a rotating target frame in an image according to one embodiment;
[0034] Figure 6 A data flow diagram of rotating target detection in one embodiment;
[0035] Figure 7 1 is a structural block diagram of a rotating target detection device based on a rotating axis in one embodiment. DETAILED DESCRIPTION
[0036] In order to make the purpose, technical solutions and advantages of this application more clearly understood, the present application is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.
[0037] The following describes in detail the implementation details of the technical solutions of the embodiments of the present application.
[0038] In one embodiment, Figure 1 As shown, a flowchart of a rotating target detection method based on a rotating axis is provided, and the method may include the following steps:
[0039] Step S101: obtain an image to be detected, input the image to be detected into a pre-trained target detection model, and output a normalized rotation axis representation prediction result of a rotated target box in the image to be detected.
[0040] Here, the image to be detected is acquired through a camera, image database, or other data acquisition method. The image to be detected can be a color or grayscale image of any size and resolution, and may contain multiple rotating objects of various shapes and orientations. These images serve as input data and provide the visual information required for rotating object detection.
[0041] The object detection model is built on the Transformer architecture, using the DETR (Detection Transformer) or its compatible architecture as its basic framework, and is capable of end-to-end spatial structure modeling. During the training phase, the rotated object boxes in the training dataset are annotated using a rotation axis representation method. The annotated data is then normalized to obtain normalized rotation axis representation annotation results within a uniform numerical range. The purpose of this normalization is to enable the object detection model to effectively model and predict the spatial features of the rotated object boxes within a fixed numerical range, thereby improving training efficiency and generalization capabilities.
[0042] It should be noted that the rotation axis representation is to characterize the rotation characteristics of the rotating target frame by clarifying the two direction axes inside the rotating target frame, which can fully describe the spatial structure and rotation posture of the rotating target frame. These two direction axes correspond to the main geometric boundary directions of the rotating target frame, respectively, and are used to express the directionality and scale distribution of the target frame, so that the model can learn the spatial configuration of the target without relying on angle parameters. Based on this, the target detection model learns the normalized rotation axis representation annotation results as labels, thereby mastering the spatial position and direction characteristics of the rotating target, and can accurately predict the relevant parameters of the rotating target frame. The specific training process of the target detection model will be described in detail in other embodiments.
[0043] Based on the learning of the normalized rotation axis representation in the training phase, the model can directly make spatial structural judgments on the rotating targets in the image during the inference phase. During the process of rotating target detection, the acquired image to be detected is input into the pre-trained target detection model for processing. In practical applications, the target detection model is used to detect the rotating targets in the image to be detected and annotate the detected rotating targets with a rotating target box. Based on this, the target detection model outputs the detection results of the rotating targets in the form of spatial features of the rotating target box.
[0044] It is understandable that the object detection model has mastered the spatial laws expressed by the rotation axis representation through normalization processing during the training phase. During the inference process, it can directly make accurate predictions about the geometric features of the rotating target and output the normalized rotation axis representation prediction results of the rotating target box in the image to be detected. Among them, the normalized rotation axis representation prediction result is essentially a description of the rotation axis representation of the rotating target box at a unified scale. It has clear numerical boundaries and usually falls within a fixed numerical range. It can effectively control the scale range of the model output space, improving training convergence efficiency and prediction stability.
[0045] In one embodiment, Figure 2 The following is a diagram of the training process of the target detection model. The training process of the target detection model may include:
[0046] Step S201: construct a training data set, and annotate the rotation target box based on the rotation axis representation to obtain the rotation axis representation annotation result.
[0047] The training dataset is sourced from public image resources, professional industry image libraries, remote sensing image collections, or acquired through image acquisition equipment. The images in the training dataset include a variety of object instances with rotational characteristics. In real-world scenarios, objects contained in these images typically exhibit various orientations and deformation states, with obvious rotational characteristics, and are therefore collectively referred to as rotated objects.
[0048] In order to enable the object detection model to accurately learn the orientation information and spatial morphological features of these rotated objects in the image, it is necessary to annotate each rotated object in the training dataset. Specifically, a rotated object box is annotated for each rotated object in the image. The rotated object box can first be represented by a five-tuple, that is, ,in, and Indicates the center point location, and Indicates the width and height of the rotation target box, Represents the rotation angle, i.e., the angle between the rotated target box and the horizontal axis of the image. Based on the position of the rotated target box on the rotation axis, the rotation axis representation is used to describe the orientation and geometric configuration of the rotated target box, thereby obtaining the rotation axis representation annotation result for each rotated target box. The rotation axis representation annotation result reflects the direction vectors of the wide side axis and the high side axis of the rotated target box in the image plane.
[0049] In one embodiment, the rotation axis representation models the rotating target box in the form of a structured six-tuple, which includes the coordinates of the center point of the rotating target box, the first rotation axis vector and the second rotation axis vector, which together constitute six numerical components. , used to indicate the center position of the rotation target box in the image; the first rotation axis vector It is used to describe the posture of the rotating target frame along the high side direction (i.e. the long side direction). The first rotation axis vector takes the center point as the starting point and points to the vector of the rotating target frame in the high side direction in the image. The vector length is half of the high side length. The second rotation axis vector The first rotation axis vector and the second rotation axis vector form a set of local rectangular coordinate axes to accurately describe the spatial orientation of the rotating target frame. Specifically, refer to Figure 5 As shown, combining the size and rotation angle of the rotating target frame, and utilizing the spatial position relationship between the rotating target frame and the rotation axis, the first rotation axis vector Defined as:
[0050]
[0051] in, Indicates the height of the rotation target box, Represents the angle between the rotation target box and the horizontal axis of the image. The first rotation vector Represents the spatial direction starting from the center point to the high side.
[0052] Second rotation axis vector Defined as:
[0053]
[0054] in, Indicates the width of the rotation target box, the second rotation axis vector It represents the spatial direction along the width direction starting from the center point.
[0055] Through the joint expression of the center point coordinates and two sets of direction vectors, the rotation axis representation can not only fully define the spatial geometric structure of the target box, but also adapt to changes in the rotation angle. It can effectively avoid the angle discontinuity problem that occurs in the traditional rotation box parameter representation, and significantly improve the target detection model's ability to express and learn rotated targets.
[0056] Step S202 : normalize the rotation axis representation annotation result to obtain a normalized rotation axis representation annotation result.
[0057] To adapt the rotation axis representation to the training requirements of the object detection model, the rotation axis representation annotation results need to be normalized to obtain normalized rotation axis representation annotation results at a unified scale. The purpose of normalization is to map the spatial position and orientation information of different image sizes and object scales to a unified numerical range, thereby enhancing the model's ability to learn the target's spatial features, improving training efficiency and prediction accuracy.
[0058] The normalization process is essentially to perform a linear transformation on the geometric components in the rotation axis representation according to the reference space in which they are located, and map them to the interval [0,1]. In this embodiment, the rotation axis representation includes six components, namely the center point coordinates of the rotating target frame, the first rotation axis vector and the second rotation axis vector, which respectively reflect the position, direction and boundary distribution characteristics of the target. After normalization, the center point coordinate component is mapped to a proportional position relative to the image size, reflecting the relative position of the target in the image; the components of the two rotation axis vectors are converted into directional offsets with reference to the width and height of the image, reflecting the relative shape and rotation structure of the rotating target in the two main axis directions.
[0059] In the rotation axis representation, the rotation target box is represented by a six-tuple tensor, including the center point coordinate mark , first rotation axis vector and the second rotation axis vector In practical applications, since the width and height of the image are and , the center point coordinates of the rotation target frame , first rotation axis vector and the second rotation axis vector There are certain scope constraints, specifically:
[0060] refer to Figure 5 As shown, the center point coordinates satisfy ,and , that is, it is always within the image plane;
[0061] First rotation axis vector The two components of ,and ;
[0062] Second rotation axis vector The two components of ,and .
[0063] Based on this, in order to achieve feature learning under a unified scale, the rotation axis representation annotation results are normalized to the width of the image. and height As a reference standard, the above six components are mapped to the interval [0,1].
[0064] During the normalization process, the center point coordinates Normalize according to the image size, convert to relative position, and the normalized center point It can be expressed as:
[0065]
[0066] Among them, the normalized center point Indicates the normalized position coordinates of the defect target box relative to the width and height of the image.
[0067] First rotation axis vector Then perform linear mapping according to the image width and height, and shift the value range to the [0,1] interval, and the normalized first rotation axis vector It can be expressed as:
[0068]
[0069]
[0070] First rotation axis vector Perform the same linear transformation and translation, and the normalized second rotation axis vector is It can be expressed as:
[0071]
[0072]
[0073] After normalization, the spatial geometric parameters, which are directional and scalar, are compressed into a uniform fixed range, eliminating the influence of different image sizes, object scales, and poses, ensuring that all six normalized components fall within the interval [0, 1]. This processed data format is more suitable for object detection model building and learning, facilitating stable model convergence and accurately capturing the spatial distribution characteristics of rotating objects.
[0074] In step S203 , the training data set is input into the target detection model, and the normalized rotation axis annotation result is used as a label to iteratively train the target detection model.
[0075] The training dataset consists of image samples and their corresponding normalized rotation axis representation annotation results. Each image sample may contain one or more rotated targets, and each target is represented by a rotation axis in the form of a six-tuple and normalized. The training dataset is input into the target detection model batch by batch, and the normalized rotation axis representation annotation results are used as label data to guide the model to gradually optimize the network parameters through backpropagation. During the training process, the target detection model can effectively capture the spatial directional characteristics of the rotating target box in the image. Through iterative training, the model gradually masters the ability to automatically extract the position, direction and boundary contour of the rotating target from the image content, and finally can output the normalized rotation axis representation prediction results in the inference stage, thereby realizing the accurate detection and positioning of the rotating target.
[0076] In one embodiment, Figure 3 The figure shows a schematic diagram of the loss function value calculation process of the target detection model, which may include:
[0077] Step S301: Denormalize the output result of the target detection model to obtain the rotation axis representation prediction result in the training phase.
[0078] During the model training phase, the object detection model takes image samples from the training dataset as input. The output during training is the normalized rotation axis representation prediction of the rotated object bounding box, constrained to the range [0, 1]. Since the model learns normalized spatial features, to facilitate consistency measurement with the rotation axis representation annotation results, the model output must first be denormalized to restore its geometric meaning in the original physical space. This results in the rotation axis representation prediction at the actual scale of the training phase.
[0079] It can be understood that the normalized rotation axis representation prediction result is a linear mapping of the components of the rotation axis representation in the image size normalized space. Essentially, it encodes the spatial information of the rotated target frame in the image as a relative value between 0 and 1. Therefore, based on the actual size parameters of the image, the normalized vector is scaled and offset corrected, and the normalized components output by the model are mapped back to the original physical space to obtain the corresponding rotation axis representation prediction result.
[0080] Among them, in the training stage, the normalized rotation axis representation prediction result output by the target detection model corresponds to the representation of the training label, which usually includes the center point coordinates, the first rotation axis vector and the normalized values of the second rotation axis vector, denoted as .
[0081] The denormalization of the center point coordinates is to restore the relative position to the coordinate value in the image pixel space. The center point coordinates after denormalization are Specifically expressed as:
[0082]
[0083]
[0084] in, and Represents the width and height of the image respectively.
[0085] The first rotation axis vector undergoes a linear scaling and then translation transformation during the normalization process. The denormalization process requires reverse restoration. The first rotation axis vector after denormalization is Specifically expressed as:
[0086]
[0087]
[0088] Similarly, the second rotation axis vector after denormalization is Specifically expressed as:
[0089]
[0090]
[0091] In addition, in order to further ensure that the geometric structure between the rotation axis vectors conforms to the actual characteristics of the rotating target frame, it is necessary to introduce vector orthogonalization processing. Since the two main axes of the rotating target should maintain an orthogonal relationship, the second rotation axis vector is Projection onto the first rotation axis vector In the orthogonal direction, thereby eliminating its parallel component in the direction of the first vector. The projection operation is specifically expressed as:
[0092]
[0093] The above projection processing ensures that the second rotation axis vector and the first rotation axis vector maintain an orthogonal structure in a geometric sense, which helps to improve the structural rationality of the model output results and is consistent with the orthogonality constraint of the subsequent loss function.
[0094] Step S302 , calculating the loss function value between the rotation axis representation prediction result and the supervision label in the training phase, and performing backpropagation and optimization on the model parameters based on the loss function value.
[0095] The normalized rotation axis representation is designed to improve model learning efficiency during training. However, the normalized rotation axis representation itself is a relative quantity that has been scaled and translated, and lacks direct geometric interpretation. Furthermore, the rotation axis representation is a structural representation of the rotated object at the original image scale, directly reflecting the object's position, shape, and orientation. Therefore, to effectively measure the geometric deviation of the model's predictions in the loss function, the supervised labels for model training should be the original rotation axis representation annotations.
[0096] Based on this, supervised training is performed using the prediction and annotation results of the rotation axis representation during the training phase, employing various loss functions, such as the L1 loss function and the rotation intersection-over-union loss function, to calculate the loss function value. In practical applications, the loss function calculation results serve as the training signal for the object detection model and are input into the neural network's backpropagation mechanism. The backpropagation algorithm automatically calculates the gradient of the loss function with respect to each network parameter, and, combined with an optimization algorithm, adjusts the model parameters to minimize the loss function value.
[0097] As training iterations continue, the object detection model can output a more accurate representation of the rotation axis, enabling it to better restore the position, shape, and orientation of the rotated object in the original coordinate system, ultimately improving the overall detection performance and the accuracy of rotated object modeling.
[0098] In one embodiment, in order to improve the object detection model's ability to model the spatial relationship between two principal axis vectors in a rotated object frame, a cosine distance-based loss function is additionally introduced during the model training process.
[0099] During the training phase, the rotation axis representation predicted by the object detection model contains the first rotation axis vector and the second rotation axis vector . The model needs to learn and maintain the spatial structural characteristics between the two vectors to accurately reflect the geometry and orientation of the rotating target frame. In order to quantify this relationship, the cosine distance is used to quantify the angular relationship between the two vectors as the basis for constructing the loss function. This angular relationship reflects the orthogonality or degree of near-orthogonality of the two principal axis vectors. Orthogonality is a key manifestation of the consistency of the target boundary direction and an important basis for accurately describing the rotating target. Based on this, in this embodiment, a loss function of the following form is constructed:
[0100]
[0101] In the above formula, This function represents the cosine similarity between two vectors. The closer its value is to 1, the closer the two vectors are to being perpendicular to each other. During training, by minimizing the value of this cosine distance loss function, the model can effectively learn and maintain the appropriate geometric structure between the rotation axes, helping to improve the representation accuracy and directional consistency of the rotated target bounding box, making the final prediction more closely aligned with the spatial distribution characteristics of the real target.
[0102] In one embodiment, a rotating object detection frame typically has clear directional attributes and length and width boundary characteristics in its physical structure. Its two principal axes (i.e., the widthwise axis and the heightwise axis) should be orthogonal. Therefore, in the rotation axis representation, the first rotation axis vector and the second rotation axis vector must satisfy orthogonality in a right-handed coordinate system. That is, the two vectors must have a 90-degree angle between them and follow the directionality prescribed by the right-hand rule.
[0103] To guide the object detection model in learning and maintaining this geometric relationship, a right-handed orthogonality constraint between rotation axis vectors is introduced during training. Specifically, by introducing a cosine distance-based loss function and incorporating a supervision term related to the directional relationship between the rotation axes, the object detection model not only optimizes the numerical fit of each axial vector but also simultaneously learns the orthogonal directional structure between them.
[0104] During training, the object detection model continuously adjusts its parameters while automatically correcting the orientation of its output rotation axis vectors, ensuring that the predictions more closely match the actual spatial form of the rotating object. Ultimately, the trained object detection model consistently outputs a rotation axis representation that adheres to right-handed orthogonality, improving the geometric consistency and physical interpretability of the detection results.
[0105] Step S102 : converting the normalized rotation axis representation prediction result into a corresponding prediction size tensor.
[0106] The predicted result of the normalized rotation axis representation essentially expresses the directional characteristics of the two principal axes of the rotating target bounding box at a standard scale. It is a spatial structure representation with strong directionality and normalized scale. The predicted result of the normalized rotation axis representation describes the pose and shape contour orientation of the rotating target bounding box along the two axes in the 2D image plane, but does not directly contain the actual geometric size information of the rotating target bounding box. Therefore, to effectively restore the rotated target bounding box, it is necessary to further parse the predicted result of the normalized rotation axis representation into a size tensor containing a specific numerical scale.
[0107] Specifically, based on the predicted normalized rotation axis representation and combined with the original size parameters of the image to be detected, the conversion process of the rotated target box from the standardized scale to the actual image scale can be completed, thereby generating a predicted size tensor with geometric size significance. In practical applications, the predicted size tensor expresses the main parameters of the rotated target box in the form of a five-tuple, which are the center point position, rotation angle, and spatial elements such as width and height. Among them, the center point position is used to calibrate the geometric center coordinates of the rotated target box in the image plane; the rotation angle describes the angle between the target's main axis and the horizontal axis of the image to accurately express the target's posture direction; the width and height are used to represent the side length values of the rotated target box along the two orthogonal axes, which are quantitative descriptions of the outer contour of the rotated target box.
[0108] In this embodiment, the predicted size tensor is a structured representation that highly integrates the spatial position, orientation attributes and size boundary information of the rotating target, which can fully express the geometric contour and posture characteristics of the target in the image, thereby converting the normalized rotation axis representation prediction result into a predicted size tensor, which can restore the shape and size of the rotating target box in the image to be detected.
[0109] In one embodiment, Figure 4 A schematic diagram of a process flow for normalizing the rotation axis representation is shown, which may include the following steps:
[0110] Step S401 : Denormalize the normalized rotation axis representation prediction result to obtain a corresponding rotation axis representation prediction result.
[0111] To restore the normalized rotation axis representation predictions output by the object detection model to a geometric representation in the true image coordinate system, denormalization is required. The normalized rotation axis representation predictions are obtained by linearly compressing the center point position and two rotation axis vectors of the rotated object bounding box after normalizing the image size. This is primarily used to improve the numerical stability and convergence efficiency of network training. Therefore, denormalization is required to enable subsequent processing to recover the true geometric structure of the object in the image.
[0112] Among them, the normalized rotation axis represents the prediction result and is recorded as .
[0113] The denormalization of the center point coordinates is to restore the relative position to the coordinate value in the image pixel space. The center point coordinates after denormalization are Specifically expressed as:
[0114]
[0115]
[0116] in, and Represents the width and height of the image respectively.
[0117] The first rotation axis vector undergoes a linear scaling and then translation transformation during the normalization process. The denormalization process requires reverse restoration. The first rotation axis vector after denormalization is Specifically expressed as:
[0118]
[0119]
[0120] Similarly, the second rotation axis vector after denormalization is Specifically expressed as:
[0121]
[0122]
[0123] In addition, in order to further ensure that the geometric structure between the rotation axis vectors conforms to the actual characteristics of the rotating target frame, it is necessary to introduce vector orthogonalization processing. Since the two main axes of the rotating target should maintain an orthogonal relationship, the second rotation axis vector is Projection onto the first rotation axis vector In the orthogonal direction, thereby eliminating its parallel component in the direction of the first vector. The projection operation is specifically expressed as:
[0124]
[0125] The above projection processing ensures that the second rotation axis vector and the first rotation axis vector maintain an orthogonal structure in a geometric sense, which helps to improve the structural rationality of the model output result.
[0126] Step S402: The spatial position relationship of the prediction results is represented based on the rotation axis and converted into a prediction size tensor.
[0127] The predicted rotation axis representation provides the geometric spatial relationship of the rotated object in the image. The combination of its center point and the two principal axis vectors not only clarifies the location of the object box but also implies its size and orientation. Therefore, based on the spatial position relationship in the predicted rotation axis representation, we perform parsing and transformation to obtain a structured predicted size tensor.
[0128] Specifically, the rotation axis indicates that the prediction result contains the center point coordinates , first rotation axis vector and the second rotation axis vector Among them, the two axis vectors represent the vectors starting from the center point and extending along the high side and wide side of the target, respectively. The first rotation axis vector The length of the vector is half of the length of the high side, and the second rotation axis vector The length of the vector is half of the length of the broad side. Figure 5 As shown, the key parameters describing the target size and posture can be extracted through geometric calculation.
[0129] Among them, the width It can be calculated from the modulus length of the second rotation axis vector. The conversion relationship between the two can be expressed as:
[0130]
[0131] high It can be calculated from the modulus of the first rotation vector, and the conversion relationship between the two can be expressed as:
[0132]
[0133] Rotation angle Represents the rotation direction of the rotating target frame relative to the horizontal axis, usually the angle between the first rotation axis and the horizontal axis. The conversion relationship can be expressed as:
[0134]
[0135] Based on this, the geometric information derived from the spatial relationship is integrated into a set of structured predicted size tensors This predicted size tensor fully describes the position, size, and pose characteristics of the rotated target box.
[0136] It should be noted that the normalized rotation axis representation is a relative structural parameter at the image scale, typically distributed in the range [0, 1], and is suitable for model learning. Therefore, the prediction output by the target detection model is the normalized rotation axis representation prediction result. However, the normalized rotation axis representation prediction result is essentially a relative quantity and needs to be converted into a geometric expression based on the image coordinate system, namely the rotation axis representation prediction result, which is used to accurately describe the actual position, morphological orientation, and spatial structure of the rotated target box in the image to be detected. Furthermore, the rotation axis representation is converted into a unified predicted size tensor to express the size and posture information of the rotated target in a structured manner, which is suitable for subsequent detection result output and reasoning processes.
[0137] In practical applications, such as Figure 6 As shown, Figure 6 The data flow diagram of rotating target detection is shown, including the structure and data flow process of the model training stage and the model inference stage.
[0138] During the model training phase, we first use the regular five-tuple representation of the rotated target box As a starting point, obtain the rotation axis representation through geometric transformation , and then normalize it to get the normalized rotation axis representation annotation result The normalized rotation axis representation annotation results are used as labels to input into the object detection model for training. The normalized rotation axis representation prediction results are then output. For supervised learning, these prediction results are denormalized to restore them to the rotation axis representation prediction results. These results are then compared with the original rotation axis representation annotation results. A loss function is then calculated to reflect the difference between the predicted and true values. Finally, the model parameters are optimized through backpropagation.
[0139] In the model inference phase, the image to be detected is input into the trained object detection model, and the model outputs the normalized rotation axis representation prediction result. Subsequently, the normalized result is first denormalized to obtain the rotation axis representation prediction result, and then converted into a conventional prediction size tensor based on the spatial position relationship between the predicted rotation axis vectors. .
[0140] It should be noted that Refers to each tensor in the rotation axis representation, which does not mean that the rotation axis representation annotation result is the same as the rotation axis representation prediction result; similarly, Refers to each tensor of the normalized rotation axis representation, which does not mean that the normalized rotation axis representation annotation result is the same as the normalized rotation axis representation prediction result.
[0141] The rotating target detection method based on the rotation axis in the above-mentioned embodiment effectively improves the stability and numerical consistency of the rotating target representation by introducing a normalized rotation axis representation as the training and prediction object of the target detection model, facilitating the model's learning of the target's spatial geometric characteristics. During the inference phase, the rotating target box is modeled using the rotation axis representation, which intuitively expresses the rotation box's orientation information and geometric structure. Furthermore, the normalized rotation axis representation prediction output by the model accurately restores the actual-sized rotation box parameters, enabling precise positioning and posture description of rotating targets in the image.
[0142] In one embodiment, a rotating target detection device based on a rotating axis is provided, referring to Figure 7 As shown, the rotating target detection device 500 based on the rotating axis may include: a model processing module 501 and a data processing module 502.
[0143] The model processing module 501 is used to obtain an image to be detected, input the image to be detected into a pre-trained target detection model, and output a normalized rotation axis representation prediction result of a rotated target box in the image to be detected; wherein the target detection model is trained based on the normalized rotation axis representation annotation result in the training data set; the normalized rotation axis representation annotation result is a representation vector obtained by performing rotation axis representation and normalization processing on the rotated target box in the training data set;
[0144] The data processing module 502 is used to convert the normalized rotation axis representation prediction result into a corresponding predicted size tensor; the predicted size tensor includes the center point coordinates, width, height and rotation angle of the rotated target box in the image to be detected.
[0145] In one embodiment, during the model training process, the model processing module 501 is specifically used to construct a training data set, and annotate the rotating target frame based on the rotation axis representation to obtain the rotation axis representation annotation result; normalize the rotation axis representation annotation result to obtain the normalized rotation axis representation annotation result; input the training data set into the target detection model, and iteratively train the target detection model using the normalized rotation axis representation annotation result as a label.
[0146] In one embodiment, the rotation axis representation includes the center point coordinates of the rotating target frame, a first rotation axis vector and a second rotation axis vector; the first rotation axis vector represents a vector in the direction of the high side with the center point as the starting point, and the vector length is half of the high side length; the second rotation axis vector represents a vector in the direction of the wide side with the center point as the starting point, and the vector length is half of the wide side length.
[0147] In one embodiment, the model processing module 501 is specifically used to perform denormalization on the output results of the target detection model to obtain the rotation axis representation prediction results in the training stage; calculate the loss function value between the rotation axis representation prediction results in the training stage and the rotation axis representation annotation results, and backpropagate and optimize the model parameters based on the loss function value.
[0148] In one embodiment, the model processing module 501 is specifically used to calculate the cosine distance between the first rotation axis vector and the second rotation axis vector in the rotation axis representation prediction result in the training phase, and construct a loss function based on the cosine distance.
[0149] In one embodiment, the loss function is used to ensure that the first rotation axis vector and the second rotation axis vector predicted by the object detection model satisfy an orthogonality constraint.
[0150] In one embodiment, the data processing module 502 is specifically used to perform denormalization processing on the normalized rotation axis representation prediction result to obtain the corresponding rotation axis representation prediction result; and convert it into a prediction size tensor based on the spatial position relationship of the rotation axis representation prediction result.
[0151] The specific limitations of the rotating target detection device 500 based on a rotating axis can be found in the limitations of the rotating target detection method based on a rotating axis described above and will not be further elaborated here. Each module within the rotating target detection device 500 based on a rotating axis can be implemented in whole or in part via software, hardware, or a combination thereof. Each module can be embedded in or independent of a processor within a computer device in hardware form, or stored in a computer device memory in software form, allowing the processor to call and execute the corresponding operations of each module.
[0152] In one embodiment, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, a rotating target detection method based on a rotating axis is implemented.
[0153] In one embodiment, a computer storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, a rotating target detection method based on a rotating axis is implemented.
[0154] It should be noted that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by, or in conjunction with, an instruction execution system, apparatus, or device (e.g., a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device). For purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by, or in conjunction with, an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection with one or more wires (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and a portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in another suitable manner if necessary, and then storing it in a computer memory.
[0155] It should be understood that various components of the present invention may be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods may be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof may be used: a discrete logic circuit having logic gate circuits for implementing logic functions on data signals, an application-specific integrated circuit having suitable combinational logic gate circuits, a programmable gate array (PGA), a field-programmable gate array (FPGA), etc.
[0156] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
[0157] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.
[0158] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.
Claims
1. A rotating target detection method based on a rotating axis, characterized in that: include: Acquire an image to be detected, input the image to be detected into a pre-trained object detection model, and output a normalized rotation axis representation prediction result of a rotated object box in the image to be detected; wherein the object detection model is trained based on the normalized rotation axis representation annotation result in a training data set; the normalized rotation axis representation annotation result is a representation vector obtained by performing rotation axis representation and normalization processing on the rotated object box in the training data set; Converting the normalized rotation axis representation prediction result into a corresponding predicted size tensor; the predicted size tensor includes the center point coordinates, width, height and rotation angle of the rotated target box in the image to be detected; Among them, the rotation axis representation is to represent the rotation characteristics of the rotating target frame by the two direction axes inside the rotating target frame; the two direction axes correspond to the geometric boundary directions of the rotating target frame, which are used to express the directionality and scale distribution of the target frame; the normalization processing is to perform numerical normalization processing on the rotation axis representation so that the obtained representation vector falls into a unified numerical range.
2. The rotating target detection method based on the rotating axis according to claim 1, characterized in that: The training process of the target detection model includes: Constructing the training data set, and annotating the rotation target frame based on the rotation axis representation to obtain a rotation axis representation annotation result; Normalizing the rotation axis representation labeling result to obtain the normalized rotation axis representation labeling result; The training data set is input into the target detection model, and the target detection model is iteratively trained using the normalized rotation axis representation annotation result as a label.
3. The rotating target detection method based on the rotating axis according to claim 2, characterized in that: The rotation axis representation includes the center point coordinates of the rotating target frame, a first rotation axis vector and a second rotation axis vector; the first rotation axis vector represents a vector in the high side direction with the center point as the starting point, and the vector length is half of the high side length; the second rotation axis vector represents a vector in the wide side direction with the center point as the starting point, and the vector length is half of the wide side length.
4. The rotating target detection method based on the rotation axis according to claim 3, characterized in that: Inputting the training data set into the target detection model, and iteratively training the target detection model using the normalized rotation axis representation annotation result as a label, includes: Denormalize the output of the target detection model to obtain the rotation axis representation prediction result in the training phase; The loss function value between the rotation axis representation prediction result and the rotation axis representation annotation result in the training phase is calculated, and the model parameters are back-propagated and optimized based on the loss function value.
5. The rotating target detection method based on the rotating axis according to claim 4, characterized in that: The calculation of the loss function value between the rotation axis representation prediction result and the rotation axis representation annotation result in the training phase includes: The cosine distance between the first rotation axis vector and the second rotation axis vector in the rotation axis representation prediction result in the training phase is calculated, and a loss function is constructed based on the cosine distance.
6. The rotating target detection method based on the rotating axis according to claim 5, characterized in that: The loss function is used to ensure that the first rotation axis vector and the second rotation axis vector predicted by the target detection model meet an orthogonality constraint.
7. The rotating target detection method based on the rotating axis according to claim 1, characterized in that: The converting the normalized rotation axis representation prediction result into a corresponding prediction size tensor includes: Performing a denormalization process on the normalized rotation axis representation prediction result to obtain a corresponding rotation axis representation prediction result; The spatial position relationship of the prediction results is represented based on the rotation axis and converted into the prediction size tensor.
8. A rotating target detection device based on a rotating axis, characterized in that: include: A model processing module is configured to obtain an image to be detected, input the image to be detected into a pre-trained target detection model, and output a normalized rotation axis representation prediction result of a rotated target box in the image to be detected; wherein the target detection model is trained based on the normalized rotation axis representation annotation result in a training data set; the normalized rotation axis representation annotation result is a representation vector obtained by performing rotation axis representation and normalization processing on the rotated target box in the training data set; A data processing module, configured to convert the normalized rotation axis representation prediction result into a corresponding prediction size tensor; The predicted size tensor includes the center point coordinates, width, height and rotation angle of the rotated target box in the image to be detected; Among them, the rotation axis representation is to represent the rotation characteristics of the rotating target frame by the two direction axes inside the rotating target frame; the two direction axes correspond to the geometric boundary directions of the rotating target frame, which are used to express the directionality and scale distribution of the target frame; the normalization processing is to perform numerical normalization processing on the rotation axis representation so that the obtained representation vector falls into a unified numerical range.
9. An electronic device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the rotating target detection method based on the rotation axis according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the rotating target detection method based on the rotation axis according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Yolov5-based remote sensing directed target detection method
CN113920443A
Diaphorina citri intelligent detection method and device based on deep learning
CN116682106A