Method and device for establishing neural network classifier and image classification method and device

By constructing a targeted loss function to train the neural network classifier, the problem of non-convergence of background image training is solved, and rapid classification of background images is achieved.

CN114494769BActive Publication Date: 2025-09-09BEIJING SMARTCHIP MICROELECTRONICS TECHNOLOGY CO LTD +3
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210002172.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-01-04
Publication Date
2025-09-09
Estimated Expiration
2042-01-04

AI Technical Summary

Technical Problem

When existing image classification methods process background images, the neural network training does not converge and the classification efficiency of background images is low.

Method used

By constructing a loss function, distinguishing background and target images according to the type of training images, annotating labels using one-hot encoding, and obtaining feature vectors through the backbone network, a targeted loss function is constructed to train the neural network classifier.

Benefits of technology

The convergence speed of the neural network classifier is accelerated, the classification efficiency of the picture set containing background images is improved, and fast classification is achieved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114494769B_ABST
    Figure CN114494769B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for establishing a neural network classifier, as well as an image classification method and device. The establishment method comprises: obtaining a training image set, wherein the training images in the training image set include two types: target images and background images; inputting the training images in the training image set into a neural network classifier to obtain a feature vector for each training image; constructing a loss function based on the feature vectors and the types of the corresponding training images; and training the neural network classifier based on the loss function to obtain a trained neural network classifier. When establishing the neural network classifier, the establishment method constructs a loss function based on the types of the training images and uses the loss function to train the neural network classifier. This method can accelerate the convergence speed of the neural network classifier, thereby obtaining a neural network classifier that can quickly classify image sets containing background images.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a method and device for establishing a neural network classifier and an image classification method and device. Background Art

[0002] Object classification is a highly active research area in computer vision, pattern recognition, and machine learning. Nearly all computer vision tasks are downstream of object classification, including face recognition, pedestrian detection, intelligent video analysis, and pedestrian tracking in the security field; object recognition in traffic scenes, vehicle counting, wrong-way detection, license plate detection and recognition in the transportation field; and content-based image retrieval and automatic photo album categorization in the internet field. Object classification is widely used in all aspects of our daily lives, and computer-generated classification technology has, to a certain extent, reduced human burdens and transformed our lifestyles. Therefore, object classification is one of the most fundamental research issues in computer vision research.

[0003] In image classification tasks, each category has a distinct pattern. For example, in cat and dog recognition, cats and dogs both have distinct, distinguishable features. Therefore, a neural network trained on cat and dog images can effectively perform these tasks. However, in image classification tasks, some images that do not contain any objects are inevitably present, referred to in the industry as background images. Existing methods treat background images as a separate category and classify them the same as other images containing objects. The most commonly used loss functions in training are logistic loss or softmax cross entropy loss. In reality, images containing objects have a distinct pattern, and after training, the neural network will converge to a certain optimal value. However, background images do not have a distinct pattern, so using logistic loss or softmax cross entropy loss to calculate the loss equally for all categories (background and target) is clearly unreasonable. In the case of complex backgrounds, neural network training may even fail to converge. Summary of the Invention

[0004] The present invention aims to at least partially address one of the technical problems in the related art. To this end, one object of the present invention is to provide a method for establishing a neural network classifier. When establishing the neural network classifier, a loss function is constructed by training the image types. The loss function is used to train the neural network classifier, thereby accelerating the convergence of the neural network classifier and obtaining a neural network classifier that can quickly classify a set of images containing background images.

[0005] The second object of the present invention is to provide an image classification method.

[0006] The third object of the present invention is to provide a device for establishing a neural network classifier.

[0007] A fourth objective of the present invention is to provide an image classification device.

[0008] A fifth object of the present invention is to provide a computer-readable storage medium.

[0009] A sixth object of the present invention is to provide an image classification chip.

[0010] To achieve the above-mentioned purpose, an embodiment of the first aspect of the present invention proposes a method for establishing a neural network classifier, comprising: obtaining a training image set, wherein the training images in the training image set include two types: target images and background images; inputting the training images in the training image set into the neural network classifier to obtain a feature vector of each training image; constructing a loss function based on the feature vector and the type to which the corresponding training image belongs; and training the neural network classifier based on the loss function to obtain a trained neural network classifier.

[0011] According to the method for establishing a neural network classifier in an embodiment of the present invention, when establishing the neural network classifier, a loss function is constructed according to the types of different training images, and the neural network classifier is trained using the loss function. This can accelerate the convergence speed of the neural network classifier to obtain a neural network classifier that can quickly classify a set of images containing background images.

[0012] To achieve the above-mentioned purpose, the second embodiment of the present invention proposes an image classification method, comprising inputting the image to be classified into the trained neural network classifier proposed in the first embodiment of the present invention to obtain the category of the image to be classified.

[0013] According to the image classification method of an embodiment of the present invention, a trained neural network classifier is used to quickly classify a picture set containing background images, thereby improving the classification efficiency of the picture set containing background images and realizing rapid classification of the picture set containing background images.

[0014] To achieve the above-mentioned purpose, the third aspect of the present invention proposes an apparatus for establishing a neural network classifier, comprising: an acquisition module for acquiring a training image set, wherein the training images in the training image set include two types: target images and background images; an input module for inputting the training images in the training image set into the neural network classifier to obtain a feature vector of each training image; a construction module for constructing an initial neural network classifier, and constructing a loss function based on the feature vector and the type to which the corresponding training image belongs; and a training module for training the neural network classifier based on the loss function to obtain a trained neural network classifier.

[0015] To achieve the above objectives, a fourth embodiment of the present invention provides an image classification device, comprising:

[0016] The classification module is used to input the image to be classified into the trained neural network classifier proposed in the embodiment of the first aspect of the present invention to obtain the category of the image to be classified.

[0017] To achieve the above-mentioned objectives, the fifth embodiment of the present invention proposes a computer-readable storage medium on which a computer program is stored, characterized in that when the computer program is executed by a processor, it implements the method for establishing a neural network classifier proposed in the first embodiment of the present invention.

[0018] To achieve the above-mentioned purpose, the sixth embodiment of the present invention proposes an image classification chip, including a memory and a processor, wherein a computer program is stored on the memory, and the chip is characterized in that when the computer program is executed by the processor, the method for establishing a neural network classifier proposed in the first embodiment of the present invention is implemented.

[0019] Additional aspects and advantages of the present invention will be set forth in part in the description which follows and, in part, will be obvious from the description which follows, or may be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flow chart of a method for establishing a neural network classifier according to one embodiment of the present invention;

[0021] Figure 2 This is a schematic diagram of the N-dimensional spatial distribution of a neural network output according to a specific embodiment of the present invention;

[0022] Figure 3 is a flow chart of an image classification method according to an embodiment of the present invention;

[0023] Figure 4 1 is a schematic diagram of the structure of a device for establishing a neural network classifier according to an embodiment of the present invention;

[0024] Figure 5 It is a structural diagram of an image classification device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0025] The following describes embodiments of the present invention in detail, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and are not to be construed as limiting the present invention.

[0026] The following will be combined with the instructions Figure 1-5 The specific implementation methods and devices for establishing a neural network classifier and the image classification method and device of the embodiments of the present invention are described in detail.

[0027] Figure 1 FIG. 1 is a flow chart of a method for establishing a neural network classifier according to an embodiment of the present invention. Figure 1 As shown in FIG, the method for establishing a neural network classifier includes:

[0028] S1. Obtain a training image set, wherein the training images in the training image set include two types: target images and background images.

[0029] In an embodiment of the present invention, both the target image and the background image in the target image may be labeled using one-hot encoding.

[0030] Specifically, one-hot encoding, also known as single-bit significant encoding, primarily uses an N-bit state register to encode N states. Each state is represented by its own independent register bit, and only one bit is significant at any given time. One-hot encoding uses 0s and 1s to represent some parameters, using an N-bit state register to encode N states. For example, a one-hot encoding with six states would be: 000001, 000010, 000100, 001000, 010000, 100000. The greatest advantage of one-hot encoding is that only a single bit needs to be compared when comparing states, which simplifies the decoding logic to a certain extent. This reduces the amount of combinational logic required to implement the state machine, reduces complexity, and increases system speed, allowing for the highest operating clock frequency.

[0031] As an example, assume that each spatial point in the entire output space represents an object. For the target to be classified, all other objects belong to the background. Based on this premise, when there are three target categories in the target image (i.e., N = 3), one-hot encoding is used to label the training images in the training image set. The corresponding one-hot encodings of the training images in the training image set can be shown in Table 1 below.

[0032] Table 1

[0033] category Label One-hot encoded labels background 0 [0,0,0] Goal 1 1 [1,0,0] Goal 2 2 [0,1,0] Goal 3 3 [0,0,1]

[0034] As shown in Table 1, the one-hot encoding label corresponding to the background image is

[000] , the one-hot encoding label corresponding to target 1 is

[100] , the one-hot encoding label corresponding to target 2 is

[010] , and the one-hot encoding label corresponding to target 3 is

[001] .

[0035] It should be noted that the target image and background image are relative. For example, when classifying animal images, the target image could be an image containing animals such as cats and dogs, while the background image could be any image that does not contain animals such as cats and dogs (e.g., a landscape image, a human image, etc.). For another example, when classifying images of distribution network equipment, the target image could be an image containing equipment such as transformers and utility poles with power distribution lines connected to them, while the background image could be any image that does not contain equipment such as transformers and utility poles with power distribution lines connected to them (e.g., a landscape image, a human image, an animal image, etc.).

[0036] S2: Input the training images in the training image set into the neural network classifier to obtain the feature vector of each training image.

[0037] In an embodiment of the present invention, the neural network classifier adopts a backbone network, and the backbone network includes N fully connected layers, where N represents the number of target categories in the target image, and N is an integer greater than or equal to 1.

[0038] As a feasible implementation, inputting the training image into the neural network classifier to obtain the feature vector of the training image may include:

[0039] The backbone network is used to map the training image into N-dimensional Euclidean space, and the feature vector of the training image [x1, x2, ..., x N ].

[0040] Specifically, after the training image is input into the backbone network, the N fully connected layers of the backbone network map the training image to the N-dimensional Euclidean space, and the backbone network with N fully connected layers outputs the feature vector [x1, x2, ..., x N ].

[0041] S3, construct a loss function based on the feature vector and the type of the corresponding training image.

[0042] In an embodiment of the present invention, the loss function is expressed as:

[0043] LOSS i =(1-L i )((x i -1) 2 -Vthrhd ) 2 +L i (x i -1) 2 ,

[0044] Among them, L i is the value of the unique hot code label of the i-th dimension of the training image. When the training image corresponding to the feature vector is the background image, if (x i -1) 2 Less than the preset threshold V thrhd , then the loss of the i-th dimension is ((x i -1) 2 -V thrhd ) 2 , otherwise the loss of the i-th dimension is 0; when the training image corresponding to the feature vector is the target image, the loss of the i-th dimension is (x i -1) 2 .

[0045] Specifically, when the training image is a background image, if (x i -1) 2 <V thrhd , then the i-th dimension loss is ((x i -1) 2 -V thrhd ) 2 ; if (x i -1) 2 >V thrhd , then the loss of the i-th dimension is 0, where V thrhd Represents the threshold. If min[(x1-1) 2 ,(x2-1) 2 ,...(x N -1) 2 ] is greater than the threshold, the label loss of the corresponding training image is 0. When the training image is a target image, the i-th dimension loss is (x i -1) 2 .

[0046] Specifically, taking the case where there are three target categories in the target image, that is, N=3, the neural network outputs an N-dimensional spatial distribution diagram, as shown in Figure 2 As shown in the figure, it can be seen that when the training image is a target image, the Euclidean distance between the i-th dimension of the training image mapped to the N-dimensional space and 1 is less than the threshold V thrhd and close to 1; when the training image is a background image, the Euclidean distance between the feature vector of the training image mapping N-dimensional space and 1 in each dimension is greater than the threshold V thrhd .

[0047] S4, training the neural network classifier based on the loss function to obtain a trained neural network classifier.

[0048] As a feasible implementation, training a neural network classifier based on a loss function includes:

[0049] The partial derivative of the loss function is calculated, and the obtained partial derivative value is used as the back propagation amount to update the parameters of the neural network classifier.

[0050] In an embodiment of the present invention, the expression of the partial derivative value is:

[0051]

[0052] It should be noted that the present invention constructs a loss function according to the type of training image, and trains the neural network classifier based on the loss function. There is no limitation on the backbone network and optimizer. The commonly used backbone networks and optimizers for graphic classification are applicable here.

[0053] The method for establishing a neural network classifier provided in an embodiment of the present invention, when establishing the neural network classifier, constructs a loss function according to the type of the training image, uses the loss function to train the neural network classifier, accelerates the convergence speed of the neural network classifier, and obtains a neural network classifier that can quickly classify a set of pictures containing background images.

[0054] The invention also proposes an image classification method.

[0055] Figure 3 FIG. 1 is a flow chart of an image classification method according to an embodiment of the present invention. Figure 3 As shown, the image classification method includes: inputting the image to be classified into the above-mentioned trained neural network classifier to obtain the category of the image to be classified.

[0056] Specifically, a trained neural network classifier can be used to directly classify the image to be classified. The image to be classified can be input into the trained neural network classifier to obtain the category of the image to be classified.

[0057] The image to be classified can be a target image or a background image. For example, for the classification of animal images, the image to be classified can contain an image of a target animal such as a cat or dog, or a landscape image without any animals.

[0058] The image classification method provided by the embodiment of the present invention uses a trained neural network classifier to quickly classify a picture set containing background images, thereby improving the classification efficiency of the picture set containing background images and realizing rapid classification of the picture set containing background images.

[0059] The invention also proposes a device for establishing a neural network classifier.

[0060] Figure 4 FIG. 1 is a schematic diagram of a device for establishing a neural network classifier according to an embodiment of the present invention. Figure 4 As shown, the image classification device 100 includes an acquisition module 10 , an input module 20 , a construction module 30 and a training module 40 .

[0061] The acquisition module 10 is used to acquire a training image set, wherein the training images in the training image set include two types: target images and background images.

[0062] In an embodiment of the present invention, the image classification apparatus further comprises a labeling module configured to label the target and background images in the target image using one-hot encoding labels.

[0063] Specifically, one-hot encoding, also known as single-bit significant encoding, primarily uses an N-bit state register to encode N states. Each state is represented by its own independent register bit, and only one bit is significant at any given time. One-hot encoding uses 0s and 1s to represent some parameters, using an N-bit state register to encode N states. For example, a one-hot encoding with six states would be: 000001, 000010, 000100, 001000, 010000, 100000. The greatest advantage of one-hot encoding is that only a single bit needs to be compared when comparing states, which simplifies the decoding logic to a certain extent. This reduces the amount of combinational logic required to implement the state machine, reduces complexity, and increases system speed, allowing for the highest operating clock frequency.

[0064] As an example, assume that each spatial point in the entire output space represents an object. For the target to be classified, all other objects belong to the background. Based on this premise, when there are three target categories in the target image (i.e., N = 3), one-hot encoding is used to label the training images in the training image set. The corresponding one-hot encodings of the training images in the training image set can be shown in Table 1 below.

[0065] Table 1

[0066] category Label One-hot encoded labels background 0 [0,0,0] Goal 1 1 [1,0,0] Goal 2 2 [0,1,0] Goal 3 3 [0,0,1]

[0067] As shown in Table 1, the one-hot encoding label corresponding to the background image is

[000] , the one-hot encoding label corresponding to target 1 is

[100] , the one-hot encoding label corresponding to target 2 is

[010] , and the one-hot encoding label corresponding to target 3 is

[001] .

[0068] It should be noted that the target image and background image are relative. For example, when classifying animal images, the target image could be an image containing animals such as cats and dogs, while the background image could be any image that does not contain animals such as cats and dogs (e.g., a landscape image, a human image, etc.). For another example, when classifying images of distribution network equipment, the target image could be an image containing equipment such as transformers and utility poles with power distribution lines connected to them, while the background image could be any image that does not contain equipment such as transformers and utility poles with power distribution lines connected to them (e.g., a landscape image, a human image, an animal image, etc.).

[0069] The input module 20 is used to input the training images in the training image set into the neural network classifier to obtain the feature vector of each training image. The construction module 30 is used to construct an initial neural network classifier.

[0070] In an embodiment of the present invention, the construction module is specifically used to construct an initial neural network classifier using a backbone network, wherein the backbone network includes N fully connected layers, N represents the number of target categories in the target image, and N is an integer greater than or equal to 1.

[0071] As a specific embodiment, the input module is specifically used to map the training image to the N-dimensional Euclidean space using the backbone network to obtain the feature vector [x1, x2, ..., x N ].

[0072] Specifically, after the training image is input into the backbone network, the N fully connected layers of the backbone network map the training image to the N-dimensional Euclidean space, and the backbone network with N fully connected layers outputs the feature vector [x1, x2, ..., x N ].

[0073] The construction module 30 is used to construct a loss function according to the feature vector and the type of the corresponding training image.

[0074] In an embodiment of the present invention, the construction module is specifically used to construct a loss function using the following formula:

[0075] LOSS i =(1-L i )((x i -1) 2 -V thrhd ) 2 +L i (x i -1) 2 ,

[0076] Among them, L iis the value of the unique hot code label of the i-th dimension of the training image. When the training image corresponding to the feature vector is the background image, if (x i -1) 2 Less than the preset threshold V thrhd , then the loss of the i-th dimension is ((x i -1) 2 -V thrhd ) 2 , otherwise the loss of the i-th dimension is 0; when the training image corresponding to the feature vector is the target image, the loss of the i-th dimension is (x i -1) 2 .

[0077] Specifically, when the training image is a background image, if (x i -1) 2 <V thrhd , then the i-th dimension loss is ((x i -1) 2 -V thrhd ) 2 ; if (x i -1) 2 >V thrhd , then the loss of the i-th dimension is 0, where V thrhd Represents the threshold. If min[(x1-1) 2 ,(x2-1) 2 ,...(x N -1) 2 ] is greater than the threshold, the label loss of the corresponding training image is 0. When the training image is a target image, the i-th dimension loss is (x i -1) 2 .

[0078] Specifically, taking the case where there are three target categories in the target image, that is, N=3, the neural network outputs an N-dimensional spatial distribution diagram, as shown in Figure 2 As shown in the figure, it can be seen that when the training image is a target image, the Euclidean distance between the i-th dimension of the training image mapped to the N-dimensional space and 1 is less than the threshold V thrhd and close to 1; when the training image is a background image, the Euclidean distance between the feature vector of the training image mapping N-dimensional space and 1 in each dimension is greater than the threshold V thrhd .

[0079] The training module 40 is used to train the neural network classifier based on the loss function to obtain a trained neural network classifier.

[0080] As a specific embodiment, the training module is specifically used to calculate the partial derivative of the loss function, and use the obtained partial derivative value as the back-propagation amount to update the parameters of the neural network classifier.

[0081] In an embodiment of the present invention, the training module is specifically used to calculate the partial derivative value by the following formula:

[0082]

[0083] It should be noted that the present invention constructs a loss function according to the type of training image, and trains the neural network classifier based on the loss function. There is no limitation on the backbone network and optimizer. The commonly used backbone networks and optimizers for graphic classification are applicable here.

[0084] The apparatus for establishing a neural network classifier provided in an embodiment of the present invention utilizes a construction module 30 to construct a loss function according to the type of the training image when establishing the neural network classifier. The training module 40 trains the neural network classifier based on the loss function to accelerate the convergence speed of the neural network classifier, thereby obtaining a neural network classifier that can quickly classify a set of images containing background images.

[0085] The present invention also proposes an image classification device.

[0086] Figure 5 FIG. 1 is a schematic diagram of the structure of an image classification device according to an embodiment of the present invention. Figure 5 As shown, the image classification device 200 includes a classification module 50 .

[0087] The classification module 50 is used to input the image to be classified into the trained neural network classifier to obtain the category of the image to be classified.

[0088] Specifically, the classification module 50 can directly classify the image to be classified using a trained neural network classifier. The image to be classified can be input into the trained neural network classifier to obtain the category of the image to be classified.

[0089] The image to be classified can be a target image or a background image. For example, for the classification of animal images, the image to be classified can contain an image of a target animal such as a cat or dog, or a landscape image without any animals.

[0090] In the image classification device provided by the embodiment of the present invention, the classification module 50 directly uses the trained neural network classifier to quickly classify the picture set containing background images, thereby improving the classification efficiency of the picture set containing background images and realizing rapid classification of the picture set containing background images.

[0091] The present invention also provides a computer-readable storage medium.

[0092] In this embodiment, a computer program is stored on a computer-readable storage medium. The computer program corresponds to the above-mentioned method for establishing a neural network classifier. When the computer program is executed by a processor, the above-mentioned method for establishing a neural network classifier is implemented.

[0093] The present invention also proposes an image classification chip.

[0094] In this embodiment, the image classification chip includes a processor, a memory, and a computer program stored in the memory. When the processor executes the computer program, the above-mentioned method for establishing a neural network classifier is implemented.

[0095] It should be noted that the logic and / or steps represented in the flowcharts or otherwise described herein, for example, can be considered as a sequenced list of executable instructions for implementing the logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch and execute instructions from an instruction execution system, apparatus, or device), or in conjunction with such instruction execution system, apparatus, or device. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transmit a program for use by an instruction execution system, apparatus, or device, or in conjunction with such instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection portion having one or more wires (electronic device), a portable computer disk cartridge (magnetic device), random access memory (RAM), read-only memory (ROM), erasable and programmable read-only memory (EPROM or flash memory), fiber optic devices, and portable compact disc read-only memory (CDROM). Furthermore, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing it in another suitable manner if necessary, and then storing it in a computer memory.

[0096] It should be understood that various parts of the present invention can be implemented using hardware, software, firmware, or a combination thereof. In the above-described embodiments, multiple steps or methods can be implemented using software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented using hardware, as in another embodiment, any one of the following technologies known in the art or a combination thereof can be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application-specific integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.

[0097] Throughout this specification, reference to terms such as "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that a specific feature, structure, material, or characteristic described in conjunction with that embodiment or example is included in at least one embodiment or example of the present invention. In this specification, schematic representations of the above terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.

[0098] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like to indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.

[0099] Furthermore, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of the technical features being referred to. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "plurality" means at least two, such as two, three, etc., unless otherwise specifically defined.

[0100] In the present invention, unless otherwise specified or limited, the terms "installed," "connected," "connect," "fixed," etc. should be understood in a broad sense. For example, they can refer to fixed connection, detachable connection, or integration; mechanical connection, electrical connection; direct connection, or indirect connection through an intermediate medium; internal communication between two components, or interaction between two components, unless otherwise specified. Those skilled in the art will understand the specific meanings of the above terms in the present invention based on specific circumstances.

[0101] In the present invention, unless otherwise expressly specified or limited, when a first feature is "above" or "below" a second feature, it may mean that the first and second features are in direct contact, or that the first and second features are in indirect contact through an intermediary. Furthermore, when a first feature is "above," "above," or "above" a second feature, it may mean that the first feature is directly above or diagonally above the second feature, or simply means that the first feature is at a higher level than the second feature. When a first feature is "below," "below," or "below" a second feature, it may mean that the first feature is directly below or diagonally below the second feature, or simply means that the first feature is at a lower level than the second feature.

[0102] Although the embodiments of the present invention have been shown and described above, it will be understood that the above embodiments are illustrative and are not to be construed as limitations on the present invention. A person skilled in the art may change, modify, replace and modify the above embodiments within the scope of the present invention.

Claims

1. A method for establishing a neural network classifier, characterized in that: include: Acquire a training image set, wherein the training images in the training image set include two types: target images and background images; Inputting the training images in the training image set into a neural network classifier to obtain a feature vector of each training image; Constructing a loss function based on the feature vector and the type of the corresponding training image; Training the neural network classifier based on the loss function to obtain a trained neural network classifier; The expression of the loss function is: LOSS i =(1-L i )((x i -1) 2 -V thrhd ) 2 +L i (x i -1) 2 , Among them, L i is the value of the unique hot code label of the i-th dimension of the training image, x i is the value of the feature vector of the training image in the i-th dimension. When the training image corresponding to the feature vector is the background image, if (x i -1) 2 Less than the preset threshold V thrhd , then the loss of the i-th dimension is ((x i -1) 2 -V thrhd ) 2 , otherwise the loss of the i-th dimension is 0; when the training image corresponding to the feature vector is the target image, the loss of the i-th dimension is (x i -1) 2 .

2. The method for establishing a neural network classifier according to claim 1, wherein: The neural network classifier adopts a backbone network, which includes N fully connected layers, wherein N represents the number of target categories in the target image and N is an integer greater than or equal to 1.

3. The method for establishing a neural network classifier according to claim 2, wherein: The target in the target image and the background image are both labeled using one-hot encoding.

4. The method for establishing a neural network classifier according to claim 3, wherein: Inputting a training image into a neural network classifier to obtain a feature vector of the training image includes: The backbone network is used to map the training image to an N-dimensional Euclidean space to obtain the feature vector [x1, x2, ..., x N ].

5. The method for establishing a neural network classifier according to claim 1, wherein: The training of the neural network classifier based on the loss function includes: The partial derivative of the loss function is calculated, and the obtained partial derivative value is used as the back propagation amount to update the parameters of the neural network classifier.

6. The method for establishing a neural network classifier according to claim 5, characterized in that: The expression of the partial derivative value is:

7. An image classification method, characterized in that: include: The image to be classified is input into a neural network classifier trained by any one of claims 1 to 6 to obtain the category of the image to be classified.

8. A device for establishing a neural network classifier, characterized in that: include: An acquisition module is used to acquire a training image set, wherein the training images in the training image set include two types: target images and background images; An input module, configured to input the training images in the training image set into the neural network classifier to obtain a feature vector of each training image; A construction module is used to construct an initial neural network classifier and to construct a loss function according to the feature vector and the type of the corresponding training image; A training module, configured to train the neural network classifier based on the loss function to obtain a trained neural network classifier; The construction module is specifically used to construct the loss function through the following formula: LOSS i =(1-L i )((x i -1) 2 -V thrhd ) 2 +L i (x i -1) 2 , Among them, L i is the value of the unique hot code label of the i-th dimension of the training image, x i is the value of the feature vector of the training image in the i-th dimension. When the training image corresponding to the feature vector is the background image, if (x i -1) 2 Less than the preset threshold V thrhd , then the loss of the i-th dimension is ((x i -1) 2 -V thrhd ) 2 , otherwise the loss of the i-th dimension is 0; when the training image corresponding to the feature vector is the target image, the loss of the i-th dimension is (x i -1) 2 .

9. The apparatus for establishing a neural network classifier according to claim 8, characterized in that: The construction module is specifically used to construct the initial neural network classifier using a backbone network, wherein the backbone network includes N fully connected layers, N represents the number of target categories in the target image, and N is an integer greater than or equal to 1.

10. The apparatus for establishing a neural network classifier according to claim 9, characterized in that: The device further comprises: The labeling module is used to label the target in the target image and the background image using one-hot encoding labeling tags.

11. The apparatus for establishing a neural network classifier according to claim 10, characterized in that: The input module is specifically used to map the training image into N-dimensional Euclidean space using the backbone network to obtain the feature vector of the training image. [x1,x2,...,x N ]。 12. The apparatus for establishing a neural network classifier according to claim 8, wherein: The training module is specifically used to calculate the partial derivative of the loss function, and use the obtained partial derivative value as the back propagation amount to update the parameters of the neural network classifier.

13. The apparatus for establishing a neural network classifier according to claim 12, characterized in that: The training module is specifically used to calculate the partial derivative value by the following formula:

14. An image classification device, characterized in that: include: A classification module is used to input the image to be classified into a neural network classifier trained by any one of claims 1 to 6 to obtain the category of the image to be classified.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method for establishing a neural network classifier according to any one of claims 1 to 6 is implemented.

16. An image classification chip, comprising a memory and a processor, wherein a computer program is stored in the memory, characterized in that: When the computer program is executed by the processor, the method for establishing a neural network classifier according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • Image data processing method and device, computer equipment and storage medium

    CN113313215A