Image classification method, device, readable medium and electronic device
By screening high-entropy image samples to train the image classification model, the problem of low model training efficiency in the existing technology is solved, and the accuracy and training efficiency of the image classification model are improved.
Patent Information
- Application Number
- CN202110565484.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-05-24
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2041-05-24
AI Technical Summary
When training image classification models, the model training efficiency in the prior art is low, and a large number of labeled sample images are required for end-to-end training, resulting in inefficiency.
The preset image classification model obtains the entropy of multiple image samples, filters out the target image samples with higher entropy, trains the preset image classification model, and gradually improves the accuracy and training efficiency of the model.
The training efficiency and accuracy of the image classification model are improved. By filtering the optimal image samples for model training until the preset iteration is met, the classification performance of the model is improved.
Smart Images

Figure CN113240027B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of image processing technology, and in particular, to an image classification method, device, readable medium and electronic device. Background Art
[0002] With the rapid development of computer technology, the application scope of image processing technology is becoming more and more extensive. For example, deep learning models can be used to achieve image classification, pedestrian detection, medical diagnosis and other problems. In related technologies, images can be classified by image classification models, such as distinguishing the types of animals.
[0003] However, when training image classification models, in order to improve the accuracy of the model, a deep convolutional network is usually used to perform end-to-end training on a large number of labeled sample images, which results in low efficiency in model training. Summary of the invention
[0004] This summary is provided to introduce concepts in a brief form that will be described in detail in the detailed description below. This summary is not intended to identify key features or essential features of the claimed technical solution, nor is it intended to limit the scope of the claimed technical solution.
[0005] In a first aspect, the present disclosure provides an image classification method, the method comprising:
[0006] Obtain a target image to be classified;
[0007] Inputting the target image into a pre-trained target image classification model to obtain the type of the target image;
[0008] The target image classification model is trained in the following manner: obtaining the entropy corresponding to each of a plurality of image samples through a preset image classification model; determining a target image sample from the plurality of image samples according to the entropy; and training the preset image classification model through the target image sample to obtain the target image classification model.
[0009] In a second aspect, the present disclosure provides an image classification device, the device comprising:
[0010] An image acquisition module, used to acquire a target image to be classified;
[0011] A type acquisition module, used for inputting the target image into a pre-trained target image classification model to obtain the type of the target image;
[0012] The target image classification model is trained in the following manner: obtaining the entropy corresponding to each of a plurality of image samples through a preset image classification model; determining a target image sample from the plurality of image samples according to the entropy; and training the preset image classification model through the target image sample to obtain the target image classification model.
[0013] In a third aspect, the present disclosure provides a computer-readable medium having a computer program stored thereon, which, when executed by a processing device, implements the steps of the method described in the first aspect of the present disclosure.
[0014] In a fourth aspect, the present disclosure provides an electronic device, including:
[0015] a storage device having a computer program stored thereon;
[0016] A processing device is used to execute the computer program in the storage device to implement the steps of the method described in the first aspect of the present disclosure.
[0017] Through the above technical solution, the present disclosure first obtains a target image to be classified, and then inputs the target image into a pre-trained target image classification model to obtain the type of the target image, wherein the entropy corresponding to each image sample in multiple image samples can be obtained through the preset image classification model, and then the target image sample is determined from the multiple image samples according to the entropy, and finally the preset image classification model is trained through the target image sample to obtain the target image classification model. The target image sample used for training the target image classification model of the present disclosure is screened from multiple image samples according to the entropy of the image sample, and the target image sample is the image sample with the best model training effect, thereby improving the efficiency of model training.
[0018] Other features and advantages of the present disclosure will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The above and other features, advantages and aspects of the embodiments of the present disclosure will become more apparent with reference to the following detailed description in conjunction with the accompanying drawings. Throughout the drawings, the same or similar reference numerals represent the same or similar elements. It should be understood that the drawings are schematic and the originals and elements are not necessarily drawn to scale. In the drawings:
[0020] Figure 1 is a flow chart of an image classification method according to an exemplary embodiment;
[0021] Figure 2 is a flowchart of a method for training a target image classification model according to an exemplary embodiment;
[0022] Figure 3is a flowchart of a method for training a preset image classification model according to an exemplary embodiment;
[0023] Figure 4 is a flowchart showing a model training step according to an exemplary embodiment;
[0024] Figure 5 is a schematic structural diagram of an image classification device according to an exemplary embodiment;
[0025] Figure 6 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0026] Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although certain embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms and should not be construed as being limited to the embodiments described herein, which are instead provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are only for exemplary purposes and are not intended to limit the scope of protection of the present disclosure.
[0027] It should be understood that the various steps described in the method embodiments of the present disclosure may be performed in different orders and / or in parallel. In addition, the method embodiments may include additional steps and / or omit the steps shown. The scope of the present disclosure is not limited in this respect.
[0028] The term "including" and its variations used herein are open inclusions, i.e., "including but not limited to". The term "based on" means "based at least in part on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". The relevant definitions of other terms will be given in the following description.
[0029] It should be noted that the concepts such as "first" and "second" mentioned in the present disclosure are only used to distinguish different devices, modules or units, and are not used to limit the order or interdependence of the functions performed by these devices, modules or units.
[0030] It should be noted that the modifications of "one" and "plurality" mentioned in the present disclosure are illustrative rather than restrictive, and those skilled in the art should understand that unless otherwise clearly indicated in the context, it should be understood as "one or more".
[0031] The names of the messages or information exchanged between multiple devices in the embodiments of the present disclosure are only used for illustrative purposes and are not used to limit the scope of these messages or information.
[0032] Figure 1 is a flowchart of an image classification method according to an exemplary embodiment. Figure 1 As shown, the method may include:
[0033] S101, obtaining a target image to be classified.
[0034] The target image may be a video or a picture, and the present disclosure does not limit the type of the target image.
[0035] In this step, the target image may be acquired in real time, or may be acquired from a pre-stored image, or may be received from another device. The present disclosure does not limit the method for acquiring the target image.
[0036] S102: Input the target image into a pre-trained target image classification model to obtain the type of the target image.
[0037] In this step, after the target image is obtained, the target image can be input into the target image classification model, and the type of the target image can be determined by the target image classification model. For example, it can be determined which animal the target image is.
[0038] It should be noted that the type of the target image may include the classification corresponding to the target image and the prediction probability corresponding to each classification. The type of the target image is determined according to the prediction probability corresponding to each classification, and the classification with the highest prediction probability is used as the type of the target image. For example, the type of the target image may be that the target image is classified as "cat" with a prediction probability of "0.01", the target image is classified as "dog" with a prediction probability of "0.9", the target image is classified as "polar bear" with a prediction probability of "0.03", the target image is classified as "kangaroo" with a prediction probability of "0.05", and the target image is classified as "other" with a prediction probability of "0.01". Among them, the prediction probability of being classified as "dog" is the highest, so it can be determined that the type of the target image is "dog".
[0039] Figure 2 is a flowchart of a method for training a target image classification model according to an exemplary embodiment. Figure 2 As shown, the training method of the target image classification model may include:
[0040] S1. Obtain the entropy corresponding to each image sample in multiple image samples by using a preset image classification model.
[0041] Among them, the image sample can be an image with an annotated type label, and the preset image classification model can be an image classification model obtained by preliminary training with some samples in the image sample, or it can be an image classification model obtained by training with other image samples, and the present disclosure does not limit this.
[0042] Figure 3 is a flowchart of a method for training a preset image classification model according to an exemplary embodiment. Figure 3 As shown, the training method of the preset image classification model includes:
[0043] S11. Randomly extract a first preset number of image samples from a plurality of image samples.
[0044] Among them, the first preset number can be determined according to the accuracy of the preset image classification model. For models with higher accuracy requirements for the preset image classification model, a larger first preset number can be set; for models with lower accuracy requirements for the preset image classification model, a smaller first preset number can be set. The present disclosure does not limit this.
[0045] S12. Training the target neural network model using the first preset number of image samples to obtain the preset image classification model.
[0046] Among them, the target neural network model can be a neural network model of the prior art, such as DFF (Deep Feed Forword), RNN (Recurrent Neural Network), LSTM (Long / Short Term Memory), etc. The present disclosure does not limit the type of the target neural network model.
[0047] After obtaining the first preset number of image samples, the target neural network model can be trained with the first preset number of image samples with reference to the model training method in the prior art to obtain the preset image classification model.
[0048] After obtaining the preset image classification model, for each image sample in the multiple image samples, the preset image classification model can be used to obtain the category prediction result corresponding to the image sample, and the entropy corresponding to the image sample can be obtained according to the category prediction result. The category prediction result corresponding to the image sample can be obtained by the following formula:
[0049]
[0050] in, is the category prediction result of the image sample with label j, x iis the image sample.
[0051] After obtaining the category prediction result corresponding to the image sample, the entropy corresponding to the image sample can be obtained by the following formula:
[0052]
[0053] Among them, h i is the entropy corresponding to the image sample, and labels is the preset label of the image sample.
[0054] It should be noted that the above method for calculating the entropy of the image sample is only an example, and the entropy of the image sample can also be calculated by other methods in the prior art, and the present disclosure does not limit this.
[0055] S2. Determine a target image sample from multiple image samples according to the entropy.
[0056] After acquiring the multiple image samples, each image sample can be predicted by the preset image classification model, and the entropy of each image sample can be finally calculated, and then the target image sample can be determined from the multiple image samples according to the calculated entropy. In a possible implementation, an image sample whose entropy is greater than or equal to a preset entropy threshold can be used as the target image sample, and the preset entropy threshold can be preset based on experience or in other ways, and the present disclosure does not limit this.
[0057] S3. The preset image classification model is trained using the target image sample to obtain the target image classification model.
[0058] In one possible implementation, after determining the target image sample, the preset image classification model can be trained with the target image sample by referring to the model training method of the prior art to obtain the target image classification model. In another possible implementation, in order to obtain a target image classification model with higher accuracy, the model training steps can be executed repeatedly until the trained preset image classification model meets the preset stop iteration condition, and the trained preset image classification model is used as the target image classification model.
[0059] Figure 4 is a flowchart of a model training step according to an exemplary embodiment. Figure 4 As shown, the model training steps may include:
[0060] S31, training the preset image classification model using the target image sample.
[0061] After obtaining the target image sample, the preset image classification model may be iteratively trained by referring to the model training method in the prior art.
[0062] S32. Obtain the entropy corresponding to the target image sample through the trained preset image classification model.
[0063] After one iteration of training the preset image classification model, the entropy corresponding to each target image sample can be obtained by referring to the method for obtaining the entropy corresponding to the image sample in step S12.
[0064] S33: Use a second preset number of target image samples with the largest entropy as new target image samples.
[0065] Among them, the second preset number can be determined according to the efficiency of model training. For models with higher requirements for model training efficiency, a smaller second preset number can be set, and for models with lower requirements for model training efficiency, a larger second preset number can be set. The present disclosure does not limit this.
[0066] After obtaining the entropy corresponding to the target image sample, the target image samples can be arranged in descending order of entropy, and the second preset number of target image samples at the front are used as new target image samples. After that, the above steps S31 to S33 can be repeatedly executed.
[0067] It should be noted that after each time the trained preset image classification model is obtained through step S31, it can be determined whether the trained preset image classification model meets the preset stop iteration condition. When it is determined that the trained preset image classification model meets the preset stop iteration condition, the trained preset image classification model is used as the target image classification model. When it is determined that the trained preset image classification model does not meet the preset stop iteration condition, the above steps S32 to S33 are continued to be executed.
[0068] The preset stop iteration condition may be that the loss value is less than or equal to a preset loss threshold, or that the change in weight between two iterations is less than or equal to a preset change threshold, or that the number of iterations is greater than or equal to a preset number threshold, which is not limited in the present disclosure.
[0069] In summary, the present disclosure first obtains a target image to be classified, and then inputs the target image into a pre-trained target image classification model to obtain the type of the target image, wherein the entropy corresponding to each image sample in a plurality of image samples can be obtained through a preset image classification model, and then the target image sample is determined from the plurality of image samples according to the entropy, and finally the preset image classification model is trained through the target image sample to obtain the target image classification model. The target image sample used for training the target image classification model of the present disclosure is screened from a plurality of image samples according to the entropy of the image sample, and the target image sample is the image sample with the best model training effect, thereby improving the efficiency of model training. Furthermore, after the preset image classification model is iteratively trained once according to the target image sample, the present disclosure can determine a new target image sample through the trained preset image classification model again to continue training the trained preset image classification model until the trained preset image classification model meets the preset iteration stop condition, thereby improving the accuracy of the target image classification model.
[0070] Figure 5 is a schematic diagram of the structure of an image classification device according to an exemplary embodiment. Figure 5 As shown, the device may include:
[0071] An image acquisition module 501 is used to acquire a target image to be classified;
[0072] A type acquisition module 502, used for inputting the target image into a pre-trained target image classification model to obtain the type of the target image;
[0073] The target image classification model is trained in the following manner: obtaining the entropy corresponding to each image sample in a plurality of image samples through a preset image classification model; determining a target image sample from a plurality of image samples according to the entropy; and training the preset image classification model through the target image sample to obtain the target image classification model.
[0074] Accordingly, the type acquisition module 502 is also used for:
[0075] Randomly extracting a first preset number of image samples from a plurality of image samples;
[0076] The target neural network model is trained using the first preset number of image samples to obtain the preset image classification model.
[0077] Accordingly, the type acquisition module 502 is also used for:
[0078] Randomly extracting a first preset number of image samples from a plurality of image samples;
[0079] The target neural network model is trained using the first preset number of image samples to obtain the preset image classification model.
[0080] Accordingly, the type acquisition module 502 is also used for:
[0081] The image sample whose entropy is greater than or equal to the preset entropy threshold is used as the target image sample.
[0082] Accordingly, the type acquisition module 502 is also used for:
[0083] The model training steps are executed cyclically until the trained preset image classification model meets the preset stop iteration condition, and the trained preset image classification model is used as the target image classification model;
[0084] The model training steps include:
[0085] Training the preset image classification model using the target image sample;
[0086] Obtaining the entropy corresponding to the target image sample through the trained preset image classification model;
[0087] The second preset number of target image samples with the largest entropy is used as new target image samples.
[0088] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0089] In summary, the present disclosure first obtains a target image to be classified, and then inputs the target image into a pre-trained target image classification model to obtain the type of the target image, wherein the entropy corresponding to each image sample in a plurality of image samples can be obtained through a preset image classification model, and then a target image sample is determined from a plurality of image samples according to the entropy, and finally the preset image classification model is trained through the target image sample to obtain the target image classification model. The target image sample used in the present disclosure for training the target image classification model is screened from a plurality of image samples according to the entropy of the image sample, and the target image sample is the image sample with the best model training effect, thereby improving the efficiency of model training.
[0090] Reference below Figure 6 , which shows an electronic device (eg, Figure 1The terminal device in the embodiment of the present disclosure may include but is not limited to mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), vehicle-mounted terminals (such as vehicle-mounted navigation terminals), etc., and fixed terminals such as digital TVs, desktop computers, etc. Figure 6 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0091] like Figure 6 As shown, the electronic device 600 may include a processing device (e.g., a central processing unit, a graphics processing unit, etc.) 601, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 602 or a program loaded from a storage device 608 into a random access memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.
[0092] Typically, the following devices may be connected to the I / O interface 605: an input device 606 including, for example, a touch screen, a touch pad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; an output device 607 including, for example, a liquid crystal display (LCD), a speaker, a vibrator, etc.; a storage device 608 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 609. The communication device 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. Although Figure 6 The electronic device 600 is shown with various devices, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0093] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device 609, or installed from a storage device 608, or installed from a ROM 602. When the computer program is executed by the processing device 601, the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
[0094] It should be noted that the computer-readable medium disclosed above may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable mediums may include, but are not limited to: an electrical connection with 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable medium may be any tangible medium containing or storing a program that may be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The computer readable signal medium may also be any computer readable medium other than a computer readable medium, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer readable medium may be transmitted using any appropriate medium, including but not limited to: wires, optical cables, RF (radio frequency), etc., or any suitable combination of the above.
[0095] In some embodiments, the client and the server may communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), an internet (e.g., the Internet), and a peer-to-peer network (e.g., an ad hoc peer-to-peer network), as well as any currently known or future developed network.
[0096] The computer-readable medium may be included in the electronic device, or may exist independently without being incorporated into the electronic device.
[0097] The computer-readable medium carries one or more programs. When the one or more programs are executed by the electronic device, the electronic device: obtains a target image to be classified; inputs the target image into a pre-trained target image classification model to obtain the type of the target image; wherein the target image classification model is trained in the following manner: through a preset image classification model, obtains the entropy corresponding to each of a plurality of image samples; determines a target image sample from the plurality of image samples according to the entropy; and trains the preset image classification model through the target image sample to obtain the target image classification model.
[0098] Computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof, including, but not limited to, object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving 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., via the Internet using an Internet service provider).
[0099] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each square box in the flow chart or block diagram can represent a module, a program segment or a part of a code, and the module, the program segment or a part of the code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the square box can also occur in a sequence different from that marked in the accompanying drawings. For example, two square boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each square box in the block diagram and / or flow chart, and the combination of the square boxes in the block diagram and / or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0100] The modules involved in the embodiments described in the present disclosure may be implemented by software or hardware. The name of a module does not limit the module itself in some cases. For example, an image acquisition module may also be described as a "module for acquiring a target image to be classified".
[0101] The functions described above herein may be performed at least in part by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), and the like.
[0102] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable medium may include an electrical connection based on one or more lines, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0103] According to one or more embodiments of the present disclosure, Example 1 provides an image classification method, including: obtaining a target image to be classified; inputting the target image into a pre-trained target image classification model to obtain the type of the target image; wherein the target image classification model is trained in the following manner: obtaining the entropy corresponding to each of a plurality of image samples through a preset image classification model; determining a target image sample from the plurality of image samples based on the entropy; and training the preset image classification model through the target image samples to obtain the target image classification model.
[0104] According to one or more embodiments of the present disclosure, Example 2 provides the method of Example 1, and the preset image classification model is trained in the following manner: randomly extracting a first preset number of image samples from multiple image samples; training the target neural network model with the first preset number of image samples to obtain the preset image classification model.
[0105] According to one or more embodiments of the present disclosure, Example 3 provides the method of Example 1, wherein obtaining the entropy corresponding to each of a plurality of image samples through a preset image classification model includes: for each of the plurality of image samples, obtaining the category prediction result corresponding to the image sample through the preset image classification model, and obtaining the entropy corresponding to the image sample based on the category prediction result.
[0106] According to one or more embodiments of the present disclosure, Example 4 provides the method of Example 1, wherein determining a target image sample from a plurality of image samples according to the entropy comprises: taking an image sample whose entropy is greater than or equal to a preset entropy threshold as the target image sample.
[0107] According to one or more embodiments of the present disclosure, Example 5 provides a method of any one of Examples 1 to 4, wherein the preset image classification model is trained through the target image samples to obtain the target image classification model, including: looping through the model training step until the trained preset image classification model meets the preset stop iteration condition, and using the trained preset image classification model as the target image classification model; the model training step includes: training the preset image classification model through the target image samples; obtaining the entropy corresponding to the target image samples through the trained preset image classification model; and using the second preset number of target image samples with the largest entropy as new target image samples.
[0108] According to one or more embodiments of the present disclosure, Example 6 provides an image classification device, which includes: an image acquisition module, used to acquire a target image to be classified; a type acquisition module, used to input the target image into a pre-trained target image classification model to obtain the type of the target image; wherein the target image classification model is trained in the following manner: through a preset image classification model, the entropy corresponding to each of a plurality of image samples is acquired; according to the entropy, a target image sample is determined from the plurality of image samples; and through the target image sample, the preset image classification model is trained to obtain the target image classification model.
[0109] According to one or more embodiments of the present disclosure, Example 7 provides the device of Example 6, wherein the type acquisition module is further used to: randomly extract a first preset number of image samples from multiple image samples; and train the target neural network model through the first preset number of image samples to obtain the preset image classification model.
[0110] According to one or more embodiments of the present disclosure, Example 8 provides an apparatus of any one of Examples 6 to 7, wherein the type acquisition module is further used to: loop through the model training steps until the trained preset image classification model meets the preset stop iteration condition, and use the trained preset image classification model as the target image classification model; the model training steps include: training the preset image classification model through the target image samples; obtaining the entropy corresponding to the target image samples through the trained preset image classification model; and using the second preset number of target image samples with the largest entropy as new target image samples.
[0111] According to one or more embodiments of the present disclosure, Example 9 provides a computer-readable medium having a computer program stored thereon, which implements the steps of the methods described in Examples 1 to 5 when executed by a processing device.
[0112] According to one or more embodiments of the present disclosure, Example 10 provides an electronic device, comprising: a storage device on which a computer program is stored; and a processing device for executing the computer program in the storage device to implement the steps of the method described in Examples 1 to 5.
[0113] The above description is only a preferred embodiment of the present disclosure and an explanation of the technical principles used. Those skilled in the art should understand that the scope of disclosure involved in the present disclosure is not limited to the technical solutions formed by a specific combination of the above technical features, but should also cover other technical solutions formed by any combination of the above technical features or their equivalent features without departing from the above disclosed concept. For example, the above features are replaced with the technical features with similar functions disclosed in the present disclosure (but not limited to) by each other to form a technical solution.
[0114] In addition, although each operation is described in a specific order, this should not be understood as requiring these operations to be performed in the specific order shown or in a sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Similarly, although some specific implementation details are included in the above discussion, these should not be interpreted as limiting the scope of the present disclosure. Some features described in the context of a separate embodiment can also be implemented in a single embodiment in combination. On the contrary, the various features described in the context of a single embodiment can also be implemented in multiple embodiments individually or in any suitable sub-combination mode.
[0115] Although the subject matter has been described in language specific to structural features and / or method logic actions, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. On the contrary, the specific features and actions described above are merely example forms of implementing the claims. Regarding the device in the above embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Claims
1. An image classification method, characterized in that: The method comprises: Obtain a target image to be classified; Inputting the target image into a pre-trained target image classification model to obtain the type of the target image; The target image classification model is trained in the following manner: obtaining the entropy corresponding to each of the multiple image samples through a preset image classification model; determining the target image sample from the multiple image samples according to the entropy; training the preset image classification model through the target image sample to obtain the target image classification model; the training samples corresponding to the preset image classification model are a first preset number of image samples randomly selected from the multiple image samples, and the first preset number is determined according to the accuracy of the preset image classification model; The step of training the preset image classification model through the target image sample to obtain the target image classification model comprises: The model training step is executed cyclically until the trained preset image classification model meets the preset stop iteration condition, and the trained preset image classification model is used as the target image classification model; The model training step includes: Training the preset image classification model using the target image samples; Obtaining the entropy corresponding to the target image sample through the trained preset image classification model; A second preset number of target image samples with the largest entropy is used as new target image samples, where the second preset number is determined according to the efficiency of model training.
2. The method according to claim 1, characterized in that The preset image classification model is trained in the following way: Randomly extracting a first preset number of image samples from the plurality of image samples; The target neural network model is trained using the first preset number of image samples to obtain the preset image classification model.
3. The method according to claim 1, characterized in that The obtaining the entropy corresponding to each of the plurality of image samples by using a preset image classification model comprises: For each of the multiple image samples, a category prediction result corresponding to the image sample is obtained through the preset image classification model, and the entropy corresponding to the image sample is obtained according to the category prediction result.
4. The method according to claim 1, characterized in that: Determining a target image sample from a plurality of image samples according to the entropy comprises: The image sample whose entropy is greater than or equal to a preset entropy threshold is used as the target image sample.
5. An image classification device, characterized in that: The device comprises: An image acquisition module, used to acquire a target image to be classified; A type acquisition module, used for inputting the target image into a pre-trained target image classification model to obtain the type of the target image; The target image classification model is trained in the following manner: obtaining the entropy corresponding to each of the multiple image samples through a preset image classification model; determining the target image sample from the multiple image samples according to the entropy; training the preset image classification model through the target image sample to obtain the target image classification model; the training samples corresponding to the preset image classification model are a first preset number of image samples randomly selected from the multiple image samples, and the first preset number is determined according to the accuracy of the preset image classification model; The step of training the preset image classification model through the target image sample to obtain the target image classification model comprises: The model training step is executed cyclically until the trained preset image classification model meets the preset stop iteration condition, and the trained preset image classification model is used as the target image classification model; The model training step includes: Training the preset image classification model using the target image samples; Obtaining the entropy corresponding to the target image sample through the trained preset image classification model; A second preset number of target image samples with the largest entropy is used as new target image samples, where the second preset number is determined according to the efficiency of model training.
6. The device according to claim 5, characterized in that The type acquisition module is also used for: Randomly extracting a first preset number of image samples from the plurality of image samples; The target neural network model is trained using the first preset number of image samples to obtain the preset image classification model.
7. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processing device, the steps of the method described in any one of claims 1 to 4 are implemented.
8. An electronic device, characterized in that: include: a storage device having a computer program stored thereon; A processing device, configured to execute the computer program in the storage device to implement the steps of the method according to any one of claims 1 to 4.
Citation Information
Patent Citations
Vehicle attribute model training method and device, terminal and storage medium
CN110147709A
