Method and apparatus for evaluating anchor box quality

CN115908931BActive Publication Date: 2026-08-18BEIJING ZHIDA TIANJIE COMMERCIAL OPERATION MANAGEMENT CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202211532111.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-01
Publication Date
2026-08-18
Estimated Expiration
2042-12-01

AI Technical Summary

Technical Problem

[0004]有鉴于此,本公开实施例提供了一种锚框质量的评估方法、、装置、电子设备及计算机可读存储介质,以解决现有技术中,无法评估锚框质量的问题

Benefits of technology

[0009] The beneficial effects of this disclosure embodiment compared with the prior art are as follows: This disclosure embodiment obtains a training dataset and uses a feature extraction network to extract feature vectors from each training image in the training dataset. The training dataset includes: obtaining a detection dataset, which includes: multiple categories, multiple detection images for each category, and multiple labels on each detection image; using a detection model to generate multiple anchor boxes corresponding to each label on each detection image, and cropping the corresponding anchor box image from the detection image after generating each anchor box; inputting all anchor box images into an anchor box classification model and outputting the category quality score of each anchor box image; inputting all anchor box images into an anchor box recognition model and outputting the recognition quality score of each anchor box image; and evaluating the ability of the detection model to generate high-quality anchor boxes based on the category quality score and recognition quality score of all anchor box images. Therefore, by adopting the above technical means, the problem of not being able to evaluate anchor box quality in the prior art can be solved, thus proposing a method for evaluating anchor box quality.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115908931B_ABST
    Figure CN115908931B_ABST
Patent Text Reader

Abstract

The present disclosure relates to the technical field of picture processing, and provides an anchor frame quality evaluation method and device. The method comprises: obtaining a training data set, and extracting a feature vector of each training picture in the training data set by using a feature extraction network; generating, by using a detection model, a plurality of anchor frames corresponding to each label on each detection picture, and cutting an anchor frame picture corresponding to each anchor frame from the detection picture after each anchor frame is generated; inputting all anchor frame pictures into an anchor frame classification model to output a category quality score of each anchor frame picture; inputting all anchor frame pictures into an anchor frame recognition model to output a recognition quality score of each anchor frame picture; and evaluating the ability of the detection model to generate high-quality anchor frames according to the category quality scores and the recognition quality scores of all anchor frame pictures. The above technical means solves the problem in the prior art that anchor frame quality cannot be evaluated.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of image processing technology, and in particular to a method and apparatus for evaluating the quality of anchor frames. Background Technology

[0002] Most existing object detection technologies are based on anchor boxes. Anchor boxes, also known as candidate boxes, are considered higher quality during model training if they closely match the label; that is, the more overlap between the anchor box and the labeled box, the higher the anchor box's quality. However, the number of anchor boxes generated during detection is enormous and varies greatly in quality. Treating all anchor boxes equally is unreasonable, as each anchor box contributes to the training process and results in some loss. Current technologies do not differentiate between anchor boxes based on their quality.

[0003] In realizing the present invention, the inventors discovered at least the following technical problem in the related technology: the inability to assess the quality of the anchor frame. Summary of the Invention

[0004] In view of this, the present disclosure provides a method, apparatus, electronic device, and computer-readable storage medium for evaluating the quality of anchor frames, in order to solve the problem that the quality of anchor frames cannot be evaluated in the prior art.

[0005] A first aspect of this disclosure provides a method for evaluating anchor box quality, comprising: acquiring a training dataset and extracting feature vectors for each training image in the training dataset using a feature extraction network, wherein the training dataset includes: acquiring a detection dataset, wherein the detection dataset includes: multiple categories, multiple detection images for each category, and multiple labels on each detection image; generating multiple anchor boxes corresponding to each label on each detection image using a detection model, and cropping the anchor box image corresponding to each anchor box from the detection image after generating each anchor box; inputting all anchor box images into an anchor box classification model and outputting a category quality score for each anchor box image; inputting all anchor box images into an anchor box recognition model and outputting a recognition quality score for each anchor box image; and evaluating the ability of the detection model to generate high-quality anchor boxes based on the category quality scores and recognition quality scores of all anchor box images.

[0006] A second aspect of this disclosure provides an anchor frame quality evaluation apparatus, comprising: an acquisition module configured to acquire a detection dataset, wherein the detection dataset includes: multiple categories, multiple detection images for each category, and multiple labels on each detection image; a generation module configured to generate multiple anchor frames corresponding to each label on each detection image using a detection model, and to crop an anchor frame image corresponding to each anchor frame from the detection image after generating each anchor frame; a classification module configured to input all anchor frame images into an anchor frame classification model and output a category quality score for each anchor frame image; a recognition module configured to input all anchor frame images into an anchor frame recognition model and output a recognition quality score for each anchor frame image; and an evaluation module configured to evaluate the ability of the detection model to generate high-quality anchor frames based on the category quality scores and recognition quality scores of all anchor frame images.

[0007] A third aspect of this disclosure provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the method described above.

[0008] A fourth aspect of this disclosure provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the above-described method.

[0009] The beneficial effects of this disclosure embodiment compared with the prior art are as follows: This disclosure embodiment obtains a training dataset and uses a feature extraction network to extract feature vectors from each training image in the training dataset. The training dataset includes: obtaining a detection dataset, which includes: multiple categories, multiple detection images for each category, and multiple labels on each detection image; using a detection model to generate multiple anchor boxes corresponding to each label on each detection image, and cropping the corresponding anchor box image from the detection image after generating each anchor box; inputting all anchor box images into an anchor box classification model and outputting the category quality score of each anchor box image; inputting all anchor box images into an anchor box recognition model and outputting the recognition quality score of each anchor box image; and evaluating the ability of the detection model to generate high-quality anchor boxes based on the category quality score and recognition quality score of all anchor box images. Therefore, by adopting the above technical means, the problem of not being able to evaluate anchor box quality in the prior art can be solved, thus proposing a method for evaluating anchor box quality. Attached Figure Description

[0010] To more clearly illustrate the technical solutions in the embodiments of this disclosure, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0011] Figure 1 This is a schematic diagram illustrating an application scenario of an embodiment of this disclosure;

[0012] Figure 2 This is a flowchart illustrating a method for evaluating the quality of an anchor frame provided in an embodiment of this disclosure;

[0013] Figure 3 This is a schematic diagram of the structure of an anchor frame quality evaluation device provided in an embodiment of this disclosure;

[0014] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this disclosure. Detailed Implementation

[0015] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, so as to provide a thorough understanding of the embodiments of this disclosure. However, those skilled in the art will understand that this disclosure may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this disclosure with unnecessary detail.

[0016] The following will describe in detail, with reference to the accompanying drawings, a method and apparatus for evaluating the quality of an anchor frame according to an embodiment of the present disclosure.

[0017] Figure 1 This is a schematic diagram illustrating an application scenario of an embodiment of this disclosure. The application scenario may include terminal devices 101, 102, and 103, server 104, and network 105.

[0018] Terminal devices 101, 102, and 103 can be hardware or software. When terminal devices 101, 102, and 103 are hardware, they can be various electronic devices with displays that support communication with server 104, including but not limited to smartphones, tablets, laptops, and desktop computers. When terminal devices 101, 102, and 103 are software, they can be installed in the aforementioned electronic devices. Terminal devices 101, 102, and 103 can be implemented as multiple software programs or software modules, or as a single software program or software module; this disclosure does not impose any limitations on this. Furthermore, various applications can be installed on terminal devices 101, 102, and 103, such as data processing applications, instant messaging tools, social platform software, search applications, shopping applications, etc.

[0019] Server 104 can be a server that provides various services, such as a backend server that receives requests sent by terminal devices with which it has established communication connections. This backend server can receive and analyze the requests sent by the terminal devices and generate processing results. Server 104 can be a single server, a server cluster consisting of several servers, or a cloud computing service center. This embodiment of the disclosure does not impose any limitations on these aspects.

[0020] It should be noted that server 104 can be either hardware or software. When server 104 is hardware, it can be various electronic devices that provide various services to terminal devices 101, 102, and 103. When server 104 is software, it can be multiple software programs or software modules that provide various services to terminal devices 101, 102, and 103, or it can be a single software program or software module that provides various services to terminal devices 101, 102, and 103. This disclosure does not limit the scope of the embodiments.

[0021] Network 105 can be a wired network using coaxial cable, twisted pair, and fiber optic connection, or it can be a wireless network that enables interconnection of various communication devices without wiring, such as Bluetooth, Near Field Communication (NFC), Infrared, etc. This disclosure does not limit the scope of the network.

[0022] Users can establish a communication connection with server 104 via network 105 through terminal devices 101, 102, and 103 to receive or send information, etc. It should be noted that the specific types, quantities, and combinations of terminal devices 101, 102, and 103, server 104, and network 105 can be adjusted according to the actual needs of the application scenario, and this disclosure embodiment does not impose any limitations on this.

[0023] Figure 2This is a flowchart illustrating a method for evaluating the quality of an anchor frame provided in an embodiment of this disclosure. Figure 2 The method for evaluating the quality of anchor frames can be derived from... Figure 1 The computer or server, or the software on the computer or server, executes the command. For example... Figure 2 As shown, the method for evaluating the quality of the anchor frame includes:

[0024] S201, Obtain the detection dataset, which includes: multiple categories, multiple detection images for each category, and multiple labels on each detection image;

[0025] S202, using the detection model to generate multiple anchor boxes corresponding to each label in each detection image, and cropping the anchor box image corresponding to each anchor box from the detection image after generating each anchor box;

[0026] S203: Input all anchor frame images into the anchor frame classification model and output the category quality score for each anchor frame image;

[0027] S204: Input all anchor frame images into the anchor frame recognition model and output the recognition quality score for each anchor frame image.

[0028] S205, based on the category quality score and recognition quality score of all anchor frame images, evaluate the ability of the detection model to generate high-quality anchor frames.

[0029] For example, the detection dataset includes categories such as people, cats, dogs, rabbits, and pigeons. There are multiple detection images for each category, and multiple labels on each detection image. It should be noted that multiple categories can appear on a single detection image, such as a detection image containing two people, a cat, and a dog (the labels for people, cats, and dogs are all selected).

[0030] The detection model can be any commonly used object detection model. This embodiment aims to evaluate the detection model's ability to generate high-quality anchor boxes. Therefore, the detection model generates multiple anchor boxes corresponding to each label on each detected image. Then, an anchor box classification model and an anchor box recognition model are used to evaluate the corresponding anchor box images. The anchor box classification model and anchor box recognition model can be residual neural networks. The category quality score and recognition quality score of all anchor box images can be weighted and summed according to preset weights. The final result of the weighted summation is used to evaluate the detection model's ability to generate high-quality anchor boxes.

[0031] According to the technical solution provided in this disclosure, a training dataset is obtained, and a feature extraction network is used to extract the feature vector of each training image in the training dataset. The training dataset includes: obtaining a detection dataset, which includes multiple categories, multiple detection images for each category, and multiple labels on each detection image; using a detection model to generate multiple anchor boxes corresponding to each label on each detection image, and cropping the corresponding anchor box image from the detection image after generating each anchor box; inputting all anchor box images into an anchor box classification model and outputting the category quality score of each anchor box image; inputting all anchor box images into an anchor box recognition model and outputting the recognition quality score of each anchor box image; and evaluating the ability of the detection model to generate high-quality anchor boxes based on the category quality score and recognition quality score of all anchor box images. Therefore, by adopting the above technical means, the problem of not being able to evaluate anchor box quality in the prior art can be solved, thus proposing a method for evaluating anchor box quality.

[0032] Before utilizing the anchor box classification and recognition models, model training is required, including: obtaining a public dataset, which includes multiple categories, multiple images for each category, and multiple labels for each image; placing multiple anchor boxes corresponding to each label on each image, and calculating the intersection-over-union ratio (IoU) between each anchor box and its corresponding label; selecting a preset number of anchor boxes for each label based on the IoU; cropping the training image corresponding to each anchor box from the selected images; labeling each training image with its category identifier, its corresponding label identifier, and its corresponding IoU, thus obtaining the training dataset; and training the anchor box classification and recognition models using the training dataset.

[0033] The public dataset can be an existing dataset. This embodiment processes the public dataset to obtain the training dataset required for this embodiment. The anchor box classification model and anchor box recognition model are trained using the training dataset. Multiple anchor boxes corresponding to each label in each image are placed on each image. This can be generated using the detection model in this disclosure or other models used for object detection. The intersection-union ratio (IUU) function is used to calculate the ratio of the intersection to the union between the anchor box and its corresponding label, which is the IUU value between the anchor box and its corresponding label. For example, if 50 anchor boxes are placed on each image for each label, 10 anchor boxes with an IUU value greater than 0.3 are selected, and 10 anchor boxes with an IUU value less than 0.3 are selected, resulting in 50 anchor boxes selected for each label. The training image corresponding to the anchor box has the same meaning as the anchor box image corresponding to the anchor box mentioned above; this is only to distinguish that the training image is from the training dataset, while the anchor box image is from the validation dataset. Through annotation processing, each training image has an identifier for its category, an identifier for its corresponding label, and its corresponding IUU value.

[0034] The anchor box classification model is trained using the training dataset, including: inputting all training images from the training dataset into the anchor box classification model and outputting the probability value of each training image for each category; and training the anchor box classification model using a first loss function based on the label and the highest probability value corresponding to each training image, wherein the highest probability value corresponding to each training image is related to the category quality score of that training image.

[0035] For example, if a training image is input into an anchor box classification model, the output will show that the probability of the training image being a human is 0.5, the probability of the training image being a cat is 0.1, the probability of the training image being a dog is 0.1, and so on, with the highest probability value corresponding to the training image being 0.5.

[0036] First loss function loss1:

[0037] loss1=Σ-(y*log(p)+(1-y)*log(1-p))

[0038] Where y and p are the label and the highest probability value corresponding to each training image, respectively.

[0039] -(y*log(p)+(1-y)*log(1-p)) is the loss corresponding to a single training image. The summation of the losses corresponding to all training images yields the value of the loss1 function.

[0040] The anchor box recognition model is trained using a training dataset, including: inputting all training images from the training dataset into the anchor box recognition model and outputting a feature vector corresponding to each training image; calculating a first loss value for each training image using a second loss function based on the intersection-union ratio (IU) of each training image and the feature vectors of that training image and its corresponding first target image, where the first target image corresponding to each training image is another training image, and each training image and its corresponding first target image have the same label; calculating a second loss value for each training image using a third loss function based on the feature vectors of each training image and its corresponding second target image, where the second target image corresponding to each training image is another training image, and each training image and its corresponding second target image belong to the same category but have different labels; calculating a third loss value for each training image using a fourth loss function based on the feature vectors of each training image and its corresponding first and second target images; and training an anchor box classification model using the first, second, and third loss values ​​of each training image, where the feature vectors of each training image and its corresponding first and second target images are related to the recognition quality score of that training image.

[0041] Second loss function loss2:

[0042] loss2 = iou b *(1-dot(f a ,f b ))

[0043] iou b f is the intersection-union ratio for each training image. b and f a These are the feature vectors of the training image and its corresponding first target image, respectively, with dot indicating the calculation of the vector inner product.

[0044] Third loss function: loss3

[0045] loss3 = dot(f c ,f b )

[0046] f c This is the feature vector corresponding to the second target image corresponding to the training image;

[0047] loss4 = max(0, dot(f) c ,f b )+0.3-dot(f a ,f b ))

[0048] max() is the maximum value function.

[0049] For example, let's denote a training image as b, its corresponding first target image as a, and its corresponding second target image as c, iou b f is the intersection-union ratio between b and its corresponding label, which is also its corresponding intersection-union ratio. b f a and f c These are the feature vectors corresponding to b, a, and c, respectively.

[0050] After evaluating the detection model's ability to generate high-quality anchor boxes based on the category quality score and recognition quality score of all anchor box images, the method further includes: calculating the target loss value between each label and its corresponding anchor box using the target loss function; and updating the model parameters of the detection model using the target loss value to complete the training of the detection model and improve its ability to generate high-quality anchor boxes.

[0051] The objective loss function is the loss function of the detection model. It is used to calculate the objective loss value between each label and its corresponding anchor box. The higher the quality of the anchor box corresponding to the label, the smaller the objective loss value. The objective loss function can also be divided into two parts: classification and regression. The classification part is similar to the loss function of the anchor box classification model, and the regression part is similar to the loss function of the anchor box recognition model.

[0052] All of the above-mentioned optional technical solutions can be combined in any way to form the optional embodiments of this application, and will not be described in detail here.

[0053] The following are embodiments of the apparatus disclosed herein, which can be used to execute embodiments of the method disclosed herein. For details not disclosed in the apparatus embodiments of this disclosure, please refer to the embodiments of the method disclosed herein.

[0054] Figure 3 This is a schematic diagram of an anchor frame quality evaluation device provided in an embodiment of this disclosure. Figure 3 As shown, the device for evaluating the quality of the anchor frame includes:

[0055] The acquisition module 301 is configured to acquire the detection dataset, which includes: multiple categories, multiple detection images for each category, and multiple labels on each detection image;

[0056] The generation module 302 is configured to use the detection model to generate multiple anchor boxes corresponding to each label in each detection image, and to crop the anchor box image corresponding to each anchor box from the detection image after generating each anchor box.

[0057] Category module 303 is configured to input all anchor frame images into the anchor frame classification model and output the category quality score for each anchor frame image;

[0058] The recognition module 304 is configured to input all anchor frame images into the anchor frame recognition model and output the recognition quality score of each anchor frame image.

[0059] Evaluation module 305 is configured to evaluate the detection model’s ability to generate high-quality anchor boxes based on the category quality score and recognition quality score of all anchor box images.

[0060] For example, the detection dataset includes categories such as people, cats, dogs, rabbits, and pigeons. There are multiple detection images for each category, and multiple labels on each detection image. It should be noted that multiple categories can appear on a single detection image, such as a detection image containing two people, a cat, and a dog (the labels for people, cats, and dogs are all selected).

[0061] The detection model can be any commonly used object detection model. This embodiment aims to evaluate the detection model's ability to generate high-quality anchor boxes. Therefore, the detection model generates multiple anchor boxes corresponding to each label on each detected image. Then, an anchor box classification model and an anchor box recognition model are used to evaluate the corresponding anchor box images. The anchor box classification model and anchor box recognition model can be residual neural networks. The category quality score and recognition quality score of all anchor box images can be weighted and summed according to preset weights. The final result of the weighted summation is used to evaluate the detection model's ability to generate high-quality anchor boxes.

[0062] According to the technical solution provided in this disclosure, a training dataset is obtained, and a feature extraction network is used to extract the feature vector of each training image in the training dataset. The training dataset includes: obtaining a detection dataset, which includes multiple categories, multiple detection images for each category, and multiple labels on each detection image; using a detection model to generate multiple anchor boxes corresponding to each label on each detection image, and cropping the corresponding anchor box image from the detection image after generating each anchor box; inputting all anchor box images into an anchor box classification model and outputting the category quality score of each anchor box image; inputting all anchor box images into an anchor box recognition model and outputting the recognition quality score of each anchor box image; and evaluating the ability of the detection model to generate high-quality anchor boxes based on the category quality score and recognition quality score of all anchor box images. Therefore, by adopting the above technical means, the problem of not being able to evaluate anchor box quality in the prior art can be solved, thus proposing a method for evaluating anchor box quality.

[0063] Optionally, the acquisition module 301 is further configured to acquire a public dataset, wherein the public dataset includes: multiple categories, multiple images of each category, and multiple labels on each image; multiple anchor boxes corresponding to each label on each image are plotted on each image, and the intersection-over-union ratio (IoU) between each anchor box and its corresponding label is calculated; a preset number of anchor boxes are selected for each label based on the IoU between each label and its corresponding anchor box; a training image corresponding to each anchor box is cropped from the image of each selected anchor box; the identifier of its category, the identifier of its corresponding label, and its corresponding IoU are labeled on each training image to obtain a training dataset; and the anchor box classification model and the anchor box recognition model are trained using the training dataset.

[0064] The public dataset can be an existing dataset. This embodiment processes the public dataset to obtain the training dataset required for this embodiment. The anchor box classification model and anchor box recognition model are trained using the training dataset. Multiple anchor boxes corresponding to each label in each image are placed on each image. This can be generated using the detection model in this disclosure or other models used for object detection. The intersection-union ratio (IUU) function is used to calculate the ratio of the intersection to the union between the anchor box and its corresponding label, which is the IUU value between the anchor box and its corresponding label. For example, if 50 anchor boxes are placed on each image for each label, 10 anchor boxes with an IUU value greater than 0.3 are selected, and 10 anchor boxes with an IUU value less than 0.3 are selected, resulting in 50 anchor boxes selected for each label. The training image corresponding to the anchor box has the same meaning as the anchor box image corresponding to the anchor box mentioned above; this is only to distinguish that the training image is from the training dataset, while the anchor box image is from the validation dataset. Through annotation processing, each training image has an identifier for its category, an identifier for its corresponding label, and its corresponding IUU value.

[0065] Optionally, the acquisition module 301 is further configured to input all training images in the training dataset into the anchor box classification model, output the probability value of each training image for each category; and train the anchor box classification model using a first loss function based on the label and the highest probability value corresponding to each training image, wherein the highest probability value corresponding to each training image is related to the category quality score of the training image.

[0066] For example, if a training image is input into an anchor box classification model, the output will show that the probability of the training image being a human is 0.5, the probability of the training image being a cat is 0.1, the probability of the training image being a dog is 0.1, and so on, with the highest probability value corresponding to the training image being 0.5.

[0067] First loss function loss1:

[0068] loss1=∑-(y*log(p)+(1-y)*log(1-p))

[0069] Where y and p are the label and the highest probability value corresponding to each training image, respectively.

[0070] -(y*log(p)+(1-y)*log(1-p)) is the loss corresponding to a single training image. The summation of the losses corresponding to all training images yields the value of the loss1 function.

[0071] Optionally, the acquisition module 301 is further configured to input all training images in the training dataset into the anchor box recognition model and output the feature vector corresponding to each training image; based on the intersection-union ratio (IU) of each training image and the feature vector corresponding to the training image and its corresponding first target image, calculate the first loss value corresponding to each training image using a second loss function, wherein the first target image corresponding to each training image is another training image, and each training image and its corresponding first target image have the same label; based on the feature vector corresponding to each training image and its corresponding second target image, calculate the second loss value corresponding to each training image using a third loss function, wherein the second target image corresponding to each training image is another training image, and each training image and its corresponding second target image belong to the same category but have different labels; based on the feature vector corresponding to each training image and its corresponding first and second target images, calculate the third loss value corresponding to each training image using a fourth loss function; train the anchor box classification model using the first, second, and third loss values ​​corresponding to each training image, wherein the feature vector corresponding to each training image and its corresponding first and second target images is related to the recognition quality score of the training image.

[0072] Second loss function loss2:

[0073] loss2 = iou b *(1-dot(f a ,f b ))

[0074] iou b f is the intersection-union ratio for each training image. b and f a These are the feature vectors of the training image and its corresponding first target image, respectively, with dot indicating the calculation of the vector inner product.

[0075] Third loss function: loss3

[0076] loss3 = dot(f c ,f b )

[0077] f cThis is the feature vector corresponding to the second target image corresponding to the training image;

[0078] loss4 = max(0, dot(f) c ,f b )+0.3-dot(f a ,f b ))

[0079] max() is the maximum value function.

[0080] For example, let's denote a training image as b, its corresponding first target image as a, and its corresponding second target image as c, iou b f is the intersection-union ratio between b and its corresponding label, which is also its corresponding intersection-union ratio. b f a and f c These are the feature vectors corresponding to b, a, and c, respectively.

[0081] Optionally, the evaluation module 305 is also configured to calculate the target loss value between each label and its corresponding anchor box using the target loss function; and to update the model parameters of the detection model using the target loss value to complete the training of the detection model and improve the ability of the detection model to generate high-quality anchor boxes.

[0082] The objective loss function is the loss function of the detection model. It is used to calculate the objective loss value between each label and its corresponding anchor box. The higher the quality of the anchor box corresponding to the label, the smaller the objective loss value. The objective loss function can also be divided into two parts: classification and regression. The classification part is similar to the loss function of the anchor box classification model, and the regression part is similar to the loss function of the anchor box recognition model.

[0083] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this disclosure.

[0084] Figure 4 This is a schematic diagram of the electronic device 4 provided in an embodiment of this disclosure. Figure 4 As shown, the electronic device 4 of this embodiment includes: a processor 401, a memory 402, and a computer program 403 stored in the memory 402 and executable on the processor 401. When the processor 401 executes the computer program 403, it implements the steps in the various method embodiments described above. Alternatively, when the processor 401 executes the computer program 403, it implements the functions of each module / unit in the various device embodiments described above.

[0085] Electronic device 4 can be a desktop computer, laptop, handheld computer, cloud server, or other electronic device. Electronic device 4 may include, but is not limited to, processor 401 and memory 402. Those skilled in the art will understand that... Figure 4 This is merely an example of electronic device 4 and does not constitute a limitation on electronic device 4. It may include more or fewer components than shown, or different components.

[0086] The processor 401 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

[0087] The memory 402 can be an internal storage unit of the electronic device 4, such as a hard disk or RAM of the electronic device 4. The memory 402 can also be an external storage device of the electronic device 4, such as a plug-in hard disk, Smart Media Card (SMC), Secure Digital (SD) card, Flash Card, etc., equipped on the electronic device 4. The memory 402 can also include both internal and external storage units of the electronic device 4. The memory 402 is used to store computer programs and other programs and data required by the electronic device.

[0088] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0089] If an integrated module / unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program may include computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium may include: any entity or device capable of carrying computer program code, recording media, USB flash drives, portable hard drives, magnetic disks, optical disks, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in a computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in a jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.

[0090] The above embodiments are only used to illustrate the technical solutions of this disclosure, and are not intended to limit it. Although this disclosure has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this disclosure, and should all be included within the protection scope of this disclosure.

Claims

1. A method for evaluating the quality of an anchor frame, characterized in that, include: Obtain the detection dataset, wherein the detection dataset includes: multiple categories, multiple detection images for each category, and multiple labels on each detection image; The detection model is used to generate multiple anchor boxes corresponding to each label in each detection image, and the anchor box image corresponding to each anchor box is cropped from the detection image after each anchor box is generated. Input all anchor frame images into the anchor frame classification model and output the category quality score for each anchor frame image; Input all anchor frame images into the anchor frame recognition model and output the recognition quality score for each anchor frame image; The ability of the detection model to generate high-quality anchor boxes is evaluated based on the category quality score and recognition quality score of all anchor box images, including: weighting and summing the category quality score and recognition quality score of all anchor box images according to preset weights, and using the final result of the weighted summation to evaluate the ability of the detection model to generate high-quality anchor boxes; Obtain a public dataset, wherein the public dataset includes: multiple categories, multiple images for each category, and multiple labels on each image; On each image, lay out multiple anchor boxes corresponding to each label in the image, and calculate the intersection-union ratio between each anchor box and its corresponding label; Based on the intersection ratio between each label and its corresponding anchor frame, select a preset number of anchor frames for each label; The training image corresponding to each selected anchor box is cropped from the image of each anchor box. Each training image is labeled with its category identifier, its corresponding label identifier, and its corresponding intersection-union ratio to obtain the training dataset; Input all training images in the training dataset into the anchor box recognition model, and output the feature vector corresponding to each training image; Based on the intersection-union ratio of each training image and the feature vector of the training image and its corresponding first target image, the first loss value of each training image is calculated using the second loss function. The first target image corresponding to each training image is another training image, and the labels of each training image and its corresponding first target image are the same. Based on the feature vectors of each training image and its corresponding second target image, the second loss value of each training image is calculated using the third loss function. The second target image corresponding to each training image is another training image, and each training image and its corresponding second target image belong to the same category but have different labels. Based on the feature vectors of each training image and its corresponding first and second target images, the third loss value for each training image is calculated using the fourth loss function. The anchor box classification model is trained using the first loss value, the second loss value, and the third loss value corresponding to each training image. The feature vectors of each training image and its corresponding first target image and second target image are related to the recognition quality score of the training image.

2. The method according to claim 1, characterized in that, Training the anchor box classification model using the training dataset includes: Input all training images in the training dataset into the anchor box classification model, and output the probability value of each training image for each category; Based on the label and the highest probability value corresponding to each training image, the anchor box classification model is trained using a first loss function, wherein the highest probability value corresponding to each training image is related to the category quality score of that training image.

3. The method according to claim 2, characterized in that, The first loss function loss1: Where y and p are the label and the highest probability value corresponding to each training image, respectively.

4. The method according to claim 1, characterized in that, The second loss function, loss2: iou b f is the intersection-union ratio for each training image. b and f a These are the feature vectors of the training image and its corresponding first target image, respectively, with dot indicating the calculation of the vector inner product. The third loss function loss3: f c This is the feature vector corresponding to the second target image corresponding to the training image; max() is the maximum value function.

5. The method according to claim 1, characterized in that, After evaluating the ability of the detection model to generate high-quality anchor boxes based on the category quality score and recognition quality score of all anchor box images, the method further includes: The target loss function is used to calculate the target loss value between each label and its corresponding anchor box. The model parameters of the detection model are updated using the target loss value to complete the training of the detection model and improve the ability of the detection model to generate high-quality anchor boxes.

6. A device for evaluating the quality of an anchor frame, characterized in that, include: The acquisition module is configured to acquire a detection dataset, wherein the detection dataset includes: multiple categories, multiple detection images for each category, and multiple labels on each detection image; acquire a public dataset, wherein the public dataset includes: multiple categories, multiple images for each category, and multiple labels on each image; lay out multiple anchor boxes corresponding to each label on each image, and calculate the intersection-over-union ratio (IoU) between each anchor box and its corresponding label; select a preset number of anchor boxes for each label based on the IoU between each label and its corresponding anchor box; crop the training image corresponding to each anchor box from the image of each selected anchor box; label each training image with the identifier of its category, the identifier of its corresponding label, and its corresponding IoU, to obtain a training dataset; input all training images in the training dataset into the anchor box recognition model, and output the feature vector corresponding to each training image; and based on the IoU corresponding to each training image and the first target image corresponding to that training image... The anchor box classification model is trained using the feature vectors corresponding to each training image and a second loss function. The first target image corresponding to each training image is another training image, and each training image shares the same label as its corresponding first target image. Based on the feature vectors of each training image and its corresponding second target image, a second loss function is used to calculate the second loss value for each training image. The second target image corresponding to each training image is another training image, and each training image belongs to the same category but has different labels. Based on the feature vectors of each training image and its corresponding first and second target images, a third loss function is used to calculate the third loss value for each training image. The anchor box classification model is trained using the first, second, and third loss values ​​for each training image. The feature vectors of each training image and its corresponding first and second target images are correlated with the recognition quality score of that training image. The generation module is configured to use the detection model to generate multiple anchor boxes corresponding to each label in each detection image, and to crop the anchor box image corresponding to each anchor box from the detection image after generating each anchor box. The category module is configured to input all anchor frame images into the anchor frame classification model and output a category quality score for each anchor frame image. The recognition module is configured to input all anchor frame images into the anchor frame recognition model and output the recognition quality score for each anchor frame image. The evaluation module is configured to evaluate the detection model's ability to generate high-quality anchor boxes based on the category quality score and recognition quality score of all anchor box images.

7. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the steps of the method as described in any one of claims 1 to 5.

8. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method as described in any one of claims 1 to 5.

Citation Information

Patent Citations

  • Anchor frame generation method for image target detection processing and lightweight target detection method

    CN112101430A

  • Picture analysis model adjustment method and device and computer readable storage medium

    CN114359669A

  • Target detection method based on optimized anchor frame mechanism

    CN114863199A