CN116486206A - Data processing method, device, computer equipment and medium based on model optimization - Google Patents

Data processing method, device, computer equipment and medium based on model optimization Download PDF

Info

Publication number
CN116486206A
CN116486206A CN202310456026.6A CN202310456026A CN116486206A CN 116486206 A CN116486206 A CN 116486206A CN 202310456026 A CN202310456026 A CN 202310456026A CN 116486206 A CN116486206 A CN 116486206A
Authority
CN
China
Prior art keywords
image
trained
model
loss
real
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310456026.6A
Other languages
Chinese (zh)
Inventor
瞿晓阳
王健宗
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN202310456026.6A priority Critical patent/CN116486206A/en
Publication of CN116486206A publication Critical patent/CN116486206A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/77Processing image or video features in feature spaces; using data integration or data reduction, e.g. principal component analysis [PCA] or independent component analysis [ICA] or self-organising maps [SOM]; Blind source separation
    • G06V10/774Generating sets of training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N20/00Machine learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/70Arrangements for image or video recognition or understanding using pattern recognition or machine learning
    • G06V10/764Arrangements for image or video recognition or understanding using pattern recognition or machine learning using classification, e.g. of video objects
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02TCLIMATE CHANGE MITIGATION TECHNOLOGIES RELATED TO TRANSPORTATION
    • Y02T10/00Road transport of goods or passengers
    • Y02T10/10Internal combustion engine [ICE] based vehicles
    • Y02T10/40Engine management systems

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Medical Informatics (AREA)
  • Artificial Intelligence (AREA)
  • General Physics & Mathematics (AREA)
  • Evolutionary Computation (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Databases & Information Systems (AREA)
  • Multimedia (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Mathematical Physics (AREA)
  • Image Analysis (AREA)

Abstract

The present invention relates to the field of artificial intelligence technologies, and in particular, to a data processing method, apparatus, computer device, and medium based on model optimization. According to the method, noise is input into a generating model to obtain a generated image, the generated image is input into a solving model to obtain a label of the generated image, a real-time image and labels corresponding to the generated image and the real-time image are determined, the solving model is trained, a randomly generated input image is input into the solving model to obtain a solving result, the input image is updated according to a loss value calculated by the solving result, the solving model is trained again by adopting the updated input image, the solving model is trained based on the generated image and the real-time image, knowledge of the real-time image can be learned by the solving model, the input data is updated, the diversity of the input data is expanded, and the generalization capability of the solving model is improved, so that the accuracy of model incremental learning is improved under the condition of no history sample.

Description

Data processing method, device, computer equipment and medium based on model optimization
Technical Field
The present invention relates to the field of artificial intelligence technologies, and in particular, to a data processing method, apparatus, computer device, and medium based on model optimization.
Background
At present, a trained model is generally and directly deployed to process a real-time sample in an actual application scene, but because the trained model is obtained based on historical sample training, when the real-time sample and the historical sample are different, the processing accuracy of the trained model is lower.
The existing method generally adopts an incremental learning mode to update a trained model, takes a real-time sample and a historical sample as a training set, optimizes the trained model, and enables the optimized model to not only keep the knowledge learned from the historical sample, but also learn new knowledge from the real-time sample;
however, as the importance of data privacy increases, the model provider generally does not provide a history sample during model training, so that the model user can optimize the trained model only through a local real-time sample, the optimization effect of the model is poor, and the accuracy of model incremental learning is seriously reduced, so that how to improve the accuracy of model incremental learning under the condition of no history sample becomes a problem to be solved urgently.
Disclosure of Invention
In view of the above, the embodiment of the invention provides a model training method, a device, a computer device and a medium based on artificial intelligence, so as to solve the problem of lower accuracy of model incremental learning under the condition of no history sample.
In a first aspect, an embodiment of the present invention provides a data processing method based on model optimization, where the data processing method includes:
inputting randomly generated noise into a pre-trained generation model to obtain a generated image, inputting the generated image into a pre-trained solution model to obtain a first solution result, and determining the first solution result as a label corresponding to the generated image;
acquiring a real-time image and a label corresponding to the real-time image, and training the pre-trained solution model according to the generated image, the real-time image and the label corresponding to the generated image and the real-time image to obtain a trained solution model;
randomly generating an input image, and respectively inputting the input image into the pre-trained solution model and the trained solution model to obtain a second solution result and a third solution result;
fixing parameters of the pre-trained solving model and the trained solving model, randomly selecting a label of a real-time image as a reference label, inputting the second solving result, the third solving result and the reference label into a preset loss function to obtain a loss value, and performing iterative training on the input image according to the loss value until the loss value converges to obtain an updated input image;
And determining the reference label as the label of the updated input image, and retraining the trained solution model by adopting the updated input image and the label thereof to obtain an optimized solution model.
In a second aspect, an embodiment of the present invention provides a data processing apparatus based on model optimization, the data processing apparatus including:
the image generation module is used for inputting randomly generated noise into a pre-trained generation model to obtain a generated image, inputting the generated image into a pre-trained solution model to obtain a first solution result, and determining that the first solution result is a label corresponding to the generated image;
the preliminary training module is used for acquiring a real-time image and a label corresponding to the real-time image, and training the pre-trained solution model according to the generated image, the real-time image and the label corresponding to the real-time image and the real-time image to obtain a trained solution model;
the random generation module is used for randomly generating an input image, and respectively inputting the input image into the pre-trained solution model and the trained solution model to obtain a second solution result and a third solution result;
The input updating module is used for fixing parameters of the pre-trained solving model and the trained solving model, randomly selecting a label of a real-time image as a reference label, inputting the second solving result, the third solving result and the reference label into a preset loss function to obtain a loss value, and performing iterative training on the input image according to the loss value until the loss value converges to obtain an updated input image;
and the retraining module is used for determining the reference label as the label of the updated input image, and retraining the trained solution model by adopting the updated input image and the label thereof to obtain an optimized solution model.
In a third aspect, an embodiment of the present invention provides a computer device, the computer device comprising a processor, a memory and a computer program stored in the memory and executable on the processor, the processor implementing the data processing method according to the first aspect when executing the computer program.
In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium storing a computer program which, when executed by a processor, implements the data processing method according to the first aspect.
Compared with the prior art, the embodiment of the invention has the beneficial effects that:
inputting randomly generated noise into a pre-trained generation model to obtain a generated image, inputting the generated image into the pre-trained solution model to obtain a first solution result, determining the first solution result as a label corresponding to the generated image, acquiring a real-time image and a label corresponding to the real-time image, training the pre-trained solution model according to the generated image, the real-time image and the label corresponding to the real-time image to obtain a trained solution model, randomly generating the input image, inputting the input image into the pre-trained solution model and the trained solution model respectively to obtain a second solution result and a third solution result, fixing parameters of the pre-trained solution model and the trained solution model, randomly selecting a label of the real-time image as a reference label, inputting the second solution result, the third solution result and the reference label into a preset loss function to obtain a loss value, performing iterative training on the input image according to the loss value until the loss value is converged to obtain an updated input image, determining the label of the updated input image, performing retraining on the trained solution model by adopting the updated input image and the label thereof, obtaining the optimized solution model, and obtaining the updated solution model based on the accuracy of the updated solution model when the updated solution model is more accurate than the generated image, obtaining the training model based on the training data, and obtaining the updated training data based on the updated solution model, and the accuracy of the updated solution model can be obtained when the updated model is based on the updated model, the input to the input model, the training data can be obtained based on the updated model, and the training data, and the accuracy can be obtained based on the model, and the model can be obtained, therefore, the accuracy of model incremental learning is improved under the condition of no history sample.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are needed in the embodiments or the description of the prior art will be briefly described below, it being obvious that the drawings in the following description are only some embodiments of the present invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic view of an application environment of a data processing method based on model optimization according to a first embodiment of the present invention;
FIG. 2 is a schematic flow chart of a data processing method based on model optimization according to a first embodiment of the present invention;
FIG. 3 is a schematic flow chart of a data processing method based on model optimization according to a second embodiment of the present invention;
FIG. 4 is a schematic structural diagram of a data processing apparatus based on model optimization according to a third embodiment of the present invention;
fig. 5 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is detected" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon detection of a [ described condition or event ]" or "in response to detection of a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the invention. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The embodiment of the invention can acquire and process the related data based on the artificial intelligence technology. Among these, artificial intelligence (Artificial Intelligence, AI) is the theory, method, technique and application system that uses a digital computer or a digital computer-controlled machine to simulate, extend and extend human intelligence, sense the environment, acquire knowledge and use knowledge to obtain optimal results.
Artificial intelligence infrastructure technologies generally include technologies such as sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technologies, operation/interaction systems, mechatronics, and the like. The artificial intelligence software technology mainly comprises a computer vision technology, a robot technology, a biological recognition technology, a voice processing technology, a natural language processing technology, machine learning/deep learning and other directions.
It should be understood that the sequence numbers of the steps in the following embodiments do not mean the order of execution, and the execution order of the processes should be determined by the functions and the internal logic, and should not be construed as limiting the implementation process of the embodiments of the present invention.
In order to illustrate the technical scheme of the invention, the following description is made by specific examples.
The data processing method based on model optimization provided by the embodiment of the invention can be applied to an application environment as shown in fig. 1, wherein a client communicates with a server. The client includes, but is not limited to, a palm top computer, a desktop computer, a notebook computer, an ultra-mobile personal computer (UMPC), a netbook, a cloud terminal device, a personal digital assistant (personal digital assistant, PDA), and other computer devices. The server may be an independent server, or may be a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms.
Referring to fig. 2, a flow chart of a data processing method based on model optimization according to an embodiment of the present invention is provided, where the data processing method may be applied to a client in fig. 1, a computer device corresponding to the client is connected to a server to obtain a real-time image received by the server and a tag corresponding to the real-time image, a pre-trained generating model and a pre-trained solving model are deployed in a computer device corresponding to the client, and the pre-trained generating model and the pre-trained solving model may refer to models with known model parameters, where the known model parameters may be obtained based on historical data training. As shown in fig. 2, the data processing method may include the steps of:
step S201, inputting randomly generated noise into a pre-trained generation model to obtain a generated image, inputting the generated image into a pre-trained solution model to obtain a first solution result, and determining the first solution result as a label corresponding to the generated image.
The randomly generated noise may refer to a noise image, and may be generally realized through a rand function, the pre-trained generating model may refer to a generating model obtained by training a historical image, the generating image may refer to a generating model output corresponding to the noise image, the pre-trained solving model may refer to a solving model obtained by training the historical image, the solving model may refer to a classification model, a prediction model and the like, and the generating result may refer to a solving result corresponding to the generating image. The generated image and the label corresponding to the generated image can provide training data for preliminary training of the pre-trained solution model.
Specifically, both the pre-trained generation model and the pre-trained solution model have known model parameters, and because of the non-interpretability of the model, sharing model parameters does not reveal corresponding training set data, and therefore model parameters are known by default, but the training data set corresponding to the model parameters is unknown to protect the privacy data.
The step of inputting the randomly generated noise into the pre-trained generating model to obtain the generating image, inputting the generating image into the pre-trained solving model to obtain the first solving result, determining the first solving result as the label corresponding to the generating image, generating the image through the pre-trained generating model obtained through the history image training, generating the generating image similar to the history image as far as possible, and obtaining the first solving result corresponding to the generating image according to the pre-trained solving model to serve as the label, so that the knowledge learned by the solving model from the history image is reserved, and the fitting accuracy of the follow-up solving model during retraining is improved.
Step S202, acquiring a real-time image and a label corresponding to the real-time image, and training the pre-trained solution model according to the generated image, the real-time image and the label corresponding to the generated image and the real-time image to obtain the trained solution model.
The real-time image may refer to a real image obtained in real time currently, the types of the labels may be N, where N is an integer greater than zero, for example, when the solution model is a classification model, the labels include N preset class labels, and the real-time image and the label corresponding to the real-time image may be used to provide current data for preliminary training of the solution model, so that the trained solution model learns knowledge of the real-time image.
Specifically, the generated image and the real-time image are mixed, a plurality of training samples are randomly extracted without being put back to serve as a training data set of a training batch, a pre-trained solving model is trained, a loss function during training is obtained through label calculation based on output and corresponding input quantity of the solving model, the loss function during training is determined according to the type of the solving model, for example, when the solving model is a classification model, the loss function adopts a cross entropy loss function, and when the solving model is a prediction model, the loss function adopts a mean square error loss function.
Optionally, training the pre-trained solution model according to the generated image, the real-time image and the labels corresponding to the generated image and the real-time image, and obtaining the trained solution model includes:
Inputting the real-time image into a pre-trained solution model to obtain a fourth solution result corresponding to the real-time image;
calculating first loss according to the first solving result, the label corresponding to the generated image and a preset solving loss function, and calculating second loss according to the fourth solving result, the label corresponding to the real-time image and the solving loss function;
and (3) weighting and adding the first loss and the second loss, and updating parameters of the pre-trained solution model by adopting a gradient descent method based on the addition result until the addition result converges to obtain the trained solution model.
The solving loss function may refer to an cross entropy loss function, a mean square error loss function, and the like, the first loss may refer to a loss function value corresponding to the historical data, and the second loss may refer to a loss function value corresponding to the current data.
Specifically, the weight of the first loss and the weight of the second loss at the time of weighted addition may be used to control the degree of retention of the knowledge of the history data, for example, in this embodiment, the weight of the first loss is set to 0.8 and the weight of the second loss is set to 0.2.
According to the embodiment, the loss function of retraining of the solution model is determined in a weighted addition mode, so that the retention degree of the solution model on the historical data knowledge can be flexibly adjusted, and an implementer can conveniently adjust the retention degree of the historical data knowledge according to the solution accuracy of the pre-trained solution model, so that the solution accuracy of the trained solution model is improved.
Optionally, weighting the first loss and the second loss to add includes:
counting to obtain a first number of generated images and a second number of real-time images, and calculating the sum of the first number and the second number to obtain the total number;
taking the ratio of the first quantity to the total quantity as a first weight of a first loss, and taking the ratio of the second quantity to the total quantity as a second weight of a second loss;
the first loss and the second loss are weighted together according to the first weight and the second weight.
Wherein the first number may refer to a statistical number of generated images, the second number may refer to a statistical number of real-time images, and the total number may refer to a statistical number of all training samples.
According to the embodiment, the ratio of the generated image to all training samples is used as the weight of the first loss, so that the degree of preservation of the knowledge of the historical data is adjusted according to the number of the samples, the situation that the knowledge of most of the historical data is preserved when the real-time data is more is avoided, the trained solving model is difficult to adapt to the real-time image, and the solving accuracy of the real-time image is low.
According to the method, the real-time image and the label corresponding to the real-time image are obtained, the pre-trained solution model is trained according to the generated image, the real-time image and the label corresponding to the real-time image, and the trained solution model is obtained, the pre-trained solution model is trained through fusion of historical data and current data, so that the solution model learns the knowledge of the current data while retaining the knowledge of the historical data, and further the solution accuracy of the trained solution model is improved.
Step S203, randomly generating an input image, and respectively inputting the input image into a pre-trained solution model and a trained solution model to obtain a second solution result and a third solution result.
The randomly generated input image may be a random noise image, the second solution result may be a solution result of a corresponding input image output by the pre-trained solution model, and the third solution result may be a solution result of a corresponding input image output by the trained solution model.
And the step of randomly generating the input image, namely respectively inputting the input image into the pre-trained solution model and the trained solution model to obtain a second solution result and a third solution result, and solving the input image through the solution model before and after retraining, so that a loss function for retraining is convenient for subsequent calculation, and the updating accuracy of the input image is improved.
Step S204, fixing parameters of the pre-trained solving model and the trained solving model, randomly selecting a label of a real-time image as a reference label, inputting a second solving result, a third solving result and the reference label into a preset loss function to obtain a loss value, and performing iterative training on the input image according to the loss value until the loss value converges to obtain an updated input image.
The reference label may refer to a target label updated by the input image, and the loss value may refer to a loss of a solution result of the input image.
Specifically, in the training process, the training object is an input image, that is, model parameters of the solution model are fixed, and the input image is updated according to the loss value, so as to obtain an updated input image conforming to the reference label.
Optionally, the preset loss function includes a predicted loss function;
inputting the second solving result, the third solving result and the reference label into a preset loss function, and obtaining a loss value comprises the following steps:
inputting the second solving result and the reference label into a predictive loss function to obtain predictive loss;
the predictive loss function is:
L 1 =L(S 1 (x′),y)
wherein L is 1 Representing predictive loss, S 1 (x ') represents the second solution, x' represents the input image, and y represents the reference label.
According to the embodiment, the prediction loss is calculated according to the second solving result and the reference label, so that the updated input image meets the reference label as much as possible, and the image diversity expansion can be carried out in a mode of updating the input image.
Optionally, the preset loss function further includes a regular loss function;
inputting the second solving result, the third solving result and the reference label into a preset loss function to obtain a loss value, and further comprising:
Counting all pixel points in an input image to obtain pixel values of all pixel points, and calculating to obtain variances and regularization norms according to the pixel values of all pixel points;
and inputting the variance and the regularized norm into a regularized loss function to obtain the regularized loss.
Where regularization norm may refer to the L2 norm, i.e., the square root of the sum of squares of each pixel point.
Specifically, the variance threshold may be determined based on the variance average of the several real-time images, the norm threshold may be determined based on the norm average of the several real-time images, and the variance loss L a The calculation mode of (a) can be as follows:wherein sigma 2 May refer to the variance, sigma, of the input image 2′ May refer to a variance threshold, a norm loss L b The calculation mode of (a) can be as follows: l (L) b|γ-γ′| Where γ may refer to the L2 norm of the input image, γ' may refer to the norm threshold, and the canonical loss is the sum of the variance loss and the norm loss.
In the embodiment, regularization loss is calculated by using the variance and the norm of the input image, so that the pixel value distribution of the input image is as close as possible to that of a real image in the updating process, the updating reliability of the input image is improved, and the updating accuracy of the input image is further improved.
Optionally, the preset loss function further includes an antagonistic loss function;
Inputting the second solving result, the third solving result and the reference label into a preset loss function to obtain a loss value, and further comprising:
calculating a second solving result and a third solving result by adopting a preset divergence formula to obtain a target divergence;
inputting the target divergence into the fight loss function to obtain fight loss, and determining the sum of fight loss, regular loss and predicted loss as a loss value.
The divergence formula may refer to a Jensen-Shannon (JS) divergence calculation formula, a KL divergence calculation formula, and the like, and in this embodiment, the JS divergence calculation formula is used to perform the divergence calculation.
Specifically, the second solution result and the third solution result adopt a distribution form when calculating the divergence, namely, a first probability distribution and a second probability distribution output by a trained solution model are adopted, the second solution result corresponds to the maximum value in the first probability distribution, and the third solution result corresponds to the maximum value in the second probability distribution.
The value range of the JS scattering degree is [0,1], when the first probability distribution and the second probability distribution are completely overlapped, the JS scattering degree is 0, when the first probability distribution and the second probability distribution are completely not overlapped, the JS scattering degree is 1, the preset value is set to be 1, the countermeasures loss is maximum when the first probability distribution and the second probability distribution are completely overlapped, and the losses are minimum when the first probability distribution and the second probability distribution are completely not overlapped, so that the difference is generated on the output of the supervised updated input image on the trained solving model and the pre-trained solving model.
According to the embodiment, the updated input image is enabled to generate difference on the output of the trained solving model and the output of the pre-trained solving model through countering loss, so that more samples are generated, the diversity of data is improved, and the knowledge migration efficiency is improved.
According to the method, parameters of the pre-trained solving model and the trained solving model are fixed, a label of a real-time image is randomly selected to serve as a reference label, a second solving result, a third solving result and the reference label are input into a preset loss function to obtain a loss value, iterative training is conducted on the input image according to the loss value until the loss value converges to obtain an updated input image, training and updating are conducted on the input image, accordingly the updated input image conforming to the reference label is obtained, the diversity of training sets of subsequent retraining is expanded, and the fact that training samples in the training sets of retraining are all too similar to each other to cause retraining to be fitted is avoided.
Step S205, determining the reference label as the label of the updated input image, and retraining the trained solution model by adopting the updated input image and the label thereof to obtain an optimized solution model.
In this embodiment, retraining may be performed only by using the updated input image and the trained solution model corresponding to the updated input image label.
In one embodiment, the retraining may be performed using the real-time image, the generated image, the updated input image, and the label corresponding to the three to the trained solution model.
The step of determining the reference label as the label of the updated input image, and retraining the trained solution model by adopting the updated input image and the label thereof to obtain the optimized solution model, and retraining the trained solution model by adopting the updated input image can effectively improve the generalization capability of the optimized solution model.
According to the embodiment, the generated image can be ensured to be relatively close to an unknown historical sample, the generated image is obtained based on the generated model, the obtained real-time image is used for retraining the solving model, the solving model can learn knowledge of the real-time image to update model parameters under the condition of ensuring accuracy, meanwhile, training aiming at input data is adopted to optimize the input data, the diversity of the input data is expanded, the solving model is retrained based on the updated input data, and the generalization capability of the solving model is improved, so that the accuracy of model incremental learning is improved under the condition of no historical sample.
Referring to fig. 3, a flow chart of a data processing method based on model optimization according to a second embodiment of the present invention is shown, where after a trained solution model is obtained, a pre-trained generation model may be used to provide a generation sample for the trained solution model, and the pre-trained generation model may also be retrained to provide a more accurate generation sample.
When the pre-trained generation model is used for providing a generation sample for the trained solving model, model parameters of the pre-trained generation model are not required to be updated and the model is directly used, and the details are omitted.
The pre-trained generation model comprises a pre-trained generator and a pre-trained arbiter, the pre-trained generation model is trained again, and the process for obtaining the trained generation model comprises the following steps:
step S301, selecting one image from the generated image and the real-time image as a target image, and inputting the target image into a pre-trained discriminator to obtain a discrimination result of the corresponding target image;
step S302, calculating a first discrimination loss according to the image category of the target image, the discrimination result of the corresponding target image and a preset discrimination loss function, and updating parameters in the pre-trained discriminator based on the first discrimination loss to obtain the trained discriminator;
Step S303, randomly generating target noise, inputting the target noise into a pre-trained generator to obtain a noise image, inputting the noise image into a trained discriminator to obtain a discrimination result of a corresponding noise image, calculating a second discrimination loss according to the discrimination result of the corresponding noise image, the real-time image type and a discrimination loss function, and updating parameters in the pre-trained generator based on the second discrimination loss to obtain the trained generator;
step S304, determining that the trained generator and the trained arbiter form a trained generation model.
The pre-trained generator can be used for generating similar images according to the images received by the generator, the pre-trained arbiter can be used for judging whether the received images are images generated by the generator, the target images can be training samples used for retraining of the pre-trained generation model, the judging result can be a classification result, the classification result comprises a generation class and a true class, the generation class is represented by 0, and the true class is represented by 1.
The image categories include a generated image category corresponding to the generated image and a real-time image category corresponding to the real-time image, the discriminant loss function may refer to a classification loss function, such as a cross entropy loss function, and the trained discriminant may refer to a discriminant that has completed retraining, at which time the trained discriminant has learned knowledge of the real-time image.
The target noise may be gaussian noise, the noise image may be the output of a pre-trained generator, the trained generator may be a generator that completes retraining, and the trained generation model may be used to provide a generated image for the trained solution model.
Specifically, the training data set added with the real-time image is used for training the pre-trained discriminators again to ensure that the trained discriminators learn the knowledge of the real-time image, then the output result of the trained discriminators is adopted for training the pre-trained generators, at the moment, model parameters of the trained discriminators are fixed, and only model parameters of the pre-trained generators are adjusted, so that the trained generators can generate generated images which cannot be identified by the trained discriminators.
In the embodiment, the generated model is retrained to adapt to the solution model updated by the model parameters, a more reliable generated image is provided for retrained of the solution model to serve as a training sample, and error samples caused by lagging updating of the generated model are avoided, so that a fitting result is poor in the model retrained process, and the accuracy of the optimized solution model is improved.
Fig. 4 shows a block diagram of a data processing apparatus based on model optimization according to a third embodiment of the present invention, where the data processing apparatus is applied to a client, and a computer device corresponding to the client is connected to a server to obtain a real-time image received by the server and a label corresponding to the real-time image, and a pre-trained generation model and a pre-trained solution model are deployed in the computer device corresponding to the client, where the pre-trained generation model and the pre-trained solution model may refer to models with known model parameters, and the known model parameters may be obtained based on historical data training. For convenience of explanation, only portions relevant to the embodiments of the present invention are shown.
Referring to fig. 4, the data processing apparatus includes:
the image generating module 41 is configured to input randomly generated noise into a pre-trained generating model to obtain a generated image, input the generated image into a pre-trained solving model to obtain a first solving result, and determine that the first solving result is a label corresponding to the generated image;
the preliminary training module 42 is configured to acquire a real-time image and a label corresponding to the real-time image, and train the pre-trained solution model according to the generated image, the real-time image and the label corresponding to the generated image and the real-time image to obtain a trained solution model;
The random generation module 43 is configured to randomly generate an input image, and input the input image into a pre-trained solution model and a trained solution model respectively, so as to obtain a second solution result and a third solution result;
the input updating module 44 is configured to fix parameters of the pre-trained solution model and the trained solution model, randomly select a label of a real-time image as a reference label, input a second solution result, a third solution result and the reference label into a preset loss function to obtain a loss value, and perform iterative training on the input image according to the loss value until the loss value converges to obtain an updated input image;
and the retraining module 45 is configured to determine that the reference label is a label of the updated input image, retrain the trained solution model by using the updated input image and the label thereof, and obtain an optimized solution model.
Optionally, the preliminary training module 42 includes:
the image solving unit is used for inputting the real-time image into the pre-trained solving model to obtain a fourth solving result corresponding to the real-time image;
the loss calculation unit is used for calculating first loss according to the first solving result, the label corresponding to the generated image and a preset solving loss function, and calculating second loss according to the fourth solving result, the label corresponding to the real-time image and the solving loss function;
And the parameter updating unit is used for weighting and adding the first loss and the second loss, updating the parameters of the pre-trained solution model by adopting a gradient descent method based on the addition result until the addition result converges, and obtaining the trained solution model.
Optionally, the parameter updating unit includes:
the quantity counting subunit is used for counting to obtain a first quantity of generated images and a second quantity of real-time images, and calculating the sum of the first quantity and the second quantity to obtain the total quantity;
a weight determining subunit, configured to take a ratio of the first number to the total number as a first weight of the first loss and a ratio of the second number to the total number as a second weight of the second loss;
and a weighted addition subunit for adding the first loss and the second loss weights according to the first weight and the second weight.
Optionally, the pre-trained generation model includes a pre-trained generator and a pre-trained arbiter;
the above data processing apparatus further includes:
the image discrimination module is used for selecting one image from the generated image and the real-time image as a target image, inputting the target image into a pre-trained discriminator, and obtaining a discrimination result of the corresponding target image;
The discriminator updating module is used for calculating a first discrimination loss according to an image category of the target image, a discrimination result of the corresponding target image and a preset discrimination loss function, updating parameters in the pre-trained discriminator based on the first discrimination loss to obtain the trained discriminator, wherein the image category comprises a generated image category corresponding to the generated image and a real-time image category corresponding to the real-time image;
the generator updating module is used for randomly generating target noise, inputting the target noise into a pre-trained generator to obtain a noise image, inputting the noise image into a trained discriminator to obtain a discrimination result of a corresponding noise image, calculating a second discrimination loss according to the discrimination result of the corresponding noise image, the real-time image type and the discrimination loss function, and updating parameters in the pre-trained generator based on the second discrimination loss to obtain the trained generator;
and the generation model updating module is used for determining that the trained generator and the trained discriminator form a trained generation model.
Optionally, the preset loss function includes a predicted loss function;
the input update module 44 includes:
The prediction loss calculation unit is used for inputting the second solving result and the reference label into a prediction loss function to obtain a prediction loss;
the predictive loss function is:
L 1 =(S 1 (x′),)
wherein L is 1 Representing predictive loss, S 1 (x ') represents the second solution, x' represents the input image, and y represents the reference label.
Optionally, the preset loss function further includes a regular loss function;
the input update module 44 further includes:
counting all pixel points in an input image to obtain pixel values of all pixel points, and calculating to obtain variances and regularization norms according to the pixel values of all pixel points;
and inputting the variance and the regularized norm into a regularized loss function to obtain the regularized loss.
Optionally, the preset loss function includes an antagonistic loss function;
the input update module 44 further includes:
calculating a second solving result and a third solving result by adopting a preset divergence formula to obtain a target divergence;
inputting the target divergence into the fight loss function to obtain fight loss, and determining the sum of fight loss, regular loss and predicted loss as a loss value.
It should be noted that, because the content of information interaction, execution process and the like between the modules, units and sub-units is based on the same concept as the method embodiment of the present invention, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
Fig. 5 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention. As shown in fig. 5, the computer device of this embodiment includes: at least one processor (only one shown in fig. 5), a memory, and a computer program stored in the memory and executable on the at least one processor, the processor executing the computer program to perform the steps of any of the various data processing method embodiments described above.
The computer device may include, but is not limited to, a processor, a memory. It will be appreciated by those skilled in the art that fig. 5 is merely an example of a computer device and is not intended to limit the computer device, and that a computer device may include more or fewer components than shown, or may combine certain components, or different components, such as may also include a network interface, a display screen, an input device, and the like.
The processor may be a CPU, but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory includes a readable storage medium, an internal memory, etc., where the internal memory may be the memory of the computer device, the internal memory providing an environment for the execution of an operating system and computer-readable instructions in the readable storage medium. The readable storage medium may be a hard disk of a computer device, and in other embodiments may be an external storage device of the computer device, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. that are provided on the computer device. Further, the memory may also include both internal storage units and external storage devices of the computer device. The memory is used to store an operating system, application programs, boot loader (BootLoader), data, and other programs such as program codes of computer programs, and the like. The memory may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, i.e. the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-described functions. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present invention. The specific working process of the units and modules in the above device may refer to the corresponding process in the foregoing method embodiment, which is not described herein again. The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above-described embodiment, and may be implemented by a computer program to instruct related hardware, and the computer program may be stored in a computer readable storage medium, where the computer program, when executed by a processor, may implement the steps of the method embodiment described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, executable files or in some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code, a recording medium, a computer Memory, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
The present invention may also be implemented as a computer program product for implementing all or part of the steps of the method embodiments described above, when the computer program product is run on a computer device, causing the computer device to execute the steps of the method embodiments described above.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided by the present invention, it should be understood that the disclosed apparatus/computer device and method may be implemented in other manners. For example, the apparatus/computer device embodiments described above are merely illustrative, e.g., the division of modules or units is merely a logical functional division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
The above embodiments are only for illustrating the technical solution of the present invention, and are not limiting; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (10)

1. A data processing method based on model optimization, the data processing method comprising:
inputting randomly generated noise into a pre-trained generation model to obtain a generated image, inputting the generated image into a pre-trained solution model to obtain a first solution result, and determining the first solution result as a label corresponding to the generated image;
Acquiring a real-time image and a label corresponding to the real-time image, and training the pre-trained solution model according to the generated image, the real-time image and the label corresponding to the generated image and the real-time image to obtain a trained solution model;
randomly generating an input image, and respectively inputting the input image into the pre-trained solution model and the trained solution model to obtain a second solution result and a third solution result;
fixing parameters of the pre-trained solving model and the trained solving model, randomly selecting a label of a real-time image as a reference label, inputting the second solving result, the third solving result and the reference label into a preset loss function to obtain a loss value, and performing iterative training on the input image according to the loss value until the loss value converges to obtain an updated input image;
and determining the reference label as the label of the updated input image, and retraining the trained solution model by adopting the updated input image and the label thereof to obtain an optimized solution model.
2. The data processing method according to claim 1, wherein the training the pre-trained solution model according to the generated image, the real-time image, and the labels corresponding to the generated image and the real-time image to obtain a trained solution model includes:
Inputting the real-time image into the pre-trained solution model to obtain a fourth solution result corresponding to the real-time image;
calculating first loss according to the first solving result, the label corresponding to the generated image and a preset solving loss function, and calculating second loss according to the fourth solving result, the label corresponding to the real-time image and the solving loss function;
and weighting and adding the first loss and the second loss, and updating parameters of the pre-trained solution model by adopting a gradient descent method based on an addition result until the addition result converges to obtain a trained solution model.
3. The data processing method of claim 2, wherein said weighted addition of said first loss and said second loss comprises:
counting to obtain a first number of the generated images and a second number of the real-time images, and calculating the sum of the first number and the second number to obtain a total number;
taking the ratio of the first quantity to the total quantity as a first weight of the first loss and taking the ratio of the second quantity to the total quantity as a second weight of the second loss;
And adding the first loss and the second loss according to the first weight and the second weight.
4. The data processing method of claim 1, wherein the pre-trained generation model comprises a pre-trained generator and a pre-trained arbiter;
after the trained solution model is obtained, the method further comprises the following steps:
selecting one image from the generated image and the real-time image as a target image, and inputting the target image into the pre-trained discriminator to obtain a discrimination result corresponding to the target image;
calculating a first discrimination loss according to an image category to which the target image belongs, a discrimination result corresponding to the target image and a preset discrimination loss function, and updating parameters in the pre-trained discriminator based on the first discrimination loss to obtain a trained discriminator, wherein the image category comprises a generated image category corresponding to the generated image and a real-time image category corresponding to the real-time image;
randomly generating target noise, inputting the target noise into the pre-trained generator to obtain a noise image, inputting the noise image into the trained discriminator to obtain a discrimination result corresponding to the noise image, calculating a second discrimination loss according to the discrimination result corresponding to the noise image, the real-time image type and the discrimination loss function, and updating parameters in the pre-trained generator based on the second discrimination loss to obtain the trained generator;
And determining that the trained generator and the trained arbiter form a trained generation model.
5. The data processing method according to any one of claims 1 to 4, wherein the preset loss function includes a predictive loss function;
inputting the second solution result, the third solution result and the reference label into a preset loss function to obtain a loss value, wherein the step of obtaining the loss value comprises the following steps:
inputting the second solving result and the reference label into the predicted loss function to obtain predicted loss;
the predictive loss function is:
L 1 =L(S 1 (x′),y)
wherein L is 1 Representing the predicted loss, S 1 (x ) Representing the second solution result, x Representing the input image, y representing the reference label.
6. The data processing method of claim 5, wherein the predetermined loss function further comprises a regular loss function;
the step of inputting the second solving result, the third solving result and the reference label into a preset loss function to obtain a loss value, and the step of further comprising:
counting all pixel points in the input image to obtain pixel values of all pixel points, and calculating to obtain variances and regularization norms according to the pixel values of all pixel points;
And inputting the variance and the regularization norm into the regularization loss function to obtain regularization loss.
7. The data processing method of claim 6, wherein the predetermined loss function further comprises an anti-loss function;
the step of inputting the second solving result, the third solving result and the reference label into a preset loss function to obtain a loss value, and the step of further comprising:
calculating the second solving result and the third solving result by adopting a preset divergence formula to obtain target divergence;
inputting the target divergence into the fight loss function to obtain fight loss, and determining the sum of the fight loss, the regular loss and the predicted loss as the loss value.
8. A data processing apparatus based on model optimization, the data processing apparatus comprising:
the image generation module is used for inputting randomly generated noise into a pre-trained generation model to obtain a generated image, inputting the generated image into a pre-trained solution model to obtain a first solution result, and determining that the first solution result is a label corresponding to the generated image;
the preliminary training module is used for acquiring a real-time image and a label corresponding to the real-time image, and training the pre-trained solution model according to the generated image, the real-time image and the label corresponding to the real-time image and the real-time image to obtain a trained solution model;
The random generation module is used for randomly generating an input image, and respectively inputting the input image into the pre-trained solution model and the trained solution model to obtain a second solution result and a third solution result;
the input updating module is used for fixing parameters of the pre-trained solving model and the trained solving model, randomly selecting a label of a real-time image as a reference label, inputting the second solving result, the third solving result and the reference label into a preset loss function to obtain a loss value, and performing iterative training on the input image according to the loss value until the loss value converges to obtain an updated input image;
and the retraining module is used for determining the reference label as the label of the updated input image, and retraining the trained solution model by adopting the updated input image and the label thereof to obtain an optimized solution model.
9. A computer device, characterized in that it comprises a processor, a memory and a computer program stored in the memory and executable on the processor, which processor implements the data processing method according to any of claims 1 to 7 when executing the computer program.
10. A computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the data processing method according to any one of claims 1 to 7.
CN202310456026.6A 2023-04-14 2023-04-14 Data processing method, device, computer equipment and medium based on model optimization Pending CN116486206A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310456026.6A CN116486206A (en) 2023-04-14 2023-04-14 Data processing method, device, computer equipment and medium based on model optimization

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310456026.6A CN116486206A (en) 2023-04-14 2023-04-14 Data processing method, device, computer equipment and medium based on model optimization

Publications (1)

Publication Number Publication Date
CN116486206A true CN116486206A (en) 2023-07-25

Family

ID=87217403

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310456026.6A Pending CN116486206A (en) 2023-04-14 2023-04-14 Data processing method, device, computer equipment and medium based on model optimization

Country Status (1)

Country Link
CN (1) CN116486206A (en)

Similar Documents

Publication Publication Date Title
CN111523621B (en) Image recognition method and device, computer equipment and storage medium
CN108230291B (en) Object recognition system training method, object recognition method, device and electronic equipment
CN111414946B (en) Artificial intelligence-based medical image noise data identification method and related device
JP2022141931A (en) Method and device for training living body detection model, method and apparatus for living body detection, electronic apparatus, storage medium, and computer program
CN113298152B (en) Model training method, device, terminal equipment and computer readable storage medium
CN113837942A (en) Super-resolution image generation method, device, equipment and storage medium based on SRGAN
CN113919401A (en) Modulation type identification method and device based on constellation diagram characteristics and computer equipment
CN113919497A (en) Attack and defense method based on feature manipulation for continuous learning ability system
CN110119621B (en) Attack defense method, system and defense device for abnormal system call
CN116662904A (en) Method, device, computer equipment and medium for detecting variation of data type
CN116257885A (en) Private data communication method, system and computer equipment based on federal learning
CN111507396A (en) Method and device for relieving error classification of neural network on unknown samples
CN116486206A (en) Data processing method, device, computer equipment and medium based on model optimization
CN115713669A (en) Image classification method and device based on inter-class relation, storage medium and terminal
CN113283388B (en) Training method, device, equipment and storage medium of living body face detection model
CN116563898A (en) Palm vein image recognition method, device, equipment and medium based on GhostNet network
CN115080745A (en) Multi-scene text classification method, device, equipment and medium based on artificial intelligence
CN116503918A (en) Palm vein image classification method, device, equipment and medium based on ViT network
CN111815658B (en) Image recognition method and device
CN113378914B (en) False relevance removing method and device
CN111461207B (en) Picture identification model training system and method
CN115936090A (en) Model training method, apparatus and storage medium
CN116821689A (en) Text classification data enhancement method, device, equipment and medium
CN117272385A (en) Data privacy protection system based on converter
CN116843035A (en) Attack method, device, terminal equipment and medium for federal modeling defense strategy

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination