An image data processing method, computer, and readable storage medium
By conducting feature transfer training on the basic classification model, the migration classification model is generated, which solves the problems of low accuracy in image drawing style recognition and high labor cost, and achieves efficient and accurate image classification.
Patent Information
- Application Number
- CN202110136181.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-01
- Publication Date
- 2025-07-22
- Estimated Expiration
- 2041-02-01
AI Technical Summary
The prior art recognizes image drawing styles, especially a few sample styles, with low recognition accuracy, and high manual recognition costs and time-consuming.
By obtaining basic image samples and migrating image samples, building a basic classification model and dividing it into shallow and deep networks, performing feature migration training, and generating a migration classification model to improve compatibility and recognition accuracy for different image drawing styles.
It improves the accuracy of image classification, reduces labor costs, reduces recognition time, and enhances the generalization ability of the model.
Smart Images

Figure CN113570512B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to an image data processing method, a computer, and a readable storage medium. Background Art
[0002] For the security and purity of the network environment and to prevent users from obtaining abnormal data, data uploaded to the network is generally screened. There are many types of data transmitted on the network. For images, an image classification model is generally used to identify the image to obtain the image category to which the image belongs, and the screening result of the image is determined according to the image category. Among them, the image drawing styles of images are diverse. For example, there are two-dimensional image styles and non-two-dimensional image styles. The two-dimensional image styles include animation styles, game drawing styles, comic styles, and other styles. The styles included in the two-dimensional image styles can be further divided into multiple styles. For example, the animation style can include animation drawing styles, color painting styles, and illustration styles, etc. If the image is directly identified by the classification model, the characteristics unique to different styles may be ignored. In particular, the characteristics that can be identified by the classification model for styles with fewer samples are fewer, so that the classification model cannot accurately classify and identify images with different image drawing styles, that is, the accuracy of image recognition is relatively low. Or, the image category to which the image belongs is identified manually. Since the number of images to be identified is large, the labor cost is high, and the time required for the image recognition process is also long. Summary of the Invention
[0003] Embodiments of this application provide an image data processing method, a computer, and a readable storage medium, which can improve the accuracy and detection efficiency of image data processing.
[0004] One aspect of the embodiments of this application provides an image data processing method, which includes:
[0005] Obtain a basic image sample with a basic drawing style from N image samples, input the basic image sample into a basic classification model, and output basic image features corresponding to the basic image sample in the basic classification model; the basic classification model is trained based on the basic image sample; N is a positive integer;
[0006] The basic classification model is divided into a shallow basic classification network and a deep basic classification network. The transferred image samples are input into the basic classification model. The first transferred image features corresponding to the transferred image samples are output in the shallow basic classification network. In the deep basic classification network, feature transfer is performed on the first transferred image features based on the basic image features to obtain feature transfer data, and the transferred prediction classification features corresponding to the transferred image samples are output according to the feature transfer data; the transferred image samples belong to the image samples other than the basic image samples among the N image samples; the transferred image samples have a transferred drawing style.
[0007] The basic classification model is trained according to the transferred prediction classification features to generate a transferred classification model; the transferred classification model is used to perform classification prediction on images with a basic drawing style or a transferred drawing style.
[0008] One aspect of the embodiments of the present application provides an image data processing method, and the method includes:
[0009] In response to a classification recognition request for an image to be classified, the image to be classified is input into a target classification model for prediction to obtain the target image category corresponding to the image to be classified; if there is a generalized classification model, the target classification model is the generalized classification model; if there is a transferred classification model and there is no generalized classification model, the target classification model is the transferred classification model; if there is a basic classification model and there is no generalized classification model and transferred classification model, the target classification model is the basic classification model; the generalized classification model is generated by generalizing the transferred classification model; the transferred classification model is based on the basic classification model to predict the basic image features of the basic image samples with a basic drawing style, predict the first transferred image features of the transferred image samples based on the shallow basic classification network in the basic classification model, perform feature transfer on the first transferred image features based on the basic image features in the deep basic classification network to obtain feature transfer data, obtain the transferred prediction classification features according to the feature transfer data, and is generated by training the basic classification model based on the transferred prediction classification features.
[0010] Obtain the abnormal category. If the target image category belongs to the abnormal category, an image abnormality prompt message is output.
[0011] If the target image category does not belong to the abnormal category, the image to be classified is output.
[0012] One aspect of the embodiments of the present application provides an image data processing device, and the device includes:
[0013] A basic sample acquisition module, configured to acquire basic image samples with a basic drawing style from N image samples; N is a positive integer.
[0014] A basic prediction module for inputting a basic image sample into a basic classification model and outputting basic image features corresponding to the basic image sample in the basic classification model; the basic classification model is trained based on the basic image sample;
[0015] A basic model division module for dividing the basic classification model into a shallow basic classification network and a deep basic classification network;
[0016] A basic shallow processing module for inputting a transfer image sample into the basic classification model and outputting first transfer image features corresponding to the transfer image sample in the shallow basic classification network;
[0017] A basic deep processing module for performing feature transfer on the first transfer image features based on the basic image features in the deep basic classification network to obtain feature transfer data;
[0018] A transfer sample prediction module for outputting transfer prediction classification features corresponding to the transfer image sample according to the feature transfer data; the transfer image sample belongs to the image samples other than the basic image sample among the N image samples; the transfer image sample has a transfer drawing style;
[0019] A transfer model training module for training the basic classification model according to the transfer prediction classification features to generate a transfer classification model; the transfer classification model is used for classifying and predicting images with a basic drawing style or a transfer drawing style.
[0020] Among them, the basic sample acquisition module includes:
[0021] A style recognition unit for acquiring N image samples, respectively performing style recognition on the N image samples based on a style recognition model, and obtaining image drawing style features corresponding to the N image samples;
[0022] A style clustering unit for performing clustering processing on the N image samples based on the image drawing style features corresponding to the N image samples respectively to obtain M image style groups; M is a positive integer, and M is less than or equal to N;
[0023] A style statistics unit for counting the number of image samples included in each of the M image style groups to obtain the number of image samples corresponding to each of the M image style groups, and determining the image drawing style corresponding to the image style group with the largest number of image samples as the basic drawing style;
[0024] A basic determination unit for determining the image samples in the image style group corresponding to the basic drawing style as the basic image samples.
[0025] Among them, the style clustering unit includes:
[0026] A quality determination subunit, configured to determine the image quality corresponding to each of the N image samples based on the image rendering style features corresponding to the N image samples;
[0027] A sample selection subunit, configured to obtain a sample quality threshold, and record the image samples whose image quality is greater than or equal to the sample quality threshold as the to-be-trained image samples;
[0028] A sample grouping subunit, configured to perform clustering processing on the to-be-trained image samples based on the image rendering style features of the to-be-trained image samples, to obtain M image style groups;
[0029] The basic determination unit is specifically configured to:
[0030] In the M image style groups, determine the to-be-trained image samples included in the image style group corresponding to the basic rendering style as the basic image samples.
[0031] Wherein, the apparatus further includes:
[0032] A basic sample prediction module, configured to obtain the basic sample labels of the basic image samples, and perform prediction on the basic image samples through an initial standard model to obtain initial prediction classification features;
[0033] A basic model training module, configured to obtain the class error between the basic sample labels and the initial prediction classification features based on a first loss function, and adjust the parameters of the initial standard model according to the class error to generate a basic classification model.
[0034] Wherein, the basic deep processing module includes:
[0035] A first weight determination unit, configured to perform normalization processing on the basic image features in a deep basic classification network, and determine the normalized basic image features as the first transfer weights;
[0036] A first weighting processing unit, configured to perform weighting processing on the first transfer image features based on the first transfer weights in the deep basic classification network to obtain feature transfer data.
[0037] Wherein, the transfer model training module includes:
[0038] A label acquisition unit, configured to obtain the number of basic samples of the basic image samples, and obtain the basic sample labels of the basic image samples and the transfer sample labels of the transfer image samples;
[0039] A feature mapping unit, configured to obtain the feature mapping values for mapping the transfer image samples to the basic image samples according to the transfer prediction classification features;
[0040] A first function generation unit, configured to obtain the label similarity between a basic sample label and a transfer sample label, and generate a second loss function based on the number of basic samples, the feature mapping value, and the label similarity;
[0041] A transfer training unit, configured to train a basic classification model based on the second loss function to generate a transfer classification model.
[0042] Wherein, the feature mapping unit includes:
[0043] A basic prediction subunit, configured to input a basic image sample into a basic classification model to obtain a basic prediction classification feature corresponding to the basic image sample;
[0044] A mapping acquisition subunit, configured to determine a feature mapping value for mapping a transfer image sample to a basic image sample according to a first feature distance between a transfer prediction classification feature and a basic prediction classification feature.
[0045] Wherein, the mapping acquisition subunit includes:
[0046] A weight acquisition subunit, configured to determine a second transfer weight according to a first feature distance between a transfer prediction classification feature and a basic prediction classification feature;
[0047] A spatial feature generation subunit, configured to perform a weighted process on the transfer prediction classification feature based on the second transfer weight to generate a transfer spatial vector, input the transfer spatial vector into the basic classification model, and output a spatial prediction classification feature in the basic classification model;
[0048] A mapping determination subunit, configured to determine a feature mapping value for mapping a transfer image sample to a basic image sample according to a second feature distance between a basic prediction classification feature and a spatial prediction classification feature.
[0049] Wherein, the number of transfer prediction classification features is r; r is a positive integer;
[0050] The weight acquisition subunit includes:
[0051] A first distance determination subunit, configured to obtain feature sub-distances between a basic prediction classification feature and r transfer prediction classification features respectively, and determine the sum of the feature sub-distances between the basic prediction classification feature and the r transfer prediction classification features as a first prediction distance;
[0052] A weight normalization subunit, configured to perform a normalization process on the r feature sub-distances based on the first prediction distance to obtain r second transfer weights;
[0053] The spatial feature generation subunit includes:
[0054] A vector generation subunit, configured to perform weighted summation on r migration prediction classification features based on r second migration weights to generate a migration space vector.
[0055] Wherein, the number of basic prediction classification features is t; the number of basic sample labels is t; t is a positive integer;
[0056] The mapping determination subunit includes:
[0057] A second distance determination subunit, configured to obtain a prediction sub-distance between each basic prediction classification feature and the spatial prediction classification feature respectively, and determine the sum of the prediction sub-distances between each basic prediction classification feature and the spatial prediction classification feature respectively as the second prediction distance;
[0058] A normalization processing subunit, configured to perform normalization processing on each prediction sub-distance based on the second prediction distance to obtain t feature mapping values;
[0059] The first function generation unit is specifically configured to:
[0060] Obtain the label similarities between t basic sample labels and the migration sample label respectively, perform weighted processing on the t feature mapping values based on the t label similarities to obtain a feature transfer loss value, and generate a second loss function according to the feature transfer loss value and the number of basic samples.
[0061] Wherein, the device further includes:
[0062] A migration model division module, configured to obtain generalization image samples in the generalization image library, and divide the migration classification model into a shallow migration classification network and a deep migration classification network;
[0063] A migration shallow prediction module, configured to input the migration image samples into the migration classification model, and output the corresponding second migration image features of the migration image samples in the shallow migration classification network, input the generalization image samples into the migration classification model, and output the corresponding generalization image features of the generalization image samples in the shallow migration classification network; the generalization image samples have a generalization drawing style, and the generalization drawing style is different from both the basic drawing style and the migration drawing style; the migration drawing style refers to the image drawing style of the migration image samples;
[0064] A distribution calibration module, configured to obtain the migration distribution information of the second migration image features and the generalization distribution information of the generalization image features, perform distribution calibration on the migration distribution information to obtain migration calibration information, and perform distribution calibration on the generalization distribution information to obtain generalization calibration information;
[0065] A migration deep prediction module is used to input migration calibration information and generalization calibration information into a deep migration classification network, and perform weighted processing on the migration calibration information and the generalization calibration information based on the deep migration classification network to obtain generalization prediction classification features;
[0066] A generalization model training module is used to train a migration classification model according to the generalization prediction classification features to generate a generalization classification model; the generalization classification model is used to perform classification prediction on images with a basic drawing style, a migrated drawing style, or a generalized drawing style.
[0067] Among them, the generalization model training module includes:
[0068] A distribution difference acquisition unit is used to obtain a first distribution difference between the migration distribution information and the migration calibration information, and obtain a second distribution difference between the generalization distribution information and the generalization calibration information;
[0069] A second function generation unit is used to generate a backpropagation function according to the first distribution difference and the second distribution difference;
[0070] A third function generation unit is used to obtain the generalization sample label of the generalization image sample, and generate a third loss function according to the generalization prediction classification feature and the generalization sample label;
[0071] A generalization parameter adjustment unit is used to perform parameter adjustment on the migration classification model based on the backpropagation function and the third loss function to generate a generalization classification model.
[0072] An embodiment of the present application provides an image data processing device on the one hand. The device includes:
[0073] A category prediction module is used to respond to a classification recognition request for an image to be classified, input the image to be classified into a target classification model for prediction, and obtain the target image category corresponding to the image to be classified; if there is a generalization classification model, the target classification model is the generalization classification model; if there is a migration classification model and there is no generalization classification model, the target classification model is the migration classification model; if there is a basic classification model and there is no generalization classification model and migration classification model, the target classification model is the basic classification model; the generalization classification model is generated by generalizing the migration classification model; the migration classification model is based on the basic classification model to predict the basic image features of the basic image samples with the basic drawing style, predict the first migrated image features of the migrated image samples based on the shallow basic classification network in the basic classification model, perform feature migration on the first migrated image features based on the basic image features in the deep basic classification network to obtain feature migration data, obtain migration prediction classification features according to the feature migration data, and train the basic classification model based on the migration prediction classification features to generate;
[0074] An exception prompt module, which is used to obtain the exception category. If the target image category belongs to the exception category, an image exception prompt message is output;
[0075] An image output module, which is used to output the image to be classified if the target image category does not belong to the exception category.
[0076] One aspect of the embodiments of the present application provides a computer device, including a processor and a memory;
[0077] The processor is connected to the memory. Among them, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device including the processor executes the image data processing method in one aspect of the embodiments of the present application.
[0078] One aspect of the embodiments of the present application provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor so that the computer device with the processor executes the image data processing method in one aspect of the embodiments of the present application.
[0079] One aspect of the embodiments of the present application provides a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions so that the computer device executes the methods provided in various alternative manners in one aspect of the embodiments of the present application.
[0080] Implementing the embodiments of the present application will have the following beneficial effects:
[0081] In the embodiments of the present application, a computer device may obtain a basic image sample with a basic drawing style from N image samples, input the basic image sample into a basic classification model, and output basic image features corresponding to the basic image sample in the basic classification model; the basic classification model is trained based on the basic image samples; the basic classification model is divided into a shallow basic classification network and a deep basic classification network, input the migration image sample into the basic classification model, output the first migration image features corresponding to the migration image sample in the shallow basic classification network, perform feature migration on the first migration image features based on the basic image features in the deep basic classification network to obtain feature migration data, and output migration prediction classification features corresponding to the migration image sample according to the feature migration data; the migration image sample belongs to the image samples other than the basic image samples among the N image samples; the migration image sample has a migration drawing style; train the basic classification model according to the migration prediction classification features to generate a migration classification model; the migration classification model is used to classify and predict images with a basic drawing style or a migration drawing style. Through the above process, the computer device can perform further training based on the basic classification model, making the model relatively lightweight. At the same time, re-training is performed on the basic classification model trained from the basic image samples. When re-training the basic classification model, the features of the basic image samples will be incorporated into the migration image samples to standardize the feature space dimensions of samples with different image drawing styles, so that the migration classification model obtained after re-training the basic classification model can better be compatible with images with different image drawing styles, thereby improving the accuracy of the model in classifying images and enhancing the generalization ability of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0082] To more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other drawings can be obtained based on these drawings.
[0083] Figure 1 is a network interaction architecture diagram for image data processing provided by an embodiment of the present application;
[0084] Figure 2 is a schematic diagram of an image data processing scenario provided by an embodiment of the present application;
[0085] Figure 3 is a flowchart of a method for image data processing provided by an embodiment of the present application;
[0086] Figure 4 is a schematic diagram of an image clustering scenario provided by an embodiment of the present application;
[0087] Figure 5 This is a schematic diagram of a migration classification model training scenario provided by an embodiment of the present application;
[0088] Figure 6 This is a specific flowchart of image data processing provided by an embodiment of the present application;
[0089] Figure 7 This is a schematic diagram of a generalization classification model training scenario provided by an embodiment of the present application;
[0090] Figure 8 This is a schematic diagram of a model training scenario provided by an embodiment of the present application;
[0091] Figure 9 This is a schematic diagram of an image classification process provided by an embodiment of the present application;
[0092] Figure 10 This is a schematic diagram of an image recognition scenario provided by an embodiment of the present application;
[0093] Figure 11 This is another schematic diagram of an image recognition scenario provided by an embodiment of the present application;
[0094] Figure 12 This is a schematic diagram of an image data processing device provided by an embodiment of the present application;
[0095] Figure 13 This is another schematic diagram of an image data processing device provided by an embodiment of the present application;
[0096] Figure 14 This is a schematic diagram of the structure of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0097] Next, the technical solutions in the embodiments of the present application will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0098] Optionally, the present application can adopt deep learning technology in the field of artificial intelligence to implement the training of a classification model and perform category prediction on images based on the classification model.
[0099] Among them, Artificial Intelligence (AI) is to use a digital computer or a machine controlled by a digital computer to simulate, extend, and expand human intelligence, a theory, method, technology, and application system that can 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 way similar to human intelligence. Artificial intelligence also studies the design principles and implementation methods of various intelligent machines, enabling the machines to have the functions of perception, reasoning, and decision-making. For example, in this application, the automatic screening of basic image samples, the training of a basic classification model based on the basic image samples, and the retraining of the basic classification model based on transfer image samples to obtain a transfer classification model. When it is necessary to classify and identify an image, the image can be input into the transfer classification model for prediction to obtain the image category of the image. The above processes can all be considered to be implemented based on artificial intelligence.
[0100] Artificial intelligence technology is an interdisciplinary subject with a wide range of fields involved, including both hardware-level technologies and software-level technologies. Artificial intelligence basic technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction systems, and mechatronics. Artificial intelligence software technologies mainly include several major directions such as computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning. Among them, in this application, any one of the various technologies of artificial intelligence can be used alone, or the various technologies in artificial intelligence can be randomly combined and used. For example, computer vision technology can be used alone, or computer vision technology can be combined with deep learning technology, etc. There is no limitation here. By using the related technologies of artificial intelligence, the efficiency of image classification and prediction in this application is improved.
[0101] Deep Learning (DL) is a new research direction in the field of Machine Learning (ML). Deep learning is to learn the internal laws and representation levels of sample data, and the information obtained during these learning processes is very helpful for the interpretation of data such as text, images, and sounds. By performing deep learning on icon training samples, an icon recognition model that can be used for icon recognition in this application is obtained, and the icon recognition model can also be adjusted for error feedback according to the prediction results of the icon recognition model, so that the icon recognition model can have the ability of analysis and learning like a human. Among them, deep learning is a complex machine learning algorithm, and the effects achieved in speech and image recognition far exceed those of previous related technologies. Deep learning usually includes technologies such as artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and rote learning.
[0102] With the research and progress of artificial intelligence technology, artificial intelligence technology has been studied and applied in multiple fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless, autonomous driving, drones, robots, smart healthcare, smart customer service, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role. For example, in the field of image recognition in this application.
[0103] Among them, the solution provided in the embodiments of this application involves technologies such as deep learning in the field of artificial intelligence, and is specifically described through the following embodiments:
[0104] In the embodiments of this application, please refer to Figure 1 , Figure 1 is a network interaction architecture diagram for image data processing provided in the embodiments of this application, and the embodiments of this application can be implemented by a computer device. As Figure 1 shown, the computer device 101 can obtain N image samples. Among them, the computer device 101 can obtain the N image samples from an image database, such as ImageNet, etc.; or, the computer device 101 can obtain N image samples from the Internet; or, the computer device 101 can also obtain N image samples from a user device associated with the computer device, such as user devices 102a, 102b, and 102c, etc., which are not limited here. Among them, ImageNet is a large visual database for visual object recognition software research, and is actually a huge picture library available for image / visual training. Among them, N is a positive integer. For example, if the computer device 101 obtains the N image samples from an image database, then N is less than or equal to the total number of images included in the image database. Optionally, N can be a preset default training sample quantity, and N can also be determined according to the sample acquisition location, which refers to the above-mentioned image database, Internet, or user device, etc., which are not limited here. For example, if the sample acquisition location is a user device associated with the computer device 101, then the computer device 101 obtains image samples from the user device during the model training period, and records the number of image samples obtained by the computer device 101 during the model training period as N.
[0105] Further, the computer device 101 obtains a basic image sample with a basic drawing style from N image samples, inputs the basic image sample into a basic classification model, and outputs basic image features corresponding to the basic image sample in the basic classification model. The basic classification model is trained based on the basic image samples. Among them, the basic classification model can be used to classify and predict images with a basic drawing style. Further, feature transfer is performed on the transferred image samples through the basic image features, and the basic classification model is retrained according to the basic image features and the transferred image samples to obtain a transferred classification model. The transferred classification model can be used to classify and predict images with a basic drawing style or a transferred drawing style. Among them, the transferred classification model is trained based on the feature fusion of the basic image samples and the transferred image samples, unifies the features of the basic image samples and the transferred image samples, enables the transferred classification model to better be compatible with the basic image samples and the transferred image samples, enables the transferred classification model to classify and identify images with different image drawing styles, improves the accuracy of image classification, and directly classifies and identifies images based on the model, saving labor costs and reducing the time consumed for classifying and identifying images.
[0106] Specifically, please refer to Figure 2 , Figure 2 which is a schematic diagram of an image data processing scenario provided by an embodiment of the present application. As Figure 2As shown, the computer device 201 obtains N image samples 202, performs clustering processing on the N image samples 202, determines the basic drawing style according to the clustering processing result, obtains the basic image sample 203 with the basic drawing style from the N image samples, and trains the initial standard model based on the basic image sample 203 to obtain the basic classification model 204. The basic image sample 203 is input into the basic classification model 204 for prediction to obtain the basic image features corresponding to the basic image sample 203. Further, the computer device 201 can obtain the transfer image sample 205 from the N image samples 202, and divide the basic classification model 204 into a shallow basic classification network 2041 and a deep basic classification network 2042. The transfer image sample 205 is input into the basic classification model 204, and the transfer image sample 205 is predicted based on the shallow basic classification network 2041 to obtain the first transfer image features corresponding to the transfer image sample 205. Feature transfer is performed on the first transfer image features based on the basic image features in the deep basic classification network 2042 to obtain feature transfer data, and the transfer prediction classification features corresponding to the transfer image sample 205 are output according to the feature transfer data. The basic classification model 204 is trained according to the transfer prediction classification features, specifically, the parameters of the basic classification model 204 are adjusted to generate the transfer classification model 206. When the computer device 201 obtains the image to be classified 207, the transfer classification model 206 is called to predict the image to be classified 207 to obtain the image category to which the image to be classified 207 belongs. Since the basic classification model 204 is retrained, the features of the basic image sample and the features of the transfer image sample are fused to unify the dimensionality standards of the basic drawing style corresponding to the basic image sample and the transfer drawing style corresponding to the transfer image sample, improve the compatibility of the transfer classification model with different image drawing styles, and thus improve the accuracy of the transfer classification model in classifying and recognizing images.
[0107] It can be understood that the computer device or user device in the embodiments of the present application includes, but is not limited to, a terminal device or a server. In other words, the computer device can be a server or a terminal device, or a system composed of a server and a terminal device; the user device can be a server or a terminal device, or a system composed of a server and a terminal device. Among them, the user device can also be regarded as a kind of computer device. Among them, the above-mentioned terminal device can be an electronic device, including but not limited to mobile phones, tablet computers, desktop computers, laptop computers, handheld computers, in-vehicle devices, augmented reality / virtual reality (AR / VR) devices, head-mounted displays, smart TVs, wearable devices, smart speakers, digital cameras, cameras, and other mobile internet devices (MID) with network access capabilities. Among them, the above-mentioned server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, vehicle-road collaboration, content delivery network (CDN), and big data and artificial intelligence platforms.
[0108] Optionally, the data involved in the embodiments of the present application can be stored in a computer device, or the data can be stored based on cloud storage technology, which is not limited herein.
[0109] Further, please refer to Figure 3 , Figure 3 which is a flowchart of a method for image data processing provided by the embodiments of the present application. As Figure 3 shown, the image data processing process includes the following steps:
[0110] Step S301, obtain a basic image sample with a basic drawing style from N image samples, input the basic image sample into a basic classification model, and output the corresponding basic image feature of the basic image sample in the basic classification model.
[0111] In the embodiments of the present application, a computer device can obtain N image samples, obtain a basic image sample with a basic drawing style from the N image samples, input the basic image sample into a basic classification model, and output the corresponding basic image feature of the basic image sample in the basic classification model. Among them, N is a positive integer, and the basic classification model is trained based on the basic image samples. Specifically, the computer device can train an initial standard model based on a first loss function to generate a basic classification model.
[0112] Among them, the computer device can obtain N image samples, and respectively perform style recognition on the N image samples based on the style recognition model to obtain the image drawing style features corresponding to the N image samples. Specifically, the image drawing features may include M image drawing style labels and the associated probabilities of each image drawing style label. Among the N image samples, there is an image sample k, where k is a positive integer. The computer device determines the image drawing style of the image sample k based on the associated probabilities between the image sample k and the M image drawing style labels, that is, determines the image drawing style label corresponding to the maximum associated probability as the image drawing style of the image sample k. Based on the image drawing style features corresponding to the N image samples respectively, perform clustering processing on the N image samples to obtain M image style groups, where M is a positive integer and M is less than or equal to N. Specifically, perform clustering processing on the N image samples based on the image drawing styles indicated by the image drawing style features corresponding to the N image samples respectively. Among them, the image samples in each image style group have the same image drawing style, and different image style groups have different image drawing styles. Count the number of image samples included in each of the M image style groups to obtain the number of image samples corresponding to each of the M image style groups, and determine the image drawing style corresponding to the image style group with the largest number of image samples as the basic drawing style. Determine the image samples in the image style group corresponding to the basic drawing style as the basic image samples. Among them, the styles of the image samples include the second-generation style and the non-second-generation style. The second-generation style can also be called the ACG style, that is, the styles corresponding to animation, comic, game, etc. Among them, the second-generation style may include, but is not limited to, the animation style, the game drawing style, the comic style, and other styles. These major styles can also include multiple different minor styles. For example, the animation style may include, but is not limited to, the animation drawing style, the color painting drawing style, and the illustration drawing style, etc.; the game drawing style may include, but is not limited to, the game scene drawing style, the game character drawing style, and the live-action computer animation drawing style (that is, the live-action CG drawing style), etc. CG is computer animation, and its full name is Computergraphics; the comic style may include, but is not limited to, the grid comic drawing style, the page comic drawing style, and the strip comic drawing style, etc.; other styles may include, but is not limited to, the sketch drawing style, the pencil drawing style, the expression drawing style, and the figure drawing style, etc., and are not limited here.
[0113] Among them, in the embodiments of the present application, when clustering N image samples, the N image samples can be clustered based on the styles of large categories. For example, a computer device can cluster the N image samples based on styles such as animation style, game drawing style, comic style, and other styles. Or, when clustering the N image samples, the N image samples can also be clustered based on the styles of small categories. For example, a computer device can cluster the N image samples based on styles such as animation drawing style, color painting style, illustration style, game scene drawing style, game character drawing style, live-action CG drawing style, … and figure drawing style, etc. Or, the computer device can also cluster the N image samples in a way that combines the styles of large categories and small categories. For example, a computer device can cluster the N image samples based on styles such as animation drawing style, color painting style, illustration style, game drawing style, comic style, sketch style, … and figure drawing style, etc. Among them, when clustering the N image samples based on the styles of large categories, the amount of data to be processed during the clustering process can be reduced, the workload of the clustering process can be reduced, and the efficiency of the clustering process can be improved. When clustering the N image samples based on the styles of small categories, the division accuracy between different image drawing styles can be improved. Furthermore, when training a classification model, the accuracy of model training can be improved, thereby improving the accuracy of the trained classification model in classifying and recognizing images. And when clustering the N image samples in a way that combines the styles of large categories and small categories, the accuracy of model training can be improved while ensuring an appropriate amount of data. The way of combining the styles of large categories and small categories can be determined according to actual needs.
[0114] Optionally, the computer device may determine the image quality corresponding to each of the N image samples based on the image rendering style features corresponding to the N image samples. Specifically, the image rendering features may include M image rendering style labels and the associated probabilities of each image rendering style label. The computer device determines the image rendering style label corresponding to the maximum associated probability as the image rendering style of image sample k, and determines the maximum associated probability as the image quality corresponding to image sample k. Similarly, the image rendering styles and image qualities corresponding to the N image samples are obtained. Optionally, the computer device may perform quality prediction on the image rendering style features corresponding to the N image samples respectively based on a quality prediction model to obtain the image quality corresponding to each of the N image samples. Further, the computer device may obtain a sample quality threshold, and record the image samples with an image quality greater than or equal to the sample quality threshold as the image samples to be trained; perform clustering processing on the image samples to be trained based on the image rendering style features of the image samples to be trained to obtain M image style groups. At this time, when determining the image samples in the image style group corresponding to the basic rendering style as the basic image samples, the computer device determines, among the M image style groups, the image samples to be trained included in the image style group corresponding to the basic rendering style as the basic image samples. Optionally, the image style group corresponding to the basic rendering style may be denoted as the basic style group.
[0115] For example, please refer to Figure 4 , Figure 4 which is a schematic diagram of an image clustering scenario provided by an embodiment of the present application. As Figure 4 shown, the computer device obtains N image samples 401, including image sample 4011, image sample 4012, image sample 4013, image sample 4014, image sample 4015, etc. The computer device performs style recognition on the N image samples 401 respectively based on a style recognition model 402 to obtain the image rendering style features 4021 corresponding to the N image samples 401, and determines the image rendering styles 403 corresponding to the N image samples 401 according to the image rendering style features 4021 corresponding to the N image samples 401. Specifically, input image sample 4011 into style recognition model 402 for style recognition, and output the image rendering style features of image sample 4011 in style recognition model 402. Based on the image rendering style features of image sample 4011, determine the image rendering style of image sample 4011 as image rendering style 1; input image sample 4012 into style recognition model 402 for style recognition, and output the image rendering style features of image sample 4012 in style recognition model 402. Based on the image rendering style features of image sample 4012, determine the image rendering style of image sample 4012 as image rendering style 2; until the image rendering style features and image rendering styles corresponding to the N image samples are obtained.
[0116] Among them, Figure 4 The steps indicated by the dashed arrows are optional steps. The computer device can directly perform clustering processing on N image samples based on the image drawing styles corresponding to the N image samples respectively, that is, divide the image samples with the same image drawing style into one category to obtain M image style groups 404. Among them, assume that the image drawing style corresponding to the image sample 4011 is the animation drawing style (i.e., image drawing style 1 is the animation drawing style), the image drawing style corresponding to the image sample 4012 is the stick figure drawing style (i.e., image drawing style 2 is the stick figure drawing style), the image drawing style corresponding to the image sample 4013 is the grid comic drawing style, the image drawing style corresponding to the image sample 4014 is the strip comic drawing style, the image drawing style corresponding to the image sample 4015 is the game drawing style, etc. The computer device performs clustering processing on N image samples based on the image drawing styles corresponding to the N image samples respectively to obtain M image style groups 404, including the animation drawing style group (corresponding to the animation drawing style), the stick figure drawing style group (corresponding to the stick figure drawing style), the grid comic drawing style group (corresponding to the grid comic drawing style), the strip comic drawing style group (corresponding to the strip comic drawing style), the game drawing style group (corresponding to the game drawing style), and other drawing style groups (i.e., Figure 4 the group corresponding to the XX drawing style in
[0117] Optionally, the computer device can also execute the steps indicated by the dashed arrows, that is, the computer device can determine the image quality corresponding to the N image samples respectively based on the image drawing style features corresponding to the N image samples respectively, screen the N image samples according to the image quality corresponding to the N image samples respectively and the sample quality threshold to obtain the image samples to be trained. Perform clustering processing on the image samples to be trained to obtain M image style groups 404, determine the basic style group from the M image style groups 404, determine the image drawing style corresponding to the basic style group as the basic drawing style, and determine the image samples to be trained in the basic style group as the basic image samples.
[0118] Step S302: Divide the basic classification model into a shallow basic classification network and a deep basic classification network. Input the migrated image samples into the basic classification model. Output the first migrated image features corresponding to the migrated image samples in the shallow basic classification network. In the deep basic classification network, perform feature migration on the first migrated image features based on the basic image features to obtain feature migration data, and output the migrated prediction classification features corresponding to the migrated image samples according to the feature migration data.
[0119] In the embodiment of the present application, the computer device can obtain the number of model division layers, and divide the basic classification model into a shallow basic classification network and a deep basic classification network at the number of model division layers. The computer device inputs the migrated image samples into the basic classification model, and outputs the first migrated image features corresponding to the migrated image samples in the shallow basic classification network of the basic classification model; in the deep basic classification network, perform normalization processing on the basic image features, and determine the normalized basic image features as the first migration weights; in the deep basic classification network, perform weighted processing on the first migrated image features based on the first migration weights to perform feature migration on the first migrated image features to obtain feature migration data, and output the migrated prediction classification features corresponding to the migrated image samples according to the feature migration data. Among them, assuming that the dimension of the basic image features is h, perform normalization processing on the basic image features to obtain a vector composed of h decimals between 0 and 1, and use this vector as the first migration weights, and perform dot multiplication on the first migration weights and the first migrated image features to obtain feature migration data. Optionally, if the number of the basic image features is at least two, then the at least two basic image features can be averaged to obtain basic average features, and the basic average features are normalized to obtain the first migration weights. Among them, the migrated image samples belong to the image samples other than the basic image samples among the N image samples, and the migrated image samples have a migrated drawing style. Optionally, the migrated image samples can be all the image samples other than the basic image samples among the N image samples, or can be some of the image samples other than the basic image samples among the N image samples, which is not limited here.
[0120] For example, please refer to Figure 5 , Figure 5 is a schematic diagram of a migrated classification model training scenario provided by an embodiment of the present application. As Figure 5As shown, the computer device inputs the basic image sample 501 into the basic classification model. The basic classification model includes a shallow basic classification network 502 and a deep basic classification network 503, and outputs the basic image feature 504 corresponding to the basic image sample 501 in the basic classification model. The migration image sample 505 is input into the basic classification model, and the first migration image feature corresponding to the migration image sample is output in the shallow basic classification network 502. The basic image feature 504 is combined with the deep basic classification network 503, and the first migration image feature is feature migrated based on the basic image feature 504 in the deep basic classification network 503 to obtain feature migration data, and the migration prediction classification feature 506 corresponding to the migration image sample 505 is output according to the feature migration data.
[0121] Step S303: Train the basic classification model according to the migration prediction classification feature to generate a migration classification model.
[0122] In the embodiment of the present application, the computer device trains the basic classification model according to the migration prediction classification feature to generate a migration classification model, and the migration classification model can be used to classify and predict images with a basic drawing style or a migration drawing style. Among them, the computer device can generate a second loss function according to the basic image feature and the migration prediction classification feature, and train the basic classification model based on the second loss function to generate a migration classification model. Specifically, the computer device can obtain the basic sample quantity of the basic image sample, obtain the basic sample label of the basic image sample and the migration sample label of the migration image sample; according to the migration prediction classification feature, obtain the feature mapping value that maps the migration image sample to the basic image sample; obtain the label similarity between the basic sample label and the migration sample label, and generate a second loss function based on the basic sample quantity, the feature mapping value and the label similarity; train the basic classification model based on the second loss function to generate a migration classification model. Among them, the generation process of the second loss function can be seen as shown in formula ①:
[0123]
[0124] Among them, L cdl represents the second loss function, t is the quantity of the basic image sample, that is, the basic sample quantity, t is a positive integer, B S is used to represent the basic style group, is used to represent the i-th basic image sample in the basic style group. Among them, y i is used to represent the true value of the basic image sample, that is, the basic sample label of the basic image sample, specifically referring to the basic sample label of the i-th basic image sample; y jIt is used to represent the true value of the migration image sample, that is, the migration sample label of the migration image sample, specifically the migration sample label of the jth migration image sample; I(y i ,y j ) is used to represent the label similarity between the basic sample label and the migration sample label. If the basic sample label is the same as the migration sample label, the first similarity is determined as the label similarity between the basic sample label and the migration sample label, such as the first similarity can be 1; if the basic sample label is different from the migration sample label, the second similarity is determined as the label similarity between the basic sample label and the migration sample label, such as the second similarity can be 0, the first similarity is greater than the second similarity, and the label similarity is used to shorten the distance between image samples belonging to different image drawing styles and the same image category, so as to achieve generalization of the model. β i It is used to represent the feature mapping value of mapping the migration image sample to the base image sample, specifically, mapping the migration image sample to the base style group B. S The feature map value of the i-th base image sample in log(β i ) is used to represent the logarithmic operation of the feature map value. The computer device can obtain the basic sample number t of the basic image sample, based on the basic sample number t and the feature map value β i and label similarity I(y i ,y j ) generates a second loss function. Specifically, the computer device can obtain the label similarities between the t basic sample labels and the migration sample labels, perform weighted processing on the t feature mapping values based on the t label similarities to obtain a feature transfer loss value, and generate a second loss function based on the feature transfer loss value and the number of basic samples. The feature transfer loss value is i can take any positive integer from 1 to t. Among them, the computer device can perform weighted summation on the feature mapping values based on label similarity, and then divide by the number of basic samples to equalize the weighted summation of the feature mapping values, so as to obtain the feature mapping values of all basic image samples mapped to the migrated image samples. Since when the basic sample label is the same as the migrated sample label, a weight of the first similarity (such as 1) is added to the feature mapping value between the two, and when the basic sample label is different from the migrated sample label, a weight of the second similarity (such as 0) is added to the feature mapping value between the two, only when the basic sample label is the same as the migrated sample label, the feature mapping value between the basic image sample and the migrated image sample is considered, so that the second loss function can represent the distance between image samples belonging to the same image category and different image rendering styles. Based on the second loss function to adjust the parameters of the basic classification model, the distance between image samples belonging to the same image category and different image rendering styles can be shortened, thereby improving the compatibility of the migrated classification model with different image rendering styles and improving the accuracy of the migrated classification model for classifying and recognizing images.
[0125] Among them, it can be considered that in the embodiment of the present application, the number of basic image samples is t, and the number of basic sample labels, basic prediction classification features, etc. corresponding to the basic image samples are all t; the number of migrated image samples is t, and the number of migrated sample labels, migrated prediction classification features, etc. corresponding to the migrated image samples are all t.
[0126] Among them, the computer device can input the basic image sample into the basic classification model to obtain the basic prediction classification feature corresponding to the basic image sample; determine the feature mapping value of mapping the migrated image sample to the basic image sample according to the first feature distance between the migrated prediction classification feature and the basic prediction classification feature. Specifically, the computer device can determine the second migration weight according to the first feature distance between the migrated prediction classification feature and the basic prediction classification feature; perform weighted processing on the migrated prediction classification feature based on the second migration weight to generate a migration space vector, input the migration space vector into the basic classification model, and output a space prediction classification feature in the basic classification model; determine the feature mapping value of mapping the migrated image sample to the basic image sample according to the second feature distance between the basic prediction classification feature and the space prediction classification feature.
[0127] Among them, the generation process of the feature mapping value can be seen in formula ② as follows:
[0128]
[0129] Among them, as shown in formula ②, β i is used to represent the feature mapping value of mapping the migrated image sample to the basic image sample, that is, β in formula ① i. F is the learned classification model, which refers to the basic classification model here. F() refers to the result obtained after inputting the parameters in the brackets into the basic classification model. Specifically, the computer device can input the basic image sample into the basic classification model to obtain the basic prediction classification feature corresponding to the basic image sample, denoted as where e is used to represent the distance calculation formula. For example, is used to represent the second feature distance between the basic prediction classification feature and the spatial prediction classification feature. Among them, is used to represent the transfer space vector. Among them, is used to represent the basic image sample belonging to the basic style group. Input the transfer space vector into the basic classification model, and output the spatial prediction classification feature in the basic classification model, that is
[0130] Specifically, the computer device can obtain the prediction sub-distance between each basic prediction classification feature and the spatial prediction classification feature respectively, and determine the sum of the prediction sub-distances between each basic prediction classification feature and the spatial prediction classification feature as the second prediction distance. Specifically, as shown in formula ②, the computer device can obtain under the condition of, the prediction sub-distance between each basic prediction classification feature and the spatial prediction classification feature respectively, that is The can take any basic image sample in the basic style group B S . The computer device determines the sum of the prediction sub-distances between each basic prediction classification feature and the spatial prediction classification feature as the second prediction distance. The second prediction distance is Based on the second prediction distance, normalize each prediction sub-distance to obtain t feature mapping values. For example, is used to represent the prediction sub-distance between the i-th basic prediction classification feature and the spatial prediction classification feature. Based on the second prediction distance, normalize the i-th prediction sub-distance to obtain the i-th feature mapping value β i . Similarly, t feature mapping values can be obtained.
[0131] Furthermore, the computer device can obtain the label similarity between t basic sample labels and the transfer sample labels respectively, weight the t feature mapping values based on the t label similarities to obtain the feature transfer loss value, and generate the second loss function according to the feature transfer loss value and the number of basic samples, as shown in formula ①.
[0132] Further, the number of transfer prediction classification features is r, and the number of basic prediction classification features is t; r is a positive integer, and t is a positive integer. When determining the second transfer weight according to the first feature distance between the transfer prediction classification features and the basic prediction classification features, the computer device can obtain the feature sub-distances between the basic prediction classification features and the r transfer prediction classification features respectively, and determine the sum of the feature sub-distances between the basic prediction classification features and the r transfer prediction classification features as the first prediction distance; based on the first prediction distance, normalize the r feature sub-distances to obtain r second transfer weights. The generation process of the second transfer weight can be seen in Formula ③ as follows:
[0133]
[0134] As shown in Formula ③, α g is used to represent the g-th second transfer weight, B T is used to represent the transfer style group, is used to represent the p-th transfer image sample in the transfer style group. The computer device can obtain the feature sub-distances between the i-th basic prediction classification feature and the r transfer prediction classification features respectively, and the feature sub-distance is p can take any positive integer from 1 to r. Through this condition, based on the feature sub-distances between the i-th basic prediction classification feature and the r transfer prediction classification features can be obtained. Determine the sum of the r feature sub-distances as the first prediction distance, denoted as Based on the first prediction distance, normalize the r feature sub-distances to obtain r second transfer weights. For example, based on the first prediction distance, normalize the feature sub-distance between the i-th basic prediction classification feature and the g-th transfer prediction classification feature to obtain the g-th second transfer weight. In this way, it is possible to calculate different basic prediction classification features separately, obtain the distances between each basic prediction classification feature and the transfer space when mapped to the transfer space where the transfer image sample is located, thereby improving the accuracy of the second transfer weight, improving the accuracy of representing the distance between the basic prediction classification feature and the transfer prediction classification feature, and further improving the accuracy of model training.
[0135] Optionally, the computer device may pairwise combine the r migration prediction classification features with the t basic prediction classification features to obtain r pairs of prediction results. Each pair of prediction results includes a migration prediction classification feature and a basic prediction classification feature. At this time, r is equal to t. Optionally, the computer device may randomly sort the r migration prediction classification features to obtain a migration feature sequence, and randomly sort the t basic prediction classification features to obtain a basic feature sequence; or, the computer device may sort the r migration prediction classification features according to the training order of the r migration image samples to obtain a migration feature sequence, and sort the t basic prediction classification features according to the training order of the t basic image samples to obtain a basic feature sequence, etc., which are not limited herein. Further, the computer device pairwise combines the r migration prediction classification features in the migration feature sequence with the t basic prediction classification features in the basic feature sequence to obtain r pairs of prediction results. Specifically, the computer device may combine the first migration prediction classification feature with the first basic prediction classification feature to obtain the first pair of prediction results; combine the second migration prediction classification feature with the second basic prediction classification feature to obtain the second pair of prediction results;...; until r pairs of prediction results are obtained. Optionally, the computer device may also randomly select a migration prediction classification feature from the r migration prediction classification features, randomly select a basic prediction classification feature from the t basic prediction classification features, and combine the selected migration prediction classification feature with the basic prediction classification feature to obtain the first pair of prediction results; randomly select a migration prediction classification feature from the remaining (r - 1) migration prediction classification features, randomly select a basic prediction classification feature from the remaining (t - 1) basic prediction classification features, and combine the selected migration prediction classification feature with the basic prediction classification feature to obtain the second pair of prediction results;..., until r pairs of prediction results are obtained. In other words, the combination method of pairwise combining the r migration prediction classification features with the t basic prediction classification features is not limited in this application. The computer device may obtain the feature sub - distances corresponding to each pair of prediction results respectively, determine the sum of the r feature sub - distances as the first prediction distance, and normalize the r feature sub - distances based on the first prediction distance to obtain r second migration weights. Through this method, the distance information corresponding to all basic prediction classification features and all migration classification features can be represented based on the r second migration weights, the data volume for calculating the second migration weights can be reduced, thereby reducing the time consumption and improving the acquisition efficiency of the second migration weights.
[0136] Furthermore, the computer device may perform a weighting process on the migration prediction classification features based on the second migration weights to generate a migration space vector. Specifically, the computer device may perform a weighted sum on the r second migration weights for the r migration prediction classification features to generate a migration space vector. The generation process of this migration space vector can be seen in Formula ④ as follows:
[0137]
[0138] where B T is used to represent the migration style group, is used to represent the g-th migration image sample in this migration style group. Based on Formula ③, r second migration weights can be obtained. Based on the r second migration weights, the r migration prediction classification features are weighted in sequence, and the sum of the weighted results is determined as the migration space vector
[0139] Through the above Formula ③, the feature sub-distances between the i-th basic prediction classification feature and the r migration prediction classification features are determined, and the r feature sub-distances are normalized to obtain the second migration weights of the r migration prediction classification features for the i-th basic prediction classification feature respectively, that is, r second migration weights are obtained; based on Formula ④, the r second migration weights are used to perform a weighted sum on the r migration prediction classification features to generate a migration space vector Substitute the migration space vector into Formula ② to obtain the spatial prediction classification feature corresponding to the migration space vector According to the prediction sub-distances between the t basic prediction classification features and the spatial prediction classification features respectively, the t prediction sub-distances are normalized to obtain t feature mapping values, β i represents the i-th feature mapping value among the t feature mapping values; based on Formula ①, the label similarities between the t basic sample labels and the migration sample labels are obtained, and the t feature mapping values are weighted based on the t label similarities to obtain a feature transfer loss value. The feature transfer loss value is averaged based on the number of basic samples t to generate a second loss function L cdl cdl, the base classification model is trained based on the second loss function to generate a transfer classification model. The mapping between the base space where the base image samples are located and the transfer space where the transfer image samples are located is realized, so that the second loss function can represent the distance between the base image samples and the transfer image samples. When the base sample label of the base image sample is the same as the transfer sample label of the transfer image sample, the second loss function will increase as the distance between the two increases. Therefore, by adjusting the parameters of the base classification model based on the second loss function, the distance between the base image samples and the transfer image samples with different image drawing styles and belonging to the same image category can be reduced, thereby improving the compatibility of the trained transfer classification model with different image drawing styles and improving the classification and recognition accuracy of images with different image drawing styles based on the transfer classification model.
[0140] In the embodiment of the present application, the computer device can obtain base image samples with a base drawing style from N image samples, input the base image samples into the base classification model, and output the base image features corresponding to the base image samples in the base classification model; the base classification model is trained based on the base image samples; the base classification model is divided into a shallow base classification network and a deep base classification network, input the transfer image samples into the base classification model, output the first transfer image features corresponding to the transfer image samples in the shallow base classification network, perform feature transfer on the first transfer image features based on the base image features in the deep base classification network to obtain feature transfer data, and output the transfer prediction classification features corresponding to the transfer image samples according to the feature transfer data; the transfer image samples belong to the image samples in N image samples other than the base image samples; the transfer image samples have a transfer drawing style; the base classification model is trained according to the transfer prediction classification features to generate a transfer classification model; the transfer classification model is used to classify and predict images with a base drawing style or a transfer drawing style. Through the above process, the computer device can further train based on the base classification model, making the model relatively lightweight. At the same time, it is retrained on the base classification model trained from the base image samples. When retraining the base classification model, the features of the base image samples will be incorporated into the transfer image samples to standardize the feature space dimension of samples with different image drawing styles, so that the transfer classification model obtained after retraining the base classification model can better be compatible with images with different image drawing styles, thereby improving the accuracy of the model in classifying images and improving the generalization ability of the model.
[0141] Further, please refer to Figure 6 , Figure 6 is a specific flowchart of image data processing provided by the embodiment of the present application. As Figure 6 shown, the process includes the following steps:
[0142] Step S601: Obtain N image samples and the image drawing style features respectively corresponding to each image sample.
[0143] In an embodiment of the present application, the computer device may obtain N image samples, and perform style recognition on the N image samples respectively based on a style recognition model to obtain the image drawing style features respectively corresponding to the N image samples.
[0144] Step S602: Perform clustering processing on the N image samples based on the image drawing style features respectively corresponding to each image sample to obtain M image style groups.
[0145] In an embodiment of the present application, the computer device may determine the image drawing style respectively corresponding to each image sample based on the image drawing style features respectively corresponding to each image sample, divide the image samples with the same image drawing style into one category to obtain M image style groups, that is, the image samples in the same image style group have the same image drawing style, and the image samples in different image style groups have different image drawing styles. Among them, each image style group may include one or at least two image samples. Optionally, the computer device may first determine the image quality respectively corresponding to the N image samples based on the image drawing style features respectively corresponding to the N image samples; screen the N image samples based on the image quality, delete the image samples with the image quality less than the sample quality threshold, and perform clustering processing on the remaining image samples to obtain M image style groups.
[0146] Among them, for steps S601 to S602, reference may be made to Figure 3 the specific description shown in step S301 in
[0147] Step S603: Divide the M image style groups into a basic style group, a transfer style group, and a generalization style group.
[0148] In an embodiment of the present application, a computer device may count the number of image samples included in each of the M image style groups to obtain the number of image samples corresponding to each of the M image style groups, record the image style group with the largest number of image samples as the base style group, determine the image drawing style corresponding to the base style group as the base drawing style, and determine the image samples included in the base style group as the base image samples. Optionally, obtain a migration style threshold, determine the image style groups with the number of image samples less than the migration style threshold as the generalization style groups, and determine the image samples included in the generalization style groups as the generalization image samples; or, the generalization image samples may be directly obtained from a generalization image library. Determine the image style groups other than the base style group and the migration style groups among the M image style groups as the migration style groups, and determine the image samples included in the migration style groups as the migration image samples. Wherein, the number of the generalization image groups is a, a is 0 or a positive integer, each generalization image group corresponds to an image drawing style, that is, the number of the generalization drawing styles is a; the number of the migration style groups is b, b is a positive integer, each migration style group corresponds to an image drawing style, that is, the number of the migration drawing styles is b.
[0149] Step S604: Train the initial standard model based on the base image samples in the base style group to generate a base classification model.
[0150] In an embodiment of the present application, a computer device may obtain the base sample labels of the base image samples, predict the base image samples through the initial standard model to obtain the initial predicted classification features; obtain the category error between the base sample labels and the initial predicted classification features based on the first loss function, and adjust the parameters of the initial standard model according to the category error to generate a base classification model. The first loss function may include a normalized cross-entropy loss function (softmax crossentropy) or a cycle discrepancy loss function, etc. Wherein, the initial standard model may be a basic model for classification, such as a resNet network, etc.
[0151] Step S605: Train the base classification model based on the migration image samples in the migration style group to generate a migration classification model.
[0152] In an embodiment of the present application, a computer device may train the base classification model based on the migration image samples to generate a migration classification model. This process may refer to Figure 3 Steps S301 to S303 shown in Figure 5As shown, the computer device can normalize the basic image features 504, weight the transfer prediction classification features 506 based on the normalized basic image features, and generate a second loss function according to the weighted processing result. Among them, Figure 5 the area 507 is used to indicate the weighted processing. Based on the second loss function generated by combining the image sample and the transfer image sample, a conventional loss function can also be generated according to the transfer sample label of the transfer image sample, and the basic classification model can be trained based on the second loss function and the conventional loss function to generate a transfer classification model.
[0153] Furthermore, when training the basic classification model based on the transfer image samples in the transfer style group, the basic classification model can be trained based on the transfer image samples in b transfer style groups in sequence, that is, it can be considered that one transfer style group is trained at a time, so that the image rendering styles corresponding to the b transfer style groups can be integrated into the basic classification model, and finally a transfer classification model is obtained. The training order of the b transfer style groups can be determined based on the number of image samples included in each transfer style group, or can be random, which is not limited here.
[0154] Among them, taking one transfer style group as an example, assuming that this transfer style group includes r transfer image samples and the basic style group includes t basic image samples, through formula ①, the second loss function of a transfer image sample in the basic classification model can be obtained, that is, the computer device trains the basic classification model based on r transfer image samples in sequence. The r transfer image samples include the transfer image sample j, and the second loss function generated by the transfer image sample j during the process of the basic classification model is obtained through formula ① to formula ④.
[0155] Step S606, train the transfer classification model based on the generalization image samples in the generalization style group to generate a generalization classification model.
[0156] In an embodiment of the present application, a computer device may divide a migration classification model into a shallow migration classification network and a deep migration classification network. The migration image samples are input into the migration classification model, and the corresponding second migration image features of the migration image samples are output in the shallow migration classification network. The generalization image samples are input into the migration classification model, and the corresponding generalization image features of the generalization image samples are output in the shallow migration classification network, where the generalization image samples have a generalization drawing style that is different from both the base drawing style and the migration drawing style; the migration drawing style refers to the image drawing style of the migration image samples. The migration distribution information of the second migration image features and the generalization distribution information of the generalization image features are obtained. The migration distribution information is calibrated to obtain migration calibration information, and the generalization distribution information is calibrated to obtain generalization calibration information; the migration calibration information and the generalization calibration information are input into the deep migration classification network, and the deep migration classification network performs a weighted process on the migration calibration information and the generalization calibration information to obtain generalization prediction classification features; the migration classification model is trained according to the generalization prediction classification features to generate a generalization classification model; the generalization classification model is used to perform classification prediction on images with a base drawing style, a migration drawing style, or a generalization drawing style.
[0157] Specifically, reference may be made to Figure 7 , Figure 7 which is a schematic diagram of a generalization classification model training scenario provided by an embodiment of the present application. As Figure 7 shown, the computer device inputs the migration image sample 701 into the migration classification model, and the corresponding second migration image features of the migration image sample 701 are output in the shallow migration classification network 702. The generalization image sample 703 is input into the migration classification model, and the corresponding generalization image features of the generalization image sample 703 are output in the shallow migration classification network. The migration distribution information of the second migration image features and the generalization distribution information of the generalization image features can be seen in Figure 7 region 7041. For example, the black circles in this region 7041 represent the second migration image features, and the gray triangles represent the generalization image features. According to the second migration image features, the migration distribution information indicated by the black curve in region 7041 can be obtained, and according to the generalization image features, the generalization distribution information indicated by the gray curve in region 7041 can be obtained. Further, the computer device can perform mutual distribution calibration on the migration distribution information and the generalization distribution information to obtain the migration calibration information corresponding to the migration distribution information and the generalization calibration information corresponding to the generalization distribution information. Reference may be made to Figure 7The middle region 7042. For example, in this region 7042, the black circles represent the calibrated second migration image features, and the gray triangles represent the calibrated generalization image features. According to the calibrated second migration image features, the migration calibration information indicated by the black curve in region 7042 can be obtained. According to the calibrated generalization image features, the generalization calibration information indicated by the gray curve in region 7042 can be obtained. Among them, the migration calibration information further includes the calibrated second migration image features, and the generalization calibration information further includes the calibrated generalization image features. The migration calibration information and the generalization calibration information are input into the deep migration classification network 705, and based on the deep migration classification network 705, the migration calibration information and the generalization calibration information are weighted to obtain the generalized prediction classification features, that is Figure 7 the weighted result in
[0158] Furthermore, the computer device can obtain the first distribution difference between the migration distribution information and the migration calibration information, and obtain the second distribution difference between the generalization distribution information and the generalization calibration information; generate a backpropagation function according to the first distribution difference and the second distribution difference; obtain the generalization sample label of the generalization image sample, and generate a third loss function according to the generalization prediction classification feature and the generalization sample label; adjust the parameters of the migration classification model based on the backpropagation function and the third loss function to generate a generalization classification model. By this means, the differences between different image drawing styles can be reduced, thereby improving the compatibility of the trained generalization classification model with different image drawing styles. Among them, when the computer device detects the emergence of a new image drawing style, it can further train the classification model based on step S606.
[0159] Among them, reference can be made to Figure 8 , Figure 8 which is a schematic diagram of a model training scenario provided by an embodiment of the present application. As Figure 8 shown, the computer device can perform clustering processing on N image samples to obtain M image style groups 801, and divide the M image style groups 801 into a basic style group, a migration style group, and a generalization style group. Obtain basic image samples 802 from the basic style group, and predict the basic image samples 802 based on the initial standard model 803 to obtain the initial prediction classification features 804. Generate a first loss function according to the category error between the initial prediction classification features 804 and the basic sample labels of the basic image samples 802, and train the initial standard model 803 based on the first loss function to generate a basic classification model 806.
[0160] Obtain a migrated image sample 805 from the migration style group, input the migrated image sample 805 into the basic classification model 806 for prediction to obtain a migrated prediction classification feature 807, and perform a weighted process on the migrated prediction classification feature 807 through the basic prediction classification feature output by the basic image sample 802 in the basic classification model 806 to generate a second loss function. Among them, the weighted process can be referred to Figure 8 in the area 808. The weighted process indicated by this area 808 is used to represent the adjustment process of the features of the migrated image sample by the basic image sample when training the basic classification model 806, rather than directly performing a weighted process on the migrated prediction classification feature 807 based on the initial prediction classification feature 804. Adjust the parameters of the basic classification model 806 according to the second loss function to generate a migrated classification model 810. This process can be referred to Figure 3 for the specific description shown in steps S301 to S303 in
[0161] Obtain a generalized image sample 809 from the generalization style group, input the generalized image sample 809 into the migrated classification model 810 for prediction to obtain a generalized prediction classification feature 811. Among them, when predicting the generalized image sample 809 based on the migrated classification model 810, the style of the generalized image sample 809 can be calibrated based on the migrated image sample 805, a backpropagation function is generated according to the style calibration, a third loss function is generated according to the generalized prediction classification feature 8011, and the parameters of the migrated classification model 810 are adjusted according to the backpropagation function and the third loss function to generate a generalized classification model. Among them, the third loss function can be, but is not limited to, a calibration soft loss function (calibration soft loss) or a softmax cross entropy loss function, etc.
[0162] Furthermore, please refer to Figure 9 , Figure 9 is a schematic diagram of an image classification process provided by an embodiment of the present application. As Figure 9 shown, this process includes the following steps:
[0163] Step S901, in response to a classification recognition request for an image to be classified, input the image to be classified into a target classification model for prediction to obtain a target image category corresponding to the image to be classified.
[0164] In an embodiment of the present application, the computer device responds to a classification recognition request for an image to be classified, inputs the image to be classified into a target classification model for prediction, and obtains the target image category corresponding to the image to be classified. Among them, if there is a generalized classification model, the target classification model is the generalized classification model; if there is a transfer classification model and there is no generalized classification model, the target classification model is the transfer classification model; if there is a basic classification model and there is no generalized classification model and transfer classification model, the target classification model is the basic classification model; the generalized classification model is generated by generalizing the transfer classification model; the transfer classification model is based on the basic classification model to predict the basic image features of the basic image samples with the basic drawing style, predicts the first transfer image features of the transfer image samples based on the shallow basic classification network in the basic classification model, performs feature transfer on the first transfer image features based on the basic image features in the deep basic classification network to obtain feature transfer data, obtains transfer prediction classification features according to the feature transfer data, and is generated by training the basic classification model based on the transfer prediction classification features. Optionally, when the user uploads an image to be classified in the data application, the computer device associated with the data application can be considered to receive a classification recognition request for the image to be classified. Among them, the data application can be an application program, or can be a web application or a website application, etc.; or, the computer device can perform periodic detection on the acquired images. For example, the computer device sequentially uses the images acquired within an image detection cycle as the images to be classified, and performs classification recognition on the images to be classified. That is to say, when it is necessary to perform classification recognition on the image to be classified, it can be considered to receive a classification recognition request for the image to be classified. The specific triggering timing of the classification recognition request is not limited here. Among them, the more types of image drawing styles that the target classification model is compatible with, the greater the accuracy of the classification recognition of the image by the target classification model can be considered. Therefore, when there is a generalized classification model, the target classification model is the generalized classification model; when there is no generalized classification model, the target classification model can be the transfer classification model; when there is no generalized classification model and no transfer classification model, the target classification model can be the basic classification model. Optionally, if there is no generalized classification model, no transfer classification model, and no basic classification model, the target classification model can be an initial standard model, so that when the computer device receives a classification recognition request for an image to be classified, it can timely perform classification recognition on the image to be classified, so as to avoid the loss caused by the inability to perform classification recognition during the model training process, thereby improving the efficiency of image classification recognition.
[0165] Among them, the image categories may include, but are not limited to, normal image categories, pornographic image categories, horror image categories, violent image categories, etc. A push result for the image to be classified is determined based on the target image category. Among them, the classification and recognition request may be sent by a user device or triggered in a computer device, which is not limited here. Among them, the computer device may be a platform device corresponding to an application or a user device, etc.
[0166] Step S902, obtain the abnormal category.
[0167] In the embodiment of the present application, if the target image category belongs to the abnormal category, step S903 is executed to output an image abnormality prompt message; if the target image category does not belong to the abnormal category, step S904 is executed to output the image to be classified. Optionally, the abnormal category may be a default abnormal category or an abnormal category corresponding to the application. For example, the computer device may obtain the abnormal category associated with the application and compare the target image category with the abnormal category.
[0168] Step S903, output an image abnormality prompt message.
[0169] In the embodiment of the present application, if the target image category belongs to the abnormal category, the computer device may output an image abnormality prompt message, and the image abnormality prompt message includes the target image category. For example, when a user uploads an image to be classified to an application, and the computer device detects that the target image category of the image to be classified belongs to the abnormal category, an image abnormality prompt message is sent to the user terminal where the user is located, so that the user terminal displays the image abnormality prompt message, and the user cancels the upload of the image to be classified based on the image abnormality prompt message or processes the image to be classified and uploads it again.
[0170] Step S904, output the image to be classified.
[0171] In the embodiment of the present application, if the target image category does not belong to the abnormal category, the computer device outputs the image to be classified. For example, when a user uploads an image to be classified to an application, and the computer device detects that the target image category of the image to be classified does not belong to the abnormal category, the image to be classified is uploaded to the application, and the image to be classified may also be displayed in the application.
[0172] Optionally, the computer device may also obtain a legal category. If the target image category belongs to the legal category, step S904 is executed; if the target image category does not belong to the legal category, step S903 is executed.
[0173] For example, please refer to Figure 10 , Figure 10 is a schematic diagram of an image recognition scenario provided by the embodiment of the present application. AsFigure 10 As shown, the user device 1001 sends an image upload request for the image 1002 to be classified to the computer device 1003. The computer device 1003 determines that it has received a classification and recognition request for the image 1002 to be classified based on this image upload request, inputs the image 1002 to be classified into the target classification model 1003 for prediction, and obtains that the target image category of the image 1002 to be classified is the horror image category. This horror image category belongs to the abnormal category, and an image abnormality prompt message is sent to the user device 1001. The user device 1001 displays the image abnormality prompt message 1005 for the image 1002 to be classified on the image display page 1004. This image abnormality prompt message 1005 can be generated according to the target image category. For example, in Figure 10 , this image abnormality prompt message 1005 can be "The image is relatively horror and the upload fails." etc. Optionally, this image abnormality prompt message 1005 can also include an image modification prompt, and based on this image modification prompt, it instructs the user to modify the image 1002 to be classified and re-upload it. For example, this image modification prompt is "You can add mosaics etc. to cover the horror area" or "Crop the horror area" etc., which is not limited here.
[0174] Optionally, after obtaining the image to be classified, the computer device can also identify the target image drawing style to which the image to be classified belongs. If the target image drawing style is in an untrained state, the classification model that can be obtained is trained based on the target image drawing style, and the image to be classified is classified and recognized based on the trained classification model; if the target image drawing style is in a trained state, the classification model is directly obtained to classify and recognize the image to be classified. Specifically, reference can be made to Figure 11 , Figure 11 which is another schematic diagram of an image recognition scenario provided by an embodiment of this application. As Figure 11As shown, the user device 1101 sends an image upload request to the computer device 1103. The image upload request includes the image to be classified 1102. When the computer device 1103 receives this image upload request, it is equivalent to obtaining a classification and recognition request for the image to be classified 1102. The computer device 1103 can identify the target image drawing style corresponding to the image to be classified 1102, obtain the training status for this target image drawing style. If the target image drawing style is in an untrained state, it obtains the target image samples associated with the target image drawing style, and performs model training based on these target image samples to obtain the target classification model 1104. Optionally, if there is a generalization classification model, the computer device can perform model training on the generalization classification model based on the target image samples to generate the target classification model 1104; if there is a transfer classification model and no generalization classification model, the computer device can perform model training on the transfer classification model based on the target image samples to generate the target classification model 1104. At this time, the computer device can also perform generalization processing on the basis of the target classification model 1104 to obtain a generalization classification model; if there is a basic classification model, and no transfer classification model and generalization classification model, the computer device can perform model training on the basic classification model based on the target image samples to generate the target classification model 1104. At this time, the computer device can also perform transfer training on the basis of the target classification model 1104 to generate a transfer classification model.
[0175] If the target image drawing style is in a trained state, the target classification model 1104 is directly called. Among them, if there is a generalized classification model, the target classification model is the generalized classification model. At this time, the target image drawing style belongs to the basic drawing style, the transfer drawing style, or the generalized drawing style; if there is a transfer classification model and there is no generalized classification model, the target classification model is the transfer classification model. At this time, the target image drawing style belongs to the basic drawing style or the transfer drawing style; if there is a basic classification model and there is no generalized classification model and transfer classification model, the target classification model is the basic classification model. At this time, the target image drawing style belongs to the basic drawing style. The computer device classifies and recognizes the image to be classified 1102 based on the target classification model 1104, and predicts the classification recognition result 1105 corresponding to the image to be classified 1102. Assuming that there are q image category labels, where q is a positive integer, the classification recognition result 1105 includes q image category labels and the category probabilities corresponding to each image category label respectively, such as image category label 1 and the category probability 1 corresponding to image category label 1, image category label 2 and the category probability 2 corresponding to image category label 2,..., image category label q and the category probability q corresponding to image category label q. The image category label with the largest category probability is determined as the target image category corresponding to the image to be classified 1102. The computer device 1103 can obtain the legal category corresponding to the associated application program. If the target image category belongs to the legal category, an image legal message is sent to the user device 1101, and the image to be classified 1102 is uploaded to the application program. The user device 1101 can display the image to be classified 1102 on the image display page 1106 of the application program.
[0176] Optionally, the computer device using the model and the computer device training the model can be the same device or different devices. Among them, in Figure 11 , if the computer device using the model and the computer device training the model are different devices, and the computer device 1103 obtains that the target image drawing style is in an untrained state, a model training request is sent to the computer device training the model. The model training request includes the target image drawing style. When the computer device training the model trains the model based on the target image drawing style and generates the target classification model 1104, the target classification model 1104 is sent to the computer device 1103.
[0177] Further, please refer to Figure 12 , Figure 12It is a schematic diagram of an image data processing device provided by an embodiment of the present application. The image data processing device may be a computer program (including program codes, etc.) running on a computer device. For example, the image data processing device may be an application software. The device may be used to execute the corresponding steps in the method provided by the embodiment of the present application. As Figure 12 shown, the image data processing device 1200 may be used for Figure 3 the computer device in the corresponding embodiment. Specifically, the device may include: a basic sample acquisition module 11, a basic prediction module 12, a basic model division module 13, a basic shallow processing module 14, a basic deep processing module 15, a migration sample prediction module 16, and a migration model training module 17.
[0178] The basic sample acquisition module 11 is used to acquire basic image samples with a basic drawing style from N image samples; N is a positive integer;
[0179] The basic prediction module 12 is used to input the basic image samples into a basic classification model and output the basic image features corresponding to the basic image samples in the basic classification model; the basic classification model is trained based on the basic image samples;
[0180] The basic model division module 13 is used to divide the basic classification model into a shallow basic classification network and a deep basic classification network;
[0181] The basic shallow processing module 14 is used to input the migration image samples into the basic classification model and output the first migration image features corresponding to the migration image samples in the shallow basic classification network;
[0182] The basic deep processing module 15 is used to perform feature migration on the first migration image features based on the basic image features in the deep basic classification network to obtain feature migration data;
[0183] The migration sample prediction module 16 is used to output the migration prediction classification features corresponding to the migration image samples according to the feature migration data; the migration image samples belong to the image samples in the N image samples except the basic image samples; the migration image samples have a migration drawing style;
[0184] The migration model training module 17 is used to train the basic classification model according to the migration prediction classification features to generate a migration classification model; the migration classification model is used to perform classification prediction on images with a basic drawing style or a migration drawing style.
[0185] Among them, the basic sample acquisition module 11 includes:
[0186] A style recognition unit 111, configured to obtain N image samples, perform style recognition on the N image samples respectively based on a style recognition model, and obtain image drawing style features corresponding to the N image samples respectively;
[0187] A style clustering unit 112, configured to perform clustering processing on the N image samples based on the image drawing style features corresponding to the N image samples respectively, and obtain M image style groups; M is a positive integer, and M is less than or equal to N;
[0188] A style statistics unit 113, configured to count the number of image samples included in each of the M image style groups respectively, obtain the number of image samples corresponding to each of the M image style groups respectively, and determine the image drawing style corresponding to the image style group with the largest number of image samples as the basic drawing style;
[0189] A basic determination unit 114, configured to determine the image samples in the image style group corresponding to the basic drawing style as basic image samples.
[0190] Wherein, the style clustering unit 112 includes:
[0191] A quality determination subunit 1121, configured to determine the image quality corresponding to the N image samples respectively based on the image drawing style features corresponding to the N image samples respectively;
[0192] A sample selection subunit 1122, configured to obtain a sample quality threshold, and record the image samples with image quality greater than or equal to the sample quality threshold as the to-be-trained image samples;
[0193] A sample grouping subunit 1123, configured to perform clustering processing on the to-be-trained image samples based on the image drawing style features of the to-be-trained image samples, and obtain M image style groups;
[0194] The basic determination unit 114 is specifically configured to:
[0195] In the M image style groups, determine the to-be-trained image samples included in the image style group corresponding to the basic drawing style as the basic image samples.
[0196] Wherein, the apparatus 1200 further includes:
[0197] A basic sample prediction module 18, configured to obtain the basic sample labels of the basic image samples, and perform prediction on the basic image samples through an initial standard model to obtain initial prediction classification features;
[0198] A basic model training module 19, configured to obtain the category error between the basic sample labels and the initial prediction classification features based on a first loss function, and adjust the parameters of the initial standard model according to the category error to generate a basic classification model.
[0199] Among them, the basic deep processing module 15 includes:
[0200] The first weight determination unit 151 is used to normalize the basic image features in the deep basic classification network, and determine the normalized basic image features as the first transfer weight;
[0201] The first weighted processing unit 152 is used to perform weighted processing on the first transfer image features based on the first transfer weight in the deep basic classification network to obtain feature transfer data.
[0202] Among them, the transfer model training module 17 includes:
[0203] The label acquisition unit 171 is used to acquire the number of basic samples of the basic image samples, and acquire the basic sample labels of the basic image samples and the transfer sample labels of the transfer image samples;
[0204] The feature mapping unit 172 is used to obtain the feature mapping value that maps the transfer image samples to the basic image samples according to the transfer prediction classification features;
[0205] The first function generation unit 173 is used to obtain the label similarity between the basic sample labels and the transfer sample labels, and generate the second loss function based on the number of basic samples, the feature mapping value and the label similarity;
[0206] The transfer training unit 174 is used to train the basic classification model based on the second loss function to generate a transfer classification model.
[0207] Among them, the feature mapping unit 172 includes:
[0208] The basic prediction subunit 1721 is used to input the basic image samples into the basic classification model to obtain the basic prediction classification features corresponding to the basic image samples;
[0209] The mapping acquisition subunit 1722 is used to determine the feature mapping value that maps the transfer image samples to the basic image samples according to the first feature distance between the transfer prediction classification features and the basic prediction classification features.
[0210] Among them, the mapping acquisition subunit 1722 includes:
[0211] The weight acquisition subunit 172a is used to determine the second transfer weight according to the first feature distance between the transfer prediction classification features and the basic prediction classification features;
[0212] A spatial feature generation subunit 172b, configured to perform a weighting process on the transfer prediction classification features based on the second transfer weight to generate a transfer spatial vector, input the transfer spatial vector into the basic classification model, and output spatial prediction classification features in the basic classification model;
[0213] A mapping determination subunit 172c, configured to determine a feature mapping value for mapping the transfer image sample to the basic image sample according to a second feature distance between the basic prediction classification features and the spatial prediction classification features.
[0214] Wherein, the number of transfer prediction classification features is r; t is a positive integer;
[0215] The weight acquisition subunit 172a includes:
[0216] A first distance determination subunit 172d, configured to obtain feature sub-distances between the basic prediction classification features and the r transfer prediction classification features respectively, and determine the sum of the feature sub-distances between the basic prediction classification features and the r transfer prediction classification features as a first prediction distance;
[0217] A weight normalization subunit 172e, configured to perform a normalization process on the r feature sub-distances based on the first prediction distance to obtain r second transfer weights;
[0218] The spatial feature generation subunit 172b includes:
[0219] A vector generation subunit 172f, configured to perform a weighted summation on the r transfer prediction classification features based on the r second transfer weights to generate a transfer spatial vector.
[0220] Wherein, the number of basic prediction classification features is t; the number of basic sample labels is t; t is a positive integer;
[0221] The mapping determination subunit 172c includes:
[0222] A second distance determination subunit 172g, configured to obtain prediction sub-distances between each basic prediction classification feature and the spatial prediction classification features respectively, and determine the sum of the prediction sub-distances between each basic prediction classification feature and the spatial prediction classification features as a second prediction distance;
[0223] A normalization processing subunit 172h, configured to perform a normalization process on each prediction sub-distance based on the second prediction distance to obtain t feature mapping values;
[0224] The first function generation unit 173 is specifically configured to:
[0225] Obtain the label similarities between t basic sample labels and the transfer sample labels respectively, perform weighted processing on the t feature mapping values based on the t label similarities to obtain a feature transfer loss value, and generate a second loss function according to the feature transfer loss value and the number of basic samples.
[0226] Among them, the device 1200 further includes:
[0227] A transfer model division module 20, configured to obtain generalization image samples in a generalization image library, and divide the transfer classification model into a shallow transfer classification network and a deep transfer classification network;
[0228] A transfer shallow prediction module 21, configured to input the transfer image samples into the transfer classification model, output the second transfer image features corresponding to the transfer image samples in the shallow transfer classification network, input the generalization image samples into the transfer classification model, and output the generalization image features corresponding to the generalization image samples in the shallow transfer classification network; the generalization image samples have a generalization drawing style, and the generalization drawing style is different from both the basic drawing style and the transfer drawing style; the transfer drawing style refers to the image drawing style of the transfer image samples;
[0229] A distribution calibration module 22, configured to obtain the transfer distribution information of the second transfer image features and the generalization distribution information of the generalization image features, perform distribution calibration on the transfer distribution information to obtain transfer calibration information, and perform distribution calibration on the generalization distribution information to obtain generalization calibration information;
[0230] A transfer deep prediction module 23, configured to input the transfer calibration information and the generalization calibration information into the deep transfer classification network, and perform weighted processing on the transfer calibration information and the generalization calibration information based on the deep transfer classification network to obtain generalization prediction classification features;
[0231] A generalization model training module 24, configured to train the transfer classification model according to the generalization prediction classification features to generate a generalization classification model; the generalization classification model is used to perform classification prediction on images with a basic drawing style, a transfer drawing style, or a generalization drawing style.
[0232] Among them, the generalization model training module 24 includes:
[0233] A distribution difference acquisition unit 241, configured to obtain a first distribution difference between the transfer distribution information and the transfer calibration information, and obtain a second distribution difference between the generalization distribution information and the generalization calibration information;
[0234] A second function generation unit 242, configured to generate a backpropagation function according to the first distribution difference and the second distribution difference;
[0235] A third function generation unit 243, configured to obtain the generalization sample label of the generalization image sample, and generate a third loss function according to the generalization prediction classification feature and the generalization sample label;
[0236] A generalization parameter adjustment unit 244, configured to adjust the parameters of the transfer classification model based on the backpropagation function and the third loss function to generate a generalization classification model.
[0237] An embodiment of the present application provides an image data processing device. The device can obtain a basic image sample with a basic drawing style from N image samples, input the basic image sample into a basic classification model, and output the basic image feature corresponding to the basic image sample in the basic classification model; the basic classification model is trained based on the basic image sample; the basic classification model is divided into a shallow basic classification network and a deep basic classification network, input the transfer image sample into the basic classification model, output the first transfer image feature corresponding to the transfer image sample in the shallow basic classification network, perform feature transfer on the first transfer image feature based on the basic image feature in the deep basic classification network to obtain feature transfer data, and output the transfer prediction classification feature corresponding to the transfer image sample according to the feature transfer data; the transfer image sample belongs to the image samples in the N image samples except the basic image sample; the transfer image sample has a transfer drawing style; train the basic classification model according to the transfer prediction classification feature to generate a transfer classification model; the transfer classification model is used to perform classification prediction on images with a basic drawing style or a transfer drawing style. Through the above process, the computer device can perform further training based on the basic classification model, making the model relatively lightweight. At the same time, it performs re-training on the basic classification model trained from the basic image sample. When re-training the basic classification model, the features of the basic image sample will be incorporated into the transfer image sample to standardize the feature space dimension of samples with different image drawing styles, so that the transfer classification model obtained after re-training the basic classification model can better be compatible with images with different image drawing styles, thereby improving the accuracy of the model in classifying images and enhancing the generalization ability of the model.
[0238] Further, please refer to Figure 13 , Figure 13 which is a schematic diagram of another image data processing device provided by an embodiment of the present application. The image data processing device can be a computer program (including program code, etc.) running in a computer device. For example, the image data processing device can be an application software; the device can be used to execute the corresponding steps in the method provided by the embodiment of the present application. As Figure 13 shown, the image data processing device 1300 can be used to Figure 9The computer device in the corresponding embodiment. Specifically, the device may include: a category prediction module 1301, an anomaly prompt module 1302, and an image output module 1303.
[0239] The category prediction module 1301 is configured to respond to a classification recognition request for an image to be classified, input the image to be classified into a target classification model for prediction, and obtain the target image category corresponding to the image to be classified; if there is a generalized classification model, the target classification model is the generalized classification model; if there is a transfer classification model and no generalized classification model, the target classification model is the transfer classification model; if there is a basic classification model and no generalized classification model and transfer classification model, the target classification model is the basic classification model; the generalized classification model is generated by generalizing the transfer classification model; the transfer classification model is based on the basic classification model to predict the basic image features of the basic image samples with the basic drawing style, predict the first transfer image features of the transfer image samples based on the shallow basic classification network in the basic classification model, perform feature transfer on the first transfer image features based on the basic image features in the deep basic classification network to obtain feature transfer data, obtain transfer prediction classification features according to the feature transfer data, and train the basic classification model based on the transfer prediction classification features.
[0240] The anomaly prompt module 1302 is configured to obtain the anomaly category, and if the target image category belongs to the anomaly category, output an image anomaly prompt message.
[0241] The image output module 1303 is configured to output the image to be classified if the target image category does not belong to the anomaly category.
[0242] See Figure 14 , Figure 14 is a schematic structural diagram of a computer device provided by an embodiment of the present application. As Figure 14 shown, the computer device in the embodiment of the present application may include: one or more processors 1401 and a memory 1402, and may further include an input / output interface 1403. The processor 1401, the memory 1402, and the input / output interface 1403 are connected through a bus 1404. The memory 1402 is used to store a computer program, the computer program includes program instructions, the input / output interface 1403 is used to receive and output data, such as for data interaction between the computer device and the user device; the processor 1401 is used to execute the program instructions stored in the memory 1402.
[0243] Among them, the processor 1401 is located in the computer device for training the model and may perform the following operations:
[0244] Obtain a basic image sample with a basic drawing style from N image samples, input the basic image sample into a basic classification model, and output the basic image features corresponding to the basic image sample in the basic classification model; the basic classification model is trained based on the basic image sample; N is a positive integer;
[0245] Divide the basic classification model into a shallow basic classification network and a deep basic classification network, input the transfer image sample into the basic classification model, output the first transfer image features corresponding to the transfer image sample in the shallow basic classification network, perform feature transfer on the first transfer image features based on the basic image features in the deep basic classification network to obtain feature transfer data, and output the transfer prediction classification features corresponding to the transfer image sample according to the feature transfer data; the transfer image sample belongs to the image samples among the N image samples except the basic image sample; the transfer image sample has a transfer drawing style;
[0246] Train the basic classification model according to the transfer prediction classification features to generate a transfer classification model; the transfer classification model is used to perform classification prediction on images with a basic drawing style or a transfer drawing style.
[0247] The processor 1401 is located in a computer device using the trained model and can perform the following operations:
[0248] In response to a classification recognition request for an image to be classified, input the image to be classified into the target classification model for prediction to obtain the target image category corresponding to the image to be classified; if there is a generalized classification model, the target classification model is the generalized classification model; if there is a transfer classification model and there is no generalized classification model, the target classification model is the transfer classification model; if there is a basic classification model and there is no generalized classification model and transfer classification model, the target classification model is the basic classification model; the generalized classification model is generated by generalizing the transfer classification model; the transfer classification model is based on the basic classification model to predict the basic image features of the basic image sample with the basic drawing style, predict the first transfer image features of the transfer image sample based on the shallow basic classification network in the basic classification model, perform feature transfer on the first transfer image features based on the basic image features in the deep basic classification network to obtain feature transfer data, obtain the transfer prediction classification features according to the feature transfer data, and train the basic classification model based on the transfer prediction classification features to generate;
[0249] Obtain an abnormal category, and if the target image category belongs to the abnormal category, output an image abnormality prompt message;
[0250] If the target image category does not belong to the abnormal category, output the image to be classified.
[0251] In some possible embodiments, the processor 1401 may be a central processing unit (CPU), and the processor may also be 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. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0252] The memory 1402 may include a read-only memory and a random access memory, and provide instructions and data to the processor 1401 and the input / output interface 1403. A part of the memory 1402 may also include a non-volatile random access memory. For example, the memory 1402 may also store information about the device type.
[0253] In a specific implementation, the computer device may execute, through each of its built-in functional modules, the implementation manners provided in each step of the Figure 3 or Figure 6 and specifically refer to the implementation manners provided in each step of the Figure 3 or Figure 6 which will not be elaborated herein.
[0254] By providing a computer device according to an embodiment of the present application, including: a processor, an input / output interface, and a memory, the computer program in the memory is obtained through the processor and executed Figure 3For each step of the method shown in [the figure], perform image data processing operations. In the embodiments of the present application, a basic image sample with a basic drawing style is obtained from N image samples, and the basic image sample is input into a basic classification model, and the basic image features corresponding to the basic image sample are output in the basic classification model; the basic classification model is trained based on the basic image samples; the basic classification model is divided into a shallow basic classification network and a deep basic classification network, the migration image sample is input into the basic classification model, the first migration image features corresponding to the migration image sample are output in the shallow basic classification network, and the first migration image features are feature-migrated based on the basic image features in the deep basic classification network to obtain feature migration data, and the migration prediction classification features corresponding to the migration image sample are output according to the feature migration data; the migration image sample belongs to the image samples other than the basic image sample among the N image samples; the migration image sample has a migration drawing style; the basic classification model is trained according to the migration prediction classification features to generate a migration classification model; the migration classification model is used to classify and predict images with a basic drawing style or a migration drawing style. Through the above process, the computer device can be further trained based on the basic classification model, making the model relatively lightweight. At the same time, it is retrained on the basic classification model obtained by training the basic image samples. When retraining the basic classification model, the features of the basic image samples will be incorporated into the migration image samples to standardize the feature space dimension of samples with different image drawing styles, so that the migration classification model obtained after retraining the basic classification model can better be compatible with images with different image drawing styles, thereby improving the accuracy of the model in classifying images and enhancing the generalization ability of the model.
[0255] The embodiments of the present application also provide a computer-readable storage medium storing a computer program adapted to be loaded and executed by the processor Figure 3 or Figure 6 the image data processing method provided by each step in [the figure], and specifically, reference may be made to the Figure 3 or Figure 6 implementation manners provided by each step in [the figure], which will not be elaborated herein. In addition, the description of the beneficial effects of adopting the same method will not be elaborated either. For the technical details not disclosed in the embodiments of the computer-readable storage medium involved in the present application, please refer to the description of the method embodiments of the present application. As an example, the computer program can be deployed to be executed on one computer device, or on multiple computer devices located at one place, or on multiple computer devices distributed at multiple places and interconnected through a communication network.
[0256] The computer-readable storage medium may be the image data processing device provided in any of the foregoing embodiments or an internal storage unit of the computer device, such as a hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Further, the computer-readable storage medium may also include both an internal storage unit and an external storage device of the computer device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0257] The embodiments of the present application also provide a computer program product or a computer program. The computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes Figure 3 or Figure 6 the methods provided in various alternative manners in, realizing that the computer device is further trained based on the basic classification model, making the model relatively lightweight. At the same time, re-training is performed on the basic classification model obtained by training with basic image samples. When re-training the basic classification model, the features of the basic image samples are incorporated into the migrated image samples to standardize the feature space dimension of samples with different image drawing styles, so that the migrated classification model obtained after re-training the basic classification model can better be compatible with images of different image drawing styles, thereby improving the accuracy of the model in classifying images and enhancing the generalization ability of the model.
[0258] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the term "including" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, device, product, or equipment that includes a series of steps or units is not limited to the listed steps or modules, but may optionally further include steps or modules not listed, or may optionally further include other step units inherent to these processes, methods, devices, products, or equipment.
[0259] Those of ordinary skill in the art will appreciate that the units and algorithm steps of the examples described in connection with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of the examples have been generally described in terms of function in this description. Whether these functions are executed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0260] The methods and related devices provided by the embodiments of this application are described with reference to the method flowcharts and / or structural schematic diagrams provided by the embodiments of this application. Specifically, each process and / or block of the method flowchart and / or structural schematic diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable image data processing devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable image data processing devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or structural schematic Figure 1 one block or multiple blocks. These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable image data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in Figure 1 one process or multiple processes and / or structural schematic Figure 1 one block or multiple blocks. These computer program instructions can also be loaded onto a computer or other programmable image data processing device, such that a series of operation steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in Figure 1 one process or multiple processes and / or structural schematic one block or multiple blocks.
[0261] The foregoing disclosure is only for the preferred embodiments of this application, and of course, it cannot be used to limit the scope of rights of this application. Therefore, equivalent changes made in accordance with the claims of this application still fall within the scope covered by this application.
Claims
1. An image data processing method, characterized in that, The method includes: Obtaining a basic image sample with a basic drawing style from N image samples, inputting the basic image sample into a basic classification model, and outputting basic image features corresponding to the basic image sample in the basic classification model; the basic classification model is trained based on the basic image sample; N is a positive integer; Dividing the basic classification model into a shallow basic classification network and a deep basic classification network, inputting a transfer image sample into the basic classification model, and outputting first transfer image features corresponding to the transfer image sample in the shallow basic classification network; Performing normalization processing on the basic image features in the deep basic classification network, and determining the normalized basic image features as first transfer weights; In the deep basic classification network, performing weighted processing on the first transfer image features based on the first transfer weights to obtain feature transfer data; Outputting transfer prediction classification features corresponding to the transfer image sample according to the feature transfer data; the transfer image sample belongs to the image samples other than the basic image sample among the N image samples; the transfer image sample has a transfer drawing style; Training the basic classification model according to the transfer prediction classification features to generate a transfer classification model; the transfer classification model is used for classifying and predicting images with the basic drawing style or the transfer drawing style.
2. The method according to claim 1, characterized in that, The obtaining a basic image sample with a basic drawing style from N image samples includes: Obtaining N image samples, respectively performing style recognition on the N image samples based on a style recognition model to obtain image drawing style features respectively corresponding to the N image samples; Performing clustering processing on the N image samples based on the image drawing style features respectively corresponding to the N image samples to obtain M image style groups; M is a positive integer, and M is less than or equal to N; Counting the number of image samples included in each of the M image style groups to obtain the number of image samples respectively corresponding to the M image style groups, and determining the image drawing style corresponding to the image style group with the largest number of image samples as the basic drawing style; Determining the image samples in the image style group corresponding to the basic drawing style as basic image samples.
3. The method according to claim 2, wherein The performing clustering processing on the N image samples based on the image drawing style features respectively corresponding to the N image samples to obtain M image style groups includes: Determining the image quality respectively corresponding to the N image samples based on the image drawing style features respectively corresponding to the N image samples; Obtaining a sample quality threshold, and denoting the image samples with image quality greater than or equal to the sample quality threshold as to-be-trained image samples; Performing clustering processing on the to-be-trained image samples based on the image drawing style features of the to-be-trained image samples to obtain M image style groups; The determining the image samples in the image style group corresponding to the basic drawing style as basic image samples includes: Among the M image style groups, the to-be-trained image samples included in the image style group corresponding to the basic drawing style are determined as basic image samples.
4. The method according to claim 1, wherein The method further includes: Obtaining basic sample labels of the basic image samples, and predicting the basic image samples through an initial standard model to obtain initial predicted classification features; Obtaining a category error between the basic sample labels and the initial predicted classification features based on a first loss function, and adjusting parameters of the initial standard model according to the category error to generate a basic classification model.
5. The method according to claim 1, wherein The training of the basic classification model according to the transfer predicted classification features to generate a transfer classification model includes: Obtaining the number of basic samples of the basic image samples, and obtaining the basic sample labels of the basic image samples and the transfer sample labels of the transfer image samples; According to the transfer predicted classification features, obtaining feature mapping values for mapping the transfer image samples to the basic image samples; Obtaining a label similarity between the basic sample labels and the transfer sample labels, and generating a second loss function based on the number of basic samples, the feature mapping values, and the label similarity; Training the basic classification model based on the second loss function to generate a transfer classification model.
6. The method according to claim 5, wherein The obtaining of the feature mapping values for mapping the transfer image samples to the basic image samples according to the transfer predicted classification features includes: Inputting the basic image samples into the basic classification model to obtain basic predicted classification features corresponding to the basic image samples; Determining the feature mapping values for mapping the transfer image samples to the basic image samples according to a first feature distance between the transfer predicted classification features and the basic predicted classification features.
7. The method according to claim 6, wherein The determining of the feature mapping values for mapping the transfer image samples to the basic image samples according to the first feature distance between the transfer predicted classification features and the basic predicted classification features includes: Determining a second transfer weight according to the first feature distance between the transfer predicted classification features and the basic predicted classification features; Performing a weighting process on the transfer predicted classification features based on the second transfer weight to generate a transfer space vector, inputting the transfer space vector into the basic classification model, and outputting space predicted classification features in the basic classification model; Determining the feature mapping values for mapping the transfer image samples to the basic image samples according to a second feature distance between the basic predicted classification features and the space predicted classification features.
8. The method according to claim 7, wherein The number of the transfer predicted classification features is r; r is a positive integer; The determining of the second transfer weight according to the first feature distance between the transfer predicted classification features and the basic predicted classification features includes: Obtaining feature sub-distances between the basic predicted classification features and r transfer predicted classification features respectively, and determining the sum of the feature sub-distances between the basic predicted classification features and r transfer predicted classification features as a first prediction distance; Performing a normalization process on the r feature sub-distances based on the first prediction distance to obtain r second transfer weights; Performing weighted processing on the migration prediction classification features based on the second migration weight to generate a migration space vector, including: Performing weighted summation on the r migration prediction classification features based on the r second migration weights to generate a migration space vector.
9. The method according to claim 7, wherein The number of the basic prediction classification features is t; the number of the basic sample labels is t; t is a positive integer; Determining a feature mapping value for mapping the migration image sample to the basic image sample according to a second feature distance between the basic prediction classification feature and the spatial prediction classification feature, including: Obtaining a prediction sub-distance between each basic prediction classification feature and the spatial prediction classification feature respectively, and determining the sum of the prediction sub-distances between each basic prediction classification feature and the spatial prediction classification feature respectively as a second prediction distance; Performing normalization processing on each prediction sub-distance based on the second prediction distance to obtain t feature mapping values; Obtaining a label similarity between the basic sample label and the migration sample label, and generating a second loss function based on the number of basic samples, the feature mapping value, and the label similarity, including: Obtaining a label similarity between each of the t basic sample labels and the migration sample label respectively, performing weighted processing on the t feature mapping values based on the t label similarities to obtain a feature transfer loss value, and generating a second loss function according to the feature transfer loss value and the number of basic samples.
10. The method according to claim 1, characterized in that, The method further includes: Obtaining a generalization image sample in a generalization image library, and dividing the migration classification model into a shallow migration classification network and a deep migration classification network; Inputting the migration image sample into the migration classification model, and outputting a second migration image feature corresponding to the migration image sample in the shallow migration classification network; inputting the generalization image sample into the migration classification model, and outputting a generalization image feature corresponding to the generalization image sample in the shallow migration classification network; the generalization image sample has a generalization drawing style, and the generalization drawing style is different from both the basic drawing style and the migration drawing style; the migration drawing style refers to the image drawing style of the migration image sample; Obtaining migration distribution information of the second migration image feature and generalization distribution information of the generalization image feature, performing distribution calibration on the migration distribution information to obtain migration calibration information, and performing distribution calibration on the generalization distribution information to obtain generalization calibration information; Transmitting the migration calibration information and the generalization calibration information into the deep migration classification network, and performing weighted processing on the migration calibration information and the generalization calibration information based on the deep migration classification network to obtain a generalization prediction classification feature; Training the migration classification model according to the generalization prediction classification feature to generate a generalization classification model; the generalization classification model is used for classifying and predicting an image with the basic drawing style, the migration drawing style, or the generalization drawing style.
11. The method according to claim 10, wherein Training the migration classification model according to the generalization prediction classification feature to generate a generalization classification model, including: Obtain a first distribution difference between the migration distribution information and the migration calibration information, and obtain a second distribution difference between the generalization distribution information and the generalization calibration information; Generate a backpropagation function according to the first distribution difference and the second distribution difference; Obtain the generalization sample label of the generalization image sample, and generate a third loss function according to the generalization prediction classification feature and the generalization sample label; Based on the backpropagation function and the third loss function, adjust the parameters of the migration classification model to generate a generalization classification model.
12. An image data processing method, characterized in that, The method includes: In response to a classification recognition request for an image to be classified, input the image to be classified into a target classification model for prediction to obtain the target image category corresponding to the image to be classified; if there is a generalization classification model, the target classification model is the generalization classification model; if there is a migration classification model and there is no generalization classification model, the target classification model is the migration classification model; if there is a basic classification model and there is no generalization classification model and the migration classification model, the target classification model is the basic classification model; the generalization classification model is generated by generalizing the migration classification model; the migration classification model is based on the basic classification model to predict a basic image sample with a basic drawing style to obtain basic image features, predict a first migration image feature of a migration image sample based on a shallow basic classification network in the basic classification model, perform feature migration on the first migration image feature based on the basic image features in a deep basic classification network to obtain feature migration data, obtain a migration prediction classification feature according to the feature migration data, and train the basic classification model based on the migration prediction classification feature to generate; the feature migration data is obtained by weighting the first migration image feature with a first migration weight obtained by normalizing the basic image features in the deep basic classification network; Obtain an abnormal category, and if the target image category belongs to the abnormal category, output an image abnormality prompt message; If the target image category does not belong to the abnormal category, output the image to be classified.
13. A computer device, characterized in that, Comprising a processor and a memory; The processor is connected to the memory, wherein the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1-11, or executes the method according to claim 12.
14. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and the computer program is adapted to be loaded and executed by a processor so that a computer device having the processor executes the method according to any one of claims 1-11, or executes the method according to claim 12.
Citation Information
Patent Citations
Semantic segmentation method for low-illumination scene
CN110458844A
Domain Stylization Using a Neural Network Model
US20190244060A1