Image Processing Method, Apparatus, Electronic Device, and Storage Medium
By acquiring the feature vectors of the image and combining the similarity matching of multiple image classification models and reference category vectors, the problem of low recognition efficiency of a single model is solved, efficient and accurate image recognition is achieved, and retraining costs are reduced.
Patent Information
- Application Number
- CN202210507448.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-10
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-05-10
AI Technical Summary
In the prior art, when image recognition is performed based on a single image recognition model, the recognition efficiency is low and the accuracy is low. When adding new categories to identify, a large number of samples are required to retrain the training, resulting in high cost and low efficiency.
By obtaining the feature vectors of the images to be classified, multiple image classification models are input separately to obtain the first attribute value, and match the similarity with the reference category vector, the target category is comprehensively determined to avoid retraining the model.
It improves the accuracy and efficiency of image recognition, reduces cost consumption, and can identify categories that cannot be recognized by the image classification model.
Smart Images

Figure CN114842261B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to computer processing technologies, and in particular, to an image processing method, apparatus, electronic device, and storage medium. Background Art
[0002] In the field of image recognition technology, generally, in order to improve the efficiency of image recognition, people increasingly tend to use a trained image recognition model to recognize an image to be recognized and obtain a recognition result.
[0003] However, if you want to obtain a high-precision recognition model, it is often necessary to use a large number of images with labeled categories to train the model. During the model training process, the model will only learn in the direction it believes is correct. For example, if a picture of a cat is recognized as a dog with a relatively high probability, the model will keep learning this wrong knowledge, resulting in a problem of low recognition accuracy when recognizing based on a single trained image recognition model. At the same time, if you want to add the recognition of a new category so that the model can automatically recognize the new category, it is necessary to retrain the model using a large number of new category sample images, which consumes a large amount of time cost and results in a problem of low work efficiency. Summary of the Invention
[0004] Embodiments of the present invention provide an image processing method, apparatus, electronic device, and storage medium to improve the accuracy of recognizing different category images and reduce cost consumption.
[0005] In a first aspect, embodiments of the present invention provide an image processing method, which includes:
[0006] Obtain an image to be classified and determine the feature vector of the image to be classified;
[0007] Input the image to be classified into each image classification model respectively to obtain a first attribute value corresponding to each actual classification category;
[0008] Determine the similarity between the feature vector and each reference category vector to obtain a second attribute value corresponding to each reference category identifier of the image to be classified; wherein, the reference category vector corresponds to each reference category identifier;
[0009] Based on each first attribute value and each second attribute value, determine the target category corresponding to the image to be classified.
[0010] In a second aspect, embodiments of the present invention further provide an image processing apparatus, which includes:
[0011] A feature vector determination module, configured to obtain an image to be classified and determine the feature vector of the image to be classified;
[0012] A first attribute value acquisition module, configured to input the image to be classified into each image classification model respectively, so as to obtain first attribute values corresponding to each actual classification category;
[0013] A second attribute value acquisition module, configured to determine the similarity between the feature vector and each reference category vector, so as to obtain second attribute values corresponding to each reference category identifier of the image to be classified; wherein, the reference category vector corresponds to each reference category identifier;
[0014] A target category determination module, configured to determine the target category corresponding to the image to be classified based on each first attribute value and each second attribute value.
[0015] In a third aspect, an embodiment of the present invention further provides an electronic device, where the device includes:
[0016] One or more processors;
[0017] A storage device, configured to store one or more programs,
[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement the image processing method according to any one of the embodiments of the present invention.
[0019] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the image processing method according to any one of the embodiments of the present invention is implemented.
[0020] The technical solution of the embodiment of the present invention obtains the image to be classified, determines the feature vector of the image to be classified, inputs the image to be classified into each image classification model respectively to obtain the first attribute value corresponding to each actual classification category, and determines the similarity between the feature vector and each reference category vector to obtain the second attribute value corresponding to each reference category identifier of the image to be classified. Based on each first attribute value and each second attribute value, the target category corresponding to the image to be classified is determined, which solves the problem in the prior art that the recognition efficiency is low due to the recognition of the image to be classified based on a single image recognition model to obtain the recognition result. It realizes the separate recognition of the image to be classified based on each image classification model to obtain the first attribute value corresponding to each actual classification category. At the same time, based on the similarity between each reference category vector and the feature vector of the image to be classified, the second attribute value corresponding to each reference category identifier is obtained. Furthermore, based on each first attribute value and each second attribute value, the target category corresponding to the image to be classified is comprehensively determined, so as to realize the comprehensive recognition of the image based on each image classification model and each reference category vector, improve the accuracy of recognizing different types of images, and without reconstructing the model, it can determine the type of image that cannot be recognized by the image classification model based on each reference category vector, reduce cost consumption, and achieve the technical effects of improving the accuracy and efficiency of image recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the technical solutions of the exemplary embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments. Obviously, the introduced drawings are only the drawings of a part of the embodiments to be described by the present invention, rather than all the drawings. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0022] Figure 1 It is a flowchart of an image processing method provided by Embodiment 1 of the present invention;
[0023] Figure 2 It is a flowchart of an image processing method provided by Embodiment 2 of the present invention;
[0024] Figure 3 It is a structural block diagram of an image processing device provided by Embodiment 4 of the present invention;
[0025] Figure 4 It is a schematic structural diagram of an electronic device provided by Embodiment 5 of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0026] The present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the present invention, rather than limiting the present invention. Additionally, it should be noted that for the convenience of description, only the parts related to the present invention rather than all the structures are shown in the accompanying drawings.
[0027] Embodiment 1
[0028] Figure 1 FIG. is a flowchart of an image processing method provided in Embodiment 1 of the present invention. This embodiment is applicable to the situation of image classification. This method can be executed by the image processing device in the embodiments of the present invention. The device can be implemented in software and / or hardware. Optionally, it can be implemented through an electronic device, which can be a mobile terminal, a PC terminal, a server, etc. The device can be configured in a computing device. The image processing method provided in this embodiment specifically includes the following steps:
[0029] S110. Obtain the image to be classified and determine the feature vector of the image to be classified.
[0030] Among them, the image to be classified can be understood as the image that needs to be recognized. It can be an image collected based on a camera device or an image pre-stored in a storage space. Correspondingly, the image to be classified can be an animal image, a lesion image, a person image, etc. The image to be classified can also be an image corresponding to an image classification model. For example, if the image classification model is an animal recognition model, then the image to be classified can be an animal image. If the image classification model is a person recognition model, then the image to be classified can be a person image. It should be noted that the image to be classified can be one or multiple, and there is no limitation here. For example, in an actual scenario, if a large number of labeled sample images are to be obtained, as many images to be classified as possible can be obtained at this time, so as to identify the images to be classified based on this technical solution and obtain the labeled sample images with classified categories. The feature vector can be used to represent the uniqueness of the image. Optionally, the feature vector can be obtained by extracting the information of image pixel points or by extracting the information of key feature points of the image.
[0031] In practical applications, any image that needs to be recognized can be used as the image to be classified. An image corresponding to an image classification model can also be used as the image to be classified, so as to subsequently recognize the image to be classified based on the image classification model. The feature extraction algorithm can be used to extract the features of the image to be classified to obtain the feature vector corresponding to the image to be classified, so as to subsequently comprehensively determine the category of the image to be classified based on the feature vector and improve the accuracy of image recognition.
[0032] S120. Input the image to be classified into each image classification model respectively to obtain the first attribute values corresponding to each actual classification category.
[0033] Among them, the image classification model can be a pre-trained model for classifying images. The actual classification categories refer to the categories that the image classification model can recognize. For example, if the image classification model is an animal recognition model, the actual classification categories can be Corgi, Shiba Inu, Husky, Golden Retriever, and so on.
[0034] In practical applications, in order to improve the accuracy of image recognition and prevent the problem of model Confirmation Bias, multiple independent image classification models can be pre-trained based on a large number of images of actual classification categories. Each image classification model has the ability to recognize images of each actual classification category. When the image to be classified is input into each image classification model respectively, the confidence levels corresponding to each actual classification category are finally obtained as the first attribute values. For example, when the image to be classified A is input into Model 1, Model 2, and Model 3 respectively, the first attribute values corresponding to each actual classification category such as Corgi, Shiba Inu, Husky, Golden Retriever, etc. can be obtained. So as to determine which actual classification category the image to be classified A belongs to by comparing the magnitudes of the first attribute values subsequently.
[0035] It should be noted that when the image to be classified is input into each image classification model respectively, each image classification model can perform recognition processing on the image, and each model can output the confidence levels corresponding to each actual classification category. Correspondingly, there can be multiple confidence levels for each actual classification category. The multiple confidence levels included in a certain actual classification category can be fused to obtain the comprehensive confidence level corresponding to this actual classification category as the first attribute value. Correspondingly, the first attribute values corresponding to each actual classification category can be obtained.
[0036] Optionally, inputting the image to be classified into each image classification model respectively to obtain the first attribute values corresponding to each actual classification category includes: for each image classification model, inputting the image to be classified into the current image classification model to obtain the to-be-used attribute values corresponding to at least one actual classification category corresponding to the current image classification model; for each actual classification category, determining at least one to-be-used attribute value corresponding to the current actual classification category, and performing mean processing on the at least one to-be-used attribute value to obtain the first attribute value corresponding to the current actual classification category.
[0037] It should be noted that the processing of each image classification model is the same. Taking one of the image classification models as the current image classification model for illustration.
[0038] In practical applications, the image to be classified can be input into the current image classification model, and the current image classification model outputs the confidence levels corresponding to at least one actual classification category as the attribute values to be used. For example, when the image A to be classified is input into Model 1 respectively, Model 1 can output the attribute values to be used corresponding to each actual classification category such as Corgi, Shiba Inu, Husky, Golden Retriever, etc. Correspondingly, each image classification model can output the attribute values to be used corresponding to each actual classification category. It should be noted that the method for determining the first attribute value corresponding to each actual classification category is the same. Taking one of the actual classification categories as the current actual classification category for illustration. At least one attribute value to be used corresponding to the current actual classification category can be obtained, and then the average value can be obtained by averaging the attribute values to be used, and the average value can be used as the first attribute value corresponding to the current actual classification category. For example, for the actual classification category A, the attribute value to be used output by Model 1 is 0.3, the attribute value to be used output by Model 2 is 0.4, and the attribute value to be used output by Model 3 is 0.5. Then the first attribute value of the actual classification category A can be (0.3 + 0.4 + 0.5) ÷ 3 = 0.4. Correspondingly, the first attribute value corresponding to each actual classification category can be obtained. So as to determine which actual classification category the image A to be classified belongs to by comparing the magnitudes of the first attribute values subsequently.
[0039] S130. Determine the similarity between the feature vector and each reference category vector to obtain the second attribute value corresponding to the image to be classified and each reference category identifier.
[0040] Among them, the reference category vector corresponds to each reference category identifier. The reference category identifier can be used to represent the uniqueness of the category. For example, the Husky category can be represented by A, and the German Shepherd category can be represented by B. It should be noted that the category corresponding to the reference category identifier can be the same as or different from the actual classification category. For example, the actual classification categories are Husky and Golden Retriever, and the categories corresponding to the reference category identifier can include Husky and German Shepherd. Images of categories that the image classification model does not have the ability to recognize can be identified based on this technical solution, such as German Shepherds, without retraining the model for recognizing German Shepherd images, improving the recognition efficiency. Also, the recognition accuracy of Husky category images in the image classification model can be enhanced based on this technical solution. The vector form representation of the reference category identifier is the reference category vector.
[0041] In practical applications, the feature vector of the image to be classified can be compared with each reference category vector corresponding to each reference category identifier respectively. For example, calculate the similarity between the vectors as the second attribute value corresponding to each reference category identifier.
[0042] It should be noted that before determining the similarity between the feature vector and each reference category vector to obtain the second attribute value corresponding to the image to be classified and each reference category identifier, the reference category vector corresponding to a certain reference category identifier can be calculated in advance using the image corresponding to the reference category identifier. For example, the feature vector of each image can be extracted, and then the feature vectors can be fused to obtain a vector that can represent the reference category identifier as the reference category vector. Accordingly, the reference category vector corresponding to each reference category identifier can be obtained.
[0043] Optionally, the method further includes: for each reference category identifier, obtaining at least one first original image corresponding to the current reference category identifier, and respectively determining the feature vector corresponding to the first original image; by performing mean processing on at least one feature vector corresponding to the same reference category identifier, determining the reference category vector corresponding to each reference category identifier.
[0044] It should be noted that the method for determining the reference category vector corresponding to each reference category identifier is the same. Taking one of the reference category identifiers as the current reference category identifier for illustration. The first original image can be an image with a marked category.
[0045] Specifically, in order to improve the accuracy of determining the reference category vector and thus improve the accuracy of image recognition based on the reference category vector, as many first original images corresponding to the current reference category identifier as possible can be obtained. At this time, the first original image is an image marked with the reference category identifier. For example, if the reference category identifier is the category identifier of a cat, the first original image is an image of the cat category. Further, the feature extraction algorithm can be used to extract the feature vectors of all the first original images corresponding to the current reference category identifier, and then the mean processing can be performed on the feature vectors to obtain the mean value, which can be used as the reference category vector corresponding to the current reference category identifier. Accordingly, based on the above method for determining the reference category vector, the reference category vector corresponding to each reference category identifier can be determined to enable the subsequent determination of the category of the image to be classified based on the reference category vector.
[0046] It should be noted that the above S120 to S130 can be executed sequentially or in parallel, and the specific execution order is not limited. The above order is only the order for explaining the technical solutions in each step, not the execution order of each step.
[0047] S140. Based on each first attribute value and each second attribute value, determine the target category corresponding to the image to be classified.
[0048] Specifically, the first attribute values and the second attribute values can be compared, and the classification category with the largest attribute value can be used as the target category corresponding to the image to be classified. Alternatively, the first attribute values and the second attribute values can be normalized to obtain the attribute values after normalization, and the classification category with the largest attribute value can be used as the target category corresponding to the image to be classified.
[0049] It should be noted that there may be attribute values corresponding to the same classification category among the first attribute values and the second attribute values. For example, the first attribute value of a husky is obtained based on an image classification model, and the second attribute value corresponding to the husky is also obtained based on the reference category vector of the husky. To improve the accuracy of image recognition, these two attribute values can be fused to comprehensively determine the attribute value indicating that the image to be classified belongs to the husky category. Accordingly, the fused attribute values corresponding to all classification categories can be obtained, and then based on the fused attribute values, the final category of the image to be classified can be determined.
[0050] Optionally, determining the target category corresponding to the image to be classified based on the first attribute values and the second attribute values includes: determining a set including all actual classification categories and reference category identifiers, where the set includes at least one category element; for each category element, determining the element type corresponding to the current category element, and processing the first attribute value and the second attribute value of the current category element according to the element type to determine the target category.
[0051] In practical applications, all actual classification categories and reference category identifiers can be combined to obtain a union set, and each category in the set can be used as a category element. For example, if the actual classification categories are husky, German shepherd, and golden retriever, and the categories corresponding to the reference category identifiers are husky, German shepherd, and shiba inu, then the set includes four category elements: husky, German shepherd, golden retriever, and shiba inu. It should be noted that the method for determining the element type corresponding to each category element is the same, and one of the category elements can be used as the current category element for illustration. The element type corresponding to the current category element can be determined. The first attribute value and the second attribute value of the current category element can be processed according to the element type to determine the target category.
[0052] Optionally, the implementation process of determining the element type corresponding to the current category element can be: if the attribute value of the current category element includes the first attribute value or the second attribute value, it is determined that the element type corresponding to the current category element is the first type; or, if the attribute value of the current category element includes the first attribute value and the second attribute value, it is determined that the element type corresponding to the current category element is the second type.
[0053] Exemplarily, assume that the current category element is of the husky category. If only the first attribute value corresponding to the German shepherd category is obtained based on the image classification model, or only the second attribute value corresponding to the German shepherd category is obtained based on the reference category vector, the element type corresponding to the German shepherd category can be the first type; if the first attribute value corresponding to the husky category is obtained based on the image classification model and the second attribute value corresponding to the husky category is also obtained based on the reference category vector, the element type corresponding to the husky category can be the second type.
[0054] It should be noted that when each element type is the first type, it can be explained that each actual classification category is different from each reference category identifier, and there are no duplicate categories. At this time, the first attribute values and the second attribute values can be normalized to obtain the attribute values after normalization of each attribute value, and the classification category with the largest attribute value can be used as the target category corresponding to the image to be classified. When the second type is included in each element type, it can be explained that there are duplicate categories among each actual classification category and each reference category identifier. The first attribute value and the second attribute value corresponding to the duplicate category, that is, the category element of the second type, can be fused to obtain an attribute value that can comprehensively evaluate this category element. Furthermore, based on the attribute value of this category element and the attribute value of the category element of the first type, the target category corresponding to the image to be classified can be determined.
[0055] Optionally, processing the first attribute value and the second attribute value of the current category element according to the element type to determine the target category includes: if each element type is the first type, normalizing the first attribute values and the second attribute values to obtain the third attribute value corresponding to each category element, and determining the target category corresponding to the image to be classified based on each third attribute value; or, if the second type is included in each element type, taking the average of the first attribute value and the second attribute value of the current category element to obtain the fourth attribute value corresponding to the current category element, and determining the target category corresponding to the image to be classified based on the fourth attribute values corresponding to each category element.
[0056] Specifically, if all element types are of the first type, normalization processing can be performed on all first attribute values and all second attribute values so that the sum of all first attribute values and all second attribute values is 1. Furthermore, the attribute values corresponding to each category element, i.e., the third attribute values, can be obtained. The classification category corresponding to the maximum value among the third attribute values can be used as the target category of the image to be classified. Alternatively, if the second type is included in the element types, mean processing can be performed on the first attribute value and the second attribute value corresponding to the current category element. If the current category element is of the first type, the corresponding first attribute value or second attribute value is 0. For example, if the current category element A is of the first type, the first attribute value is 0.2, and the second attribute value is 0.3, then the mean is (0.2 + 0.3) ÷ 2 = 0.25. The mean can be used as the fourth attribute value of the current category element A. Correspondingly, the fourth attribute values corresponding to each category element can be obtained, and the classification category corresponding to the maximum value among the fourth attribute values can be used as the target category of the image to be classified.
[0057] In the technical solution of this embodiment, by obtaining the image to be classified, determining the feature vector of the image to be classified, inputting the image to be classified into each image classification model respectively, obtaining the first attribute values corresponding to each actual classification category, and determining the similarity between the feature vector and each reference category vector to obtain the second attribute values corresponding to the image to be classified and each reference category identifier. Based on each first attribute value and each second attribute value, the target category corresponding to the image to be classified is determined, which solves the problem in the prior art that the image to be classified is recognized based on a single image recognition model to obtain the recognition result, resulting in low recognition efficiency. It realizes the separate recognition of the image to be classified based on each image classification model to obtain the first attribute values corresponding to each actual classification category. At the same time, based on the similarity between each reference category vector and the feature vector of the image to be classified, the second attribute values corresponding to each reference category identifier are obtained. Furthermore, based on each first attribute value and each second attribute value, the target category corresponding to the image to be classified is comprehensively determined to realize the comprehensive recognition of the image based on each image classification model and each reference category vector, improve the accuracy of recognizing different category images, and without reconstructing the model, the type of image that cannot be recognized by the image classification model can be determined based on each reference category vector, reducing cost consumption, and achieving the technical effects of improving the accuracy and efficiency of image recognition.
[0058] Embodiment 2
[0059] Figure 2 It is a flowchart of an image processing method provided in Embodiment 2 of the present invention. On the basis of the foregoing embodiment, the method further includes training to obtain each image classification model. The specific implementation manner can refer to the technical solution of this embodiment. The same or corresponding technical terms as those in the above embodiment will not be elaborated here.
[0060] As Figure 2 shown, the method specifically includes the following steps:
[0061] S210. Obtain the training sample sets corresponding to each classification model to be trained.
[0062] It should be noted that, in order to avoid the problem of confirmation bias in image recognition by a single model and solve the problem of difficulty in obtaining labeled samples in the traditional method, this technical solution uses a small number of labeled samples as the training set, divides the training set into several parts, separately trains the corresponding classification models based on each part of the training set to obtain the corresponding trained classification models, then processes the unlabeled samples based on the trained classification models to obtain labeled samples, and then selects the labeled samples with high confidence from the labeled samples and adds them to the training set to repeatedly train the trained classification models, improving the model recognition accuracy while improving the sample labeling efficiency and cost.
[0063] Among them, the classification model to be trained can be understood as the classification model that needs to be trained. The training sample set includes at least one training sample, and each training sample includes a second original image corresponding to each actual classification category. The second original image can be an image with a labeled category. For example, if the actual classification category is the husky category, the second original image is an image of the husky category.
[0064] Specifically, a small number of second original images corresponding to each actual classification category can be obtained, and each second original image can be divided into several parts. Each part of the second original image can be used as the training sample set corresponding to a classification model to be trained, and the training sample set is used to train the corresponding classification model to be trained.
[0065] S220. For each classification model to be trained, use the second original image in the current training sample corresponding to the current classification model to be trained as the input of the current classification model to be trained, use the actual classification category as the output of the current classification model to be trained, and train the current classification model to be trained to obtain the trained current classification model to be trained.
[0066] It should be noted that the processing method for each classification model to be trained is the same. Taking one of the classification models to be trained as the current classification model to be trained as an example for description.
[0067] Specifically, the current classification model to be trained can be trained based on each training sample in the training sample set corresponding to the current classification model to be trained, so as to obtain the trained current classification model to be trained. It should be noted that the processing method for each training sample is the same. Taking the processing of one training sample as an example, the second original image in the current training sample can be input into the current classification model to be trained. The model can perform learning processing on the second original image and output the category corresponding to the second original image. Then, an algorithm can be used to perform loss processing on the output category and the actual classification category expected to be output to obtain a loss value, so as to correct the model parameters in the current classification model to be trained based on the loss value and train the current classification model to be trained. The convergence of the loss function of the current classification model to be trained can be used as the training goal. For example, the training error of the loss function, that is, the loss parameter, can be used as the condition for detecting whether the loss function has reached convergence, such as whether the training error is less than the preset error or whether the error change trend tends to be stable, or whether the current number of iterations is equal to the preset number. If the convergence condition is detected, such as the training error of the loss function reaches less than the preset error or the error change tends to be stable, it indicates that the training of the current classification model to be trained is completed, and at this time, the iterative training can be stopped. If it is detected that the current does not reach the convergence condition, training samples can be further obtained to continue training the current classification model to be trained until the training error of the loss function is within the preset range. When the training error of the loss function reaches convergence, it can be considered that the current classification model to be trained is trained well, that is, the trained current classification model to be trained is obtained, so that when a to-be-classified image is input, the trained current classification model to be trained can output the category of the to-be-classified image.
[0068] S230. Re-take the trained current classification model to be trained as the current classification model to be trained and train it until the loss function of the current classification model to be trained converges, so as to obtain the corresponding image classification model.
[0069] In practical applications, in order to improve the accuracy of model training, labeled samples, that is, the second original images, can be continuously obtained to continue training the trained current classification model to be trained based on the second original images until the loss function of the current classification model to be trained converges, so as to obtain the corresponding image classification model. In order to improve the recognition accuracy of the image classification model, the image classification model can be re-taken as the current classification model to be trained, and the steps of training the current classification model to be trained to obtain the image classification model can be repeatedly executed until the recognition state of the image classification model meets the preset requirements, and the obtained image classification model can be used as the final image classification model.
[0070] It should be noted that, in order to reduce the cost of marked sample acquisition, after obtaining the trained current classification model to be trained, the unmarked sample images can be processed based on the trained current classification model to be trained to obtain the categories corresponding to the unmarked sample images. Then, based on the categories and the corresponding unmarked sample images, the marked images can be obtained. The marked images can be used as the training set, or the images with confidence levels higher than the preset threshold in the marked images can be used as the training set to continue training the current classification model to be trained.
[0071] Optionally, using the trained current classification model to be trained again as the current classification model to be trained and training until the loss function of the current classification model to be trained converges to obtain the corresponding image classification model, including: obtaining at least one image to be labeled; inputting each image to be labeled into the trained current classification model to be trained, outputting the actual classification categories corresponding to the images to be labeled and the corresponding attribute values to be processed, and using the trained current classification model to be trained again as the current classification model to be trained; determining the target labeled images from the images to be labeled based on the preset attribute value threshold, the attribute values to be processed, and the corresponding actual classification categories; updating the training sample set based on the target labeled images, and re-executing the step of training the current classification model to be trained based on the updated training sample set until the loss function of the current classification model to be trained converges to obtain the corresponding image classification model.
[0072] Among them, the image to be labeled can be understood as the image that needs to be marked.
[0073] In this embodiment, as many and as rich as possible images to be labeled can be obtained. Then, each image to be labeled can be used as the input of the trained current classification model to be trained, and the model outputs the actual classification categories corresponding to the images to be labeled and the corresponding confidence levels, that is, the attribute values to be processed. The images to be labeled with attribute values to be processed greater than the preset attribute value threshold can be used as the images to be processed. The images to be processed can be marked with the corresponding actual classification categories to obtain the marked images of the images to be processed as the target labeled images. Each target labeled image can be added to the historical training sample set corresponding to the current classification model to be trained to obtain a new training sample set, and the step of training the current classification model to be trained is re-executed based on the new training sample set until the loss function of the current classification model to be trained converges to obtain the corresponding image classification model, so that when inputting a certain image to be classified, the trained image classification model can accurately output the target category of the image to be classified.
[0074] S240. Obtain an image to be classified and determine the feature vector of the image to be classified.
[0075] S250. Input the image to be classified into each image classification model respectively to obtain first attribute values corresponding to each actual classification category.
[0076] S260. Determine the similarity between the feature vector and each reference category vector to obtain second attribute values corresponding to each reference category identifier of the image to be classified.
[0077] S270. Based on each first attribute value and each second attribute value, determine the target category corresponding to the image to be classified.
[0078] The technical solution of this embodiment avoids the problem of confirmation bias in image recognition by a single model by using a small number of labeled samples as the training set to train multiple classification models to be trained. At the same time, based on the training sets of each part, the corresponding classification models are trained separately to obtain the corresponding trained classification models. Then, based on the trained classification models, the unlabeled samples are processed to obtain labeled samples. Furthermore, the labeled samples with high confidence are selected from the labeled samples and added to the training set to retrain the trained classification models, improving the model recognition accuracy while improving the sample labeling efficiency and cost.
[0079] Embodiment III
[0080] As an optional embodiment of the above embodiment, in order to make those skilled in the art further clear the technical solution of the embodiment of the present invention, a specific application scenario example is given. Specifically, the following specific content can be referred to.
[0081] Exemplarily, assume the number of image classification models is 3. When training these three image classification models, a total training sample set (TrainDataSset) including at least one second original image (LabelDataSset) can be used, and TrainDataSset is divided into three parts to obtain TrainDataSset1, TrainDataSset2, and TrainDataSset3. Each part of the training sample set serves as the training sample set for a classification model to be trained. For example, the classification models to be trained can be model1, model2, and model3. The training samples (train_sample) in each training sample set can be respectively input into the corresponding classification model to be trained. For example, train_sample1 is input into model1, train_sample2 is input into model2, and train_sample3 is input into model3 to train the models, obtaining the trained model1, model2, and model3. Further, each unlabeled image (UnLabelDataSset) can be input into the trained classification model to be trained to obtain the labeled images, and the label samples with a confidence level greater than the preset attribute threshold can be selected from the labeled images and added to the total training sample set (TrainDataSset). Repeat the steps of dividing TrainDataSset to obtain TrainDataSset1, TrainDataSset2, and TrainDataSset3, and the steps of training the trained model1, model2, and model3 based on TrainDataSset1, TrainDataSset2, and TrainDataSset3 until the trained image classification models are obtained. The pseudo-code for the process is as follows:
[0082] #TrainDataSset = LabelDataSset
[0083] For epoch in Epoch:
[0084] #Divide the total training sample set into three parts
[0085] TrainDataSset1,TrainDataSset2,TrainDataSset3 = split(TrainData Sset)
[0086] For train_sample1, train_sample2, train_sample3 in TrainDataSset1, TrainDataSset2, TrainDataSset3:
[0087] model1 = train_model(model1, train_sample1)
[0088] model2 = train_model(model2, train_sample2)
[0089] model3 = train_model(model3, train_sample3)
[0090] # Use the current model to predict the unlabeled dataset to obtain a new total training sample set TrainDataSset = LabelDataSset + FindNewData(model1, model2, model3, UnLabelDataSset)
[0091] Based on the above solution, at least one first original image corresponding to the current reference category identifier can also be obtained, and the feature vectors corresponding to the first original image can be determined respectively. By averaging the at least one feature vector corresponding to the same reference category identifier, the reference category vectors corresponding to each reference category identifier are determined. The pseudo-code of the implementation process is as follows:
[0092] Animal2Embedding = {}
[0093] # Traverse the collected first original images
[0094] For image, label in InternetImages:
[0095] # Add the feature vector corresponding to the first original image to the corresponding reference category identifier
[0096] Animal2Embedding[label].append(model(image))
[0097] For animal in Animal2Embedding:
[0098] # Use the average value of the feature vectors corresponding to the same reference category identifier as the reference category vector corresponding to each reference category identifier
[0099] Animal2Embedding[label] = mean(Animal2Embedding[label])
[0100] Based on the above solution, it is also possible to use the trained model to calculate a reference category vector for a reference category identifier, which is used to enhance the effect of the model during inference. The overall process of comprehensively determining the target category of the image to be classified by combining the reference category vector and the image classification model is as follows:
[0101] prob = model(x) + Top1Sim(x, model, Animal2Embedding)
[0102] Among them, x represents the image to be classified, model(x) represents the first attribute value output by the image classification model, Animal2Embedding represents the reference category vector, Top1Sim(x, model, Animal2Embedding) represents the similarity between the feature vector of the image to be classified and the reference category vector, that is, the second attribute value, and prob represents the comprehensive evaluation result of the image to be classified. In an actual scenario, when there are reference category vectors for multiple reference category identifiers, the similarity between the feature vector of the image to be classified and each reference category vector can be calculated to obtain the second attribute value corresponding to the reference category identifier. When the actual classification category corresponding to the image classification model is different from all the reference category identifiers, the first attribute value and each second attribute value can be finally normalized by SoftMax to obtain the third attribute value corresponding to each category. The maximum value among the third attribute values can be used as the probability value representing the target category. Correspondingly, the target category of the image to be classified is obtained.
[0103] The technical solution of this embodiment is based on each image classification model to separately identify the image to be classified, obtaining the first attribute value corresponding to each actual classification category. At the same time, it is also based on the similarity between each reference category vector and the feature vector of the image to be classified, obtaining the second attribute value corresponding to each reference category identifier. Then, based on each first attribute value and each second attribute value, the target category corresponding to the image to be classified is comprehensively determined, realizing the comprehensive recognition of the image based on each image classification model and each reference category vector, improving the accuracy of image recognition for different categories, and without the need to reconstruct the model, it is possible to determine the type of image that the image classification model cannot recognize based on each reference category vector, reducing cost consumption, and achieving the technical effects of improving the accuracy and efficiency of image recognition.
[0104] Embodiment 4
[0105] Figure 3The block diagram of an image processing device provided in the fourth embodiment of the present invention. The device includes: a feature vector determination module 310, a first attribute value acquisition module 320, a second attribute value acquisition module 330, and a target category determination module 340.
[0106] Among them, the feature vector determination module 310 is configured to obtain an image to be classified and determine the feature vector of the image to be classified;
[0107] The first attribute value acquisition module 320 is configured to input the image to be classified into each image classification model respectively, and obtain first attribute values corresponding to each actual classification category;
[0108] The second attribute value acquisition module 330 is configured to determine the similarity between the feature vector and each reference category vector, and obtain second attribute values corresponding to each reference category identifier of the image to be classified; wherein, the reference category vector corresponds to each reference category identifier;
[0109] The target category determination module 340 is configured to determine the target category corresponding to the image to be classified based on each first attribute value and each second attribute value.
[0110] The technical solution of this embodiment solves the problem of low recognition efficiency in the prior art of identifying an image to be classified based on a single image recognition model and obtaining a recognition result by obtaining an image to be classified, determining the feature vector of the image to be classified, inputting the image to be classified into each image classification model respectively to obtain first attribute values corresponding to each actual classification category, and determining the similarity between the feature vector and each reference category vector to obtain second attribute values corresponding to each reference category identifier of the image to be classified. Based on each first attribute value and each second attribute value, the target category corresponding to the image to be classified is determined, realizing the separate recognition of the image to be classified based on each image classification model to obtain first attribute values corresponding to each actual classification category. At the same time, based on the similarity between each reference category vector and the feature vector of the image to be classified, second attribute values corresponding to each reference category identifier are obtained. Furthermore, based on each first attribute value and each second attribute value, the target category corresponding to the image to be classified is comprehensively determined, so as to realize the comprehensive recognition of the image based on each image classification model and each reference category vector, improve the accuracy of recognizing different category images, and without reconstructing the model, the type of image that cannot be recognized by the image classification model can be determined based on each reference category vector, reducing cost consumption, and achieving the technical effects of improving the accuracy and efficiency of image recognition.
[0111] On the basis of the above device, optionally, the first attribute value acquisition module 320 includes a to-be-used attribute value determination unit and a first attribute value determination unit.
[0112] A to-be-used attribute value determination unit, configured to input the to-be-classified image into the current image classification model for each image classification model, and obtain at least one to-be-used attribute value corresponding to the current image classification model for the actual classification category;
[0113] A first attribute value determination unit, configured to determine at least one to-be-used attribute value corresponding to the current actual classification category for each actual classification category, and perform mean processing on the at least one to-be-used attribute value to obtain a first attribute value corresponding to the current actual classification category.
[0114] Based on the above device, optionally, the device includes a reference category vector determination module, and the reference category vector determination module includes a feature vector determination unit and a reference category vector determination unit.
[0115] The feature vector determination unit is configured to obtain at least one first original image corresponding to the current reference category identifier for each reference category identifier, and respectively determine a feature vector corresponding to the first original image;
[0116] The reference category vector determination unit is configured to determine a reference category vector corresponding to each reference category identifier by performing mean processing on at least one feature vector corresponding to the same reference category identifier.
[0117] Based on the above device, optionally, the target category determination module 340 includes a set determination unit and a target category determination unit.
[0118] The set determination unit is configured to determine a set including each actual classification category and each reference category identifier, where the set includes at least one category element;
[0119] The target category determination unit is configured to determine an element type corresponding to the current category element for each category element, and process the first attribute value and the second attribute value of the current category element according to the element type to determine the target category.
[0120] Based on the above device, optionally, the target category determination module 340 further includes an element type determination unit.
[0121] The element type determination unit is configured to, if the attribute value of the current category element includes a first attribute value or a second attribute value, determine that the element type corresponding to the current category element is a first type; or,
[0122] if the attribute value of the current category element includes a first attribute value and a second attribute value, determine that the element type corresponding to the current category element is a second type.
[0123] Based on the above device, optionally, the target category determination unit includes a target category determination subunit.
[0124] The target category determination subunit is configured to, if each element type is the first type, perform normalization processing on each first attribute value and each second attribute value to obtain a third attribute value corresponding to each category element, and determine the target category corresponding to the image to be classified based on each third attribute value; or,
[0125] if the second type is included in each element type, perform mean processing on the first attribute value and the second attribute value of the current category element to obtain a fourth attribute value corresponding to the current category element, and determine the target category corresponding to the image to be classified based on the fourth attribute values corresponding to each category element.
[0126] Based on the above device, optionally, the device further includes an image classification model acquisition module, and the image classification model acquisition module includes a training sample set acquisition unit, a to-be-trained classification model training unit, and an image classification model determination unit.
[0127] The training sample set acquisition unit is configured to acquire a training sample set corresponding to each to-be-trained classification model; wherein, the training sample set includes at least one training sample, and the training sample includes a second original image corresponding to each actual classification category;
[0128] The to-be-trained classification model training unit is configured to, for each to-be-trained classification model, use the second original image in the current training sample corresponding to the current to-be-trained classification model as the input of the current to-be-trained classification model, and use the actual classification category as the output of the current to-be-trained classification model, and train the current to-be-trained classification model to obtain a trained current to-be-trained classification model;
[0129] The image classification model determination unit is configured to use the trained current to-be-trained classification model as the current to-be-trained classification model again and train it until the loss function of the current to-be-trained classification model converges, to obtain a corresponding image classification model.
[0130] Based on the above device, optionally, the image classification model determination unit includes a to-be-annotated image acquisition subunit, a to-be-processed attribute value output subunit, a target annotated image determination subunit, and an image classification model determination subunit.
[0131] The to-be-annotated image acquisition subunit is configured to acquire at least one to-be-annotated image;
[0132] A to-be-processed attribute value output subunit, configured to input each to-be-annotated image into the trained current to-be-trained classification model, output the actual classification category corresponding to each to-be-annotated image and the corresponding to-be-processed attribute value, and re-use the trained current to-be-trained classification model as the current to-be-trained classification model;
[0133] A target annotated image determination subunit, configured to determine a target annotated image from each to-be-annotated image based on a preset attribute value threshold, each to-be-processed attribute value, and the corresponding actual classification category;
[0134] An image classification model determination subunit, configured to update the training sample set based on each target annotated image, and re-execute the step of training the current to-be-trained classification model based on the updated training sample set until the loss function of the current to-be-trained classification model converges, to obtain the corresponding image classification model.
[0135] The image processing apparatus provided by an embodiment of the present invention can execute the image processing method provided by any embodiment of the present invention, and has functional modules and beneficial effects corresponding to the execution of the method.
[0136] It should be noted that the various units and modules included in the above apparatus are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for the convenience of mutual distinction, and are not used to limit the protection scope of the embodiments of the present invention.
[0137] Embodiment 5
[0138] Figure 4 It is a schematic structural diagram of an electronic device provided by Embodiment 5 of the present invention. Figure 4 It shows a block diagram of an exemplary electronic device 40 suitable for implementing the implementation manner of the embodiment of the present invention. Figure 4 The shown electronic device 40 is only an example, and should not bring any limitation to the functions and usage scopes of the embodiments of the present invention.
[0139] As Figure 4 shown, the electronic device 40 is presented in the form of a general-purpose computing device. The components of the electronic device 40 may include, but are not limited to: one or more processors or processing units 401, a system memory 402, and a bus 403 connecting different system components (including the system memory 402 and the processing unit 401).
[0140] The bus 403 represents one or more of several types of bus architectures, including a memory bus or memory controller, a peripheral bus, an Accelerated Graphics Port, a processor bus, or a local bus using any of the several bus architectures. By way of example, and not limitation, such architectures can include Industry Standard Architecture (ISA) bus, Micro Channel Architecture (MAC) bus, Enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
[0141] The electronic device 40 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 40, including both volatile and nonvolatile media, removable and non-removable media.
[0142] System memory 402 can include computer system readable media in the form of volatile memory, such as random access memory (RAM) 404 and / or cache memory 405. The electronic device 40 can further include other removable / non-removable, volatile / nonvolatile computer system storage media. By way of example only, storage system 406 can be used for reading and writing non-removable, nonvolatile magnetic media ( Figure 4 not shown and typically called a "hard disk drive"). Although Figure 4 not shown in the figures, a disk drive for reading and writing a removable nonvolatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing a removable nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) can be provided. In these instances, each drive can be connected to the bus 403 by one or more data media interfaces. Memory 402 can include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the present invention.
[0143] A program / utility 408 having a set (at least one) of program modules 407 can be stored, for example, in memory 402, such program modules 407 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may include an implementation of a networking environment. The program modules 407 typically carry out the functions and / or methods of the embodiments described herein.
[0144] The electronic device 40 can also communicate with one or more external devices 409 (such as a keyboard, a pointing device, a display 410, etc.), and can also communicate with one or more devices that enable a user to interact with the electronic device 40, and / or communicate with any device that enables the electronic device 40 to communicate with one or more other computing devices (such as a network card, a modem, etc.). Such communication can be carried out through an input / output (I / O) interface 411. Also, the electronic device 40 can communicate with one or more networks (such as a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) through a network adapter 412. As shown in the figure, the network adapter 412 communicates with other modules of the electronic device 40 through a bus 403. It should be understood that although Figure 4 not shown in the figure, other hardware and / or software modules can be used in combination with the electronic device 40, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.
[0145] The processing unit 401 executes various functional applications and data processing by running programs stored in the system memory 402, such as implementing the image processing method provided by the embodiments of the present invention.
[0146] Embodiment Six
[0147] Embodiment Six of the present invention also provides a storage medium containing computer-executable instructions, and the computer-executable instructions are used to execute an image processing method when executed by a computer processor. The method includes:
[0148] Obtain an image to be classified, and determine the feature vector of the image to be classified;
[0149] Input the image to be classified into each image classification model respectively, and obtain a first attribute value corresponding to each actual classification category;
[0150] Determine the similarity between the feature vector and each reference category vector, and obtain a second attribute value corresponding to each reference category identifier of the image to be classified; wherein, the reference category vector corresponds to each reference category identifier;
[0151] Based on each first attribute value and each second attribute value, determine the target category corresponding to the image to be classified.
[0152] The computer storage medium of the embodiments of the present invention may employ any combination of one or more computer-readable media. The computer-readable media may be computer-readable signal media or computer-readable storage media. The computer-readable storage media may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer-readable storage media include: an electrical connection having one or more wires, a portable computer disk, 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 this document, the computer-readable storage media may be any tangible medium that contains or stores a program that can be used by or in connection with an instruction execution system, apparatus, or device.
[0153] The computer-readable signal media may include a data signal propagated in a baseband or as part of a carrier wave, in which computer-readable program code is carried. Such a propagated data signal may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing. The computer-readable signal media may also be any computer-readable media other than the computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device.
[0154] The program code contained on the computer-readable media may be transmitted by any appropriate medium, including but not limited to wireless, wire, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0155] The computer program code for performing the operations of the embodiments of the present invention may be written in one or more programming languages or combinations thereof. The programming languages include object-oriented programming languages such as Java, Smalltalk, C++, and also include conventional procedural programming languages such as the "C" language or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, executed as a stand-alone software package, partially on the user's computer and partially on a remote computer, or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., through the Internet using an Internet service provider).
[0156] Note that the above is only a preferred embodiment of the present invention and the technical principles applied. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein. Various obvious changes, re-adjustments, and substitutions can be made by those skilled in the art without departing from the protection scope of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments. Without departing from the concept of the present invention, it can also include more other equivalent embodiments, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. An image processing method, characterized in that, Including: Obtain the image to be classified and determine the feature vector of the image to be classified; For each image classification model, input the image to be classified into the current image classification model to obtain at least one to-be-used attribute value corresponding to the current image classification model; For each actual classification category, determine at least one to-be-used attribute value corresponding to the current actual classification category, and perform mean processing on the at least one to-be-used attribute value to obtain a first attribute value corresponding to the current actual classification category; Determine the similarity between the feature vector and each reference category vector to obtain a second attribute value corresponding to each reference category identifier of the image to be classified; wherein, the reference category vector corresponds to each reference category identifier; Based on each first attribute value and each second attribute value, determine the target category corresponding to the image to be classified; Wherein, the determining the target category corresponding to the image to be classified based on each first attribute value and each second attribute value includes: Determine a set including each actual classification category and each reference category identifier, wherein the set includes at least one category element; For each category element, determine the element type corresponding to the current category element, including: if the attribute value of the current category element includes a first attribute value or a second attribute value, determine that the element type corresponding to the current category element is the first type; or, if the attribute value of the current category element includes a first attribute value and a second attribute value, determine that the element type corresponding to the current category element is the second type; Process the first attribute value and the second attribute value of the current category element according to the element type to determine the target category, including: if each element type is the first type, perform normalization processing on each first attribute value and each second attribute value to obtain a third attribute value corresponding to each category element, and based on each third attribute value, determine the target category corresponding to the image to be classified; or, if the element types include the second type, perform mean processing on the first attribute value and the second attribute value of the current category element to obtain a fourth attribute value corresponding to the current category element, and based on the fourth attribute values corresponding to each category element, determine the target category corresponding to the image to be classified; The method further includes: For each reference category identifier, obtain at least one first original image corresponding to the current reference category identifier, and respectively determine the feature vector corresponding to the first original image, wherein the first original image is an image with a marked category; By performing mean processing on at least one feature vector corresponding to the same reference category identifier, determine the reference category vector corresponding to each reference category identifier.
2. The method according to claim 1, wherein It further includes: Train to obtain each image classification model; The training to obtain each image classification model includes: Obtain the training sample set corresponding to each classification model to be trained; wherein, the training sample set includes at least one training sample, and the training sample includes a second original image corresponding to each actual classification category; For each classification model to be trained, use the second original image in the current training samples corresponding to the current classification model to be trained as the input of the current classification model to be trained, and use the actual classification category as the output of the current classification model to be trained, and train the current classification model to be trained to obtain the trained current classification model to be trained; Use the trained current classification model to be trained as the current classification model to be trained again and train it until the loss function of the current classification model to be trained converges to obtain the corresponding image classification model.
3. The method according to claim 2, wherein The step of using the trained current classification model to be trained as the current classification model to be trained again and training it until the loss function of the current classification model to be trained converges to obtain the corresponding image classification model includes: Obtain at least one image to be labeled; Input each image to be labeled into the trained current classification model to be trained, output the actual classification category corresponding to each image to be labeled and the corresponding attribute value to be processed, and use the trained current classification model to be trained as the current classification model to be trained again; Based on the preset attribute value threshold, each attribute value to be processed, and the corresponding actual classification category, determine the target labeled images from each image to be labeled; Update the training sample set based on each target labeled image, and based on the updated training sample set, re-execute the step of training the current classification model to be trained until the loss function of the current classification model to be trained converges to obtain the corresponding image classification model.
4. An image processing apparatus, characterized in that, Including: A feature vector determination module for obtaining an image to be classified and determining the feature vector of the image to be classified; A first attribute value acquisition module for, for each image classification model, inputting the image to be classified into the current image classification model to obtain at least one attribute value to be used corresponding to the actual classification category corresponding to the current image classification model; for each actual classification category, determine at least one attribute value to be used corresponding to the current actual classification category, and perform mean processing on the at least one attribute value to be used to obtain the first attribute value corresponding to the current actual classification category; A second attribute value acquisition module for determining the similarity between the feature vector and each reference category vector to obtain the second attribute value corresponding to the image to be classified and each reference category identifier; wherein, the reference category vector corresponds to each reference category identifier; A target category determination module for determining the target category corresponding to the image to be classified based on each first attribute value and each second attribute value; The target category determination module includes a set determination unit and a target category determination unit; The set determination unit is used to determine a set including each actual classification category and each reference category identifier, where the set includes at least one category element; The target category determination unit is used to, for each category element, determine the element type corresponding to the current category element, and process the first attribute value and the second attribute value of the current category element according to the element type to determine the target category; The device further includes a reference category vector determination module, and the reference category vector determination module includes a feature vector determination unit and a reference category vector determination unit; The feature vector determination unit is configured to, for each reference category identifier, obtain at least one first original image corresponding to the current reference category identifier, and respectively determine a feature vector corresponding to the first original image, where the first original image is an image with a marked category; The reference category vector determination unit is configured to determine a reference category vector corresponding to each reference category identifier by performing mean processing on at least one feature vector corresponding to the same reference category identifier; The target category determination module further includes an element type determination unit; The element type determination unit is configured to, if the attribute value of the current category element includes a first attribute value or a second attribute value, determine that the element type corresponding to the current category element is a first type; or, if the attribute value of the current category element includes a first attribute value and a second attribute value, determine that the element type corresponding to the current category element is a second type; The target category determination unit includes a target category determination subunit; The target category determination subunit is configured to, if each element type is a first type, perform normalization processing on each first attribute value and each second attribute value to obtain a third attribute value corresponding to each category element, and determine the target category corresponding to the image to be classified based on each third attribute value; or, if the element types include a second type, perform mean processing on the first attribute value and the second attribute value of the current category element to obtain a fourth attribute value corresponding to the current category element, and determine the target category corresponding to the image to be classified based on the fourth attribute value corresponding to each category element.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by a processor, it implements the image processing method according to any one of claims 1-3.
Citation Information
Patent Citations
Face emotion identifying method, apparatus and storage medium
CN107633203A
Fruit and vegetable images classifying and identifying method and system based on model integration
CN108319968A