Image classification method and device based on single positive image, storage medium and computer
By training on coding neural networks and single-class support vector machine models, a high-accurate image classification is achieved using single positive image sets, solving the problem of difficulty in training an effective image classification model in the absence of negative image samples.
Patent Information
- Application Number
- CN202010769102.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-03
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2040-08-03
AI Technical Summary
In some application scenarios, there are only positive image samples and no negative image samples, making it difficult to train an image classification model with high prediction accuracy.
By providing a single positive image set, the encoded neural network model is trained to extract the features of the positive image, and the decoded neural network model is used to restore the image, adjust the parameters of the encoded neural network model to extract appropriate features. Then, the extracted features are input into the single-class support vector machine model for training, divide the positive image range, and finally use the trained model to classify the detected image.
This realizes image classification based on only a single positive image to achieve high accuracy, and solves the problem of difficulty in training an effective image classification model in the absence of negative image samples.
Smart Images

Figure CN114092733B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of machine learning and image science, and in particular to an image classification method and device, a storage medium and a computer based on a single positive class image. Background Art
[0002] Deep learning has performed exceptionally well in the fields of image classification and image semantic segmentation due to its high prediction accuracy in recognition applications. It mainly uses convolutional neural networks (CNNs) to find features in images, separate targets from the background, or distinguish targets of different categories.
[0003] However, the premise of building a high-quality neural network model is to have a high-quality image training set, which not only requires quantity, but also needs to have a certain tolerance for environmental differences. This is especially important in industrial applications, because there are many force majeure factors that cause image changes. In industrial environments, the decline in the performance of hardware such as light sources, cameras, and lenses, and changes and interference in the external environment will affect the robustness of the model, but they cannot be fully reflected in the existing image data.
[0004] However, in some application scenarios, there are only positive image samples but no negative image samples. In this case, how to train an image classification model with high prediction accuracy is a big challenge. Summary of the invention
[0005] The object of the present invention is to provide an image classification method and device, a storage medium and a computer based on a single positive image, which can be trained based only on a single positive image and then classify the image with high accuracy.
[0006] To achieve the purpose of the invention, according to one aspect of the present invention, the present invention provides an image classification method based on a single positive image, which includes: providing a single positive image set, an encoding neural network model, a decoding neural network model and a single-class support vector machine model, wherein the single positive image set includes multiple positive images; inputting the positive images in the single positive image set into the encoding neural network model to train the encoding neural network model, at which time the encoding neural network model extracts the features of the positive images, and the decoding neural network model decodes the restored images based on the features extracted by the encoding neural network model, and obtains the final encoding neural network model after training; inputting the features of each positive image extracted by the final encoding network model into the single-class support vector machine model for training to divide the range of positive images, and obtain the final single-class support vector machine model; inputting the image to be detected into the final encoding neural network model for feature extraction, and the final single-class support vector machine model performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image.
[0007] According to another aspect of the present invention, the present invention provides an image classification device based on a single positive image, which includes: an encoding neural network model, which is configured to receive positive images in a single positive image set for training, at which time the encoding neural network model extracts features of the positive images, and obtains a final encoding neural network model after training; a decoding neural network model, which is configured to decode a restored image based on the features extracted by the encoding neural network model; and a single-class support vector machine model, which is configured to receive the features of each positive image extracted by the final encoding network model for training, and then divide the range of positive images to obtain a final single-class support vector machine model, wherein the image to be detected is input into the final encoding neural network model for feature extraction, and the final single-class support vector machine model performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image.
[0008] According to another aspect of the present invention, the present invention provides a storage medium storing program instructions, which are executed in the program execution to execute the above-mentioned image classification method based on a single positive image. The image classification method based on a single positive image includes: providing a single positive image set, an encoding neural network model, a decoding neural network model and a single-class support vector machine model, wherein the single positive image set includes multiple positive images; inputting the positive images in the single positive image set into the encoding neural network model to train the encoding neural network model, at which time the encoding neural network model extracts the features of the positive images, and the decoding neural network model decodes the restored images based on the features extracted by the encoding neural network model, and obtains the final encoding neural network model after training; inputting the features of each positive image extracted by the final encoding network model into the single-class support vector machine model for training to divide the range of positive images, and obtain the final single-class support vector machine model; inputting the image to be detected into the final encoding neural network model for feature extraction, and the final single-class support vector machine model performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image.
[0009] According to another aspect of the present invention, the present invention provides a computer, which includes a processor and a memory, wherein the memory stores program instructions, and the processor runs the program instructions to execute the above-mentioned image classification method based on a single positive image. The image classification method based on a single positive image includes: providing a single positive image set, an encoding neural network model, a decoding neural network model and a single-class support vector machine model, wherein the single positive image set includes multiple positive images; inputting the positive images in the single positive image set into the encoding neural network model to train the encoding neural network model, at which time the encoding neural network model extracts the features of the positive images, and the decoding neural network model decodes the restored images based on the features extracted by the encoding neural network model, and obtains the final encoding neural network model after training; inputting the features of each positive image extracted by the final encoding network model into the single-class support vector machine model for training to divide the range of positive images, and obtain the final single-class support vector machine model; inputting the image to be detected into the final encoding neural network model for feature extraction, and the final single-class support vector machine model performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image.
[0010] Compared with the prior art, the present invention uses a single positive image to train an encoding neural network. When the encoding neural network can extract appropriate features of the input positive image, the extracted features are used to train a single-class support vector machine model to divide the range of positive images. Finally, the trained encoding neural network and the single-class support vector machine model are used to jointly perform positive and negative classification on the image to be detected, and the final accuracy is also relatively high. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 A schematic diagram of a flow chart of an image classification method based on a single positive class image in one embodiment of the present invention;
[0012] Figure 2 A schematic diagram of an image classification device based on a single positive class image in one embodiment of the present invention; and
[0013] Figure 3 It is a schematic diagram of the structure of the encoding neural network model and the decoding neural network model in one embodiment of the present invention. DETAILED DESCRIPTION
[0014] In order to further explain the technical means and effects adopted by the present invention to achieve the predetermined invention purpose, the specific implementation methods, structures, features and effects of the present invention are described in detail below in conjunction with the accompanying drawings and preferred embodiments.
[0015] Figure 1 FIG. 1 is a flow chart of an image classification method 100 based on a single positive image in one embodiment of the present invention. Figure 1 As shown, the image classification method 100 based on a single positive image includes the following steps or operations.
[0016] Step 110, Combination Figure 2 As shown, a single positive class image set, an encoding neural network model 210, a decoding neural network model 220 and a single class support vector machine model 230 (OneClassSvm) are provided.
[0017] The single positive image set includes multiple positive images, and the meaning of "single positive image set" is that there are only positive images in this image set, and no negative images. "Single positive image" means a single positive image, and the image classification in the present invention only determines whether the image to be detected is a positive image.
[0018] Preferably, the positive images in the single positive image set have been size normalized.
[0019] Obviously, the single positive class image set, the encoding neural network model, the decoding neural network model and the single class support vector machine model can be provided in the same step or in different steps, depending on the need and choice.
[0020] Step 120, input the positive images in the single positive image set into the encoding neural network model 210 to train the encoding neural network model 210. At this time, the encoding neural network model 210 extracts the features of the positive images, and the decoding neural network model 220 decodes the restored images based on the features extracted by the encoding neural network model. After training, the final encoding neural network model is obtained.
[0021] Specifically, during the training process of the encoding neural network model 210, by comparing the positive image input into the encoding neural network model 210 and the restored image output by the decoding neural network model 220, the parameters and structure of the encoding neural network model 210 are adjusted to ensure that the encoding neural network model 210 can extract appropriate features, so that the decoding neural network model 220 can obtain a suitable restored image.
[0022] In one embodiment, the encoding neural network model is used to downsample the input positive image to extract high-dimensional features, and the decoding neural network model 220 is used to upsample the high-dimensional features to obtain the restored image. By comparing the positive image input to the encoding neural network model 210 and the restored image output by the decoding neural network model 220, it is determined whether the encoding neural network model 210 has extracted appropriate features. If the encoding neural network model 210 has not extracted appropriate features, the parameters and structure of the encoding neural network model 210 are adjusted to continue training until the encoding neural network model 210 can extract appropriate features.
[0023] Combination Figure 3 As shown, the encoding neural network model 210 includes one encoding unit or a plurality of encoding units connected in series. Figure 3 In the example, two encoding units 211 and 212 are given. In other embodiments, there may be only one encoding unit, or more encoding units. Each encoding unit includes a convolution layer, an activation layer, and a pooling layer connected in sequence, and the last encoding unit outputs the extracted features. Figure 3 The second encoding unit 212 outputs the extracted features. The decoding neural network model 220 includes a decoding unit or a plurality of decoding units connected in series. Figure 3In the example, two decoding units 221 and 222 are given. In other embodiments, there may be only one decoding unit, or more decoding units. Each decoding unit includes a deconvolution layer and an activation layer connected in sequence, and the last decoding unit outputs a restored image. Figure 3 , the second decoding unit 222 outputs a restored image.
[0024] Preferably, the encoding neural network model 210 can adopt a jump structure, in which case the input of each encoding unit is also channel-superimposed or numerically added with its own output and the output of the subsequent encoding unit. Specifically, the input of the first encoding unit 211 is channel-superimposed or numerically added with its own output and the output of the subsequent second encoding unit 212. Similarly, the decoding neural network model can also adopt a jump structure, in which case the input of each decoding unit is also channel-superimposed or numerically added with its own output and the output of the subsequent decoding unit. Specifically, the input of the first encoding unit 221 is channel-superimposed or numerically added with its own output and the output of the subsequent second decoding unit 222.
[0025] Step 130, combining Figure 2 As shown, the features of each positive class image extracted by the final encoding network model 210 are input into the single-class support vector machine model 230 for training to divide the range of positive class images, thereby obtaining the final single-class support vector machine model 230.
[0026] Specifically, the single-class support vector machine model 230 maps the extracted features, and during detection, it can be determined whether it is a positive image by whether the mapping of the extracted features is within the constructed feature mapping range.
[0027] Step 140, input the image to be detected into the final encoding neural network model 210 for feature extraction, and the final single-class support vector machine model 230 performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image.
[0028] In this way, the classification of the image to be detected can be achieved. Some images to be detected can also be called test images. If after testing multiple test images, it is found that the classification accuracy is not high, then it is necessary to re-optimize the parameters and structure of the single-class support vector machine model 230, and then re-train the single-class support vector machine model 230 to obtain the final single-class support vector machine model 230, and finally test it again. It can be seen that the present invention can train an image classifier with a high accuracy rate using a single positive class image, which solves the problem that the image classifier cannot be trained with only a single class of images in some application scenarios.
[0029] In an application example, a test set is finally input, features are extracted using the encoding neural network model 210, and the test image is detected using the single-class support vector machine model 230, with a final accuracy of about 70%.
[0030] According to another aspect of the present invention, the present invention can also be implemented as an image classification device 200 based on a single positive class image. Figure 2 FIG. 2 is a schematic diagram of the structure of an image classification device 200 in one embodiment of the present invention. The image classification device 200 includes an encoding neural network model 210, a decoding neural network model 220 and a single-class support vector machine model 230 (OneClassSvm).
[0031] The encoding neural network model 210 is configured to receive positive images in a single positive image set for training. At this time, the encoding neural network model extracts the features of the positive images, and the final encoding neural network model is obtained after training. The encoding neural network model 220 is configured to decode the restored image based on the features extracted by the encoding neural network model. The single-class support vector machine model 230 is configured to receive the features of each positive image extracted by the final encoding network model for training, and then divide the range of positive images to obtain the final single-class support vector machine model. The image to be detected is input into the final encoding neural network model 210 for feature extraction, and the final single-class support vector machine model 230 performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image.
[0032] Specifically, during the training process of the encoding neural network model 210, by comparing the positive image input into the encoding neural network model 210 and the restored image output by the decoding neural network model 220, the parameters and structure of the encoding neural network model 210 are adjusted to ensure that the encoding neural network model 210 can extract appropriate features, so that the decoding neural network model 220 can obtain a suitable restored image.
[0033] In one embodiment, in combination Figure 3 As shown, the encoding neural network model is used to downsample the input positive image to extract high-dimensional features, and the decoding neural network model 220 is used to upsample the high-dimensional features to obtain the restored image. By comparing the positive image input to the encoding neural network model 210 and the restored image output by the decoding neural network model 220, it is determined whether the encoding neural network model 210 has extracted appropriate features. If the encoding neural network model 210 has not extracted appropriate features, the parameters and structure of the encoding neural network model 210 are adjusted to continue training until the encoding neural network model 210 can extract appropriate features.
[0034] Combination Figure 3 As shown, the encoding neural network model 210 includes one encoding unit or a plurality of encoding units connected in series. Figure 3 In the example, two encoding units 211 and 212 are given. In other embodiments, there may be only one encoding unit, or more encoding units. Each encoding unit includes a convolution layer, an activation layer, and a pooling layer connected in sequence, and the last encoding unit outputs the extracted features. Figure 3 The second encoding unit 212 outputs the extracted features. The decoding neural network model 220 includes a decoding unit or a plurality of decoding units connected in series. Figure 3 In the example, two decoding units 221 and 222 are given. In other embodiments, there may be only one decoding unit, or more decoding units. Each decoding unit includes a deconvolution layer and an activation layer connected in sequence, and the last decoding unit outputs a restored image. Figure 3 , the second decoding unit 222 outputs a restored image.
[0035] Since the image classification device 200 is essentially technically consistent with the image classification method 100 , the repetitive parts will not be repeated here.
[0036] According to another aspect of the present invention, the present invention provides a storage medium storing program instructions, which are executed during the program execution to execute the above-mentioned image classification method. The image expansion method comprises: providing a single positive image set, an encoding neural network model, a decoding neural network model and a single-class support vector machine model, wherein the single positive image set comprises a plurality of positive images; inputting the positive images in the single positive image set into the encoding neural network model to train the encoding neural network model, at which time the encoding neural network model extracts the features of the positive images, and the decoding neural network model decodes the restored images based on the features extracted by the encoding neural network model, and obtains the final encoding neural network model after training; inputting the features of each positive image extracted by the final encoding network model into the single-class support vector machine model for training to divide the range of positive images, and obtains the final single-class support vector machine model; inputting the image to be detected into the final encoding neural network model for feature extraction, and the final single-class support vector machine model performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image. The remaining steps of the image classification method 100 are not repeated here.
[0037] According to another aspect of the present invention, the present invention provides a computer, which includes a processor and a memory, wherein the memory stores program instructions, and the processor runs the program instructions to execute the above-mentioned image classification method. The image expansion method includes: providing a single positive class image set, an encoding neural network model, a decoding neural network model and a single class support vector machine model, wherein the single positive class image set includes multiple positive class images; inputting the positive class images in the single positive class image set into the encoding neural network model to train the encoding neural network model, at this time, the encoding neural network model extracts the features of the positive class images, and the decoding neural network model decodes the restored images based on the features extracted by the encoding neural network model, and obtains the final encoding neural network model after training; inputting the features of each positive class image extracted by the final encoding network model into the single class support vector machine model for training to divide the positive class image range, and obtain the final single class support vector machine model; inputting the image to be detected into the final encoding neural network model for feature extraction, and the final single class support vector machine model performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive class image. The remaining steps of the image classification method 100 are not repeated here.
[0038] In the present invention, in order to facilitate understanding, the relevant schemes are sometimes introduced in the form of multiple steps. However, the order of the step numbers does not necessarily mean that there is a sequential order. It also depends on whether there is a sequential dependency between the two steps. If there is no sequential dependency between the two steps, then even if the step numbers are in sequence, it does not mean that there is a sequential relationship between the two steps.
[0039] In this document, the terms "comprises," "comprising," or any other variations thereof, are intended to cover a non-exclusive inclusion of elements other than those listed and may also include additional elements not expressly listed.
[0040] In this document, the directional words such as front, back, top, and bottom are defined by the positions of the components in the drawings and the positions of the components relative to each other, and are only for the sake of clarity and convenience in expressing the technical solution. It should be understood that the use of the directional words should not limit the scope of protection claimed in this application.
[0041] In the absence of conflict, the above embodiments and features in the embodiments may be combined with each other.
[0042] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An image classification method based on a single positive image, characterized in that: It includes: Providing a single positive image set, an encoding neural network model, a decoding neural network model, and a single-class support vector machine model, wherein the single positive image set includes a plurality of positive images; Inputting the positive image in the single positive image set into the encoding neural network model to train the encoding neural network model, wherein the encoding neural network model extracts features of the positive image, and the decoding neural network model decodes the restored image based on the features extracted by the encoding neural network model, and the final encoding neural network model is obtained after training; Inputting the features of each positive image extracted by the network model into the single-class support vector machine model for training to divide the range of positive images, thereby obtaining a final single-class support vector machine model; The image to be detected is input into the final encoding neural network model for feature extraction, and the final single-class support vector machine model performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image.
2. The image classification method based on a single positive image as claimed in claim 1, characterized in that: During the training process of the encoding neural network model, by comparing the positive image input to the encoding neural network model and the restored image output by the decoding neural network model, the parameters and structure of the encoding neural network model are adjusted to ensure that the encoding neural network model can extract appropriate features, so that the decoding neural network model can obtain a suitable restored image.
3. The image classification method based on a single positive image as claimed in claim 1, characterized in that: The encoding neural network model is used to downsample the input positive image to extract high-dimensional features, and the decoding neural network model is used to upsample the high-dimensional features to obtain the restored image. By comparing the positive image input to the encoding neural network model and the restored image output by the decoding neural network model, it is determined whether the encoding neural network model has extracted appropriate features. If the encoding neural network model has not extracted appropriate features, the parameters and structure of the encoding neural network model are adjusted to continue training until the encoding neural network model can extract appropriate features.
4. The image classification method based on a single positive image as claimed in claim 3, characterized in that: The encoding neural network model includes one encoding unit or multiple encoding units connected in series, each encoding unit includes a convolution layer, an activation layer and a pooling layer connected in sequence, and the last encoding unit outputs the extracted features. The decoding neural network model includes one decoding unit or multiple decoding units connected in series, each decoding unit includes a deconvolution layer and an activation layer connected in sequence, and the last decoding unit outputs a restored image. The encoding neural network model adopts a jumping structure, and the input of each encoding unit is also channel-superimposed or numerically added with its own output and the output of the subsequent encoding unit. The decoding neural network model adopts a jumping structure, and the input of each decoding unit is also channel-superimposed or numerically added with its own output and the output of the subsequent decoding unit.
5. The image classification method based on a single positive image as claimed in claim 1, characterized in that: The positive images in the single positive image set have been size-normalized.
6. An image classification device based on a single positive image, characterized in that: It includes: An encoding neural network model is configured to receive a positive image in a single positive image set for training, wherein the encoding neural network model extracts features of the positive image and obtains a final encoding neural network model after training; A decoding neural network model configured to decode a restored image based on the features extracted by the encoding neural network model; and The single-class support vector machine model is configured to receive the final encoded features of each positive class image extracted by the network model for training, and then divide the positive class image range to obtain the final single-class support vector machine model. The image to be detected is input into the final encoding neural network model for feature extraction, and the final single-class support vector machine model performs image classification based on the features extracted by the final encoding neural network model to determine whether the image to be detected is a positive image.
7. The image classification device based on a single positive image as claimed in claim 6, characterized in that: During the training process of the encoding neural network model, by comparing the positive image input to the encoding neural network model and the restored image output by the decoding neural network model, the parameters and structure of the encoding neural network model are adjusted to ensure that the encoding neural network model can extract appropriate features, so that the decoding neural network model can obtain a suitable restored image.
8. The image classification device based on a single positive image as claimed in claim 6, characterized in that: The encoding neural network model is used to downsample the input positive image to extract high-dimensional features, and the decoding neural network model is used to upsample the high-dimensional features to obtain the restored image. By comparing the positive image input to the encoding neural network model and the restored image output by the decoding neural network model, it is determined whether the encoding neural network model has extracted appropriate features. If the encoding neural network model has not extracted appropriate features, the parameters and structure of the encoding neural network model are adjusted to continue training until the encoding neural network model can extract appropriate features.
9. The image classification device based on a single positive image as claimed in claim 8, characterized in that: The encoding neural network model includes one encoding unit or multiple encoding units connected in series, each encoding unit includes a convolution layer, an activation layer and a pooling layer connected in sequence, and the last encoding unit outputs the extracted features. The decoding neural network model includes one decoding unit or multiple decoding units connected in series, each decoding unit includes a deconvolution layer and an activation layer connected in sequence, and the last decoding unit outputs a restored image. The encoding neural network model adopts a jumping structure, and the input of each encoding unit is also channel-superimposed or numerically added with its own output and the output of the subsequent encoding unit. The decoding neural network model adopts a jumping structure, and the input of each decoding unit is also channel-superimposed or numerically added with its own output and the output of the subsequent decoding unit.
10. A storage medium, characterized in that: It stores program instructions, and when the program is executed, it is run to execute the image expansion method based on a single positive image as described in any one of claims 1-5.
11. A computer, characterized in that: It comprises a processor and a memory, wherein the memory stores program instructions, and the processor runs the program instructions to execute the image expansion method based on a single positive image as claimed in any one of claims 1 to 5.
Citation Information
Patent Citations
Single classifier-based electric image environment influence recognition method
CN108764298A
An image classification network training method based on massive single-class and single-amplitude images
CN109325513A