Detailed Description
Exemplary embodiments of the present invention will now be described with reference to the accompanying drawings, in which various details of the embodiments of the present invention are included to facilitate understanding, and are to be considered merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
Fig. 1 is a schematic diagram of main flow of a method for processing image data according to an embodiment of the present invention, as shown in fig. 1, the method for processing image data is applied to a server, and includes the following steps:
S101, marking a data set to be processed by using an image marking model obtained by training an initial training sample set to obtain a marking result data set;
Step S102, determining the similarity between the labeling result data set and the initial training sample set;
And step 103, updating the initial training sample set according to the similarity.
In an embodiment of the present invention, the initial training sample set includes a plurality of pieces of sample data, each piece of sample data including image data and labeling data (i.e., labels). The initial training sample set can be a purely manually marked image data set, and can also be a noise data set obtained through a semi-supervised or weakly supervised learning method. The error labels exist in the initial training sample set, the labeling quality of the error labels is low, and therefore the performance of an image labeling model obtained by training the initial training sample set containing the error labels is poor, and the labeling accuracy is low, so that the error labels in the initial training sample set need to be updated and corrected.
And training the neural network model by using the initial training sample set to obtain an image annotation model, wherein the neural network model can be a CNN (convolutional neural network) model of resnet50 0 (an image recognition model structure) or other neural network models, such as EFFICIENTNET, GOOGLENET and other neural network models.
The method comprises the steps of marking an unlabeled data set to be processed by using an image marking model to obtain a marking result data set, wherein each marking result data set comprises image data and model marking data obtained by marking the image marking model. The source of the data set to be processed is not particularly limited, and may be online data of some services, or data crawled from a third party or the internet.
In an optional implementation manner of the embodiment of the present invention, after obtaining the labeling result data set in step S101, correction is further included on the labeling result data set. Since the model annotation data in the annotation result data set may have an inaccurate condition, the erroneous or inaccurate model annotation data may be corrected by correction. The correction can be in a manual correction mode or an automatic correction mode so as to correct the wrong label in the model labeling data.
Optionally, when correcting the labeling result data set, in order to improve the correction efficiency and accuracy, the labeling result data set may be sampled and then corrected, for example, a part of labeling result data is extracted from the labeling result data set to correct, so that the similarity between the labeling result data set and the initial training sample set may be determined according to the part of labeling result data in the labeling result set. For example, 50 pieces of labeling result data are extracted from a labeling result data set containing 100 pieces of labeling result data for manual correction, the 50 pieces of labeling result data after manual correction are used as the labeling result data set, and the similarity between the 50 pieces of labeling result data and the initial training sample set is determined.
In the embodiment of the invention, in step S102, the similarity between the labeling result data set and the initial training sample set is determined, wherein the similarity between the labeling result data and each piece of sample data in the initial training sample set is calculated for any labeling result data in the labeling result data set.
And when the similarity between the labeling result data set and the initial training sample set is determined, calculating the similarity between each piece of sample data in the initial training sample set and the labeling result data according to any one of the labeling result data. For example, if the initial training sample set includes K pieces of sample data, K is an integer greater than or equal to 1, then, for any labeling result data, K similarity results may be calculated, and if the labeling result data set includes L pieces of labeling result data, then, a total of l×k similarity results may be calculated. The result of obtaining the l×k similarities by calculation may be used as the similarity between the labeling result set and the initial training sample set.
In an alternative implementation manner of the embodiment of the present invention, the similarity may be a distance, for example, may be at least one of a Cosine distance (Cosine distance, also referred to as Cosine similarity), a euclidean distance, and the like.
In an embodiment of the present invention, as shown in fig. 2, updating an initial training sample set according to the similarity includes:
Step S201, for any labeling result data, a sample data subset with similarity meeting a preset condition between the initial training sample set and any labeling result data is screened out;
Step S201, updating the initial training sample set according to the sample data subsets corresponding to all the labeling result data and the labeling result data sets.
In the embodiment of the invention, for any labeling result data, after calculating the similarity between any labeling result data and each sample data in the initial training sample set, judging whether the similarity meets a preset condition, and forming a sample data subset according to the sample data meeting the preset condition, wherein the similarity is the similarity between standard result data and sample data, different expression modes of the similarity are different, and the preset conditions are different. When the similarity is a distance, sample data with a distance smaller than a preset distance threshold (such as 0.1) from any one of the labeling result data is used as sample data meeting a preset condition, and the sample data meeting the preset condition can be that the distances between each piece of sample data and any one of the labeling result data are ordered according to the order from small to large for any one of the labeling result data, and the sample data corresponding to the distance N before the ordering is used as the sample data meeting the preset condition, wherein N is a positive integer greater than 1.
For each piece of labeling result data in the labeling result data set, one sample data subset is corresponding, and for the labeling result data set containing L pieces of labeling result data, L sample data subsets can be obtained, namely, sample data subsets corresponding to all the labeling result data are obtained. The initial training sample set may be updated according to the sample data subsets and the labeling result data sets corresponding to all the labeling result data, i.e. the updated initial training sample set contains the sample data subsets and the labeling result data sets corresponding to all the labeling result data. The initial training sample set may also be updated by selecting a portion of the sample data in the sample data subset corresponding to all of the annotation result data and all or a portion of the annotation result data.
In the embodiment of the invention, before updating the initial training sample set according to the sample data subsets corresponding to all the labeling result data and the labeling result data sets, the method further comprises correcting the sample data meeting the preset condition and/or
And de-duplicating the sample data meeting the preset condition.
In order to further improve the accuracy of labeling labels in the sample data subsets, before updating the initial training sample set according to the sample data subsets corresponding to all labeling result data and the labeling result data sets, correcting the sample data meeting preset conditions to obtain corrected sample data subsets, correcting error labels, updating the initial training sample set by using the corrected sample data subsets and the labeling result data sets, and improving the labeling quality of the updated initial training sample set, so that the performance of an image labeling model is improved.
In the embodiment of the invention, each piece of labeling result data corresponds to one sample data subset, the sample data subsets comprise sample data meeting the preset condition, all the labeling result data correspond to a plurality of sample data subsets, and the same data possibly exist in the plurality of sample data subsets, so that the same data in the sample data subsets corresponding to all the labeling result data can be de-duplicated to simplify the data.
In an alternative implementation manner of the embodiment of the present invention, as shown in fig. 3, calculating a similarity between the labeling result data and each sample data in the initial training sample set includes:
Step 301, determining sample characteristics corresponding to each piece of sample data and labeling result characteristics corresponding to any labeling result data;
Step S301, determining the similarity between the labeling result data and each piece of sample data according to the distance between the labeling result feature and each sample feature.
In the embodiment of the invention, when the similarity between the labeling result data and each sample data in the initial training sample set is calculated, the labeling result feature corresponding to the labeling result data and the sample feature corresponding to each sample data can be extracted, wherein the labeling result feature and the sample feature can be represented by adopting feature vectors, and the labeling result feature and the sample feature can be extracted by adopting an image labeling model or other ubiquity open source models.
Extracting the labeling result features from the labeling result data set to form a labeling result feature set, extracting the sample features from the initial training sample set to form a sample feature set, and taking the similarity between the labeling result feature set and the sample feature set as the similarity between the labeling result data and the initial training sample set. And aiming at any marking result feature, taking the calculated distance between any marking result feature and each sample feature as the similarity between any marking result data and each sample data, determining the sample feature with the distance meeting the preset condition from any marking result feature, mapping the sample feature meeting the preset condition back to the initial training sample set, and determining the corresponding sample data meeting the preset condition, namely screening a sample data subset meeting the preset condition from the initial training sample set.
In the embodiment of the invention, the distance between the labeling result feature and the sample feature is calculated, and the method can be realized by selecting an open source library faiss (an open source search library aiming at clustering and similarity).
In an embodiment of the present invention, determining a sample feature corresponding to each sample data includes:
respectively determining M sub-features corresponding to the sample data by using M preset models, wherein M is a positive integer greater than or equal to 1;
And splicing the M sub-features to obtain sample features corresponding to each piece of sample data, or taking the M sub-features as the M sample features corresponding to each piece of sample data.
In the embodiment of the invention, the M preset models can select an image annotation model obtained by training an initial training sample set, and can also select one or more of other generalization open source models, such as VGG, resnet, inceptionV and other convolution network models. The extraction of the labeling result features and the sample features can be performed by adopting one image labeling model or a plurality of preset models.
In the embodiment of the invention, when determining the sample characteristics corresponding to each piece of sample data, each preset model can extract one sample sub-characteristic corresponding to the piece of sample data for each piece of sample data, and M sample sub-characteristics can be obtained by respectively extracting M preset models.
In one implementation manner of the embodiment of the present invention, after determining M sample sub-features corresponding to the strip of sample data, each sample sub-feature is used as a sample feature corresponding to the strip of sample data, that is, M sample features may be obtained for one strip of sample data.
Similarly, when determining the labeling result features corresponding to any one piece of labeling result data, each preset model can extract one labeling result sub-feature for each piece of labeling result data, M preset models are adopted to extract M labeling result sub-features respectively, and each labeling result sub-feature is used as the labeling result feature corresponding to the piece of sample data, namely M labeling result features can be obtained for one piece of labeling result data.
In one implementation manner of the embodiment of the present invention, when determining sample features satisfying a preset condition, for any labeling result feature, each preset model may determine N sample features satisfying the preset condition, and for M preset models, m×n sample features satisfying the preset condition may be determined, so that sample data corresponding to m×n sample features may be used as sample data satisfying the preset condition, so that a sample data subset may be determined, and then the initial training sample set may be updated according to the sample data subset and the labeling result data set.
In another implementation manner of the embodiment of the present invention, after determining M sample sub-features corresponding to the piece of sample data, the M sample sub-features are spliced to form a sample feature, and the sample feature is used as the sample feature corresponding to the piece of sample data, for example, if m=3, 3 sample sub-features extracted from 3 preset models respectively for a certain piece of sample data are (a, b), (c, d) and (e, f), then the 3 sample sub-features may be spliced to form a sample feature (a, b, c, d, e, f), so as to obtain a sample data subset with higher similarity from the initial training sample set.
Similarly, M preset models are adopted to extract the marking result features, and each preset model can extract one marking result sub-feature for each piece of marking result data, so that M marking result sub-features can be obtained, and the M marking result sub-features are spliced into one marking result feature serving as the marking result feature corresponding to the piece of marking result data.
In another implementation manner of the embodiment of the present invention, when determining sample features satisfying a preset condition, N sample features satisfying the preset condition may be determined for one labeling result feature, so that sample data corresponding to the N sample features satisfying the preset condition may be used as sample data satisfying the preset condition, so that a sample data subset may be determined, and then the initial training sample set may be updated according to the sample data subset and the labeling result data set.
In the embodiment of the invention, the updated initial training sample set comprises the labeling result data set and the sample data subset, the image labeling model obtained by training the updated initial training sample set has better performance, and the labeling accuracy of the image labeling model is higher.
Fig. 4 shows a method for processing image data according to an embodiment of the present invention, which includes:
step S401, obtaining an initial training sample set;
step S402, training by using an initial training sample set to obtain an image annotation model;
step S403, acquiring a data set to be processed, and marking the data set to be processed by using an image marking model to acquire a marking result data set;
Step S404, manually correcting the labeling result data set after sampling to obtain a corrected labeling result data set;
Step S405, extracting the labeling result characteristics in the corrected labeling result data set by using the image labeling model, and extracting the sample characteristics in the initial training sample set;
Step S406, for any labeling result feature, calculating the cosine distance between each sample feature and any labeling result feature, and determining sample data corresponding to the sample features with the cosine distances smaller than a preset distance threshold as sample data meeting preset conditions;
step S407, constructing a sample data subset according to sample data which meet preset conditions and correspond to all the labeling result features;
Step S408, manually correcting the sample data subset to obtain a corrected sample data subset;
step S409, adding the corrected sample data subset and the corrected labeling result data set to obtain an updated initial training sample set, and returning to the step S401.
The image data processing method includes the steps of marking a data set to be processed by using an image marking model obtained through training of an initial training sample set to obtain a marking result data set, correcting the marking result data set to achieve correction of a wrong label in the marking result data set, determining similarity between the marking result data set and the initial training sample set, screening or searching sample data subsets with the similarity meeting preset conditions from the initial training sample set, and updating the initial training sample set by using the marking result data set and the initial training sample set. The method provided by the embodiment of the invention can be used for efficiently updating and correcting the error labels in the initial training sample set, so that the labeling quality of the initial training sample set is improved, the performance of the image labeling model obtained by training is further improved, and the labeling accuracy of the image labeling model is improved.
As shown in fig. 5, another aspect of an embodiment of the present invention provides an apparatus 500 for processing image data, including:
The model labeling module 501 labels the data set to be processed by using an image labeling model obtained by training an initial training sample set to obtain a labeling result data set;
a determining module 502, configured to determine a similarity between the labeling result dataset and the initial training sample set;
an updating module 503 updates the initial training sample set according to the similarity.
In the embodiment of the present invention, the model labeling module 501 is further configured to correct the labeling result dataset after obtaining the labeling result dataset.
In the embodiment of the present invention, the determining module 502 is further configured to calculate, for any labeling result data in the labeling result data set, a similarity between the labeling result data and each sample data in the initial training sample set, respectively.
In the embodiment of the invention, the updating module 503 is further configured to screen, for any labeling result data, a sample data subset with similarity satisfying a preset condition with any labeling result data from the initial training sample set, and update the initial training sample set according to the sample data subsets corresponding to all the labeling result data and the labeling result data sets.
In the embodiment of the present invention, the updating module 503 is further configured to correct the sample data that meets the preset condition before updating the initial training sample set according to the sample data subsets corresponding to all the labeling result data and the labeling result data sets, and/or
And de-duplicating the sample data meeting the preset condition.
In the embodiment of the present invention, the determining module 502 is further configured to determine a sample feature corresponding to each piece of sample data and a labeling result feature corresponding to any one of the labeling result data, and determine a similarity between the labeling result data and each piece of sample data according to a distance between the labeling result feature and each sample feature.
In the embodiment of the present invention, the determining module 502 is further configured to determine M sub-features corresponding to sample data by using M preset models, where M is a positive integer greater than or equal to 1, splice the M sub-features to obtain sample features corresponding to each piece of sample data, or use the M sub-features as M sample features corresponding to each piece of sample data.
In a further aspect, an embodiment of the present invention provides an electronic device, including one or more processors, and a storage device configured to store one or more programs, where the one or more programs are executed by the one or more processors, and cause the one or more processors to implement a method for processing image data according to an embodiment of the present invention.
The embodiment of the invention also provides a computer readable medium, on which a computer program is stored, which when executed by a processor implements the method of image data processing according to the embodiment of the invention.
Fig. 6 shows an exemplary system architecture 600 of a method of image data processing or an apparatus of image data processing to which embodiments of the invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 is used as a medium to provide communication links between the terminal devices 601, 602, 603 and the server 605. The network 604 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
A user may interact with the server 605 via the network 604 using the terminal devices 601, 602, 603 to receive or send messages, etc. Various communication client applications such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only) may be installed on the terminal devices 601, 602, 603.
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (by way of example only) providing support for shopping-type websites browsed by users using terminal devices 601, 602, 603. The background management server may analyze and process the received data such as the product information query request, and feedback the processing result (e.g., the target push information, the product information—only an example) to the terminal device.
It should be noted that, the method for processing image data provided in the embodiment of the present invention is generally executed by the server 605, and accordingly, the device for processing image data is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, there is illustrated a schematic diagram of a computer system 700 suitable for use in implementing an embodiment of the present invention. The terminal device shown in fig. 7 is only an example, and should not impose any limitation on the functions and the scope of use of the embodiment of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, ROM 702, and RAM 703 are connected to each other through a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Connected to the I/O interface 705 are an input section 706 including a keyboard, a mouse, and the like, an output section 707 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, a speaker, and the like, a storage section 708 including a hard disk, and the like, and a communication section 709 including a network interface card such as a LAN card, a modem, and the like. The communication section 709 performs communication processing via a network such as the internet. The drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read therefrom is mounted into the storage section 708 as necessary.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 709, and/or installed from the removable medium 711. The above-described functions defined in the system of the present invention are performed when the computer program is executed by a Central Processing Unit (CPU) 701.
The computer readable medium shown in the present invention may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of a computer-readable storage medium may include, but are not limited to, an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules involved in the embodiments of the present invention may be implemented in software or in hardware. The described modules may also be provided in a processor, for example, a processor may be described as including a model annotation module, a determination module, and an update module. The names of these modules do not constitute a limitation on the module itself in some cases, and for example, the update module may also be described as "a module that updates the initial training sample set according to similarity".
As a further aspect, the invention also provides a computer readable medium which may be comprised in the device described in the above embodiments or may be present alone without being fitted into the device. The computer readable medium carries one or more programs which, when executed by the apparatus, cause the apparatus to include labeling a data set to be processed using an image labeling model obtained by training an initial training sample set to obtain a labeling result data set, determining a similarity between the labeling result data set and the initial training sample set, and updating the initial training sample set according to the similarity.
According to the technical scheme, an image annotation model obtained by training an initial training sample set is utilized to annotate a data set to be processed to obtain an annotation result data set, the annotation result data set is corrected to correct a wrong label in the annotation result data set, similarity between the annotation result data set and the initial training sample set is determined, a sample data subset with the similarity meeting preset conditions is screened from the initial training sample set, and the initial training sample set is updated by utilizing the annotation result data set and the initial training sample set. The method provided by the embodiment of the invention can be used for efficiently updating and correcting the error labels in the initial training sample set, so that the labeling quality of the initial training sample set is improved, the performance of the image labeling model obtained by training is further improved, and the labeling accuracy of the image labeling model is improved.
The above embodiments do not limit the scope of the present invention. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives can occur depending upon design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should be included in the scope of the present invention.