Model optimization method, device, equipment, storage medium and computer program product
By performing loss value calculation and fusion processing on training images, the parameters of the image prediction model are optimized, which solves the problem of noise interference caused by manual annotation information and improves the performance and accuracy of the image classification model.
Patent Information
- Application Number
- CN202210262876.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-17
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-03-17
AI Technical Summary
In the existing technology, the performance of image classification models is lower than expected, mainly due to the subjectivity and noise of manual annotation information, resulting in poor performance of the feature extraction module.
By acquiring training images and performing image processing according to different loss value calculation indicators, extracting features, calculating loss values, and fusion processing of the loss values, we can optimize the parameters of the image prediction model and reduce the model loss value, thereby constructing high-performance images. Classification model to avoid the interference of manual annotation information.
It improves the performance of the image classification model, outputs more accurate results, avoids noise interference caused by manual annotation information, and enhances the stability and accuracy of the model.
Smart Images

Figure CN114936998B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a model optimization method, device, equipment, storage medium and computer program product. Background Art
[0002] At present, before classifying any image, the feature extraction module in the image classification model can usually be trained based on the training sample set, so that the trained image classification model can be used to extract features of any image, and the extracted image features can be used to predict the category. However, in the process of training the feature extraction module, the existing technology usually trains the feature extraction module based on the difference between the manual annotation information of each sample image in the training sample set and the corresponding prediction information; due to the subjectivity of the manual annotation information, the manual annotation information of each sample image in the training sample set is noisy, so that the model performance of the feature extraction module trained based on the manual annotation information is low, which in turn leads to the low model performance of the image classification model. Based on this, how to improve the model performance of the feature extraction module and thus improve the model performance of the image classification model has become a research hotspot. Summary of the invention
[0003] The embodiments of the present application provide a model optimization method, apparatus, device, storage medium and computer program product, which can improve the model performance of the image prediction model to construct an image classification model with better model performance. In other words, the embodiments of the present application can improve the model performance of the image classification model.
[0004] On the one hand, an embodiment of the present application provides a model optimization method, the method comprising:
[0005] Acquire a training image, and perform image processing on the training image according to image processing tasks corresponding to one or more loss value calculation indicators, to obtain one or more images of the training image under each loss value calculation indicator;
[0006] The image prediction model is called respectively to perform feature extraction on each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator;
[0007] Calculating the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and fusing the loss values of the training image under the one or more loss value calculation indicators to obtain a model loss value of the image prediction model;
[0008] The model parameters in the image prediction model are optimized in a direction of reducing the model loss value to construct an image classification model.
[0009] On the other hand, an embodiment of the present application provides a model optimization device, the device comprising:
[0010] An acquisition unit, used for acquiring a training image;
[0011] A processing unit, configured to perform image processing on the training image according to image processing tasks corresponding to one or more loss value calculation indicators, to obtain one or more images of the training image under each loss value calculation indicator;
[0012] The processing unit is further used to call the image prediction model to perform feature extraction on each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator;
[0013] The processing unit is further configured to calculate the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and perform fusion processing on the loss values of the training image under the one or more loss value calculation indicators to obtain a model loss value of the image prediction model;
[0014] The processing unit is also used to optimize the model parameters in the image prediction model in a direction of reducing the model loss value to construct an image classification model.
[0015] In another aspect, an embodiment of the present application provides a computer device, the computer device comprising a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the following steps are implemented:
[0016] Acquire a training image, and perform image processing on the training image according to image processing tasks corresponding to one or more loss value calculation indicators, to obtain one or more images of the training image under each loss value calculation indicator;
[0017] The image prediction model is called respectively to perform feature extraction on each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator;
[0018] Calculating the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and fusing the loss values of the training image under the one or more loss value calculation indicators to obtain a model loss value of the image prediction model;
[0019] The model parameters in the image prediction model are optimized in a direction of reducing the model loss value to construct an image classification model.
[0020] In another aspect, an embodiment of the present application provides a computer storage medium, wherein the computer storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the following steps:
[0021] Acquire a training image, and perform image processing on the training image according to image processing tasks corresponding to one or more loss value calculation indicators, to obtain one or more images of the training image under each loss value calculation indicator;
[0022] The image prediction model is called respectively to perform feature extraction on each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator;
[0023] Calculating the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and fusing the loss values of the training image under the one or more loss value calculation indicators to obtain a model loss value of the image prediction model;
[0024] The model parameters in the image prediction model are optimized in a direction of reducing the model loss value to construct an image classification model.
[0025] On the other hand, an embodiment of the present application provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, it implements the above-mentioned model optimization method.
[0026] After acquiring the training image, the embodiment of the present application can first perform image processing on the training image according to the image processing tasks corresponding to one or more loss value calculation indicators, and obtain one or more images of the training image under each loss value calculation indicator; then, the image prediction model is called to extract features of each image under each loss value calculation indicator, and the image features of each image under each loss value calculation indicator are obtained, and then the loss value of the training image under each loss value calculation indicator can be calculated according to each image feature under each loss value calculation indicator, so as to obtain the model loss value of the image prediction model, so as to optimize the model parameters in the image prediction model in the direction of reducing the model loss value, so as to improve the model performance of the image prediction model, and then construct an image classification model with better model performance, that is, the embodiment of the present application can improve the model performance of the image classification model. In addition, the embodiment of the present application does not introduce noisy artificial annotation information in the model optimization process, which can effectively avoid the interference caused by artificial label information, and then better construct the image classification model, so that the constructed image classification model can output more accurate results. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0028] Figure 1a It is a flow chart of a model optimization solution provided in an embodiment of the present application;
[0029] Figure 1b is a schematic diagram of interaction between a terminal and a server provided in an embodiment of the present application;
[0030] Figure 2 It is a flow chart of a model optimization method provided in an embodiment of the present application;
[0031] Figure 3 It is a flow chart of another model optimization method provided in an embodiment of the present application;
[0032] Figure 4 It is a flow chart of another model optimization method provided in an embodiment of the present application;
[0033] Figure 5a is a schematic diagram of a flower screen detection result provided in an embodiment of the present application;
[0034] Figure 5b is a schematic diagram of another flower screen detection result provided in an embodiment of the present application;
[0035] Figure 6 It is a structural schematic diagram of a model optimization device provided in an embodiment of the present application;
[0036] Figure 7 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0037] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0038] With the continuous development of Internet technology, artificial intelligence (AI) technology has also been better developed. The so-called artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0039] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. The basic technologies of artificial intelligence generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, mechatronics and other technologies. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0040] Machine Learning (ML) is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Deep learning is a technology that uses deep neural network systems to perform machine learning; machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and self-learning.
[0041] Based on computer vision technology and machine learning / deep learning technology in AI technology, the embodiment of the present application proposes a model optimization method to improve the model performance of the image prediction model, and then build an image classification model with better model performance. It should be noted that the embodiment of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc.
[0042] See also Figure 1aAs shown, the general principle of the model optimization scheme proposed in the embodiment of the present application is as follows: First, a training image can be obtained, and the training image can be processed according to the image processing tasks corresponding to one or more loss value calculation indicators to obtain one or more images of the training image under each loss value calculation indicator. Then, based on the one or more images of the training image under each loss value calculation indicator, the image prediction model can be optimized to construct an image classification model; specifically, the image prediction model can be called to extract features of each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator; and the loss value of the training image under each loss value calculation indicator is calculated according to each image feature under each loss value calculation indicator, so as to fuse the loss value of the training image under one or more loss value calculation indicators to obtain the model loss value of the image prediction model, and then the model parameters in the image prediction model can be optimized in the direction of reducing the model loss value to construct an image classification model.
[0043] Practice has shown that the model optimization scheme proposed in the embodiments of the present application can have at least the following beneficial effects: ① The model loss value of the image prediction model can be determined based on one or more images of the training image under each loss value calculation indicator, and then the model performance of the image prediction model can be improved through the model loss value, so as to construct an image classification model with better model performance and improve the model performance of the image classification model; ② The entire training process does not require the participation of artificial labels, which can effectively overcome the interference of noisy artificial labels on model training.
[0044] In a specific implementation, the model optimization scheme mentioned above can be executed by a computer device, which can be a terminal or a server; wherein the terminal mentioned here can include but is not limited to: mobile phones, computers, smart watches, intelligent voice interaction devices, smart home appliances, vehicle terminals, aircraft, etc.; various clients (applications, APPs) can be run in the terminal, such as video playback clients, social clients, browser clients, information flow clients, education clients, etc. The server mentioned here can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), as well as basic cloud computing services such as big data and artificial intelligence platforms, etc. Furthermore, the computer device mentioned in the embodiments of the present application may be located outside or inside the blockchain network, without limitation. The so-called blockchain network is a network composed of a peer-to-peer network (P2P network) and a blockchain, and the blockchain refers to a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. It is essentially a decentralized database, a string of data blocks (or blocks) generated by cryptographic methods.
[0045] Alternatively, in other embodiments, the above-mentioned model optimization scheme may also be jointly executed by the server and the terminal; the terminal and the server may be directly or indirectly connected via wired or wireless communication, which is not limited in this application. For example: the terminal may be responsible for acquiring the training image, and determining one or more images of the training image under each loss value calculation indicator, and then sending the one or more images of the training image under each loss value calculation indicator to the server; so that the server can optimize the image prediction model based on the one or more images of the training image under each loss value calculation indicator to construct an image classification model, such as Figure 1b As shown. For another example, the terminal may obtain a training image and send the training image to the server; so that the server can determine one or more images of the training image under each loss value calculation indicator, and then calculate the model loss value of the image prediction model based on the one or more images of the training image under each loss value calculation indicator, and send the model loss value of the image prediction model to the terminal; further, the terminal optimizes the model parameters in the image prediction model in the direction of reducing the model loss value to construct an image classification model. It should be understood that only two situations in which the terminal and the server jointly execute the above-mentioned model optimization scheme are exemplarily described here, and are not exhaustive.
[0046] Based on the relevant description of the above model optimization scheme, the embodiment of the present application proposes a model optimization method, which can be executed by the computer device (terminal or server) mentioned above; or, the model optimization method can be executed by the terminal and the server together. For the convenience of explanation, the following description will be based on the example of a computer device executing the model optimization method; please refer to Figure 2 , the model optimization method may include the following steps S201-S204:
[0047] S201, obtaining a training image, and performing image processing on the training image according to image processing tasks corresponding to one or more loss value calculation indicators, to obtain one or more images of the training image under each loss value calculation indicator.
[0048] In an embodiment of the present application, the above-mentioned one or more loss value calculation indicators include but are not limited to: a consistency loss value calculation indicator and an angle prediction loss value calculation indicator, etc.; that is, one or more loss value calculation indicators may include a consistency loss value calculation indicator, may also include an angle prediction loss value calculation indicator, may also include a consistency loss value calculation indicator and an angle prediction loss value calculation indicator, etc., and the present application does not impose any restrictions on this.
[0049] It should be noted that the methods for obtaining the above training images include but are not limited to the following:
[0050] The first acquisition method: the computer device may first obtain an image download link, and then download the image according to the image download link; if the number of images corresponding to the image download link is 1, the downloaded image is used as a training image; if the number of images corresponding to the image download link is greater than 1, an image may be selected from the downloaded images as a training image. Alternatively, the computer device may select an image from one or more stored images, and use the selected image as a training image.
[0051] The second acquisition method: the computer device may be configured with a shooting component, and the computer device may collect images in the environment through the shooting component, and use the collected images as training images.
[0052] The third acquisition method: the computer device may first acquire any video data, and extract a frame of image from the any video data, and then use the extracted image as a training image.
[0053] It should be understood that the above training image is any image in the training image set, and accordingly, the computer device can use each image in the training image set to optimize the image prediction model to construct an image classification model; that is, the computer device can use each image in the training image set as the above training image. The training image set may include at least one image in the downloaded images, one or more captured images, at least one frame of image in one or more video data, and so on.
[0054] S202, respectively calling the image prediction model to perform feature extraction on each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator.
[0055] It should be noted that the image prediction model may refer to a CNN (Convolutional Neural Networks) model or a ResNet (Residual Network) model, and this application does not impose any restrictions on this; that is, this application does not impose any restrictions on the specific network structure of the image prediction model. For example, computer equipment can use a more mature CNN model as the structure of a deep network to further improve the effect.
[0056] S203, respectively calculating the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and fusing the loss values of the training image under one or more loss value calculation indicators to obtain a model loss value of the image prediction model.
[0057] It should be understood that the computer device can calculate the loss value of the training image under any loss value calculation indicator based on the various image features under the loss value calculation indicator, that is, the computer device can not introduce noisy artificial annotation information, then correspondingly, the model optimization method proposed in this application is a process of learning and robustly training the image prediction model through a self-supervised learning strategy.
[0058] It should be noted that when the training image is any image in the training image set, the computer device can use each image in the training image set to perform model training on the image prediction model. Accordingly, the loss values of each image in the training image set under one or more loss value calculation indicators can be fused to obtain the model loss value of the image prediction model.
[0059] S204, optimizing the model parameters in the image prediction model in a direction of reducing the model loss value to construct an image classification model.
[0060] It should be noted that the method proposed in this application can be applied to the image flower screen detection task. In this case, the constructed image classification model can be used for flower screen detection of any image, that is, the image classification model can be used to determine whether any image is a flower screen detection result (such as a flower screen image or a normal image); or, the method proposed in this application can also be applied to the image clarity detection task. In this case, the constructed image classification model can be used for clarity detection of any image, that is, the image classification model can be used to determine whether any image is clear (such as a clear image or an unclear image), etc.; this application does not limit this. Among them, flower screen detection refers to the detection of whether an image (i.e., a picture) has a flower screen phenomenon, and the final output result can be the probability value of the current image being a flower screen image, that is, the flower screen confidence, and then the binary result of whether the current image is a flower screen image can be output; and clarity detection refers to the detection of whether an image is clear, and the final output result can refer to the probability value of the current image being a clear image, etc.
[0061] After acquiring the training image, the embodiment of the present application can first perform image processing on the training image according to the image processing tasks corresponding to one or more loss value calculation indicators, and obtain one or more images of the training image under each loss value calculation indicator; then, the image prediction model is called to extract features of each image under each loss value calculation indicator, and the image features of each image under each loss value calculation indicator are obtained, and then the loss value of the training image under each loss value calculation indicator can be calculated according to each image feature under each loss value calculation indicator, so as to obtain the model loss value of the image prediction model, so as to optimize the model parameters in the image prediction model in the direction of reducing the model loss value, so as to improve the model performance of the image prediction model, and then construct an image classification model with better model performance, that is, the embodiment of the present application can improve the model performance of the image classification model. In addition, the embodiment of the present application does not introduce noisy artificial annotation information in the model optimization process, which can effectively avoid the interference caused by artificial label information, and then better construct the image classification model, so that the constructed image classification model can output more accurate results.
[0062] See also Figure 3 , is a flowchart of another model optimization method provided in an embodiment of the present application. The model optimization method can be executed by the computer device (terminal or server) mentioned above; or, the model optimization method can be executed by the terminal and the server together. For the convenience of explanation, the following description will be based on the example of a computer device executing the model optimization method; please refer to Figure 3 , the model optimization method may include the following steps S301-S308:
[0063] S301, obtaining a training image, and performing image processing on the training image according to image processing tasks corresponding to one or more loss value calculation indicators, to obtain one or more images of the training image under each loss value calculation indicator.
[0064] In one embodiment, one or more loss value calculation indicators include a consistency loss value calculation indicator, and the image processing task corresponding to the consistency loss value calculation indicator refers to an image quality adjustment task; then accordingly, when the computer device performs image processing on the training image according to the image processing tasks corresponding to the one or more loss value calculation indicators, and obtains one or more images of the training image under each loss value calculation indicator, the computer device can perform image processing on the training image according to the image quality adjustment task to adjust one or more image quality influencing factors of the training image, and obtain at least two image quality adjusted images of the training image under the consistency loss value calculation indicator.
[0065] It should be noted that the above one or more factors affecting image quality include but are not limited to: illumination, contrast and saturation, etc. Among them, illumination can also be called brightness, that is, the illumination of the image refers to the brightness of the light shining on the image. The greater the illumination of the image, the more dazzling or glaring the image will appear, and the smaller the illumination of the image, the darker the image will appear; contrast refers to the difference between different colors. The greater the contrast, the greater the contrast between different colors. Correspondingly, the smaller the contrast, the smaller the contrast between different colors; saturation refers to the concentration of the image color. The higher the saturation, the fuller the color. Correspondingly, the lower the saturation, the older and darker the color will appear, and when the saturation is 0, the image is a grayscale image. It should be understood that the present application does not limit the specific method of image processing for training images according to the image quality adjustment task; illustratively, the present application can achieve the effect of data enhancement through changes in illumination, contrast and saturation, but the data enhancement means used by the present application for unlabeled data are not limited to changes in illumination, contrast and saturation, and more complex data enhancement means can also be used to further improve the effect.
[0066] In another embodiment, one or more loss value calculation indicators include an angle prediction loss value calculation indicator, and the image processing task corresponding to the angle prediction loss value calculation indicator refers to an image angle rotation task; then correspondingly, when the computer device performs image processing on the training image according to the image processing tasks corresponding to the one or more loss value calculation indicators, and obtains one or more images of the training image under each loss value calculation indicator, the computer device can perform image angle rotation processing on the training image according to the target rotation angle to obtain the angle rotated image of the training image under the angle prediction loss value calculation indicator. Optionally, the computer device can construct a label for the angle rotated image of the training image, that is, the computer device can use the target rotation angle as the angle label of the angle rotated image, so as to calculate the corresponding loss value based on the angle label of the angle rotated image in the subsequent process.
[0067] It is worth noting that the above-mentioned target rotation angle can be a rotation angle randomly generated by a computer device, or it can be a preset rotation angle, and this application does not impose any restrictions on this.
[0068] It should be understood that when one or more loss value calculation indicators include a consistency loss value calculation indicator and an angle prediction loss value calculation indicator, the computer device can perform image processing on the training image according to the image quality adjustment task to obtain at least two quality adjusted images of the training image under the consistency loss value calculation indicator; and the computer device can perform image angle rotation processing on the training image according to the target rotation angle to obtain an angle rotated image of the training image under the angle prediction loss value calculation indicator.
[0069] S302, respectively calling the image prediction model to extract features of each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator.
[0070] It should be noted that the image prediction model may include a feature extraction module, that is, the computer device can call the feature extraction module in the image prediction model respectively, perform feature extraction on each image under each loss value calculation indicator, and obtain the image features of each image under each loss value calculation indicator.
[0071] It can be understood that when one or more loss value calculation indicators include a consistency loss value calculation indicator, the computer device can call the image prediction model to perform feature extraction on each of the at least two image quality adjustment images mentioned above, and obtain image features of each of the at least two image quality adjustment images; when one or more loss value calculation indicators include an angle prediction loss value calculation indicator, the computer device can call the image prediction model to perform feature extraction on the angle rotation image mentioned above, and obtain image features of the angle rotation image; when one or more loss value calculation indicators include a consistency loss value calculation indicator and an angle prediction loss value calculation indicator, the computer device can call the image prediction model to perform feature extraction on each of the at least two image quality adjustment images, and call the image prediction model to perform feature extraction on the angle rotation image, so as to obtain image features of each of the at least two image quality adjustment images, and image features of the angle rotation image.
[0072] S303, respectively calculating the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and fusing the loss values of the training image under the one or more loss value calculation indicators to obtain a model loss value of the image prediction model.
[0073] In one embodiment, when one or more loss value calculation indicators include a consistency loss value calculation indicator, the computer device may perform category confidence estimation processing on the image features of each of the at least two quality adjusted images to obtain the category confidence of each quality adjusted image; and calculate the loss value between the two quality adjusted images corresponding to each two category confidences based on the difference between each two category confidences of the at least two quality adjusted images; based on this, the loss value between each two quality adjusted images in the at least two quality adjusted images may be fused to obtain the loss value of the training image under the consistency loss value calculation indicator.
[0074] It can be understood that when the method proposed in the present application is applied to the flower screen detection task, the above-mentioned category confidence can be a flower screen confidence or a normal confidence, that is, a non-flower screen confidence, and the present application does not impose any restrictions on this; accordingly, if the category confidence is a flower screen confidence, the computer device can calculate the loss value between the two quality adjusted images corresponding to each two flower screen confidences based on the difference between each two flower screen confidences in the flower screen confidences of at least two quality adjusted images; if the category confidence is a normal confidence, the computer device can calculate the loss value between the two quality adjusted images corresponding to each two normal confidences based on the difference between each two normal confidences in the normal confidences of at least two quality adjusted images, and so on.
[0075] Further, assuming that the number of the at least two image quality adjustment images is N, where N is an integer greater than 1, that is, when one or more loss value calculation indicators include a consistency loss value calculation indicator, the computer device may perform N random image quality adjustments (including but not limited to changes in illumination, contrast, and saturation) on the training image to obtain N image quality adjustment images (such as x1, x2, ..., x N ); accordingly, the computer device can input the N quality-adjusted images into the image prediction model (i.e., the feature extraction module in the input image prediction model) to extract the image features of each quality-adjusted image, and then obtain the category confidence of each quality-adjusted image (such as p1, p2...p N ), and the category confidence can also be called probability output or probability value; in this case, the computer device can use the category confidence of the N quality-adjusted images to calculate the consistency loss value, that is, calculate the loss value of the training image under the consistency loss value calculation index; specifically, the computer device can fuse the loss values between every two quality-adjusted images in the N quality-adjusted images to obtain the loss value of the training image under the consistency loss value calculation index; based on this, the calculation method of the loss value of the training image under the consistency loss value calculation index (that is, the consistency loss value) can be expressed by the following formula 1.1:
[0076]
[0077] Among them, i∈[1,N], j∈[1,N], and p i It is used to represent the category confidence of the i-th quality-adjusted image, p j Used to represent the category confidence of the j-th image quality adjustment image; it can be understood that this loss is used to constrain the similarity between the image features corresponding to the N image quality adjustment images. This is because the image feature distributions corresponding to the N image quality adjustment images generated by performing some slight color perturbations on the training images should be close. Therefore, the image features of each image quality adjustment image are subjected to category confidence estimation processing, and the category confidences of each image quality adjustment image obtained should be close. Therefore, the computer device can determine the loss value of the training image under the consistency loss value calculation indicator based on the category confidence of each image quality adjustment image.
[0078] In another embodiment, when one or more loss value calculation indicators include an angle prediction loss value calculation indicator, the computer device may perform rotation angle prediction processing on the image features of the angle-rotated image to obtain the predicted rotation angle of the angle-rotated image relative to the training image; thereby calculating the loss value of the training image under the angle prediction loss value calculation indicator based on the difference between the predicted rotation angle and the target rotation angle.
[0079] Correspondingly, after extracting features from the angle-rotated image, the computer device can introduce an additional auxiliary branch to predict the rotation angle of the angle-rotated image. That is, the network structure (i.e., the image prediction model) can be slightly modified to introduce a fully connected layer for predicting the angle of the angle-rotated image, that is, a fully connected layer is introduced to perform rotation angle prediction processing on the image features of the angle-rotated image. Based on this, the calculation method of the loss value of the training image under the angle prediction loss value calculation indicator (i.e., the angle prediction loss value) can be expressed by the following formula 1.2:
[0080] L θ (x θ )=||f(x θ ,α)-θ|| Formula 1.2
[0081] Among them, θ is used to represent the target rotation angle, that is, the computer device can first rotate the training image by the target rotation angle θ to rotate the image x θ The structure of the angle rotation image is then used to predict the rotation angle, and the above f(x θ ,α) is used to represent the rotation angle prediction processing of the angle-rotated image by the image prediction model, that is, it can be used to represent the predicted rotation angle of the angle-rotated image relative to the training image, and α is a prediction parameter used to calculate the predicted rotation angle. This application does not limit the specific value of the prediction parameter.
[0082] Furthermore, one or more loss value calculation indicators may include a consistency loss value calculation indicator and an angle prediction loss value calculation indicator. In this case, the computer device may determine the loss value of the training image under the consistency loss value calculation indicator based on at least two image quality adjustment images, and determine the loss value of the training image under the angle prediction loss value calculation indicator based on the angle rotation image. Then accordingly, the computer device may fuse the loss values of the training image under one or more loss value calculation indicators to obtain the model loss value of the image prediction model; that is, the computer device may fuse the loss value of the training image under the consistency loss value calculation indicator and the loss value of the training image under the angle prediction loss value calculation indicator to obtain the model loss value of the image prediction model. Based on this, the calculation method of the model loss value of the image prediction model can be expressed by the following formula 1.3:
[0083] L=L θ +βL e Formula 1.3
[0084] Among them, β is used to control the weights of the corresponding two loss functions, that is, to control the weights of the loss value of the training image under the consistency loss value calculation index and the loss value of the training image under the angle prediction loss value calculation index; and β can be set according to actual needs or experience values, and this application does not limit this. In this case, the computer device can supervise the feature extraction module in the image prediction model based on the loss value of the training image under the consistency loss value calculation index, and further supervise the feature extraction module in the image prediction model based on the loss value of the training image under the angle prediction loss value calculation index.
[0085] For example, Figure 4 As shown, when one or more loss value calculation indicators include a consistency loss value calculation indicator and an angle prediction loss value calculation indicator, the computer device can construct two loss function branches corresponding to the consistency loss value and the angle prediction loss value. In this case, the computer device can perform N image processing on the training image according to the image quality adjustment task through the first branch, that is, the training image can be processed N times to obtain N quality adjustment images, and these N quality adjustment images can be input into the image prediction model (i.e., the depth model) for feature extraction, thereby obtaining the category confidence of the N quality adjustment images; wherein, the embodiment of the present application uses the depth of the lines to represent the image quality, that is, if the lines of the image are darker, the image quality is stronger (such as stronger light, etc.), and if the lines of the image are lighter, the image quality is weaker (such as weaker light, etc.). Correspondingly, the computer device can perform image angle rotation processing (i.e., angle label construction processing) on the training image according to the target rotation angle through the second branch. That is, the computer device rotates the training image to obtain an angle-rotated image, and uses the target rotation angle as the angle label of the angle-rotated image. The angle-rotated image can be input into the image prediction model for feature extraction, thereby obtaining the predicted rotation angle P of the angle-rotated image. R Based on this, the computer device can use the category confidence of the N quality-adjusted images to calculate the loss value of the training image under the consistency loss value calculation index (i.e., the consistency loss value); and use the predicted rotation angle to calculate the loss value of the training image under the angle prediction loss value calculation index (i.e., the angle prediction loss value), thereby determining the model loss value of the image prediction model based on the consistency loss value and the angle prediction loss value.
[0086] It should be noted that Figure 4The calculation method of the model loss value is only exemplified, and the present application does not limit this; for example, the computer device may also use only the consistency loss value to determine the model loss value, that is, one or more loss value calculation indicators may only include the consistency loss value calculation indicator; for another example, the computer device may also use only the angle prediction loss value to determine the model loss value, that is, one or more loss value calculation indicators may only include the angle prediction loss value; for another example, the computer device may also use the consistency loss value, the angle prediction loss value and the translation prediction loss value to determine the model loss value, that is, one or more loss value calculation indicators may include the consistency loss value calculation indicator, the angle prediction loss value calculation indicator and the translation prediction loss value calculation indicator, etc. It should be understood that the image prediction model has the same model parameters when extracting features from any image, and the computer device can call the corresponding structure in the image prediction model for prediction according to actual needs to obtain the corresponding category confidence or the corresponding predicted rotation angle, etc.
[0087] S304: Optimize the model parameters in the image prediction model in a direction of reducing the model loss value to construct an image classification model.
[0088] Specifically, the image prediction model may include a feature extraction module; when the computer device optimizes the model parameters in the image prediction model in the direction of reducing the model loss value to construct the image classification model, the computer device may optimize the model parameters of the feature extraction module in the image prediction model in the direction of reducing the model loss value to construct the image classification model; wherein the image classification model includes the optimized feature extraction module.
[0089] S305, calling the image classification model to extract features of the target image to obtain image features of the target image.
[0090] Among them, the target image (i.e., the test image) may refer to any image that needs to be predicted in terms of category; for example, in a flower screen detection task, if the computer device is to perform flower screen detection on at least one image, the computer device may use each of the at least one image as a target image. It is understandable that the computer device may also obtain one or more frames of images from any video data, and use each of the one or more frames of images as a target image. In this case, the computer device may evaluate the video quality of any video data based on the detection result of each of the one or more frames of images, and obtain the video quality evaluation result of any video data; for example, if the task of flower screen detection is to be performed, the computer device may determine the number of flower screen images in one or more frames of images, and then determine the video quality evaluation result of any video data (such as flower screen video data or normal video data) according to the size relationship between the number of flower screen images in one or more frames of images and the flower screen image threshold. The flower screen image threshold may be set according to demand or experience value, and this application does not limit this.
[0091] It can be understood that since the image classification model includes an optimized feature extraction module, that is, the computer device can call the optimized feature extraction module to extract features of the target image to obtain image features of the target image.
[0092] S306: Compare the image features of the target image with the cluster center features corresponding to the first category to obtain a first similarity.
[0093] It should be noted that the image classification model may also include a category determination module, that is, after obtaining the image features of the target image, the category determination module may be called to determine the category of the target image, etc. In this case, the computer device may call the category determination module in the image classification model, compare the image features of the target image with the cluster center features corresponding to the first category, and obtain the first similarity.
[0094] It is understandable that after obtaining the optimized feature extraction module (i.e., the feature extractor after training), the computer device can perform feature extraction on each sample image in the training sample set to obtain the image features of each sample image, and perform cluster analysis on the image features of each sample image to obtain at least two cluster center features; specifically, the computer device can perform cluster analysis on the image features of each sample image to obtain at least two cluster clusters, and then perform mean operation on the image features of at least one sample image included in each cluster cluster to obtain the cluster center features of each cluster cluster. Among them, the number of at least two cluster center features is the number of categories, and the number of categories can be set according to actual needs or empirical values, and this application does not limit this; for example, when the number of categories is 2, the computer device can perform cluster analysis on the image features of each sample image to obtain two cluster center features (i.e., the cluster center feature corresponding to the first category and the cluster center feature corresponding to the second category).
[0095] Correspondingly, if the cluster center features corresponding to the first category and the cluster center features corresponding to the second category are obtained through an image classification model; then the computer device can call the image classification model to extract features from each sample image in the training sample set to obtain image features of each sample image; and perform cluster analysis on the image features of each sample image to obtain the cluster center features corresponding to the first category and the cluster center features corresponding to the second category.
[0096] Furthermore, when the computer device compares the image features of the target image with the cluster center features corresponding to the first category to obtain the first similarity, the computer device can calculate the cosine similarity between the image features of the target image and the cluster center features corresponding to the first category, and use the cosine similarity between the image features of the target image and the cluster center features corresponding to the first category as the first similarity; the computer device can also calculate the Euclidean distance between the image features of the target image and the cluster center features corresponding to the first category, and use the Euclidean distance between the image features of the target image and the cluster center features corresponding to the first category as the first similarity, and so on; the present application does not limit the specific implementation method of comparing the image features of the target image with the cluster center features corresponding to the first category.
[0097] S307: Compare the image features of the target image with the cluster center features corresponding to the second category to obtain a second similarity.
[0098] Correspondingly, the computer device can calculate the cosine similarity between the image features of the target image and the cluster center features corresponding to the second category, and use the cosine similarity between the image features of the target image and the cluster center features corresponding to the second category as the second similarity; it can also calculate the Euclidean distance between the image features of the target image and the cluster center features corresponding to the second category, and use the Euclidean distance between the image features of the target image and the cluster center features corresponding to the second category as the second similarity, and so on; the present application does not limit the specific implementation method of comparing the image features of the target image with the cluster center features corresponding to the second category.
[0099] It should be understood that the measurement method corresponding to the second similarity is the same as the measurement method corresponding to the first similarity, that is, the computer device may use the cosine similarity between the image features of the target image and the cluster center features corresponding to the first category as the first similarity, and use the cosine similarity between the image features of the target image and the cluster center features corresponding to the second category as the second similarity; or, the computer device may use the Euclidean distance between the image features of the target image and the cluster center features corresponding to the first category as the first similarity, and use the Euclidean distance between the image features of the target image and the cluster center features corresponding to the second category as the second similarity, and so on.
[0100] S308: Determine a category of the target image based on the first similarity and the second similarity.
[0101] In one embodiment, the computer device may determine the category of the target image according to the magnitude relationship between the first similarity and the second similarity. Specifically, if the first similarity is less than or equal to the second similarity, the computer device may determine that the category of the target image is the first category; if the first similarity is greater than the second similarity, the computer device may determine that the category of the target image is the second category, and so on.
[0102] In another embodiment, the computer device may determine the target category confidence (i.e., target probability value) of the target image based on the first similarity and the second similarity, and determine the category of the target image according to the target category confidence of the target image. Specifically, if the target category confidence of the target image is greater than or equal to the target category confidence threshold, the computer device may determine that the category of the target image is the target category; if the target category confidence of the target image is less than the target category confidence threshold, the computer device may determine that the category of the target image is another category other than the target category in the first category and the second category. Wherein, the target category may be the first category or the second category, and this application does not limit this; then correspondingly, if the target category is the first category, the target category confidence refers to the probability value that the target image belongs to the first category, and the target category confidence threshold refers to the minimum target category confidence corresponding to the determination of the category of the target image as the first category; if the target category is the second category, the target category confidence refers to the probability value that the target image belongs to the second category, and the target category confidence threshold refers to the minimum target category confidence corresponding to the determination of the category of the target image as the second category.
[0103] It should be noted that, when the computer device determines the target category confidence of the target image based on the first similarity and the second similarity, the computer device may fuse the first similarity and the second similarity to obtain the fused similarity; if the target category is the first category, the computer device may determine the target category confidence of the target image based on the ratio between the first similarity and the fused similarity; if the target category is the second category, the computer device may determine the target category confidence of the target image based on the ratio between the second similarity and the fused similarity.
[0104] For example, in a flower screen detection task, the computer device may first call an image classification model to perform feature extraction on each sample image in the training sample set to obtain the image features of each sample image, and perform cluster analysis on the image features of each sample image through a clustering algorithm (such as a k-means clustering algorithm or a fuzzy c-means clustering algorithm, etc.), thereby dividing the image features of each sample image into two cluster clusters, and the two cluster clusters represent flower screen images and non-flower screen images (i.e., normal images), respectively, and then obtain the cluster center feature δ1 corresponding to the flower screen (i.e., the first category), and the cluster center feature δ2 corresponding to the non-flower screen (i.e., the second category), and retain these two cluster center features to facilitate the subsequent determination of the category of the target image based on the two cluster center features. In this case, the computer device may obtain the probability value of the target image being a flower screen according to the feature similarity between the image features of the target image and the two cluster center features (i.e., the first similarity and the second similarity), that is, obtain the flower screen confidence of the target image, and finally obtain a binary result of whether the target image is a flower screen image. Figure 5aAs shown, assuming that the screen distortion confidence of the target image is 0.99, and the screen distortion confidence at this time is greater than the screen distortion confidence threshold, the computer device can determine that the target image is a screen distortion image; Figure 5b As shown, assuming that the screen noise confidence of the target image is 0.05, and the screen noise confidence at this time is less than the screen noise confidence threshold, the computer device can determine the target image as a normal image. It should be understood that for the screen noise detection task, the embodiment of the present application can accurately detect the screen noise confidence (i.e., the screen noise degree) of the target image.
[0105] It should be noted that the above description of steps S306-S308 is only an exemplary implementation method for determining the category of the target image by the computer device. In other embodiments, assuming that the image prediction model also includes a category confidence calculation module, and during the training process, the category confidence of each image quality adjustment image is obtained by the category confidence calculation module in the image prediction model, then the image classification model may also include an optimized category confidence calculation module, that is, the computer device may use the optimized category confidence calculation module as a category determination module in the image classification model, that is, the computer device may use the branch in the image prediction model for determining the category confidence of the image as the image classification model, so that the image classification model may include an optimized feature extraction module and an optimized category confidence calculation module, and then call the optimized feature extraction module to extract features from the target image, and call the optimized category confidence calculation module to determine the category confidence of the target image to determine the category of the target image.
[0106] The embodiment of the present application can construct an image classification model with better model performance after optimizing the image prediction model. The image classification model includes an optimized feature extraction module in the image prediction model, so that the image classification model can more accurately extract features from any image to improve the accuracy of image features. Moreover, in the process of optimizing the image prediction model, the present application does not introduce noisy artificial annotation information, so that the trained model can avoid being interfered by noise labels, thereby outputting stable and reliable target category detection results (such as flower screen detection results). In addition, the embodiment of the present application can also perform target category detection (such as flower screen detection) on one or more frames of images in the video data, and evaluate the video quality of the video data through the target category detection results of one or more frames of images, thereby providing reliable technical support for video quality evaluation.
[0107] Based on the description of the above-mentioned model optimization method, the present application also proposes a model optimization device, which can be a computer program (including program code) running in a computer device. Figure 2 or Figure 3The model optimization method shown in Figure 6 , the model optimization device can run the following units:
[0108] An acquisition unit 601 is used to acquire a training image;
[0109] A processing unit 602 is used to perform image processing on the training image according to the image processing tasks corresponding to one or more loss value calculation indicators, so as to obtain one or more images of the training image under each loss value calculation indicator;
[0110] The processing unit 602 is further configured to respectively call the image prediction model to perform feature extraction on each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator;
[0111] The processing unit 602 is further configured to calculate the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and perform fusion processing on the loss values of the training image under the one or more loss value calculation indicators to obtain a model loss value of the image prediction model;
[0112] The processing unit 602 is further used to optimize the model parameters in the image prediction model in a direction of reducing the model loss value to construct an image classification model.
[0113] In one implementation, the one or more loss value calculation indicators include a consistency loss value calculation indicator, and the image processing task corresponding to the consistency loss value calculation indicator refers to an image quality adjustment task; when the processing unit 602 performs image processing on the training image according to the image processing tasks corresponding to the one or more loss value calculation indicators, and obtains one or more images of the training image under each loss value calculation indicator, it can be specifically used to:
[0114] The training image is processed according to the image quality adjustment task to adjust one or more quality influencing factors of the training image, and at least two quality adjusted images of the training image under the consistency loss value calculation index are obtained.
[0115] In another implementation manner, when the processing unit 602 calculates the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator, it can be specifically used to:
[0116] Performing category confidence estimation processing on image features of each of the at least two image quality adjusted images to obtain category confidence of each of the image quality adjusted images;
[0117] Calculating, according to a difference between every two category confidences of the at least two image quality adjusted images, a loss value between two image quality adjusted images corresponding to every two category confidences;
[0118] The loss values between each two of the at least two image quality adjusted images are fused to obtain the loss value of the training image under the consistency loss value calculation index.
[0119] In another implementation, the one or more loss value calculation indicators include an angle prediction loss value calculation indicator, and the image processing task corresponding to the angle prediction loss value calculation indicator refers to an image angle rotation task; when the processing unit 602 performs image processing on the training image according to the image processing tasks corresponding to the one or more loss value calculation indicators, and obtains one or more images of the training image under each loss value calculation indicator, it can be specifically used to:
[0120] The training image is subjected to image angle rotation processing according to the target rotation angle to obtain an angle-rotated image of the training image under the angle prediction loss value calculation index.
[0121] In another implementation manner, when the processing unit 602 calculates the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator, it can be specifically used to:
[0122] Performing rotation angle prediction processing on image features of the angle-rotated image to obtain a predicted rotation angle of the angle-rotated image relative to the training image;
[0123] According to the difference between the predicted rotation angle and the target rotation angle, the loss value of the training image under the angle prediction loss value calculation index is calculated.
[0124] In another embodiment, the image prediction model includes a feature extraction module; when the processing unit 602 optimizes the model parameters in the image prediction model in the direction of reducing the model loss value to construct the image classification model, it can be specifically used to:
[0125] The model parameters of the feature extraction module in the image prediction model are optimized in the direction of reducing the model loss value to construct an image classification model; wherein the image classification model includes the optimized feature extraction module.
[0126] In another implementation, the processing unit 602 may also be used to:
[0127] Calling the image classification model to perform feature extraction on the target image to obtain image features of the target image;
[0128] Comparing the image features of the target image with the cluster center features corresponding to the first category to obtain a first similarity;
[0129] Comparing the image features of the target image with the cluster center features corresponding to the second category to obtain a second similarity;
[0130] Based on the first similarity and the second similarity, a category of the target image is determined.
[0131] In another implementation, the cluster center features corresponding to the first category and the cluster center features corresponding to the second category are obtained by calling the image classification model; the processing unit 602 may also be used to:
[0132] Calling the image classification model to perform feature extraction on each sample image in the training sample set to obtain image features of each sample image;
[0133] Perform cluster analysis on the image features of each sample image to obtain cluster center features corresponding to the first category and cluster center features corresponding to the second category.
[0134] According to one embodiment of the present application, Figure 2 or Figure 3 Each step involved in the method shown can be Figure 6 The model optimization device shown is executed by each unit. For example, Figure 2 The step S201 shown in FIG. 1 can be performed by Figure 6 The acquisition unit 601 and the processing unit 602 shown in FIG. 6 are executed together, and steps S202-S204 can be performed by Figure 6 The processing unit 602 shown in is executed. For example, Figure 3 The step S301 shown in FIG. Figure 6 The acquisition unit 601 and the processing unit 602 shown in the figure are executed together, and steps S302-S308 can be performed by Figure 6 Processing unit 602 is shown executing, among other things.
[0135] According to another embodiment of the present application, Figure 6The various units in the model optimization device shown can be respectively or completely merged into one or several other units to constitute, or some of the units (some) can also be split into multiple smaller units in function to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present application. The above-mentioned units are divided based on logical functions. In practical applications, the function of a unit can also be realized by multiple units, or the function of multiple units can be realized by one unit. In other embodiments of the present application, the model optimization device may also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.
[0136] According to another embodiment of the present application, the program can be executed by running on a general computing device such as a computer including a central processing unit (CPU), a random access memory medium (RAM), a read-only memory medium (ROM), and other processing elements and storage elements. Figure 2 or Figure 3 A computer program (including program code) for each step involved in the corresponding method shown in Figure 6 The model optimization device shown in and the model optimization method of the embodiment of the present application are implemented. The computer program can be recorded on, for example, a computer storage medium, and loaded into the above-mentioned computing device through the computer storage medium and run therein.
[0137] After acquiring the training image, the embodiment of the present application can first perform image processing on the training image according to the image processing tasks corresponding to one or more loss value calculation indicators, and obtain one or more images of the training image under each loss value calculation indicator; then, the image prediction model is called to extract features of each image under each loss value calculation indicator, and the image features of each image under each loss value calculation indicator are obtained, and then the loss value of the training image under each loss value calculation indicator can be calculated according to each image feature under each loss value calculation indicator, so as to obtain the model loss value of the image prediction model, so as to optimize the model parameters in the image prediction model in the direction of reducing the model loss value, so as to improve the model performance of the image prediction model, and then construct an image classification model with better model performance, that is, the embodiment of the present application can improve the model performance of the image classification model. In addition, the embodiment of the present application does not introduce noisy artificial annotation information in the model optimization process, which can effectively avoid the interference caused by artificial label information, and then better construct the image classification model, so that the constructed image classification model can output more accurate results.
[0138] Based on the description of the above method embodiment and device embodiment, the present application embodiment also provides a computer device. Figure 7The computer device at least includes a processor 701, an input interface 702, an output interface 703, and a computer storage medium 704. The processor 701, the input interface 702, the output interface 703, and the computer storage medium 704 in the computer device may be connected via a bus or other means.
[0139] The computer storage medium 704 may be stored in a memory of a computer device. The computer storage medium 704 is used to store a computer program. The computer program includes program instructions. The processor 701 is used to execute the program instructions stored in the computer storage medium 704 . The processor 701 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function; in one embodiment, the processor 701 described in the embodiment of the present application can be used to perform a series of model optimizations, specifically including: obtaining a training image, and performing image processing on the training image according to the image processing tasks corresponding to one or more loss value calculation indicators, to obtain one or more images of the training image under each loss value calculation indicator; calling the image prediction model to perform feature extraction on each image under each loss value calculation indicator, to obtain the image features of each image under each loss value calculation indicator; calculating the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and fusing the loss value of the training image under the one or more loss value calculation indicators to obtain the model loss value of the image prediction model; optimizing the model parameters in the image prediction model in the direction of reducing the model loss value to construct an image classification model.
[0140] The embodiment of the present application also provides a computer storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer storage medium provides a storage space, which stores the operating system of the computer device. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space. These instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor. In one embodiment, the processor can load and execute one or more instructions stored in the computer storage medium to implement the above-mentioned related Figure 2 or Figure 3 The individual method steps in the embodiment of the model optimization method are shown.
[0141] After acquiring the training image, the embodiment of the present application can first perform image processing on the training image according to the image processing tasks corresponding to one or more loss value calculation indicators, and obtain one or more images of the training image under each loss value calculation indicator; then, the image prediction model is called to extract features of each image under each loss value calculation indicator, and the image features of each image under each loss value calculation indicator are obtained, and then the loss value of the training image under each loss value calculation indicator can be calculated according to each image feature under each loss value calculation indicator, so as to obtain the model loss value of the image prediction model, so as to optimize the model parameters in the image prediction model in the direction of reducing the model loss value, so as to improve the model performance of the image prediction model, and then construct an image classification model with better model performance, that is, the embodiment of the present application can improve the model performance of the image classification model. In addition, the embodiment of the present application does not introduce noisy artificial annotation information in the model optimization process, which can effectively avoid the interference caused by artificial label information, and then better construct the image classification model, so that the constructed image classification model can output more accurate results.
[0142] It should be noted that according to one aspect of the present application, a computer program product or a computer program is also provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer storage medium. The processor of the computer device reads the computer instructions from the computer storage medium, and the processor executes the computer instructions, so that the computer device performs the above Figure 2 or Figure 3 The methods provided in various optional aspects of the model optimization method embodiments are shown.
[0143] Furthermore, it should be understood that what is disclosed above is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.
Claims
1. A model optimization method, characterized in that: include: Acquire a training image, and perform image processing on the training image according to the image processing tasks corresponding to one or more loss value calculation indicators, to obtain one or more images of the training image under each loss value calculation indicator; the training image is an image without manual labeling, and the one or more loss value calculation indicators include a consistency loss value calculation indicator and an angle prediction loss value calculation indicator; The image prediction model is called respectively to perform feature extraction on each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator; According to each image feature under each loss value calculation indicator, the loss value of the training image under each loss value calculation indicator is calculated respectively; and the loss value of the training image under the one or more loss value calculation indicators is fused to obtain the model loss value of the image prediction model; the loss value under the consistency loss value calculation indicator is calculated based on the difference between the category confidences of every two images in each image under the consistency loss value calculation indicator, and the loss value under the angle prediction loss value calculation indicator is calculated based on the difference between the predicted rotation angle of the angle-rotated image relative to the training image and the target rotation angle; The model parameters in the image prediction model are optimized in a direction of reducing the model loss value to construct an image classification model.
2. The method according to claim 1, characterized in that The image processing task corresponding to the consistency loss value calculation index refers to an image quality adjustment task; the image processing is performed on the training image according to the image processing tasks corresponding to one or more loss value calculation indexes to obtain one or more images of the training image under each loss value calculation index, including: The training image is processed according to the image quality adjustment task to adjust one or more quality influencing factors of the training image, and at least two quality adjusted images of the training image under the consistency loss value calculation index are obtained.
3. The method according to claim 2, characterized in that The calculating the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator respectively includes: Performing category confidence estimation processing on image features of each of the at least two image quality adjusted images to obtain category confidence of each of the image quality adjusted images; Calculating, according to a difference between every two category confidences of the at least two image quality adjusted images, a loss value between two image quality adjusted images corresponding to every two category confidences; The loss values between each two of the at least two image quality adjusted images are fused to obtain the loss value of the training image under the consistency loss value calculation index.
4. The method according to claim 1, characterized in that: The image processing task corresponding to the angle prediction loss value calculation index refers to an image angle rotation task; the image processing is performed on the training image according to the image processing tasks corresponding to one or more loss value calculation indicators to obtain one or more images of the training image under each loss value calculation indicator, including: The training image is subjected to image angle rotation processing according to the target rotation angle to obtain an angle-rotated image of the training image under the angle prediction loss value calculation index.
5. The method according to claim 4, characterized in that The calculating the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator respectively includes: Performing rotation angle prediction processing on image features of the angle-rotated image to obtain a predicted rotation angle of the angle-rotated image relative to the training image; According to the difference between the predicted rotation angle and the target rotation angle, the loss value of the training image under the angle prediction loss value calculation index is calculated.
6. The method according to any one of claims 1 to 5, characterized in that The image prediction model includes a feature extraction module; The step of optimizing the model parameters in the image prediction model in a direction of reducing the model loss value to construct an image classification model includes: The model parameters of the feature extraction module in the image prediction model are optimized in the direction of reducing the model loss value to construct an image classification model; wherein the image classification model includes the optimized feature extraction module.
7. The method according to any one of claims 1 to 5, characterized in that The method further comprises: Calling the image classification model to perform feature extraction on the target image to obtain image features of the target image; Comparing the image features of the target image with the cluster center features corresponding to the first category to obtain a first similarity; Comparing the image features of the target image with the cluster center features corresponding to the second category to obtain a second similarity; Based on the first similarity and the second similarity, a category of the target image is determined.
8. The method according to claim 7, characterized in that The cluster center features corresponding to the first category and the cluster center features corresponding to the second category are obtained by calling the image classification model; the method further includes: Calling the image classification model to perform feature extraction on each sample image in the training sample set to obtain image features of each sample image; Perform cluster analysis on the image features of each sample image to obtain cluster center features corresponding to the first category and cluster center features corresponding to the second category.
9. A model optimization device, characterized in that: include: An acquisition unit, used to acquire a training image, wherein the training image is an image without a manually annotated label; A processing unit, configured to perform image processing on the training image according to image processing tasks corresponding to one or more loss value calculation indicators, respectively, to obtain one or more images of the training image under each loss value calculation indicator; the one or more loss value calculation indicators include a consistency loss value calculation indicator and an angle prediction loss value calculation indicator; The processing unit is further used to call the image prediction model to perform feature extraction on each image under each loss value calculation indicator to obtain image features of each image under each loss value calculation indicator; The processing unit is further used to calculate the loss value of the training image under each loss value calculation indicator according to each image feature under each loss value calculation indicator; and to perform fusion processing on the loss value of the training image under the one or more loss value calculation indicators to obtain the model loss value of the image prediction model; the loss value under the consistency loss value calculation indicator is calculated based on the difference between the category confidences of every two images in each image under the consistency loss value calculation indicator, and the loss value under the angle prediction loss value calculation indicator is calculated based on the difference between the predicted rotation angle of the angle-rotated image relative to the training image and the target rotation angle; The processing unit is also used to optimize the model parameters in the image prediction model in a direction of reducing the model loss value to construct an image classification model.
10. A computer device, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a computer program, and when the computer program is executed by the processor, the method according to any one of claims 1 to 8 is implemented.
11. A computer storage medium, characterized in that: The computer storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Model training method, model using method, model training device, model using device, equipment and storage medium
CN113516125A
