CN110458218B - Image classification method and device and classification network training method and device - Google Patents

Image classification method and device and classification network training method and device Download PDF

Info

Publication number
CN110458218B
CN110458218B CN201910702266.3A CN201910702266A CN110458218B CN 110458218 B CN110458218 B CN 110458218B CN 201910702266 A CN201910702266 A CN 201910702266A CN 110458218 B CN110458218 B CN 110458218B
Authority
CN
China
Prior art keywords
network
classification
feature
feature map
training
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910702266.3A
Other languages
Chinese (zh)
Other versions
CN110458218A (en
Inventor
邓晗
张学森
伊帅
闫俊杰
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Sensetime Technology Development Co Ltd
Original Assignee
Beijing Sensetime Technology Development Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Sensetime Technology Development Co Ltd filed Critical Beijing Sensetime Technology Development Co Ltd
Priority to CN201910702266.3A priority Critical patent/CN110458218B/en
Publication of CN110458218A publication Critical patent/CN110458218A/en
Application granted granted Critical
Publication of CN110458218B publication Critical patent/CN110458218B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • G06F18/253Fusion techniques of extracted features
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/19Recognition using electronic means
    • G06V30/192Recognition using electronic means using simultaneous comparisons or correlations of the image signals with a plurality of references
    • G06V30/194References adjustable by an adaptive method, e.g. learning

Abstract

The disclosure relates to an image classification method and device and a classification network training method and device, wherein the image classification method comprises the following steps: extracting a first feature map of an image to be processed; segmenting the first feature map according to the segmentation coefficient to obtain a segmented second feature map group; performing fusion processing on the second feature map to obtain a first feature vector; and inputting the first feature vector into a classification network to obtain a classification result, and classifying the image to be processed according to the classification result. According to the image classification method disclosed by the embodiment of the disclosure, the second feature map can be obtained by segmenting the coefficient and the first feature map of the image to be processed, the second feature map is fused to obtain the first feature vector, and more feature information can be obtained, so that the classification accuracy can be improved in the process of classifying according to the features, and through fusion processing, the feature information of each second feature map can be reserved, so that the feature information is rich, the information redundancy can be reduced, and the processing efficiency is improved.

Description

Image classification method and device and classification network training method and device
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to an image classification method and apparatus, and a classification network training method and apparatus.
Background
In the related art, when extracting the features of the target object in the image, the neural network extracts the features of the target object as a whole, but factors such as the appearance, posture, proportion of the target object in the image, complexity of the background, and integrity of the target object in the image may all affect the extraction result, so that the accuracy of image classification is low.
Disclosure of Invention
The disclosure provides an image classification method and device and a classification network training method and device.
According to an aspect of the present disclosure, there is provided an image classification method including:
extracting a first feature map of an image to be processed;
segmenting the first feature map according to at least one segmentation coefficient to obtain a second feature map group which is obtained after segmentation according to each segmentation coefficient, wherein the second feature map group comprises at least one second feature map;
performing fusion processing on the second feature maps in the second feature map groups to obtain first feature vectors corresponding to the segmentation coefficients;
and respectively inputting the first feature vectors into corresponding classification networks to obtain a classification result corresponding to each classification network, and classifying the images to be processed according to the classification results obtained by all the classification networks.
According to the image classification method disclosed by the embodiment of the disclosure, the second feature map can be obtained through the segmentation coefficient and the first feature map of the image to be processed, the second feature map is subjected to fusion processing to obtain at least one first feature vector, and at least one class of features of the image to be processed can be obtained, so that more feature information can be obtained, the classification accuracy can be improved according to the feature classification, the feature information of each second feature map can be reserved through fusion processing, the feature information is rich, the information redundancy can be reduced, the occupation of processing resources is reduced, and the processing efficiency is improved.
In a possible implementation manner, performing fusion processing on the second feature maps in each second feature map group to obtain a first feature vector corresponding to each segmentation coefficient includes:
performing first dimension reduction processing on at least one second feature map in a second target feature map group, wherein the second target feature map group is any one or more feature map groups in the second feature map group;
and obtaining a first feature vector corresponding to each partition coefficient according to each second feature map group after the first dimension reduction processing.
In a possible implementation manner, obtaining, according to each second feature map group after the first dimension reduction processing, a first feature vector corresponding to each partition coefficient includes:
splicing the second feature maps in the second feature map groups subjected to the first dimension reduction processing respectively to obtain third feature maps respectively;
and carrying out second dimension reduction processing on the third feature map to obtain the first feature vector corresponding to each division coefficient.
In one possible implementation, the classification networks are distributed over different processors, respectively.
By the method, the resource occupation of each processor can be reduced, the complexity of classification processing is reduced, and the condition that a single processing resource cannot meet the processing requirement is avoided.
In one possible implementation, the segmentation coefficient includes a segmentation number and a segmentation overlap degree, the segmentation number represents the number of the features obtained by segmenting the first feature map, and the segmentation overlap degree represents the overlap degree between the features obtained by segmenting the first feature map.
According to an aspect of the present disclosure, there is provided a classification network training method, including:
inputting a sample image into a feature extraction network to obtain a first training feature map of the sample image;
segmenting the first training feature map according to at least one segmentation coefficient to obtain a second training feature map group which is obtained by segmenting according to each segmentation coefficient, wherein the second training feature map group comprises at least one second training feature map;
performing fusion processing on the second training feature maps in the second training feature map groups to obtain first training feature vectors corresponding to the segmentation coefficients;
and training at least one classification network according to the first training feature vectors corresponding to the segmentation coefficients, wherein each classification network corresponds to each first training feature vector.
In a possible implementation manner, training at least one classification network according to the first feature vector corresponding to each partition coefficient includes:
inputting the first training feature vectors into corresponding classification networks respectively to obtain classification results of the classification networks respectively;
respectively determining network loss corresponding to each classification network according to the classification result of each classification network and the labeling information of the sample image;
and adjusting the network parameters of each classified network and the feature extraction network according to the network loss corresponding to each classified network.
In one possible implementation, adjusting the network parameters of each classification network and the feature extraction network according to the network loss corresponding to each classification network includes:
adjusting network parameters of each classified network according to the network loss corresponding to each classified network;
and adjusting the network parameters of the characteristic extraction network according to the network loss corresponding to each classified network.
By the method, the classification networks can be trained according to the network loss of the classification networks respectively, the training of the classification networks can be independent, the training of the classification networks can be completed through a plurality of processing resources, the resource occupation of each processing resource is reduced, the training complexity is reduced, and the condition that a single processing resource cannot meet the training requirement is avoided.
In one possible implementation, adjusting the network parameters of the feature extraction network according to the network loss corresponding to each classification network includes:
carrying out weighted summation on the network loss corresponding to each classified network to obtain the network loss of the feature extraction network;
and adjusting the network parameters of the feature extraction network according to the network loss of the feature extraction network.
According to an aspect of the present disclosure, there is provided an image classification apparatus including:
the first extraction module is used for extracting a first feature map of the image to be processed;
the first segmentation module is used for segmenting the first feature map according to at least one segmentation coefficient to obtain a second feature map group which is obtained after segmentation according to each segmentation coefficient, and the second feature map group comprises at least one second feature map;
a first fusion module, configured to perform fusion processing on the second feature maps in each second feature map group to obtain first feature vectors corresponding to each segmentation coefficient;
and the classification module is used for respectively inputting the first characteristic vectors into corresponding classification networks to obtain a classification result corresponding to each classification network, and classifying the image to be processed according to the classification results obtained by all the classification networks.
In one possible implementation, the first fusion module is further configured to:
performing first dimension reduction processing on at least one second feature map in a second target feature map group, wherein the second target feature map group is any one or more feature map groups in the second feature map group;
and obtaining a first feature vector corresponding to each partition coefficient according to each second feature map group after the first dimension reduction processing.
In one possible implementation, the first fusion module is further configured to:
splicing the second feature maps in the second feature map groups subjected to the first dimension reduction processing respectively to obtain third feature maps respectively;
and performing second dimension reduction processing on the third feature map to obtain the first feature vector corresponding to each division coefficient.
In one possible implementation, the classification networks are distributed over different processors, respectively.
In one possible implementation, the segmentation coefficient includes a segmentation number and a segmentation overlap degree, the segmentation number represents the number of the features obtained by segmenting the first feature map, and the segmentation overlap degree represents the overlap degree between the features obtained by segmenting the first feature map.
According to an aspect of the present disclosure, there is provided a classification network training apparatus including:
the second extraction module is used for inputting the sample image into a feature extraction network to obtain a first training feature map of the sample image;
the second segmentation module is used for segmenting the first training feature map according to at least one segmentation coefficient to obtain a second training feature map group which is obtained after segmentation according to each segmentation coefficient, wherein the second training feature map group comprises at least one second training feature map;
a second fusion module, configured to perform fusion processing on the second training feature maps in each of the second training feature map groups to obtain first training feature vectors corresponding to each of the segmentation coefficients;
and the training module is used for training at least one classification network according to the first training feature vectors corresponding to the segmentation coefficients, wherein each classification network corresponds to each first training feature vector.
In one possible implementation, the training module is further configured to:
inputting the first training feature vectors into corresponding classification networks respectively to obtain classification results of the classification networks respectively;
respectively determining network loss corresponding to each classification network according to the classification result of each classification network and the labeling information of the sample image;
and adjusting the network parameters of each classified network and the feature extraction network according to the network loss corresponding to each classified network.
In one possible implementation, the training module is further configured to:
adjusting network parameters of each classified network according to the network loss corresponding to each classified network;
and adjusting the network parameters of the characteristic extraction network according to the network loss corresponding to each classified network.
In one possible implementation, the training module is further configured to:
carrying out weighted summation on the network loss corresponding to each classified network to obtain the network loss of the feature extraction network;
and adjusting the network parameters of the feature extraction network according to the network loss of the feature extraction network.
According to an aspect of the present disclosure, there is provided an electronic device including:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to: the above method is performed.
According to an aspect of the present disclosure, there is provided a computer readable storage medium having stored thereon computer program instructions which, when executed by a processor, implement the above-described method.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Other features and aspects of the present disclosure will become apparent from the following detailed description of exemplary embodiments, which proceeds with reference to the accompanying drawings.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure.
FIG. 1 shows a flow diagram of an image classification method according to an embodiment of the present disclosure;
FIG. 2 shows a flow diagram of a classification network training method according to an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating an application of a classification network training method according to an embodiment of the present disclosure;
fig. 4 shows a block diagram of an image classification apparatus according to an embodiment of the present disclosure;
FIG. 5 shows a block diagram of a classification network training apparatus according to an embodiment of the present disclosure;
FIG. 6 shows a block diagram of an electronic device according to an embodiment of the disclosure;
fig. 7 shows a block diagram of an electronic device according to an embodiment of the disclosure.
Detailed Description
Various exemplary embodiments, features and aspects of the present disclosure will be described in detail below with reference to the accompanying drawings. In the drawings, like reference numbers can indicate functionally identical or similar elements. While the various aspects of the embodiments are presented in drawings, the drawings are not necessarily drawn to scale unless specifically indicated.
The word "exemplary" is used exclusively herein to mean "serving as an example, embodiment, or illustration. Any embodiment described herein as "exemplary" is not necessarily to be construed as preferred or advantageous over other embodiments.
The term "and/or" herein is merely an association relationship describing an associated object, and means that there may be three relationships, for example, a and/or B, which may mean: a exists alone, A and B exist simultaneously, and B exists alone. In addition, the term "at least one" herein means any one of a plurality or any combination of at least two of a plurality, for example, including at least one of A, B, C, and may mean including any one or more elements selected from the group consisting of A, B and C.
Furthermore, in the following detailed description, numerous specific details are set forth in order to provide a better understanding of the present disclosure. It will be understood by those skilled in the art that the present disclosure may be practiced without some of these specific details. In some instances, methods, means, elements and circuits that are well known to those skilled in the art have not been described in detail so as not to obscure the subject matter of the present disclosure.
Fig. 1 shows a flowchart of an image classification method according to an embodiment of the present disclosure, as shown in fig. 1, the method comprising:
in step S11, a first feature map of the image to be processed is extracted;
in step S12, segmenting the first feature map according to at least one segmentation coefficient, and obtaining a second feature map group obtained by segmenting according to each segmentation coefficient, where the second feature map group includes at least one second feature map;
in step S13, performing fusion processing on the second feature maps in the second feature map groups to obtain first feature vectors corresponding to the segmentation coefficients;
in step S14, the first feature vectors are respectively input to corresponding classification networks to obtain a classification result corresponding to each classification network, and the image to be processed is classified according to the classification results obtained by all the classification networks.
According to the image classification method disclosed by the embodiment of the disclosure, the second feature map can be obtained through the segmentation coefficient and the first feature map of the image to be processed, the second feature map is subjected to fusion processing to obtain at least one first feature vector, and more feature information can be obtained, so that the classification accuracy can be improved in the process of classifying according to the features, and the feature information of each second feature map can be reserved through the fusion processing, so that the feature information is rich, the information redundancy can be reduced, the occupation of processing resources is reduced, and the processing efficiency is improved.
In one possible implementation, the image classification method may be performed by a terminal device or other processing device, where the terminal device may be a User Equipment (UE), a mobile device, a User terminal, a cellular phone, a cordless phone, a Personal Digital Assistant (PDA), a handheld device, a computing device, a vehicle-mounted device, a wearable device, or the like. The other processing devices may be servers or cloud servers, etc. In some possible implementations, the method may be implemented by a processor invoking computer readable instructions stored in a memory.
In a possible implementation manner, in step S11, the process of extracting the first feature map of the image to be processed may be performed by a feature extraction network, which may be a deep learning neural network having a plurality of network levels, such as a convolutional neural network, or another network, and is not limited herein. One or more target objects, which may be people, vehicles, articles, and the like, may be included in the image to be processed.
In one possible implementation, the image to be processed may be input into a feature extraction network, and a plurality of network levels of the feature extraction network may sequentially perform feature extraction processing, where the network levels may include a convolutional layer, an active layer, and the like, and in an example, after passing through the active layer, the feature extraction network may output a first feature map of the image to be processed.
In one possible implementation manner, in step S12, the segmentation coefficient includes a segmentation number and a segmentation overlap degree, the segmentation number represents the number of the features obtained by segmenting the first feature map, and the segmentation overlap degree represents the overlap degree between the features obtained by segmenting the first feature map. In the example, the ith (1 ≦ i ≦ n, n is the number of division coefficients, i and n are integers) division coefficients are the number i of division coefficients that divide the first feature map into the second feature maps, i second feature maps may constitute the second feature map group, and the height of each second feature map is that of the first feature map
Figure GDA0003624473610000051
The degree of overlap is μ.
In an example, the number of the first feature map divided into the second feature maps may be 1, that is, the first feature map, that is, the second feature map, is not divided.
In an example, the number of the division of the first feature map into the second feature maps may be 2, that is, the first feature map may be divided into two second feature maps, and the two second feature maps may have a certain overlap, and the overlap portion may be determined according to an overlap degree between the second feature maps, which may be represented by an area ratio of an overlap region between the second feature maps to the first feature map. For example, the first feature map may be divided into two second feature maps in the height direction, the second feature maps being wideThe degree is consistent with the first profile, and the height of each second profile is 2/3 of the first profile, i.e., the degree of overlap is 1/3. The number of partitions of the first profile into second profiles may be 3, the first profile may be partitioned into three second profiles, each second profile having a height of 1/2 the first profile, the overlap may be 1/4 … …, the first profile may be partitioned into n second profiles, each second profile having a height of 1/4 … … the first profile
Figure GDA0003624473610000061
The degree of overlap is μ. The segmented second feature maps can have a certain overlap with each other, so that the classification result has robustness, for example, under the conditions that the appearance shooting of the target object is unclear, the posture is complex, the proportion of the target object in the image is small, the background is complex, or the target object is incomplete in the image, the classification processing is complex, the second feature maps in the second feature map group have a certain overlap with each other, so that each second feature map has a part of the same features, so that the second feature maps have a certain relation, namely, the difference between the second feature maps is reduced, so that the training process is more stable, and the robustness of the classification result is improved.
In an example, the first feature map may be divided into a plurality of irregular patterns, and the like, and the dividing manner is not limited in the present disclosure.
In one possible implementation manner, in step S13, a fusion process may be performed on the second feature maps in each second feature map group to obtain a first feature vector corresponding to each of the division coefficients. Step S13 may include: performing first dimension reduction processing on at least one second feature map in a second target feature map group, wherein the second target feature map group is any one or more feature map groups in the second feature map group; and obtaining a first feature vector corresponding to each partition coefficient according to each second feature map group after the first dimension reduction processing.
In an example, taking the ith group of second feature maps as an example, the first dimension reduction processing may be performed on i second feature maps in the ith group of second feature maps, respectively, to obtain second feature vectors of the second feature maps (i.e., the second feature map group after dimension reduction). And a first feature vector corresponding to the ith partition coefficient may be obtained based on the second feature vector. Obtaining a first feature vector corresponding to each division coefficient according to each second feature map group after the dimension reduction processing, including: splicing the second feature maps in the second feature map groups subjected to the first dimension reduction processing respectively to obtain third feature maps respectively; and performing second dimension reduction processing on the third feature map to obtain the first feature vector corresponding to each division coefficient.
In an example, the second feature maps in the second feature map groups after the first dimension reduction processing may be subjected to a stitching process, that is, i second feature vectors are stitched, for example, each second feature vector may be used as one feature channel of a third feature map, that is, the second feature vectors are merged into the third feature map. And the third feature map can be subjected to dimensionality reduction to obtain a first feature vector f corresponding to the target classification network i . The first feature vectors f corresponding to the 1 st through nth classification networks can be determined in the above manner 1 ,f 2 …f n
In an example, the first dimension reduction processing may not be performed on each second feature map in the second feature map group, and the second feature maps may be directly subjected to the stitching processing to obtain the third feature map, and the second dimension reduction processing is performed on the third feature map to obtain the first feature vector.
In one possible implementation, in step S14, the segmentation coefficients may respectively correspond to the classification networks, that is, the number of the classification networks may be n. The first feature vectors corresponding to the respective division coefficients may be input into the classification networks corresponding to the respective division coefficients, and the classification networks may output the classification results, respectively.
In one possible implementation, the n first feature vectors respectively contain feature information of different segmentation granularities, e.g., f 1 Feature information which may comprise a full map of the first feature map, f 2 May include a first feature map divided intoThe feature information … … of the two second feature maps may input the n first feature vectors into the corresponding classification networks for processing. Each classification network can perform feature extraction processing on the first feature vector to obtain a classification result of each classification network, for example, the ith classification network can perform feature extraction processing on the ith first feature vector f i And (5) carrying out feature extraction processing to obtain the ith classification result. In an example, the classification result may be a feature vector representing a category of the image to be processed, and the present disclosure does not limit the classification result.
In an example, the image to be processed and the reference image may be respectively input to the feature extraction network, and the classification results of the image to be processed and the reference image are respectively obtained by the respective classification networks, and the feature similarity of the classification results of the image to be processed and the reference image is determined, for example, if the feature similarity of the classification results of the image to be processed and the reference image is greater than or equal to a similarity threshold, the target object in the image to be processed and the target object in the reference image are in the same class, that is, the image to be processed and the reference image may be classified into the same class, otherwise, the image to be processed and the reference image may be classified into different classes. Alternatively, the classification result may be used to compare the image to be processed with a plurality of reference images, for example, to determine the feature similarity between the classification result and the reference features of each reference image, to determine the target reference feature with the highest feature similarity, and to classify the image to be processed and the reference images corresponding to the target reference feature into the same class. Still alternatively, the classification results of the multiple to-be-processed images are respectively compared with one or more reference images to classify the multiple to-be-processed images, for example, the classification of each video frame in a segment of video can be respectively determined (e.g., video frames including a target object can be classified into one class, video frames not including a target object can be classified into another class, etc.).
In one possible implementation, the classification networks are distributed over different processors, respectively. For example, it may be distributed across multiple GPUs (Graphics Processing units). The number of the classification networks can be multiple, the related network parameters are more, and the calculation amount in the classification processing process is larger. However, since the processing of each classification network is independent, the classification processing may be distributed over a plurality of processors, and may be performed separately, for example, one GPU may perform the classification processing of only one classification network, or the classification networks may be divided into M (M is a positive integer) groups and the classification processing of the M-group classification network may be performed by the M GPUs separately. In other examples, the processor may further include a CPU (Central Processing Unit), an FPGA (Field-Programmable Gate Array), an MCU (Microcontroller Unit), and the like, and the disclosure is not limited to the processor.
By the method, the resource occupation of each processor can be reduced, the complexity of classification processing is reduced, and the condition that a single processing resource cannot meet the processing requirement is avoided.
According to the image classification method disclosed by the embodiment of the disclosure, the second feature map can be obtained by segmenting the coefficient and the first feature map of the sample image, and the second feature map is subjected to fusion processing, so that more feature information is obtained, information redundancy is reduced, and processing efficiency is improved. And the images to be processed are classified according to a plurality of classification results output by a plurality of classification networks, so that the classification accuracy can be improved.
In one possible implementation, the feature extraction network may be trained prior to using the feature extraction network and classification network.
Fig. 2 shows a flowchart of a classification network training method according to an embodiment of the present disclosure, as shown in fig. 2, the method includes:
in step S21, inputting a sample image into a feature extraction network, and obtaining a first training feature map of the sample image;
in step S22, segmenting the first training feature map according to at least one segmentation coefficient to obtain a second training feature map set segmented according to each segmentation coefficient, where the second training feature map set includes at least one second training feature map;
in step S23, performing fusion processing on the second training feature maps in the second training feature map sets to obtain first training feature vectors corresponding to the segmentation coefficients;
in step S24, at least one classification network is trained according to the first training feature vectors corresponding to the segmentation coefficients, where each classification network corresponds to each first training feature vector.
In one possible implementation manner, in step S21, the sample image may be input into a feature extraction network, and a plurality of network levels of the feature extraction network may sequentially perform the feature extraction process, where the network levels may include a convolutional layer, an active layer, and the like, and in an example, after passing through the active layer, the feature extraction network may output a first training feature map of the sample image.
In a possible implementation manner, in step S22, the sample image may be segmented in the manner of segmenting the image to be processed as described above, and a second training feature map set corresponding to each segmentation coefficient is obtained, where the second training feature map set includes at least one second training feature map. In other implementations, the sample image may also be segmented in other manners, which are not limited herein.
In one possible implementation manner, in step S23, the second training feature maps in each second training feature map group may be fused in the manner of the above-described fusion process for the second feature maps, so as to obtain the first training feature vectors corresponding to the respective division coefficients. The second training feature map may also be subjected to fusion processing in other manners to obtain the first training feature vector corresponding to each partition coefficient, which is not limited herein.
In one possible implementation manner, in step S24, the classification networks corresponding to the segmentation coefficients may be trained respectively according to the first training feature vectors corresponding to the segmentation coefficients.
In one possible implementation, step S24 may include: inputting each first training feature vector into a corresponding classification network respectively, and obtaining a classification result of each classification network respectively; respectively determining network loss corresponding to each classification network according to the classification result of each classification network and the labeling information of the sample image; and adjusting the network parameters of each classified network and the feature extraction network according to the network loss corresponding to each classified network.
In one possible implementation manner, the first training features corresponding to the segmentation coefficients may be input into the classification networks corresponding to the segmentation coefficients, and the classification networks may output the classification results.
In one possible implementation manner, the network loss corresponding to each classification network may be determined according to the classification result of each classification network and the labeling information of the sample image. In an example, the annotation information of the sample image may be a feature similarity of the sample image and the reference image, and in an example, if the sample image and the target object in the reference image are the same person, the feature similarity of the sample image and the reference image may be annotated as 1, and if the sample image and the target object in the reference image are not the same person, the feature similarity of the sample image and the reference image may be annotated as 0.
In an example, the features of the reference image may be obtained by a feature extraction network and at least one classification network, each of which may output the features of the reference image, and n classification networks may obtain the features of the n reference images. The feature similarity between the classification result of the sample image and the features of the reference image by each classification network can be respectively determined, and the network loss corresponding to each classification network is determined according to the difference between the feature similarity determined in the above manner and the labeled feature similarity. For example, the ith classification network may output the classification result of the sample image (ith classification result) and the feature of the reference image (ith feature), determine the feature similarity (e.g., cosine similarity, etc.) between the ith classification result and the ith feature, and determine the network loss L corresponding to the ith classification network according to the difference between the feature similarity and the labeling information of the sample image i . The network loss L corresponding to each classified network can be respectively determined in the above mode 1 ,L 2 …L n
In one possible implementation, the network parameters of each of the classification networks and the feature extraction networks are adjusted according to the network loss. Wherein, according to the network loss corresponding to each classified network, adjust the network parameter of each classified network and characteristic extraction network, include: adjusting network parameters of each classified network according to the network loss corresponding to each classified network; and adjusting the network parameters of the characteristic extraction network according to the network loss corresponding to each classified network.
In an example, the network parameters of the classification networks may be adjusted according to the network loss corresponding to the classification networks, and the adjustment of the network parameters of the classification networks may be independent of each other, that is, a classification network may adjust its network parameters only through the network loss corresponding to itself, regardless of the network loss and the network parameters of other classification networks. For example, the ith network loss L may be determined i Gradients of parameters for the ith classification network
Figure GDA0003624473610000091
(p represents any network parameter of the ith classification network), and each network parameter is adjusted by a gradient descent method in a direction that minimizes network loss. According to the network loss L corresponding to each classified network in the mode 1 ,L 2 …L n To adjust the network parameters of each classification network separately.
In an example, the number of the classification networks may be multiple, the related network parameters are more, in the training process, the resource occupancy rate on the processing resources such as the GPU is higher, and the training complexity is higher, and a single processing resource may not be able to carry too much training of the classification network. Since the adjustment of the network parameters of each classification network can be independent of each other, each classification network can be trained by processing resources such as multiple GPUs, for example, one GPU can only perform the training task of one classification network. Alternatively, the plurality of classification networks may be divided into M (M is a positive integer) groups, and the M groups of classification networks may be trained by M GPUs, respectively. In addition, because the training of each set of classification networks is independent, each set of classification networks can be trained in batch, for example, one or more sets of classification networks can be selected for training, and after the training of the selected set of classification networks is completed, other sets of classification networks can be selected for training. The present disclosure does not limit the amount of processing resources used.
In an example, the network loss L can correspond according to each classified network 1 ,L 2 …L n To adjust network parameters of the feature extraction network. The feature extraction network is a neural network at the front end of each classification network, and the network loss of the feature extraction network can be determined according to all the network losses. Adjusting network parameters of the feature extraction network according to network losses corresponding to the classification networks, including: carrying out weighted summation on the network loss corresponding to each classified network to obtain the network loss of the feature extraction network; and adjusting the network parameters of the feature extraction network according to the network loss of the feature extraction network. In an example, L can be paired 1 ,L 2 …L n And carrying out treatments such as summation or weighted summation and the like to obtain the network loss L of the feature extraction network, determining the gradient of the L to each network parameter of the feature extraction network, and further adjusting each network parameter by a gradient descent method according to the direction of minimizing the network loss.
In another example, the feature extraction network may be trained first, after the feature extraction network training is completed, the network parameters of the feature extraction network are fixed, and then each classification network is trained respectively.
In one possible implementation, the feature extraction network and each classification network may be subjected to multiple network adjustments in the above manner, that is, training for multiple training cycles. And when the training condition is met, the training of the feature extraction network and each classification network is completed. The training condition may include a number of training times (i.e., a number of training cycles), for example, when the number of training times reaches a preset number, the training condition is satisfied. Alternatively, the training condition may include the magnitude or convergence of the network loss, e.g., when the network loss L is 1 ,L 2 …L n And when the loss is less than or equal to the loss threshold or the loss is converged within a preset interval, the training condition is met. After training is completed, a trained feature extraction network and classification networks can be obtainedAnd each classification network can be used for classifying the images, and in the classification processing, the feature extraction network and all the classification networks can be used for obtaining the classification results output by all the classification networks, and the feature extraction network and one or a part of the classification networks can also be used for obtaining the classification results output by one or a part of the classification networks. The present disclosure does not limit the training conditions.
By the method, the classification networks can be trained according to the network loss of the classification networks respectively, the training of the classification networks can be independent, the training of the classification networks can be completed through a plurality of processing resources, the resource occupation of each processing resource is reduced, the training complexity is reduced, and the condition that a single processing resource cannot meet the training requirement is avoided.
In a possible implementation manner, the classification of the image to be processed may be obtained by using the trained feature extraction network and at least one classification network. In an example, one or more target objects may be included in the image to be processed, which may be people, vehicles, items, and the like.
In a possible implementation manner, the images to be processed may be classified by using one or a part of the classification networks and the feature extraction networks, or may be classified by using all the classification networks and the feature extraction networks. The trained feature extraction network can extract a first feature map of the image to be processed and segment the first feature map according to the segmentation coefficient. And performing dimension reduction on the second feature maps obtained after the division to obtain second feature vectors of the second feature maps, and further performing splicing, dimension reduction and other processing on the second feature vectors to obtain the first feature vectors. And inputting the first feature vector into a classification network for processing to obtain a classification result.
In an example, the classification result is a vector form result, a feature similarity (e.g., cosine similarity, etc.) between the classification result and a feature of the reference image may be determined, and the category of the image to be processed may be determined according to the feature similarity. For example, if the feature similarity is greater than or equal to a similarity threshold, the to-be-processed image and the reference image may be classified into one category. Alternatively, the classification result may be used to compare the image to be processed with a plurality of reference images, for example, to determine the feature similarity between the classification result and the reference features of each reference image, to determine the target reference feature with the highest feature similarity, and to classify the image to be processed and the reference images corresponding to the target reference feature into the same class. Still alternatively, the classification results of the multiple to-be-processed images are respectively compared with one or more reference images to classify the multiple to-be-processed images, for example, the classification of each video frame in a segment of video can be respectively determined (e.g., video frames including a target object can be classified into one class, video frames not including a target object can be classified into another class, etc.).
According to the classification network training method disclosed by the embodiment of the disclosure, at least one first feature vector can be obtained through the segmentation coefficient and the first feature map of the sample image, and at least one class of features of the sample image can be obtained, so that the neural network obtains feature information of different segmentation granularities, the obtained feature information is richer, various features can be obtained under the conditions that the appearance of a target object is not clear in shooting, the posture is complex, the occupied proportion in the image is small, the background is complex, the target object is incomplete in the image and the like, and the performance of the neural network is improved. The training of each classification network can be independent, the training of each classification network can be completed through a plurality of processing resources, the resource occupation of each processing resource is reduced, the training complexity is reduced, and the condition that a single processing resource cannot meet the training requirement is avoided. Furthermore, in the training process, compared with the training of only one or a part of classification networks, the training of all the classification networks and the feature extraction networks can improve the performance of the feature extraction networks and each classification network, and when the images to be processed are classified, the feature extraction networks and one or a part of the classification networks can be used, or all the classification networks can be used, so that the flexibility of using the classification networks is improved, and the classification accuracy is improved.
Fig. 3 is a schematic diagram illustrating an application of a classification network training method according to an embodiment of the present disclosure, as shown in fig. 3, in a training process of a neural network, a sample image including one or more target objects may be input into a feature extraction network, and the feature extraction network may output a first training feature map of the sample image.
In one possible implementation manner, the first training feature map may be segmented according to a plurality of segmentation coefficients, and in an example, the first training feature map may be segmented according to the segmentation coefficients corresponding to the classification networks, respectively, to obtain the second training feature map corresponding to the classification networks. In an example, the number of the first training feature map being segmented into the second training feature map may be 1, that is, the first training feature map, that is, the second training feature map, is not segmented. The first training feature map may also be partitioned into 2 second training feature maps, 3 second training feature maps, and 4 second training feature maps.
In a possible implementation manner, for the second training feature maps of any classification network, the dimension reduction processing may be performed on each second training feature map to obtain a second training feature vector. The second training feature vector can be spliced and subjected to dimensionality reduction to obtain a first training feature vector which can be input into the classification network. The first feature vector f that can be input into each classification network can be obtained in the above manner 1 ,f 2 ,f 3 ,f 4
In one possible implementation, the classification networks and the feature extraction network may be trained by first training feature vectors corresponding to each classification network. The first training feature vector f can be transformed 1 ,f 2 ,f 3 ,f 4 The classification result is input into each classification network, as shown in the figure, the 1 st classification result, the 2 nd classification result, the 3 rd classification result and the 4 th classification result can be obtained. And determining the network loss L corresponding to each classification network according to each classification result and the labeling information of the sample image 1 ,L 2 ,L 3 ,L 4
In one possible implementationThe network parameters of the classified networks can be adjusted according to the network loss corresponding to the classified networks, for example, the network loss L can be adjusted according to 1 To adjust the network parameters of the first classified network according to the network loss L 2 To adjust the network parameters of the second classification network according to the network loss L 3 To adjust the network parameters of the third classification network according to the network loss L 4 To adjust network parameters of the fourth classification network. The adjustment of the network parameters of each classification network can be independent of each other, so that each classification network can be trained through a plurality of processing resources such as GPUs. For example, one GPU may perform the training task of only one classification network, i.e., the training task of each classification network may be performed by 4 GPUs.
In one possible implementation, the network loss L corresponding to each classified network can be used 1 ,L 2 ,L 3 ,L 4 Determining the network loss L of the feature extraction network, e.g., L 1 ,L 2 ,L 3 ,L 4 And carrying out processing such as summation or weighted summation and the like to obtain the network loss L of the feature extraction network, and adjusting the network parameters of the feature extraction network according to the L.
In a possible implementation manner, the feature extraction network and each classification network may be trained for multiple times in the above manner, so as to obtain the trained classification network and feature extraction network. And the trained classification network and the trained feature extraction network can be used for classifying the images to be processed. For example, the image to be processed may be classified through the feature extraction network and one, a part, or all of the classification networks, one or more classification results of the image to be processed may be obtained, and the image to be processed may be classified using the one or more classification results.
In a possible implementation manner, the classification network training method and the image classification method may be used in a classification process of video frames, for example, a pedestrian in a surveillance video is queried, and a classification of each video frame in the surveillance video may be determined through a classification network and one or more feature extraction networks, that is, video frames including the pedestrian are classified into one class, video frames not including the pedestrian are classified into another class, and the like. The present disclosure does not limit the application field of the classification network training method and the image classification method.
It is understood that the above-mentioned method embodiments of the present disclosure can be combined with each other to form a combined embodiment without departing from the logic of the principle, which is limited by the space, and the detailed description of the present disclosure is omitted.
In addition, the present disclosure also provides an image classification apparatus, a classification network training apparatus, an electronic device, a computer-readable storage medium, and a program, which can be used to implement any of the methods provided in the present disclosure, and the corresponding technical solutions and descriptions thereof will be described with reference to the corresponding descriptions of the method sections and will not be described again.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Fig. 4 shows a block diagram of an image classification apparatus according to an embodiment of the present disclosure, as shown in fig. 4, the apparatus including:
the first extraction module 11 is configured to extract a first feature map of the image to be processed;
a first segmentation module 12, configured to segment the first feature map according to at least one segmentation coefficient, and obtain a second feature map group obtained after segmentation according to each segmentation coefficient, where the second feature map group includes at least one second feature map;
a first fusion module 13, configured to perform fusion processing on the second feature maps in each second feature map group to obtain a first feature vector corresponding to each segmentation coefficient;
and the classification module 14 is configured to input the first feature vectors to corresponding classification networks respectively, obtain a classification result corresponding to each classification network, and classify the image to be processed according to the classification results obtained by all the classification networks.
In one possible implementation, the first fusion module is further configured to:
performing first dimension reduction processing on at least one second feature map in a second target feature map group, wherein the second target feature map group is any one or more feature map groups in the second feature map group;
and obtaining a first feature vector corresponding to each partition coefficient according to each second feature map group after the first dimension reduction processing.
In one possible implementation, the first fusion module is further configured to:
splicing the second feature maps in the second feature map groups subjected to the first dimension reduction processing respectively to obtain third feature maps respectively;
and performing second dimension reduction processing on the third feature map to obtain the first feature vector corresponding to each division coefficient.
In one possible implementation, the classification networks are distributed over different processors, respectively.
In one possible implementation, the segmentation coefficient includes a segmentation number and a segmentation overlap degree, the segmentation number represents the number of the features obtained by segmenting the first feature map, and the segmentation overlap degree represents the overlap degree between the features obtained by segmenting the first feature map.
Fig. 5 shows a block diagram of a classification network training apparatus according to an embodiment of the present disclosure, as shown in fig. 5, the apparatus includes:
the second extraction module 21 is configured to input the sample image into a feature extraction network, and obtain a first training feature map of the sample image;
a second segmentation module 22, configured to segment the first training feature map according to at least one segmentation coefficient to obtain a second training feature map set obtained after segmentation according to each segmentation coefficient, where the second training feature map set includes at least one second training feature map;
a second fusion module 23, configured to perform fusion processing on the second training feature maps in each of the second training feature map groups to obtain first training feature vectors corresponding to each of the segmentation coefficients;
a training module 24, configured to train at least one classification network according to the first training feature vectors corresponding to the segmentation coefficients, where each classification network corresponds to each first training feature vector.
In one possible implementation, the training module is further configured to:
inputting each first training feature vector into a corresponding classification network respectively, and obtaining a classification result of each classification network respectively;
respectively determining network loss corresponding to each classification network according to the classification result of each classification network and the labeling information of the sample image;
and adjusting the network parameters of each classified network and the feature extraction network according to the network loss corresponding to each classified network.
In one possible implementation, the training module is further configured to:
adjusting network parameters of each classified network according to the network loss corresponding to each classified network;
and adjusting the network parameters of the characteristic extraction network according to the network loss corresponding to each classified network.
In one possible implementation, the training module is further configured to:
carrying out weighted summation on the network loss corresponding to each classification network to obtain the network loss of the feature extraction network;
and adjusting the network parameters of the feature extraction network according to the network loss of the feature extraction network.
In some embodiments, functions of or modules included in the apparatus provided in the embodiments of the present disclosure may be used to execute the method described in the above method embodiments, and for specific implementation, reference may be made to the description of the above method embodiments, and for brevity, details are not described here again
Embodiments of the present disclosure also provide a computer-readable storage medium having stored thereon computer program instructions, which when executed by a processor, implement the above-mentioned method. The computer readable storage medium may be a non-volatile computer readable storage medium.
An embodiment of the present disclosure further provides an electronic device, including: a processor; a memory for storing processor-executable instructions; wherein the processor is configured as the above method.
The electronic device may be provided as a terminal, server, or other form of device.
Fig. 6 is a block diagram illustrating an electronic device 800 in accordance with an example embodiment. For example, the electronic device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, and the like.
Referring to fig. 6, electronic device 800 may include one or more of the following components: processing component 802, memory 804, power component 806, multimedia component 808, audio component 810, input/output (I/O) interface 812, sensor component 814, and communication component 816.
The processing component 802 generally controls overall operation of the electronic device 800, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations. The processing components 802 may include one or more processors 820 to execute instructions to perform all or a portion of the steps of the methods described above. Further, the processing component 802 can include one or more modules that facilitate interaction between the processing component 802 and other components. For example, the processing component 802 can include a multimedia module to facilitate interaction between the multimedia component 808 and the processing component 802.
The memory 804 is configured to store various types of data to support operations at the electronic device 800. Examples of such data include instructions for any application or method operating on the electronic device 800, contact data, phonebook data, messages, pictures, videos, and so forth. The memory 804 may be implemented by any type or combination of volatile or non-volatile memory devices such as Static Random Access Memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic or optical disks.
The power supply component 806 provides power to the various components of the electronic device 800. The power components 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the electronic device 800.
The multimedia component 808 includes a screen that provides an output interface between the electronic device 800 and a user. In some embodiments, the screen may include a Liquid Crystal Display (LCD) and a Touch Panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive an input signal from a user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front facing camera and/or a rear facing camera. The front camera and/or the rear camera may receive external multimedia data when the electronic device 800 is in an operation mode, such as a shooting mode or a video mode. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
The audio component 810 is configured to output and/or input audio signals. For example, the audio component 810 includes a Microphone (MIC) configured to receive external audio signals when the electronic device 800 is in an operational mode, such as a call mode, a recording mode, and a voice recognition mode. The received audio signals may further be stored in the memory 804 or transmitted via the communication component 816. In some embodiments, audio component 810 also includes a speaker for outputting audio signals.
The I/O interface 812 provides an interface between the processing component 802 and peripheral interface modules, which may be keyboards, click wheels, buttons, etc. These buttons may include, but are not limited to: a home button, a volume button, a start button, and a lock button.
Sensor assembly 814 includes one or more sensors for providing various aspects of state assessment for electronic device 800. For example, the sensor assembly 814 may detect an open/closed state of the electronic device 800, the relative positioning of components, such as a display and keypad of the electronic device 800, the sensor assembly 814 may also detect a change in the position of the electronic device 800 or a component of the electronic device 800, the presence or absence of user contact with the electronic device 800, orientation or acceleration/deceleration of the electronic device 800, and a change in the temperature of the electronic device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of a nearby object without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
The communication component 816 is configured to facilitate wired or wireless communication between the electronic device 800 and other devices. The electronic device 800 may access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives broadcast signals or broadcast related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 further includes a Near Field Communication (NFC) module to facilitate short-range communications. For example, the NFC module may be implemented based on Radio Frequency Identification (RFID) technology, infrared data association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth (BT) technology, and other technologies.
In an exemplary embodiment, the electronic device 800 may be implemented by one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors, or other electronic components for performing the above-described methods.
In an exemplary embodiment, a non-transitory computer-readable storage medium, such as the memory 804, is also provided that includes computer program instructions executable by the processor 820 of the electronic device 800 to perform the above-described methods.
Fig. 7 is a block diagram illustrating an electronic device 1900 in accordance with an example embodiment. For example, the electronic device 1900 may be provided as a server. Referring to fig. 7, electronic device 1900 includes a processing component 1922 further including one or more processors and memory resources, represented by memory 1932, for storing instructions, e.g., applications, that are executable by processing component 1922. The application programs stored in memory 1932 may include one or more modules that each correspond to a set of instructions. Further, the processing component 1922 is configured to execute instructions to perform the above-described method.
The electronic device 1900 may also include a power component 1926 configured to perform power management of the electronic device 1900, a wired or wireless network interface 1950 configured to connect the electronic device 1900 to a network, and an input/output (I/O) interface 1958. The electronic device 1900 may operate based on an operating system stored in memory 1932, such as Windows Server, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, or the like.
In an exemplary embodiment, a non-transitory computer readable storage medium, such as the memory 1932, is also provided that includes computer program instructions executable by the processing component 1922 of the electronic device 1900 to perform the above-described methods.
The present disclosure may be systems, methods, and/or computer program products. The computer program product may include a computer-readable storage medium having computer-readable program instructions embodied thereon for causing a processor to implement various aspects of the present disclosure.
The computer readable storage medium may be a tangible device that can hold and store the instructions for use by the instruction execution device. The computer readable storage medium may be, for example, but not limited to, an electronic memory device, a magnetic memory device, an optical memory device, an electromagnetic memory device, a semiconductor memory device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a Static Random Access Memory (SRAM), a portable compact disc read-only memory (CD-ROM), a Digital Versatile Disc (DVD), a memory stick, a floppy disk, a mechanical coding device, such as punch cards or in-groove projection structures having instructions stored thereon, and any suitable combination of the foregoing. Computer-readable storage media as used herein is not to be interpreted as a transitory signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (e.g., optical pulses through a fiber optic cable), or an electrical signal transmitted through an electrical wire.
The computer-readable program instructions described herein may be downloaded from a computer-readable storage medium to a respective computing/processing device, or to an external computer or external storage device via a network, such as the internet, a local area network, a wide area network, and/or a wireless network. The network may include copper transmission cables, fiber optic transmission, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. The network adapter card or network interface in each computing/processing device receives computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in the respective computing/processing device.
The computer program instructions for carrying out operations of the present disclosure may be assembler instructions, Instruction Set Architecture (ISA) instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C + + or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, 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 the connection may be made to an external computer (for example, through the Internet using an Internet service provider). In some embodiments, aspects of the disclosure are implemented by personalizing an electronic circuit, such as a programmable logic circuit, a Field Programmable Gate Array (FPGA), or a Programmable Logic Array (PLA), with state information of computer-readable program instructions, which can execute the computer-readable program instructions.
Various aspects of the present disclosure are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the disclosure. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer-readable program instructions.
These computer-readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a computer readable storage medium that can direct a computer, programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable medium storing the instructions comprises an article of manufacture including instructions which implement the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other devices to cause a series of operational steps to be performed on the computer, other programmable apparatus or other devices to produce a computer implemented process such that the instructions which execute on the computer, other programmable apparatus or other devices implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present disclosure, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen in order to best explain the principles of the embodiments, the practical application, or technical improvements to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (18)

1. A method of classifying an image, the method comprising:
extracting a first feature map of an image to be processed;
segmenting the first feature map according to at least one segmentation coefficient to obtain a second feature map group which is obtained after segmentation according to each segmentation coefficient, wherein the second feature map group comprises at least one second feature map;
performing intra-group fusion processing on the second feature maps in the second feature map groups to obtain first feature vectors corresponding to the segmentation coefficients;
inputting the first feature vectors into corresponding classification networks respectively to obtain a classification result corresponding to each classification network, and classifying the images to be processed according to the classification results obtained by all the classification networks;
wherein each of the division coefficients corresponds to one classification network, the division coefficient includes a division number and a division overlapping degree, the division number represents the number of the features obtained by dividing the first feature map, and the division overlapping degree represents the overlapping degree between the features obtained by dividing the first feature map.
2. The method according to claim 1, wherein performing intra-group fusion processing on the second feature maps in each second feature map group to obtain a first feature vector corresponding to each partition coefficient includes:
performing first dimension reduction processing on at least one second feature map in a second target feature map group, wherein the second target feature map group is any one or more feature map groups in the second feature map group;
and obtaining a first feature vector corresponding to each partition coefficient according to each second feature map group after the first dimension reduction processing.
3. The method according to claim 2, wherein obtaining the first feature vector corresponding to each partition coefficient from each second feature map group after the first dimension reduction processing includes:
splicing the second feature maps in the second feature map groups subjected to the first dimension reduction processing respectively to obtain third feature maps respectively;
and performing second dimension reduction processing on the third feature map to obtain the first feature vector corresponding to each division coefficient.
4. The method according to any of claims 1-3, wherein the classification networks are distributed over different processors, respectively.
5. A classification network training method is characterized by comprising the following steps:
inputting a sample image into a feature extraction network to obtain a first training feature map of the sample image;
segmenting the first training feature map according to at least one segmentation coefficient to obtain a second training feature map group segmented according to each segmentation coefficient, wherein the second training feature map group comprises at least one second training feature map;
performing intra-group fusion processing on the second training feature maps in the second training feature map groups to obtain first training feature vectors corresponding to the segmentation coefficients;
training at least one classification network according to the first training feature vectors corresponding to the segmentation coefficients, wherein each classification network corresponds to each first training feature vector;
each segmentation coefficient corresponds to one classification network, and comprises a segmentation number and a segmentation overlapping degree, wherein the segmentation number represents the number of the features obtained by segmenting the first training feature map, and the segmentation overlapping degree represents the overlapping degree between the features obtained by segmenting the first training feature map.
6. The method of claim 5, wherein training at least one classification network based on the first feature vectors corresponding to the respective partition coefficients comprises:
inputting the first training feature vectors into corresponding classification networks respectively to obtain classification results of the classification networks respectively;
respectively determining network loss corresponding to each classification network according to the classification result of each classification network and the labeling information of the sample image;
and adjusting the network parameters of each classified network and the feature extraction network according to the network loss corresponding to each classified network.
7. The method of claim 6, wherein adjusting the network parameters of each of the classification networks and the feature extraction network based on the network loss corresponding to each of the classification networks comprises:
adjusting network parameters of each classification network according to the network loss corresponding to each classification network;
and adjusting the network parameters of the characteristic extraction network according to the network loss corresponding to each classified network.
8. The method of claim 7, wherein adjusting the network parameters of the feature extraction network based on the network loss corresponding to each classification network comprises:
carrying out weighted summation on the network loss corresponding to each classified network to obtain the network loss of the feature extraction network;
and adjusting the network parameters of the feature extraction network according to the network loss of the feature extraction network.
9. An image classification apparatus, characterized in that the apparatus comprises:
the first extraction module is used for extracting a first feature map of the image to be processed;
the first segmentation module is used for segmenting the first feature map according to at least one segmentation coefficient to obtain a second feature map group which is obtained after segmentation according to each segmentation coefficient, and the second feature map group comprises at least one second feature map;
the first fusion module is used for carrying out intra-group fusion processing on the second feature maps in each second feature map group to obtain first feature vectors corresponding to each segmentation coefficient;
the classification module is used for respectively inputting the first feature vectors into corresponding classification networks to obtain a classification result corresponding to each classification network, and classifying the image to be processed according to the classification results obtained by all the classification networks;
wherein each of the division coefficients corresponds to one classification network, the division coefficient includes a division number and a division overlapping degree, the division number represents the number of the features obtained by dividing the first feature map, and the division overlapping degree represents the overlapping degree between the features obtained by dividing the first feature map.
10. The apparatus of claim 9, wherein the first fusion module is further configured to:
performing first dimension reduction processing on at least one second feature map in a second target feature map group, wherein the second target feature map group is any one or more feature map groups in the second feature map group;
and obtaining a first feature vector corresponding to each division coefficient according to each second feature map group after the first dimension reduction processing.
11. The apparatus of claim 10, wherein the first fusion module is further configured to:
splicing the second feature maps in the second feature map groups subjected to the first dimension reduction processing respectively to obtain third feature maps respectively;
and carrying out second dimension reduction processing on the third feature map to obtain the first feature vector corresponding to each division coefficient.
12. The apparatus according to any of claims 9-11, wherein the classification networks are distributed over different processors, respectively.
13. A classification network training apparatus, comprising:
the second extraction module is used for inputting the sample image into a feature extraction network to obtain a first training feature map of the sample image;
the second segmentation module is used for segmenting the first training feature map according to at least one segmentation coefficient to obtain a second training feature map group which is obtained after segmentation according to each segmentation coefficient, wherein the second training feature map group comprises at least one second training feature map;
the second fusion module is used for performing in-group fusion processing on the second training feature maps in the second training feature map groups to obtain first training feature vectors corresponding to the segmentation coefficients;
a training module, configured to train at least one classification network according to the first training feature vectors corresponding to the segmentation coefficients, where each classification network corresponds to each first training feature vector;
each segmentation coefficient corresponds to one classification network, and comprises a segmentation number and a segmentation overlapping degree, wherein the segmentation number represents the number of the features obtained by segmenting the first training feature map, and the segmentation overlapping degree represents the overlapping degree between the features obtained by segmenting the first training feature map.
14. The apparatus of claim 13, wherein the training module is further configured to:
inputting each first training feature vector into a corresponding classification network respectively, and obtaining a classification result of each classification network respectively;
respectively determining network loss corresponding to each classification network according to the classification result of each classification network and the labeling information of the sample image;
and adjusting the network parameters of each classified network and the feature extraction network according to the network loss corresponding to each classified network.
15. The apparatus of claim 14, wherein the training module is further configured to:
adjusting network parameters of each classified network according to the network loss corresponding to each classified network;
and adjusting the network parameters of the characteristic extraction network according to the network loss corresponding to each classified network.
16. The apparatus of claim 15, wherein the training module is further configured to:
carrying out weighted summation on the network loss corresponding to each classified network to obtain the network loss of the feature extraction network;
and adjusting the network parameters of the feature extraction network according to the network loss of the feature extraction network.
17. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to: performing the method of any one of claims 1 to 8.
18. A computer readable storage medium having computer program instructions stored thereon, which when executed by a processor implement the method of any one of claims 1 to 8.
CN201910702266.3A 2019-07-31 2019-07-31 Image classification method and device and classification network training method and device Active CN110458218B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910702266.3A CN110458218B (en) 2019-07-31 2019-07-31 Image classification method and device and classification network training method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910702266.3A CN110458218B (en) 2019-07-31 2019-07-31 Image classification method and device and classification network training method and device

Publications (2)

Publication Number Publication Date
CN110458218A CN110458218A (en) 2019-11-15
CN110458218B true CN110458218B (en) 2022-09-27

Family

ID=68484342

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910702266.3A Active CN110458218B (en) 2019-07-31 2019-07-31 Image classification method and device and classification network training method and device

Country Status (1)

Country Link
CN (1) CN110458218B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111242162B (en) * 2019-12-27 2023-06-20 北京地平线机器人技术研发有限公司 Training method and device of image classification model, medium and electronic equipment
CN111242230A (en) * 2020-01-17 2020-06-05 腾讯科技(深圳)有限公司 Image processing method and image classification model training method based on artificial intelligence
CN111444819B (en) * 2020-03-24 2024-01-23 北京百度网讯科技有限公司 Cut frame determining method, network training method, device, equipment and storage medium
SG10202007348TA (en) * 2020-08-01 2021-03-30 Sensetime Int Pte Ltd Target object identification method and apparatus
CN112132099A (en) * 2020-09-30 2020-12-25 腾讯科技(深圳)有限公司 Identity recognition method, palm print key point detection model training method and device
CN112258527A (en) * 2020-11-02 2021-01-22 Oppo广东移动通信有限公司 Image processing method, image processing device, electronic equipment and computer readable storage medium
CN112529913A (en) * 2020-12-14 2021-03-19 北京达佳互联信息技术有限公司 Image segmentation model training method, image processing method and device

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108805181A (en) * 2018-05-25 2018-11-13 深圳大学 A kind of image classification device and sorting technique based on more disaggregated models
CN109255334A (en) * 2018-09-27 2019-01-22 中国电子科技集团公司第五十四研究所 Remote sensing image terrain classification method based on deep learning semantic segmentation network
CN109447169A (en) * 2018-11-02 2019-03-08 北京旷视科技有限公司 The training method of image processing method and its model, device and electronic system
CN109784424A (en) * 2019-03-26 2019-05-21 腾讯科技(深圳)有限公司 A kind of method of image classification model training, the method and device of image procossing
CN109829920A (en) * 2019-02-25 2019-05-31 上海商汤智能科技有限公司 Image processing method and device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10635927B2 (en) * 2017-03-06 2020-04-28 Honda Motor Co., Ltd. Systems for performing semantic segmentation and methods thereof

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108805181A (en) * 2018-05-25 2018-11-13 深圳大学 A kind of image classification device and sorting technique based on more disaggregated models
CN109255334A (en) * 2018-09-27 2019-01-22 中国电子科技集团公司第五十四研究所 Remote sensing image terrain classification method based on deep learning semantic segmentation network
CN109447169A (en) * 2018-11-02 2019-03-08 北京旷视科技有限公司 The training method of image processing method and its model, device and electronic system
CN109829920A (en) * 2019-02-25 2019-05-31 上海商汤智能科技有限公司 Image processing method and device, electronic equipment and storage medium
CN109784424A (en) * 2019-03-26 2019-05-21 腾讯科技(深圳)有限公司 A kind of method of image classification model training, the method and device of image procossing

Also Published As

Publication number Publication date
CN110458218A (en) 2019-11-15

Similar Documents

Publication Publication Date Title
CN110458218B (en) Image classification method and device and classification network training method and device
CN110210535B (en) Neural network training method and device and image processing method and device
CN109829501B (en) Image processing method and device, electronic equipment and storage medium
CN110348537B (en) Image processing method and device, electronic equipment and storage medium
CN109800737B (en) Face recognition method and device, electronic equipment and storage medium
CN111310616B (en) Image processing method and device, electronic equipment and storage medium
US20210012523A1 (en) Pose Estimation Method and Device and Storage Medium
CN109522910B (en) Key point detection method and device, electronic equipment and storage medium
CN109816764B (en) Image generation method and device, electronic equipment and storage medium
CN110009090B (en) Neural network training and image processing method and device
CN109801270B (en) Anchor point determining method and device, electronic equipment and storage medium
CN110909815B (en) Neural network training method, neural network training device, neural network processing device, neural network training device, image processing device and electronic equipment
CN111553864B (en) Image restoration method and device, electronic equipment and storage medium
CN109919300B (en) Neural network training method and device and image processing method and device
CN109934275B (en) Image processing method and device, electronic equipment and storage medium
CN109615006B (en) Character recognition method and device, electronic equipment and storage medium
CN111242303B (en) Network training method and device, and image processing method and device
JP2022522551A (en) Image processing methods and devices, electronic devices and storage media
CN110781957A (en) Image processing method and device, electronic equipment and storage medium
CN110532956B (en) Image processing method and device, electronic equipment and storage medium
CN109145970B (en) Image-based question and answer processing method and device, electronic equipment and storage medium
CN110659690B (en) Neural network construction method and device, electronic equipment and storage medium
CN111259967B (en) Image classification and neural network training method, device, equipment and storage medium
US20210326649A1 (en) Configuration method and apparatus for detector, storage medium
CN109344703B (en) Object detection method and device, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant