Image data set division method and device, electronic equipment and storage medium
By using convolutional neural networks in the image dataset to extract features and perform clustering and data augmentation, the problem of uneven sample distribution is solved and the model performance is improved.
Patent Information
- Application Number
- CN202411141903.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-20
- Publication Date
- 2024-12-27
AI Technical Summary
The existing technology cannot effectively solve the problem of uneven sample distribution in the image dataset, resulting in insufficient training of deep learning models and biased prediction results towards categories with large samples, affecting model performance.
通过获取图像数据集,利用预先训练的卷积神经网络模型提取特征并进行聚类,基于聚类结果进行数据增强,确保每个样本簇的样本数量相等,并将其划分为训练和验证集, Ensure that the category is distributed evenly.
It effectively solves the problem of uneven image samples distribution, and improves the performance and prediction accuracy of deep learning models.
Smart Images

Figure CN119206390A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to, but is not limited to, the field of image processing technology, and in particular to a method, device, electronic device, and storage medium for dividing an image data set. Background Art
[0002] In deep learning, sample imbalance refers to the situation where there is a difference in the number of samples of different categories in the data set, and the number of samples of some categories is significantly larger than that of other categories. The data set can be a sample image data set. When the samples are imbalanced, it will lead to insufficient model training, the model prediction results will be biased towards the category with more samples, and the model evaluation will be distorted. Therefore, it is necessary to divide the data set equally. Existing data set division methods usually use random division and perform unified data enhancement on all data. Although this method achieves equal division of the data set, it still cannot solve the sample imbalance problem of the data set itself, thus affecting the performance of the deep learning model. Summary of the invention
[0003] The embodiments of the present application provide a method, device, electronic device, and storage medium for dividing an image data set, which can effectively solve the problem of uneven distribution of image samples, thereby improving the performance of a model that applies the image samples.
[0004] In a first aspect, an embodiment of the present application provides a method for dividing an image data set, comprising:
[0005] Acquire an image dataset, the image dataset comprising a plurality of sample images and a first image label corresponding to each of the sample images, wherein the first image label indicates a real image category of the sample image;
[0006] Inputting the plurality of sample images into a pre-trained target convolutional neural network model for feature extraction to obtain a plurality of target feature images, and performing clustering processing on all the target feature images to obtain a plurality of first sample clusters, wherein different first sample clusters correspond to different image categories;
[0007] Performing data enhancement on all the first sample clusters based on a preset reference sample quantity and the first image label to obtain a plurality of second sample clusters, wherein the number of samples in each of the second sample clusters is equal;
[0008] The second sample cluster is divided into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster divided into the training image set and the verification image set is the preset ratio value.
[0009] In some embodiments, the target convolutional neural network model includes a convolutional layer, a pooling layer, and a batch normalization layer connected in sequence, and the plurality of sample images are input into a pre-trained convolutional neural network model for feature extraction to obtain a plurality of target feature images, and all the target feature images are clustered to obtain a plurality of first sample clusters, including:
[0010] Inputting the plurality of sample images into the convolution layer for convolution processing to obtain a plurality of second feature images;
[0011] Inputting all the second feature images into the pooling layer for downsampling processing to obtain a plurality of third feature images;
[0012] Inputting all the third feature images into the batch normalization layer to perform feature image normalization processing to obtain a plurality of target feature images;
[0013] Clustering is performed on all of the target feature images to obtain a plurality of the first sample clusters.
[0014] In some embodiments, performing data enhancement on all the first sample clusters based on a preset reference sample quantity and the first image label to obtain a plurality of second sample clusters includes:
[0015] Determine the number of samples of each of the first sample clusters, and determine the absolute value of the difference between the reference sample number and the sample number as the target enhanced sample number, wherein the reference sample number is greater than the sample number;
[0016] Data enhancement is performed on each of the first sample clusters based on each of the target enhanced sample numbers and each of the first image labels to obtain each of the second sample clusters, wherein the sample number of each of the second sample clusters is the reference sample number.
[0017] In a second aspect, an embodiment of the present application provides an image data set partitioning device, including:
[0018] An image acquisition module, configured to acquire an image data set, wherein the image data set includes a plurality of sample images and a first image label corresponding to each of the sample images, wherein the first image label indicates a real image category of the sample image;
[0019] An image classification module, used for inputting the plurality of sample images into a pre-trained target convolutional neural network model for feature extraction to obtain a plurality of target feature images, and performing clustering processing on all the target feature images to obtain a plurality of first sample clusters, wherein different first sample clusters correspond to different image categories;
[0020] An image data enhancement module, configured to perform data enhancement on all the first sample clusters based on a preset reference sample quantity and the first image label to obtain a plurality of second sample clusters, wherein the sample quantities of each of the second sample clusters are equal;
[0021] An image data division module is used to divide the second sample cluster into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster divided into the training image set and the verification image set is the preset ratio value.
[0022] In some embodiments, the target convolutional neural network model includes a convolutional layer, a pooling layer, and a batch normalization layer connected in sequence, and the image classification module includes:
[0023] A first image feature extraction module, used for inputting the plurality of sample images into the convolution layer for convolution processing to obtain a plurality of second feature images;
[0024] An image downsampling module, used for inputting all the second feature images into the pooling layer for downsampling processing to obtain a plurality of third feature images;
[0025] An image batch normalization processing module, used for inputting all the third feature images into the batch normalization layer to perform feature image normalization processing to obtain a plurality of target feature images;
[0026] The image clustering module is used to perform clustering processing on all the target feature images to obtain a plurality of the first sample clusters.
[0027] In some embodiments, the image data enhancement module includes:
[0028] a target enhanced sample number determination module, configured to determine the sample number of each of the first sample clusters, and determine the absolute value of the difference between the reference sample number and the sample number as the target enhanced sample number, wherein the reference sample number is greater than the sample number;
[0029] A data enhancement module is used to perform data enhancement on each of the first sample clusters based on the number of target enhanced samples and each of the first image labels to obtain each of the second sample clusters, wherein the number of samples in each of the second sample clusters is the reference sample number.
[0030] In a second aspect, an embodiment of the present application provides an electronic device comprising at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions executable by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to execute the image data set division method as described in the first aspect.
[0031] In a third aspect, an embodiment of the present application further provides a computer-readable storage medium storing computer-executable instructions, wherein the computer-executable instructions are used to execute the image data set division method as described in the first aspect.
[0032] The embodiments of the present application provide a method, device, electronic device, and storage medium for dividing an image data set, the method comprising: obtaining an image data set, the image data set comprising multiple sample images and a first image label corresponding to each of the sample images, wherein the first image label indicates the real image category of the sample image; inputting the multiple sample images into a pre-trained target convolutional neural network model for feature extraction to obtain multiple target feature images, and clustering all of the target feature images to obtain multiple first sample clusters, wherein different first sample clusters correspond to different image categories; performing data enhancement on all of the first sample clusters based on a preset reference sample number and the first image label to obtain multiple second sample clusters, wherein the number of samples in each of the second sample clusters is equal; dividing the second sample clusters into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster that are divided into the training image set and the verification image set is the preset ratio value. This application proposes a data set partitioning method that clusters image features extracted by a convolutional neural network model and performs targeted data enhancement based on the clustering results. Compared with the existing random partitioning scheme, it can effectively solve the problem of uneven distribution of image samples, thereby improving the performance of the model that applies the image samples. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 is a flowchart of the steps of a method for dividing an image data set provided by an embodiment of the present application;
[0034] Figure 2 is a flowchart of steps for obtaining a first sample cluster provided by another embodiment of the present application;
[0035] Figure 3 is a flowchart of steps for performing data enhancement on a first sample cluster provided by another embodiment of the present application;
[0036] Figure 4 is a module schematic diagram of an image data set division device provided by another embodiment of the present application;
[0037] Figure 5 It is a structural diagram of an electronic device provided in another embodiment of the present application. DETAILED DESCRIPTION
[0038] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0039] It is understood that although the functional modules are divided in the device schematic diagram and the logical order is shown in the flow chart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flow chart. The terms "first", "second", etc. in the specification, claims or the above drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0040] In deep learning, sample imbalance refers to the situation where there is a difference in the number of samples of different categories in the data set, and the number of samples of some categories is significantly larger than that of other categories. The data set can be a sample image data set. When the samples are imbalanced, it will lead to insufficient model training, the model prediction results will be biased towards the category with more samples, and the model evaluation will be distorted. Therefore, it is necessary to divide the data set equally. Existing data set division methods usually use random division and perform unified data enhancement on all data. Although this method achieves equal division of the data set, it still cannot solve the sample imbalance problem of the data set itself, thus affecting the performance of the deep learning model.
[0041] To solve the above-mentioned problems, an embodiment of the present application provides a method, device, electronic device, and storage medium for dividing an image data set, the method comprising: obtaining an image data set, the image data set comprising multiple sample images and a first image label corresponding to each of the sample images, wherein the first image label indicates the real image category of the sample image; inputting the multiple sample images into a pre-trained target convolutional neural network model for feature extraction to obtain multiple target feature images, and clustering all of the target feature images to obtain multiple first sample clusters, wherein different first sample clusters correspond to different image categories; performing data enhancement on all of the first sample clusters based on a preset reference sample number and the first image label to obtain multiple second sample clusters, wherein the number of samples in each of the second sample clusters is equal; dividing the second sample cluster into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster divided into the training image set and the verification image set is the preset ratio value. This application proposes a data set partitioning method that clusters image features extracted by a convolutional neural network model and performs targeted data enhancement based on the clustering results. Compared with the existing random partitioning scheme, it can effectively solve the problem of uneven distribution of image samples, thereby improving the performance of the model that applies the image samples.
[0042] The embodiments of the present application are further described below in conjunction with the accompanying drawings.
[0043] refer to Figure 1 , Figure 1 : is a flowchart of a method for dividing an image data set provided by an embodiment of the present application. The present application embodiment provides a method for dividing an image data set, which includes but is not limited to the following steps:
[0044] Step S110, acquiring an image data set, where the image data set includes a plurality of sample images and a first image label corresponding to each sample image, wherein the first image label indicates a real image category of the sample image;
[0045] Step S120, inputting the plurality of sample images into a pre-trained target convolutional neural network model for feature extraction to obtain a plurality of target feature images, and performing clustering processing on all the target feature images to obtain a plurality of first sample clusters, wherein different first sample clusters correspond to different image categories;
[0046] Step S130, performing data enhancement on all first sample clusters based on a preset reference sample quantity and the first image label to obtain a plurality of second sample clusters, wherein the number of samples in each second sample cluster is equal;
[0047] Step S140, dividing the second sample cluster into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster divided into the training image set and the verification image set is a preset ratio value.
[0048] It can be understood that after obtaining a plurality of sample images and a first image label corresponding to each sample image, the embodiment of the present application inputs the image samples into a pre-trained target convolutional neural network model for feature extraction to obtain a plurality of target feature images. The target feature image is high-level semantic information extracted from each sample image, that is, more abstract and in-depth information in the sample image, which can better reflect the differences between different sample images. The clustering result obtained by performing image clustering processing using the target feature image, that is, the higher the credibility of the first sample cluster, that is, using the image features extracted from the sample image as the input of the image clustering operation can effectively ensure the accuracy of the clustering result while providing an effective data basis for the subsequent image data set division, thereby more effectively avoiding problems such as insufficient model training and bias caused by sample imbalance.
[0049] It should be noted that the purpose of the present application is to solve the problem of uneven distribution of sample types in an image data set. Therefore, if the number of sample images corresponding to different image types in the image data set is equal, it is considered that a balanced distribution of sample types has been achieved. The present application embodiment does not limit the specific number of sample images corresponding to different image types in the image data set, that is, it does not limit the specific number of reference samples, which can be determined by those skilled in the art according to actual needs. Before performing the image division operation of the image data set, data enhancement is performed on all first sample clusters based on the number of reference samples and the first image label to obtain multiple second sample clusters with an equal number of samples, that is, a set of sample images with balanced distribution of various types of samples is obtained, thereby ensuring that the image type distribution in the training set and the verification set obtained by subsequent image division is consistent.
[0050] It should be noted that the first image label is used to indicate the real image category of the sample image. In the process of data enhancement for the first sample cluster, the first image label is an important basis for evaluating the data enhancement effect. By comparing the candidate image label corresponding to the enhanced sample image in the generated second sample cluster with the first image label corresponding to the original sample image in the second sample cluster, when the candidate image label is the same as the first image label, it means that the sample image after data enhancement effectively retains the key information of the image, that is, the usability of the second sample cluster after data enhancement is higher, and the second sample cluster can be further divided into images.
[0051] It should be noted that this embodiment does not limit the specific method of data enhancement, and it may be a data enhancement method such as flipping, cropping, scaling, superimposing noise, changing image properties (brightness, saturation, contrast, hue, sharpness), affine transformation, multi-image fusion, etc. on the first sample cluster whose sample image number is smaller than the reference sample number, so that the number of sample images of each second sample cluster obtained after data enhancement is equal to the reference sample number.
[0052] It should be noted that the present embodiment does not limit the specific clustering processing method, and may use a K-means clustering algorithm, a hierarchical clustering algorithm, or a density clustering algorithm, etc. Furthermore, when the K-means clustering algorithm is used to cluster the target feature image, the K parameter of the K-means clustering algorithm is dynamically adjusted based on the accuracy of the evaluation result obtained by inputting the verification image set into the image processing model.
[0053] It can be understood that the embodiment of the present application obtains an image data set, wherein the image data set includes multiple sample images and first image labels corresponding to each of the sample images, wherein the first image label indicates the real image category of the sample image; the multiple sample images are input into a pre-trained target convolutional neural network model for feature extraction to obtain multiple target feature images, and all of the target feature images are clustered to obtain multiple first sample clusters, wherein different first sample clusters correspond to different image categories; data enhancement is performed on all of the first sample clusters based on a preset reference sample number and the first image label to obtain multiple second sample clusters, wherein the number of samples in each of the second sample clusters is equal; the second sample clusters are divided into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster divided into the training image set and the verification image set is the preset ratio value. This application proposes a data set partitioning method that clusters image features extracted by a convolutional neural network model and performs targeted data enhancement based on the clustering results. Compared with the existing random partitioning scheme, it can effectively solve the problem of uneven distribution of image samples, thereby improving the performance of the model that applies the image samples.
[0054] In addition, in some embodiments, the target convolutional neural network model includes a convolutional layer, a pooling layer, and a batch normalization layer, referring to Figure 2 , Figure 1 Step S120 includes but is not limited to the following steps:
[0055] Step S210, inputting a plurality of sample images into a convolution layer for convolution processing to obtain a plurality of second feature images;
[0056] Step S220, inputting all the second feature images into the pooling layer for downsampling processing to obtain a plurality of third feature images;
[0057] Step S230, inputting all third feature images into a batch normalization layer for feature image normalization processing to obtain a plurality of target feature images;
[0058] Step S240: performing clustering processing on all target feature images to obtain a plurality of first sample clusters.
[0059] It can be understood that the convolution layer, pooling layer and batch normalization layer of the target convolutional neural network model of the embodiment of the present application, based on this model structure, input multiple sample images into the convolution layer for convolution processing to obtain multiple second feature images, input all the second feature images into the pooling layer for downsampling processing to obtain multiple third feature images, input all the third feature images into the batch normalization layer for feature image normalization processing to obtain multiple target feature images, cluster all the target feature images to obtain multiple first sample clusters, thereby providing an effective data basis for subsequent clustering processing.
[0060] It should be noted that the target convolutional neural network model of this embodiment can be a lightweight pre-trained network model without a classification layer, such as a VGG16 model or a ResNet18 model.
[0061] In addition, in some embodiments, the training method of the target convolutional neural network model in the embodiments of the present application includes but is not limited to the following steps:
[0062] Inputting a plurality of sample images into an initial convolutional neural network model for feature extraction to obtain a plurality of fourth feature images, wherein each fourth feature image carries a second image label, and the initial convolutional neural network model includes an output layer and an input layer;
[0063] Calculate a first loss value based on a preset loss function, all first image labels, and all second image labels;
[0064] When the first loss value is greater than a preset loss threshold, a back propagation algorithm is used to propagate the loss value from the output layer to the input layer to update the model parameters of the initial convolutional neural network model to obtain an intermediate convolutional neural network model;
[0065] Inputting the plurality of sample images into the intermediate convolutional neural network model for feature extraction to obtain a plurality of fifth feature images, wherein each fifth feature image carries a third image label;
[0066] A second loss value is calculated based on a preset loss function, all first image labels, and all third image labels. When the second loss value is less than or equal to a preset loss threshold, the intermediate convolutional neural network model is determined as the target convolutional neural network model.
[0067] It can be understood that since the first image label of the embodiment of the present application is the expected output value of the convolutional neural network model after the sample image is input into the convolutional neural network model, the first image label can guide the update of the model parameters when training the model, so that the network model can correctly learn the mapping from input to output. The first image label is used as the judgment criterion for the accuracy of the model output. Based on the preset loss function, the first image label and the second image label carried by the fourth feature image are used to calculate the model loss value, that is, the first loss value. When the first loss value is greater than the preset loss threshold, it means that the current error of the initial convolutional neural network model is large. The loss value is propagated from the output layer to the input layer using the back propagation algorithm to update the model parameters of the initial convolutional neural network model to obtain an intermediate convolutional neural network model. The new model loss value is recalculated until the model loss value is less than or equal to the preset loss threshold, and a target convolutional neural network model with higher model accuracy is obtained, thereby providing an effective data basis for the verification image set and training image set with uniform sample distribution obtained by subsequent clustering and image data set partitioning operations.
[0068] In addition, refer to Figure 3 , in some embodiments, Figure 1 Step S130 includes but is not limited to the following steps:
[0069] Step S310, determining the number of samples of each first sample cluster, and determining the absolute value of the difference between the reference sample number and the sample number as the target enhanced sample number, wherein the reference sample number is greater than the sample number;
[0070] Step S320 , performing data enhancement on each first sample cluster based on each target enhancement sample quantity and each first image label to obtain each second sample cluster, wherein the sample quantity of each second sample cluster is the reference sample quantity.
[0071] It is understandable that the number of samples of each second sample cluster obtained by clustering may not be all equal, and the embodiment of the present application needs to ensure that the number of sample images of each second sample cluster is the same in order to achieve balanced sample distribution. Based on this, the number of samples of each first sample cluster is determined, and the absolute value of the difference between the reference sample number and the sample number is determined as the target enhanced sample number, wherein the reference sample number is greater than the sample number, and data enhancement is performed on each first sample cluster based on each target enhanced sample number and each first image label, so that it is possible to perform more data enhancement on the images in the second sample cluster with a smaller number of sample images, generate more new images, and thus supplement the number of samples of the minority class, so that the number of samples of each class is basically the same, solve the problem of uneven sample distribution, and obtain a second sample cluster that meets the requirements.
[0072] In addition, refer to Figure 4 , Figure 4 is a schematic diagram of a module of an image data set partitioning device provided by an embodiment of the present application. The present invention also provides an image data set partitioning device 500, comprising:
[0073] An image acquisition module 510 is used to acquire an image data set, where the image data set includes a plurality of sample images and a first image label corresponding to each sample image, wherein the first image label indicates a real image category of the sample image;
[0074] An image classification module 520 is used to input a plurality of sample images into a pre-trained target convolutional neural network model for feature extraction to obtain a plurality of target feature images, and to perform clustering processing on all target feature images to obtain a plurality of first sample clusters, wherein different first sample clusters correspond to different image categories;
[0075] An image data enhancement module 530 is used to perform data enhancement on all first sample clusters based on a preset reference sample quantity and a first image label to obtain a plurality of second sample clusters, wherein the sample quantity of each second sample cluster is equal;
[0076] The image data division module 540 is used to divide the second sample cluster into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster divided into the training image set and the verification image set is a preset ratio value.
[0077] In some embodiments, the target convolutional neural network model includes a convolution layer, a pooling layer, and a batch normalization layer, and the image classification module 520 includes:
[0078] A first image feature extraction module 521 is used to input a plurality of sample images into a convolution layer for convolution processing to obtain a plurality of second feature images;
[0079] An image downsampling module 522 is used to input all the second feature images into the pooling layer for downsampling processing to obtain multiple third feature images;
[0080] An image batch normalization processing module 523 is used to input all third feature images into a batch normalization layer to perform feature image normalization processing to obtain multiple target feature images;
[0081] The image clustering module 524 is used to perform clustering processing on all target feature images to obtain multiple first sample clusters.
[0082] In some embodiments, the image data enhancement module 530 includes:
[0083] A target enhanced sample number determination module 531 is used to determine the sample number of each first sample cluster, and determine the absolute value of the difference between the reference sample number and the sample number as the target enhanced sample number, wherein the reference sample number is greater than the sample number;
[0084] The data enhancement module 532 is used to perform data enhancement on each first sample cluster based on each target enhanced sample quantity to obtain each second sample cluster, wherein the sample quantity of each second sample cluster is the reference sample quantity.
[0085] It should be noted that the specific implementation of the image data set division device is substantially the same as the specific embodiment of the image data set division device described above, and will not be described in detail herein.
[0086] like Figure 5 As shown, Figure 5 600 is a structural diagram of an electronic device provided by an embodiment of the present application. The present invention also provides an electronic device 600, including:
[0087] The processor 610 may be implemented by a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present application;
[0088] The memory 620 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 620 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 620, and the processor 610 calls and executes the image data set division method of the embodiment of the present application, for example, executing the above-described Figure 1 Steps S110 to S140 of the method, Figure 2 Steps S210 to S240 of the method and Figure 3 Steps S310 to S320 of the method;
[0089] Input / output interface 630, used to implement information input and output;
[0090] Communication interface 640, used to realize communication interaction between the present apparatus and other devices, which can be realized by wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.);
[0091] Bus 660 , which transmits information between various components of the device (e.g., processor 610 , memory 620 , input / output interface 630 , and communication interface 640 );
[0092] The processor 610 , the memory 620 , the input / output interface 630 and the communication interface 640 are connected to each other in communication within the device via the bus 660 .
[0093] The present application also provides a storage medium, which is a computer-readable storage medium. The storage medium stores a computer program. When the computer program is executed by a processor, the above-mentioned image data set division method is implemented. For example, the above-mentioned Figure 1 Steps S110 to S140 of the method, Figure 2 Steps S210 to S240 of the method, Figure 3 Method steps S310 to S320.
[0094] As a non-transient computer-readable storage medium, the memory can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage devices. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The device embodiments described above are merely schematic, wherein the units described as separate components may or may not be physically separated, and are implemented to be located in one place, or may also be distributed to multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0095] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically include computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0096] The above is a specific description of the preferred implementation of the present invention, but the present invention is not limited to the above-mentioned implementation mode. Technical personnel familiar with the field can also make various equivalent deformations or substitutions under the shared conditions without violating the spirit of the present invention. These equivalent deformations or substitutions are all included in the scope defined by the claims of the present invention.
Claims
1. A method for dividing an image data set, characterized in that: include: Acquire an image dataset, the image dataset comprising a plurality of sample images and a first image label corresponding to each of the sample images, wherein the first image label indicates a real image category of the sample image; Inputting the plurality of sample images into a pre-trained target convolutional neural network model for feature extraction to obtain a plurality of target feature images, and performing clustering processing on all the target feature images to obtain a plurality of first sample clusters, wherein different first sample clusters correspond to different image categories; Performing data enhancement on all the first sample clusters based on a preset reference sample quantity and the first image label to obtain a plurality of second sample clusters, wherein the number of samples in each of the second sample clusters is equal; The second sample cluster is divided into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster divided into the training image set and the verification image set is the preset ratio value.
2. The image data set partitioning method according to claim 1, characterized in that: The target convolutional neural network model includes a convolutional layer, a pooling layer and a batch normalization layer. The plurality of sample images are input into a pre-trained convolutional neural network model for feature extraction to obtain a plurality of target feature images, and all the target feature images are clustered to obtain a plurality of first sample clusters, including: Inputting the plurality of sample images into the convolution layer for convolution processing to obtain a plurality of second feature images; Inputting all the second feature images into the pooling layer for downsampling processing to obtain a plurality of third feature images; Inputting all the third feature images into the batch normalization layer to perform feature image normalization processing to obtain a plurality of target feature images; Clustering is performed on all of the target feature images to obtain a plurality of the first sample clusters.
3. The image data set partitioning method according to claim 1, characterized in that: The step of performing data enhancement on all the first sample clusters based on the preset reference sample quantity and the first image label to obtain a plurality of second sample clusters includes: Determine the number of samples of each of the first sample clusters, and determine the absolute value of the difference between the reference sample number and the sample number as the target enhanced sample number, wherein the reference sample number is greater than the sample number; Data enhancement is performed on each of the first sample clusters based on each of the target enhanced sample numbers and each of the first image labels to obtain each of the second sample clusters, wherein the sample number of each of the second sample clusters is the reference sample number.
4. An image data set partitioning device, characterized in that: include: An image acquisition module, configured to acquire an image data set, wherein the image data set includes a plurality of sample images and a first image label corresponding to each of the sample images, wherein the first image label indicates a real image category of the sample image; An image classification module, used for inputting the plurality of sample images into a pre-trained target convolutional neural network model for feature extraction to obtain a plurality of target feature images, and performing clustering processing on all the target feature images to obtain a plurality of first sample clusters, wherein different first sample clusters correspond to different image categories; An image data enhancement module, configured to perform data enhancement on all the first sample clusters based on a preset reference sample quantity and the first image label to obtain a plurality of second sample clusters, wherein the sample quantities of each of the second sample clusters are equal; An image data division module is used to divide the second sample cluster into a training image set and a verification image set, wherein the ratio of the number of images between the training image set and the verification image set is a preset ratio value, and the ratio of the number of images of the same image category in the second sample cluster divided into the training image set and the verification image set is the preset ratio value.
5. The image data set division device according to claim 4, characterized in that: The target convolutional neural network model includes a convolutional layer, a pooling layer and a batch normalization layer connected in sequence, and the image classification module includes: A first image feature extraction module, used for inputting the plurality of sample images into the convolution layer for convolution processing to obtain a plurality of second feature images; An image downsampling module, used for inputting all the second feature images into the pooling layer for downsampling processing to obtain a plurality of third feature images; An image batch normalization processing module, used for inputting all the third feature images into the batch normalization layer to perform feature image normalization processing to obtain a plurality of target feature images; The image clustering module is used to perform clustering processing on all the target feature images to obtain a plurality of the first sample clusters.
6. The image data set division device according to claim 4, characterized in that: The image data enhancement module comprises: a target enhanced sample number determination module, configured to determine the sample number of each of the first sample clusters, and determine the absolute value of the difference between the reference sample number and the sample number as the target enhanced sample number, wherein the reference sample number is greater than the sample number; A data enhancement module is used to perform data enhancement on each of the first sample clusters based on the number of target enhanced samples and each of the first image labels to obtain each of the second sample clusters, wherein the number of samples in each of the second sample clusters is the reference sample number.
7. An electronic device, characterized in that: It includes at least one control processor and a memory for communicating with the at least one control processor; the memory stores instructions that can be executed by the at least one control processor, and the instructions are executed by the at least one control processor to enable the at least one control processor to execute the image data set division method as described in any one of claims 1 to 3.
8. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the image data set division method according to any one of claims 1 to 3.
