A method and apparatus for training and inference of density estimation and classification prediction models for densely packed targets.
The object classification model is trained through the deep neural network model to achieve automatic prediction of animal postures such as birds, which solves the problem of high manual statistics costs in the existing technology and reduces the cost of animal posture statistics.
Patent Information
- Application Number
- CN202111173528.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-08
- Publication Date
- 2024-08-27
- Estimated Expiration
- 2041-10-08
AI Technical Summary
In the existing technology, population posture statistics of birds and other animals rely on manual statistical methods with high labor costs, which are difficult to implement efficiently.
By obtaining a training sample data set, including training images and label data, a deep neural network model is used to train an object classification model, and a model capable of predicting object poses is generated, thereby achieving automatic prediction of the poses of animals such as birds.
It reduces the cost of posture statistics of animals and other objects, improves statistical efficiency, and partially overcomes the waste of human and financial resources in manual statistical methods.
Smart Images

Figure CN113887447B
Abstract
Description
Technical Field
[0001] The embodiments of the present disclosure relate to the fields of artificial intelligence and ecological protection technology, and more specifically, to a method for training an object classification model, a method for predicting object classification, a training device for an object classification model, an object classification prediction device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In the ecological field, different animals have different sensitivities to the environment. Based on this feature, animals with higher environmental sensitivity can be used as indicator species of the ecological environment, such as birds.
[0003] In the process of realizing the concept of the present disclosure, the inventors found that there are at least the following problems in the related art: the statistics of population postures of animals such as birds rely on manual statistical methods with high labor costs. Summary of the invention
[0004] In view of this, the embodiments of the present disclosure provide a training method for an object classification model, an object classification prediction method, a training device for an object classification model, an object classification prediction device, an electronic device, a computer-readable storage medium, and a computer program product.
[0005] One aspect of an embodiment of the present disclosure provides a method for training an object classification model, including:
[0006] Acquire a training sample data set, wherein the training samples in the training sample data set include training images and label data of the training images, wherein the training images represent multiple postures of objects, the objects include animals, and the label data include real posture classification information for the postures;
[0007] Inputting the training image into a deep neural network model and outputting a recognition result, wherein the recognition result includes predicted posture classification information;
[0008] Calculate the loss function based on the recognition result and the label data to obtain a loss result; and
[0009] The network parameters of the deep neural network model are iteratively adjusted according to the loss results to generate a trained object classification model.
[0010] According to an embodiment of the present disclosure, the types of the above-mentioned objects include multiple types; the above-mentioned label data also includes real type classification information generated according to the types of the above-mentioned objects; and the above-mentioned recognition results also include predicted type classification information.
[0011] According to an embodiment of the present disclosure, the above-mentioned deep neural network model includes a first feature extraction network, a first object category classification network and a first object posture classification network;
[0012] Among them, the above-mentioned first object type classification network and the above-mentioned first object posture classification network both include a first convolutional layer, a maximum pooling layer, a second convolutional layer, an average pooling layer and a fully connected layer that are cascaded in sequence.
[0013] According to an embodiment of the present disclosure, the above-mentioned training image is input into a deep neural network model, and the recognition result is output, including:
[0014] Input the training image into the first feature extraction network and output a first feature map;
[0015] Input the first feature map into the first convolutional layer, and output a second feature map;
[0016] Input the second feature map into the maximum pooling layer, and output a compressed second feature map;
[0017] Input the compressed second feature map into the second convolutional layer, and output a third feature map;
[0018] Input the third feature map into the average pooling layer, and output a compressed third feature map;
[0019] The compressed third feature map is input into the fully connected layer, and the predicted posture classification information or the predicted type classification information is output.
[0020] According to an embodiment of the present disclosure, the above-mentioned label data also includes a real density map generated based on the above-mentioned object, and the above-mentioned recognition result also includes a predicted density map, wherein the above-mentioned real density map represents the real aggregation degree of the above-mentioned object at multiple positions in the above-mentioned training image, and the above-mentioned predicted density map represents the predicted aggregation degree of the above-mentioned object at multiple positions in the above-mentioned training image.
[0021] According to an embodiment of the present disclosure, the above-mentioned deep neural network model includes a second feature extraction network, a hole convolution layer, a density map generation network and a second object posture classification network;
[0022] The step of inputting the training image into a deep neural network model and outputting a recognition result includes:
[0023] Input the training image into the second feature extraction network and output a fourth feature map;
[0024] Inputting the fourth feature map into the second object posture classification network, and outputting the predicted posture classification information;
[0025] Input the fourth feature map into the hole convolution layer, and output a fifth feature map;
[0026] The fifth feature map is input into the density map generation network, and a predicted density map is output.
[0027] According to an embodiment of the present disclosure, the training method of the above object classification model further includes:
[0028] Obtaining multiple initial training images;
[0029] When the pixel size of the initial training image does not meet the preset condition, adjusting the pixel size of the image to be recognized to obtain the training image;
[0030] Obtaining the label data by labeling the training images; and
[0031] The training sample data set is generated according to the plurality of training images and the label data corresponding to the training images.
[0032] Another aspect of the embodiments of the present disclosure provides an object classification prediction method, including:
[0033] Acquire an image to be identified, wherein the image to be identified represents multiple postures of an object, and the object includes an animal; and
[0034] Inputting the image to be recognized into an object classification model to obtain a recognition result, wherein the recognition result includes target posture classification information;
[0035] The object classification model is trained using the method described above.
[0036] According to an embodiment of the present disclosure, the types of the above-mentioned objects include multiple types, and the above-mentioned animals include birds; the above-mentioned recognition result also includes target type classification information and / or a target density map, and the above-mentioned target density map represents the degree of aggregation of the above-mentioned objects at different positions in the above-mentioned image to be recognized;
[0037] The above method further comprises:
[0038] According to the target density map, target quantity information of the object is generated.
[0039] Another aspect of the embodiments of the present disclosure provides a training device for an object classification model, comprising:
[0040] A first acquisition module is used to acquire a training sample data set, wherein the training samples in the training sample data set include training images and label data of the training images, wherein the training images represent multiple postures of objects, the objects include animals, and the label data include real posture classification information for the postures;
[0041] An output module, used to input the training image into a deep neural network model and output a recognition result, wherein the recognition result includes predicted posture classification information;
[0042] A calculation module, used to calculate a loss function according to the recognition result and the label data to obtain a loss result; and
[0043] The iterative training module is used to iteratively adjust the network parameters of the above-mentioned deep neural network model according to the above-mentioned loss results to generate a trained object classification model.
[0044] Another aspect of the embodiments of the present disclosure provides an object classification prediction device, including:
[0045] A second acquisition module is used to acquire an image to be identified, wherein the image to be identified represents a plurality of postures of an object, and the object includes an animal; and
[0046] A prediction module, used for inputting the above-mentioned image to be recognized into an object classification model to obtain a recognition result, wherein the above-mentioned recognition result includes target posture classification information;
[0047] The object classification model is trained using the method described above.
[0048] Another aspect of an embodiment of the present disclosure provides an electronic device, comprising: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors implement the method described above.
[0049] Another aspect of an embodiment of the present disclosure provides a computer-readable storage medium storing computer-executable instructions, which are used to implement the method described above when executed.
[0050] Another aspect of an embodiment of the present disclosure provides a computer program product, wherein the computer program product includes computer executable instructions, and the instructions are used to implement the method described above when executed.
[0051] According to an embodiment of the present disclosure, by training a deep neural network using training images including postures of objects such as animals, an object classification model capable of predicting the posture of the object can be obtained, so that the posture of objects such as animals can be predicted using the classified object model, thereby at least partially overcoming the technical problem that the statistics of population postures of animals such as birds rely on manual statistical methods with relatively high labor costs, thereby achieving the technical effect of reducing the statistical cost of the postures of objects such as animals. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The above and other objects, features and advantages of the present disclosure will become more apparent through the following description of the embodiments of the present disclosure with reference to the accompanying drawings, in which:
[0053] Figure 1 An exemplary system architecture of a training method for an application object classification model or an object classification prediction method according to an embodiment of the present disclosure is schematically shown;
[0054] Figure 2 A flowchart of a method for training an object classification model according to an embodiment of the present disclosure is schematically shown;
[0055] Figure 3 A flowchart of generating a training sample data set according to an embodiment of the present disclosure is schematically shown;
[0056] Figure 4 A method diagram schematically illustrates a method for training an object classification model according to an embodiment of the present disclosure;
[0057] Figure 5 A flowchart of an object classification prediction method according to an embodiment of the present disclosure is schematically shown;
[0058] Figure 6 A block diagram schematically shows a training device for an object classification model according to an embodiment of the present disclosure;
[0059] Figure 7 A block diagram schematically shows an object classification prediction device according to an embodiment of the present disclosure; and
[0060] Figure 8 A block diagram of an electronic device for implementing a training method for an object classification model or an object classification prediction method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0061] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. However, it should be understood that these descriptions are exemplary only and are not intended to limit the scope of the present disclosure. In the following detailed description, for ease of explanation, many specific details are set forth to provide a comprehensive understanding of the embodiments of the present disclosure. However, it is apparent that one or more embodiments may also be implemented without these specific details. In addition, in the following description, descriptions of known structures and technologies are omitted to avoid unnecessary confusion of the concepts of the present disclosure.
[0062] The terms used herein are only for describing specific embodiments and are not intended to limit the present disclosure. The terms "comprise", "include", etc. used herein indicate the existence of the features, steps, operations and / or components, but do not exclude the existence or addition of one or more other features, steps, operations or components.
[0063] All terms (including technical and scientific terms) used herein have the meanings commonly understood by those skilled in the art, unless otherwise defined. It should be noted that the terms used herein should be interpreted as having a meaning consistent with the context of this specification, and should not be interpreted in an idealized or overly rigid manner.
[0064] When using expressions such as "at least one of A, B, and C, etc.", they should generally be interpreted according to the meaning of the expression commonly understood by those skilled in the art (for example, "a system having at least one of A, B, and C" should include but is not limited to a system having A alone, B alone, C alone, A and B, A and C, B and C, and / or A, B, C, etc.).
[0065] Birds are often used as indicator species for ecological environments due to their high sensitivity. In addition, when a large amount of bird population count data is obtained, the specific location of the bird population distribution can be roughly determined, thereby formulating a bird monitoring plan. Therefore, bird population counts are of great significance to the protection of the ecological environment.
[0066] However, current bird population counts are still manually counted using some traditional statistical methods with high labor costs.
[0067] Although many researchers have proposed a large number of methods based on deep neural networks for crowd counting, these methods cannot be directly transferred to bird population counting. Because in the task of crowd counting, the crowd counting algorithm mainly tries to extract effective information from the human head, so the human posture has little effect on the final extracted density information. However, the head of a bird is only a small part of the whole body, and the posture has a great influence on the morphological characteristics of the bird. In addition, the morphological characteristics of different species are also very different, so the crowd counting algorithm is difficult to adapt to the task of estimating the density of bird populations.
[0068] In view of this, the inventors discovered that a deep neural network model can be trained using a training sample data set including a variety of postures of objects such as birds, so as to obtain a trained object classification model, which can then be used to predict the postures of objects such as birds, thereby avoiding the waste of manpower and financial resources caused by manual statistical methods.
[0069] The embodiments of the present disclosure provide a training method for an object classification model, an object classification prediction method, a training device for an object classification model, an object classification prediction device, an electronic device, a computer-readable storage medium, and a computer program product. The training method for the object classification model includes obtaining a training sample data set, wherein the training samples in the training sample data set include training images and label data of the training images, wherein the training images represent various postures of objects, wherein the objects include animals, and the label data include real posture classification information for the postures; inputting the training images into a deep neural network model, outputting a recognition result, wherein the recognition result includes predicted posture classification information; calculating a loss function based on the recognition result and the label data to obtain a loss result; and iteratively adjusting the network parameters of the deep neural network model based on the loss result to generate a trained object classification model.
[0070] Figure 1 The exemplary system architecture 100 to which the object classification model training method or object classification prediction method according to the embodiment of the present disclosure can be applied is schematically shown. It should be noted that: Figure 1 What is shown is merely an example of a system architecture to which the embodiments of the present disclosure can be applied, in order to help those skilled in the art understand the technical content of the present disclosure, but it does not mean that the embodiments of the present disclosure cannot be used in other devices, systems, environments or scenarios.
[0071] like Figure 1 As shown, the system architecture 100 according to this embodiment may include terminal devices 101, 102, 103, a network 104 and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired and / or wireless communication links, etc.
[0072] The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send data, etc. The data includes a training sample data set or an initial training image. Various client applications can be installed on the terminal devices 101, 102, 103, such as object classification applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software (only as examples).
[0073] The terminal devices 101 , 102 , and 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers.
[0074] The server 105 may be a server that provides various services, such as a background management server (only an example) that provides support for websites browsed by users using the terminal devices 101, 102, and 103. The background management server may analyze and process the received data such as user requests, and feed back the processing results (such as an object classification model or target posture classification information generated based on the user's data) to the terminal device.
[0075] It should be noted that the training method or object classification prediction method of the object classification model provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the training device or object classification prediction device of the object classification model provided in the embodiment of the present disclosure can generally be set in the server 105. The training method or object classification prediction method of the object classification model provided in the embodiment of the present disclosure can also be executed by a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Correspondingly, the training device or object classification prediction device of the object classification model provided in the embodiment of the present disclosure can also be set in a server or server cluster that is different from the server 105 and can communicate with the terminal devices 101, 102, 103 and / or the server 105. Alternatively, the training method or object classification prediction method of the object classification model provided in the embodiment of the present disclosure can also be executed by the terminal devices 101, 102, or 103, or can also be executed by other terminal devices different from the terminal devices 101, 102, or 103. Correspondingly, the object classification model training device or object classification prediction device provided in the embodiments of the present disclosure may also be disposed in the terminal device 101, 102, or 103, or in other terminal devices different from the terminal device 101, 102, or 103.
[0076] It should be understood that Figure 1 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.
[0077] Figure 2 A flowchart of a method for training an object classification model according to an embodiment of the present disclosure is schematically shown.
[0078] like Figure 2 As shown, the training method of the object classification model may include operations S210 to S240.
[0079] In operation S210, a training sample data set is obtained. The training samples in the training sample data set include training images and label data of the training images. The training images represent various postures of objects. The objects may include animals. The label data includes real posture classification information for the postures.
[0080] In operation S220, the training image is input into the deep neural network model, and a recognition result is output, where the recognition result includes predicted posture classification information.
[0081] In operation S230, a loss function is calculated according to the recognition result and the label data to obtain a loss result.
[0082] In operation S240, network parameters of the deep neural network model are iteratively adjusted according to the loss result to generate a trained object classification model.
[0083] According to an embodiment of the present disclosure, the object may further include a plant, for example, the plant may include a tree or a flower, etc.
[0084] According to the embodiments of the present disclosure, animals may include mammals, fish, birds, amphibians, insects, etc. In order to facilitate the description of the present invention, the following embodiments are illustrated by birds.
[0085] According to an embodiment of the present disclosure, the postures of the bird in the training image may include a standing front view, a standing side view, a flying front view, a flying side view, and a flying bottom view.
[0086] According to an embodiment of the present disclosure, the label data may include a table file format, the content of the table file may include real posture classification information and corresponding position coordinates, and the real posture classification information may include numbering information for numbering the above-mentioned different postures.
[0087] According to an embodiment of the present disclosure, the feature extraction part of the deep neural network model can adopt convolutional neural networks (CNN). For example, a VGG-16 network with the last three convolutional layers and all fully connected layers removed can be used, and the weight parameters of the VGG-16 network have been pre-trained.
[0088] It should be noted that the deep neural network of this embodiment is not limited to convolutional neural networks such as the VGG-16 network, but may also be other types of neural networks. This disclosure embodiment is not limited to this.
[0089] According to an embodiment of the present disclosure, the acquired training image is input into a deep neural network model, predicted posture classification information is output, and a loss function is calculated based on the predicted posture classification information and label data, and the network parameters of the deep neural network model are iteratively adjusted based on the loss result. When the loss result converges, a trained object classification model can be obtained.
[0090] According to an embodiment of the present disclosure, by training a deep neural network using training images including postures of objects such as animals, an object classification model capable of predicting the posture of the object can be obtained, so that the posture of objects such as animals can be predicted using the classified object model, thereby at least partially overcoming the technical problem that the statistics of population postures of animals such as birds rely on manual statistical methods with relatively high labor costs, thereby achieving the technical effect of reducing the statistical cost of the postures of objects such as animals.
[0091] According to an embodiment of the present disclosure, the types of objects include multiple types. The label data also includes real type classification information generated according to the type of the object. The recognition result also includes predicted type classification information.
[0092] According to an embodiment of the present disclosure, the species classification information may include the species of birds, for example, birds may include swimming birds, wading birds, road birds, songbirds and climbing birds, etc. There are about 220 species of birds, which will not be described in detail here.
[0093] According to an embodiment of the present disclosure, the deep neural network model includes a first feature extraction network, a first object category classification network, and a first object posture classification network.
[0094] The first object type classification network and the first object posture classification network both include a first convolutional layer, a maximum pooling layer, a second convolutional layer, an average pooling layer, and a fully connected layer that are cascaded in sequence.
[0095] According to an embodiment of the present disclosure, the first object type classification network and the first object posture classification network are respectively connected to the output end of the first feature extraction network.
[0096] According to an embodiment of the present disclosure, the specific structure of the first feature extraction network may include two layers of convolutional layers with a convolutional kernel size of 3×3 and 64 filters, a maximum pooling layer, two layers of convolutional layers with a convolutional kernel size of 3×3 and 128 filters, a maximum pooling layer, three layers of filter size of 256, the first two layers of convolutional kernel size of 3×3, the last layer of convolutional layers with a 1×1 convolutional kernel size, a maximum pooling layer, three layers of convolutional layers with a filter size of 512, the first two layers of convolutional kernel size of 3×3, and the last layer of convolutional layers with a convolutional kernel size of 1×1.
[0097] According to an embodiment of the present disclosure, the first object type classification network and the first object posture classification network may function to identify the posture of the bird in the training image and the category to which it belongs, and the identification is a coarse classification.
[0098] According to an embodiment of the present disclosure, in order to improve the recognition speed of the object classification model and reduce the number of network layers in the object classification model, the specific structure of the above two networks may include a first convolution layer with a convolution kernel of 3×3, a filter number of 512, and a step size of 2, one or more maximum pooling layers, the maximum pooling layer can quickly reduce the data information, two layers of convolution kernels of 3×3, the number of filters of 512, the first step size of 1, and the second step size of 2. The second convolution layer can reduce the data information to achieve the effect of rapid dimensionality reduction, as well as one or more average pooling layers and at least two fully connected layers to realize the classification processing of the standing front view, standing side view, flying front view, flying side view and flying upward view of birds.
[0099] It should be noted that the specific parameters of each layer in the object classification model are not intended to limit the scope of the present disclosure, but are only examples given to illustrate the technical solution of the present application, and the specific parameters can be set according to specific needs.
[0100] According to an embodiment of the present disclosure, inputting a training image into a deep neural network model and outputting a recognition result may include the following operations.
[0101] The training image is input into the first feature extraction network, and the first feature map is output. The first feature map is input into the first convolutional layer, and the second feature map is output. The second feature map is input into the maximum pooling layer, and the compressed second feature map is output. The compressed second feature map is input into the second convolutional layer, and the third feature map is output. The third feature map is input into the average pooling layer, and the compressed third feature map is output. The compressed third feature map is input into the fully connected layer, and the predicted posture classification information or the predicted type classification information is output.
[0102] According to an embodiment of the present disclosure, the size of the first feature map may include 128×96×512, and the unit of the size is pixel. The unit of the size in the following embodiments is pixel, and no separate description is given.
[0103] According to an embodiment of the present disclosure, the size of the compressed data information of the second feature map may be one quarter of the size of the data information of the second feature map. The size of the data information of the third feature map may be one half of the size of the compressed data information of the second feature map.
[0104] According to an embodiment of the present disclosure, the output of the fully connected layer in the first object type classification network can be multiple channels, and the number of channels corresponds to the number of bird species. For example, when the number of channels is 13, it corresponds to 13 bird species.
[0105] It should be noted that the pixel values of 128×96×512 or 128×96×1 etc. involved in the embodiments of the present disclosure and below are not intended to limit the scope of the present disclosure. They are only examples given to illustrate the technical solution of the present application, and their specific values can be set according to specific needs.
[0106] According to an embodiment of the present disclosure, the label data also includes a real density map generated based on the object, and the recognition result also includes a predicted density map, the real density map represents the real aggregation degree of the object at multiple positions in the training image, and the predicted density map represents the predicted aggregation degree of the object at multiple positions in the training image.
[0107] According to an embodiment of the present disclosure, the deep neural network model includes a second feature extraction network, a hole convolution layer, a density map generation network and a second object posture classification network.
[0108] Inputting the training image into the deep neural network model and outputting the recognition result may include the following operations.
[0109] The training image is input into the second feature extraction network, and the fourth feature map is output. The fourth feature map is input into the second object posture classification network, and the predicted posture classification information is output. The fourth feature map is input into the hole convolution layer, and the fifth feature map is output. The fifth feature map is input into the density map generation network, and the predicted density map is output.
[0110] According to an embodiment of the present disclosure, the second feature extraction network has the same network structure and function as the first feature extraction network, and the second object posture classification network has the same network structure and function as the first object posture classification network, which will not be elaborated here.
[0111] According to an embodiment of the present disclosure, a density map can be used to represent a map of the number and distribution of birds. A density map generation network can refer to an algorithm structure for generating a density map built using a convolutional neural network.
[0112] According to an embodiment of the present disclosure, in order to increase the contextual association between pixels in the fourth feature map and to enable the neural network to extract more density information, multiple dilated convolution layers can be used to process the fourth feature map. The number of dilated convolution layers is preferably 6, and each dilated convolution layer adds supplementary pixels during convolution to ensure that the size of the output fifth feature map is the same as that of the fourth feature map.
[0113] According to an embodiment of the present disclosure, when the number of atrous convolution layers is 6, the number of filters of the first three atrous convolution layers can be 512, and the number of filters of the last three atrous convolution layers can be 256, 128 and 64 respectively. Its main function is to quickly reduce the amount of data.
[0114] According to an embodiment of the present disclosure, a third convolution layer with a convolution kernel size of 3×3 and a filter size of 1 may also be included between the hole convolution layer and the density map generation network to ensure that the size of the predicted density map output by the density map generation network is a preset size, for example, the preset size may be 128×96×1.
[0115] According to an embodiment of the present disclosure, the density map generation network uses the Euclidean distance to measure the difference between the estimated density map and the true density map. The loss function of the density map generation network is shown in the following formula.
[0116]
[0117] Where θ represents a set of learnable parameters in the density map generation network; N represents the number of training images; X i represents the input training image; F i Denotes the training image X i The real density map of F(X i ; θ) represents the predicted density map generated by the density map generation network, and for the training image X i Parameterized. L(θ) represents the loss value between the predicted density map and the true density map.
[0118] According to an embodiment of the present disclosure, when the first object type classification network, the first object posture classification network and the density map generation network are in the same object classification model, the first object type classification network, the first object posture classification network and the density map generation network are respectively connected to the feature extraction network of the object classification model. For example, the feature extraction network of the object classification model can be the first feature extraction network or the second feature extraction network.
[0119] According to an embodiment of the present disclosure, the first object posture classification network and the first object type classification network respectively output a plurality of different postures and perspectives and a plurality of bird types. The loss functions of the above two classification networks can use a cross entropy loss function, and are named L and L for posture and type, respectively. p and L s .
[0120] According to the embodiments of the present disclosure, by weighing the losses of the above two classification networks and the density map generation network, during the training process, the two classification networks and the object classification model with the density map generation network simultaneously participate in gradient updates, providing morphological prior knowledge for the object classification model from two aspects of the posture and type of birds, thereby making the weight of the object classification model suitable for the statistics of the number of birds. The two classification networks can be plug-and-play modules.
[0121] According to an embodiment of the present disclosure, the loss function of the object classification model having a first object category classification network, a first object posture classification network, and a density map generation network is as shown in the following formula.
[0122] L=0.9×L θ +0.05×L p +0.05×L s
[0123] Among them, L θ represents the loss function of the density map generation network; L p represents the loss function of the first object category classification network; L s represents the loss function of the first object pose classification network; L represents the loss function of the object classification model.
[0124] According to an embodiment of the present disclosure, when the loss function L of the object classification model satisfies a preset threshold condition, a trained object classification model is generated. The preset threshold condition can be specifically set according to actual needs, for example, it can be less than 2.5.
[0125] Figure 3 The flowchart of generating a training sample data set according to an embodiment of the present disclosure is schematically shown.
[0126] like Figure 3 As shown, the training method of the above-mentioned object classification model may further include operations S310 to S340.
[0127] In operation S310, a plurality of initial training images are obtained.
[0128] In operation S320, when the pixel size of the initial training image does not meet the preset condition, the pixel size of the image to be recognized is adjusted to obtain a training image.
[0129] In operation S330, label data is obtained by annotating the training image.
[0130] In operation S340, a training sample data set is generated according to a plurality of training images and label data corresponding to the training images.
[0131] According to an embodiment of the present disclosure, the preset condition may include a size of 1024×768.
[0132] According to an embodiment of the present disclosure, when the pixel size of the initial training image does not meet the preset condition, the pixels of the initial training image need to be adjusted. For example, the pixels of the initial training image can be adjusted using a pixel operation algorithm. The pixel operation algorithm may include but is not limited to Resize. e algorithm.
[0133] According to an embodiment of the present disclosure, when performing a marking operation, the following operation steps may be adopted.
[0134] For example, when manually adding bird posture annotations with a mouse, a mouse listening event can be added to the software. When the mouse clicks a certain position in the training image, the mouse listening event is triggered, the position coordinates corresponding to the position are saved, and the drawing component is called to draw the annotation dot with the position coordinate point as the center. The bird posture is determined according to the bird posture in the entire training image, and the bird posture is numbered. Or when annotating the bird species, the bird species can be annotated in the training image and can be numbered.
[0135] According to the embodiments of the present disclosure, in the process of labeling, it is necessary to combine the prior knowledge of the posture and species of the bird. The prior knowledge can represent the clear information that can help to identify.
[0136] According to an embodiment of the present disclosure, after the training image is annotated, label data for predicting the bird's posture is generated based on multiple position coordinates and the bird's posture and / or posture number corresponding to each position coordinate. Alternatively, label data for predicting the bird's species can be generated based on multiple position coordinates and the bird's species and / or species number corresponding to each position coordinate. Alternatively, label data for predicting the bird's species and posture can be generated based on multiple position coordinates and the bird's species and / or species number corresponding to each position coordinate, as well as the bird's posture and / or posture number.
[0137] Figure 4 A method diagram of a method for training an object classification model according to an embodiment of the present disclosure is schematically shown.
[0138] like Figure 4 As shown, when the deep neural network model is trained, the training images in the training sample data set are input into the deep neural network model in sequence, and the features of the birds in the training images can be extracted through the first feature extraction network to output the first feature map.
[0139] According to an embodiment of the present disclosure, the first feature map is input into a first object category classification network, a first object posture classification network or a density map generation network to obtain a recognition result including predicted category classification information, predicted posture classification information or a predicted density map.
[0140] According to an embodiment of the present disclosure, a loss function is calculated based on the recognition result and the label data to obtain a loss result. When the loss result does not meet a preset threshold condition, the network parameters of the deep neural network model are iteratively adjusted to eventually generate a trained object classification model.
[0141] Figure 5 The flowchart of the object classification prediction method according to an embodiment of the present disclosure is schematically shown.
[0142] like Figure 5 As shown, the object classification prediction method may include operations S510 to S520.
[0143] In operation S510 , an image to be recognized is acquired, where the image to be recognized represents a variety of postures of an object, and the object includes an animal.
[0144] In operation S520, the image to be recognized is input into an object classification model to obtain a recognition result, which includes target posture classification information.
[0145] Among them, the object classification model is trained using the above method.
[0146] According to an embodiment of the present disclosure, when an image to be identified is obtained, its size needs to be judged, and when the size meets a preset condition, it is input into the object classification model for identification. The preset condition may be the same as or different from the preset condition on the size of the training image in the training method of the object classification model.
[0147] According to an embodiment of the present disclosure, when the image to be identified does not meet a preset condition, the size of the image to be identified can also be adjusted using a pixel operation algorithm.
[0148] According to an embodiment of the present disclosure, by training a deep neural network using training images including postures of objects such as animals, an object classification model capable of predicting the posture of the object can be obtained, so that the posture of objects such as animals can be predicted using the classified object model, thereby at least partially overcoming the technical problem that the statistics of population postures of animals such as birds rely on manual statistical methods with relatively high labor costs, thereby achieving the technical effect of reducing the statistical cost of the postures of objects such as animals.
[0149] According to an embodiment of the present disclosure, there are multiple types of objects, including animals including birds; the recognition result also includes target type classification information and / or a target density map, and the target density map represents the degree of aggregation of objects at different positions in the image to be recognized.
[0150] According to an embodiment of the present disclosure, the object classification prediction method may further include the following operations.
[0151] According to the target density map, the target quantity information of the object is generated.
[0152] According to an embodiment of the present disclosure, when counting the number of birds, an integration operation may be performed on the target density map predicted by the object classification model to obtain target number information of birds on the image to be identified.
[0153] According to an embodiment of the present disclosure, since the first object posture classification network and the first object type classification network are configured as plug-and-play modules, the two classification networks may not be used when counting the number of birds, thereby reducing the computational complexity of the object classification model and improving computational efficiency.
[0154] Figure 6 A block diagram of a training device for an object classification model according to an embodiment of the present disclosure is schematically shown.
[0155] like Figure 6 As shown, the training device 600 for the object classification model may include a first acquisition module 610 , an output module 620 , a calculation module 630 and an iterative training module 640 .
[0156] The first acquisition module 610 is used to acquire a training sample data set. The training samples in the training sample data set include training images and label data of the training images. The training images represent various postures of objects, including animals. The label data includes real posture classification information for the postures.
[0157] The output module 620 is used to input the training image into the deep neural network model and output the recognition result, which includes the predicted posture classification information.
[0158] The calculation module 630 is used to calculate the loss function according to the recognition result and the label data to obtain the loss result.
[0159] The iterative training module 640 is used to iteratively adjust the network parameters of the deep neural network model according to the loss results to generate a trained object classification model.
[0160] According to an embodiment of the present disclosure, by training a deep neural network using training images including postures of objects such as animals, an object classification model capable of predicting the posture of the object can be obtained, so that the posture of objects such as animals can be predicted using the classified object model, thereby at least partially overcoming the technical problem that the statistics of population postures of animals such as birds rely on manual statistical methods with relatively high labor costs, thereby achieving the technical effect of reducing the statistical cost of the postures of objects such as animals.
[0161] According to an embodiment of the present disclosure, the types of objects include multiple types. The label data also includes real type classification information generated according to the type of the object. The recognition result also includes predicted type classification information.
[0162] According to an embodiment of the present disclosure, the deep neural network model may include a first feature extraction network, a first object category classification network, and a first object posture classification network.
[0163] According to an embodiment of the present disclosure, the first object category classification network and the first object posture classification network may each include a first convolutional layer, a maximum pooling layer, a second convolutional layer, an average pooling layer, and a fully connected layer that are cascaded in sequence.
[0164] According to an embodiment of the present disclosure, the output module 620 may include a first input unit, a second input unit, a third input unit, a fourth input unit, a fifth input unit, and a sixth input unit.
[0165] The first input unit is used to input the training image into the first feature extraction network and output the first feature map.
[0166] The second input unit is used to input the first feature map into the first convolutional layer and output the second feature map.
[0167] The third input unit is used to input the second feature map into the maximum pooling layer and output the compressed second feature map.
[0168] The fourth input unit is used to input the compressed second feature map into the second convolutional layer and output the third feature map.
[0169] The fifth input unit is used to input the third feature map into the average pooling layer and output the compressed third feature map.
[0170] The sixth input unit is used to input the compressed third feature map into the fully connected layer and output predicted posture classification information or predicted type classification information.
[0171] According to an embodiment of the present disclosure, the label data may also include a real density map generated based on the object, and the recognition result may also include a predicted density map, wherein the real density map represents the real aggregation degree of the object at multiple positions in the training image, and the predicted density map represents the predicted aggregation degree of the object at multiple positions in the training image.
[0172] According to an embodiment of the present disclosure, the deep neural network model may include a second feature extraction network, a hole convolution layer, a density map generation network, and a second object posture classification network.
[0173] According to an embodiment of the present disclosure, the output module 620 may include a seventh input unit, an eighth input unit, a ninth input unit, and a tenth input unit.
[0174] The seventh input unit is used to input the training image into the second feature extraction network and output the fourth feature map.
[0175] The eighth input unit is used to input the fourth feature map into the second object posture classification network and output predicted posture classification information.
[0176] The ninth input unit is used to input the fourth feature map into the hole convolution layer and output the fifth feature map.
[0177] The tenth input unit is used to input the fifth feature map into the density map generation network and output the predicted density map.
[0178] According to an embodiment of the present disclosure, the training device 600 for the object classification model may further include a third acquisition module, an adjustment module, a labeling module and a first generation module.
[0179] The third acquisition module is used to acquire a plurality of initial training images.
[0180] The adjustment module is used to adjust the pixel size of the image to be recognized to obtain a training image when the pixel size of the initial training image does not meet the preset conditions.
[0181] The labeling module is used to obtain label data by labeling the training images.
[0182] The first generating module is used to generate a training sample data set according to a plurality of training images and label data corresponding to the training images.
[0183] Figure 7 A block diagram of an object classification prediction device according to an embodiment of the present disclosure is schematically shown.
[0184] like Figure 7 As shown, the object classification prediction device may include a second acquisition module 710 and a prediction module 720 .
[0185] The second acquisition module 710 is used to acquire an image to be recognized, where the image to be recognized represents various postures of an object, including an animal.
[0186] The prediction module 720 is used to input the image to be recognized into the object classification model to obtain a recognition result, which includes target posture classification information.
[0187] Among them, the object classification model is trained using the above method.
[0188] According to an embodiment of the present disclosure, by training a deep neural network using training images including postures of objects such as animals, an object classification model capable of predicting the posture of the object can be obtained, so that the posture of objects such as animals can be predicted using the classified object model, thereby at least partially overcoming the technical problem that the statistics of population postures of animals such as birds rely on manual statistical methods with relatively high labor costs, thereby achieving the technical effect of reducing the statistical cost of the postures of objects such as animals.
[0189] According to an embodiment of the present disclosure, the types of objects may include multiple types, and animals may include birds; the recognition result may also include target type classification information and / or a target density map, and the target density map represents the degree of aggregation of objects at different positions in the image to be recognized.
[0190] According to an embodiment of the present disclosure, the object classification prediction device 700 may further include a second generation module.
[0191] The second generating module is used to generate target quantity information of the object according to the target density map.
[0192] According to the modules and units of the embodiments of the present disclosure, any multiple or at least part of the functions of any multiple thereof can be implemented in one module. According to the modules and units of the embodiments of the present disclosure, any one or more can be split into multiple modules for implementation. According to the modules and units of the embodiments of the present disclosure, any one or more can be at least partially implemented as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a System on a Chip, a System on a Substrate, a System on a Package, an Application Specific Integrated Circuit (ASIC), or can be implemented by hardware or firmware of any other reasonable way of integrating or packaging the circuit, or implemented in any one of the three implementation modes of software, hardware and firmware or in any appropriate combination of any of them. Alternatively, according to the modules and units of the embodiments of the present disclosure, one or more can be at least partially implemented as a computer program module, and when the computer program module is run, the corresponding function can be executed.
[0193] For example, any of the first acquisition module 610, the output module 620, the calculation module 630 and the iterative training module 640, or the second acquisition module 710 and the prediction module 720 can be combined in one module / unit for implementation, or any of the modules / units can be split into multiple modules / units. Alternatively, at least part of the functions of one or more modules / units / sub-units in these modules / units can be combined with at least part of the functions of other modules / units / sub-units and implemented in one module / unit. According to an embodiment of the present disclosure, at least one of the first acquisition module 610, the output module 620, the calculation module 630 and the iterative training module 640, or the second acquisition module 710 and the prediction module 720 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on a chip, a system on a substrate, a system on a package, an application specific integrated circuit (ASIC), or can be implemented by hardware or firmware such as any other reasonable way of integrating or packaging the circuit, or by any one of the three implementation methods of software, hardware and firmware or by a suitable combination of any of them. Alternatively, the first acquisition module 610, the output module 620, the calculation module 630 and the iterative training module 640, or at least one of the second acquisition module 710 and the prediction module 720 can be at least partially implemented as a computer program module, which can perform corresponding functions when executed.
[0194] It should be noted that the object classification model training device part in the embodiment of the present disclosure corresponds to the object classification model training method part in the embodiment of the present disclosure, and the description of the object classification model training device part specifically refers to the object classification model training method part, which will not be repeated here. The object classification prediction device part in the embodiment of the present disclosure corresponds to the object classification prediction method part in the embodiment of the present disclosure, and the description of the object classification prediction device part specifically refers to the object classification prediction method part, which will not be repeated here.
[0195] Figure 8 A block diagram of an electronic device suitable for implementing the method described above according to an embodiment of the present disclosure is schematically shown. Figure 8 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0196] like Figure 8As shown, the electronic device 800 according to the embodiment of the present disclosure includes a processor 801, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 802 or the program loaded from the storage part 808 to the random access memory (RAM) 803. The processor 801 may include, for example, a general-purpose microprocessor (such as a CPU), an instruction set processor and / or a related chipset and / or a special-purpose microprocessor (for example, an application-specific integrated circuit (ASIC)), etc. The processor 801 may also include an onboard memory for caching purposes. The processor 801 may include a single processing unit or multiple processing units for performing different actions of the method flow according to the embodiment of the present disclosure.
[0197] In RAM 803, various programs and data required for the operation of electronic device 800 are stored. Processor 801, ROM 802 and RAM 803 are connected to each other via bus 804. Processor 801 performs various operations of the method flow according to the embodiment of the present disclosure by executing the program in ROM 802 and / or RAM 803. It should be noted that the program can also be stored in one or more memories other than ROM 802 and RAM 803. Processor 801 can also perform various operations of the method flow according to the embodiment of the present disclosure by executing the program stored in the one or more memories.
[0198] According to an embodiment of the present disclosure, the electronic device 800 may further include an input / output (I / O) interface 805, which is also connected to the bus 804. The system 800 may further include one or more of the following components connected to the I / O interface 805: an input section 806 including a keyboard, a mouse, etc.; an output section 807 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 808 including a hard disk, etc.; and a communication section 809 including a network interface card such as a LAN card, a modem, etc. The communication section 809 performs communication processing via a network such as the Internet. A drive 810 is also connected to the I / O interface 805 as needed. A removable medium 811, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 810 as needed, so that a computer program read therefrom is installed into the storage section 808 as needed.
[0199] According to an embodiment of the present disclosure, the method flow according to an embodiment of the present disclosure can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable storage medium, and the computer program contains a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 809, and / or installed from the removable medium 811. When the computer program is executed by the processor 801, the above-mentioned functions defined in the system of the embodiment of the present disclosure are executed. According to an embodiment of the present disclosure, the system, equipment, device, module, unit, etc. described above can be implemented by a computer program module.
[0200] The present disclosure also provides a computer-readable storage medium, which may be included in the device / apparatus / system described in the above embodiments; or may exist independently without being assembled into the device / apparatus / system. The above computer-readable storage medium carries one or more programs, and when the above one or more programs are executed, the method according to the embodiment of the present disclosure is implemented.
[0201] According to an embodiment of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium. For example, it may include, but is not limited to: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM (Erasable Programmable Read Only Memory, EPROM) or flash memory), a portable compact disk read-only memory (Computer Disc Read-Only Memory, CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, an apparatus or a device.
[0202] For example, according to an embodiment of the present disclosure, the computer-readable storage medium may include the ROM 802 and / or the RAM 803 described above and / or one or more memories other than the ROM 802 and the RAM 803 .
[0203] An embodiment of the present disclosure also includes a computer program product, which includes a computer program, which contains program code for executing the method provided by the embodiment of the present disclosure. When the computer program product runs on an electronic device, the program code is used to enable the electronic device to implement the object classification model training method or object classification prediction method provided by the embodiment of the present disclosure.
[0204] When the computer program is executed by the processor 801, the above functions defined in the system / device of the embodiment of the present disclosure are executed. According to the embodiment of the present disclosure, the system, device, module, unit, etc. described above can be implemented by a computer program module.
[0205] In one embodiment, the computer program may rely on tangible storage media such as optical storage devices, magnetic storage devices, etc. In another embodiment, the computer program may also be transmitted and distributed in the form of signals on a network medium, and downloaded and installed through the communication part 809, and / or installed from a removable medium 811. The program code contained in the computer program may be transmitted using any appropriate network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the above.
[0206] According to an embodiment of the present disclosure, the program code for executing the computer program provided by the embodiment of the present disclosure can be written in any combination of one or more programming languages. Specifically, these computing programs can be implemented using high-level process and / or object-oriented programming languages, and / or assembly / machine languages. Programming languages include, but are not limited to, Java, C++, python, "C" language or similar programming languages. The program code can be executed entirely on the user computing device, partially on the user device, partially on the remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, using an Internet service provider to connect through the Internet).
[0207] The flowcharts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flowchart or block diagram may represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of the code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box may also occur in an order different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flowchart, and the combination of boxes in the block diagram or flowchart, can be implemented with a dedicated hardware-based system that performs the specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions. It can be understood by those skilled in the art that the features recorded in the various embodiments and / or claims of the present disclosure can be combined and / or combined in a variety of ways, even if such a combination or combination is not explicitly recorded in the present disclosure. In particular, without departing from the spirit and teaching of the present disclosure, the features described in the various embodiments and / or claims of the present disclosure may be combined and / or combined in a variety of ways. All of these combinations and / or combinations fall within the scope of the present disclosure.
[0208] The embodiments of the present disclosure are described above. However, these embodiments are only for illustrative purposes and are not intended to limit the scope of the present disclosure. Although the embodiments are described above separately, this does not mean that the measures in the various embodiments cannot be used in combination to advantage. The scope of the present disclosure is defined by the attached claims and their equivalents. Without departing from the scope of the present disclosure, those skilled in the art may make a variety of substitutions and modifications, which should all fall within the scope of the present disclosure.
Claims
1. A method for training an object classification model, comprising: Acquire a training sample data set, wherein the training samples in the training sample data set include training images and label data of the training images, wherein the training images represent multiple postures of an object, the object includes an animal, the label data includes real posture classification information for the posture, and the label data also includes a real density map generated according to the object, wherein the real density map represents the real aggregation degree of the object at multiple positions in the training image; Inputting the training image into a deep neural network model and outputting a recognition result, wherein the recognition result includes predicted posture classification information, and the recognition result also includes a predicted density map, wherein the deep neural network model includes a first feature extraction network, a first object type classification network, and a first object posture classification network, and the predicted density map represents the predicted aggregation degree of the object at multiple positions in the training image; Calculate a loss function according to the recognition result and the label data to obtain a loss result; and The network parameters of the deep neural network model are iteratively adjusted according to the loss result to generate a trained object classification model, so as to use the object classification model to predict the posture of the object, wherein the loss of the deep neural network model is generated by weighing the first object posture classification network, the first object type classification network and the predicted density map. During the training process, the first object posture classification network, the first object type classification network and the predicted density map are simultaneously involved in gradient updating with the object classification model generated by the predicted density map, which provides morphological prior knowledge for the object classification model from two aspects of the posture and type of the animal, thereby making the weight of the object classification model suitable for the statistics of the number of animals.
2. The method according to claim 1, wherein: The object may include multiple types; the label data may also include real type classification information generated according to the type of the object; and the recognition result may also include predicted type classification information.
3. The method according to claim 2, wherein: The first object type classification network and the first object posture classification network both include a first convolutional layer, a maximum pooling layer, a second convolutional layer, an average pooling layer and a fully connected layer which are cascaded in sequence.
4. The method according to claim 3, wherein: The step of inputting the training image into a deep neural network model and outputting a recognition result comprises: Inputting the training image into the first feature extraction network and outputting a first feature map; Input the first feature map into the first convolutional layer, and output a second feature map; Inputting the second feature map into the maximum pooling layer, and outputting a compressed second feature map; Inputting the compressed second feature map into the second convolutional layer, and outputting a third feature map; Inputting the third feature map into the average pooling layer, and outputting a compressed third feature map; The compressed third feature map is input into the fully connected layer, and the predicted posture classification information or the predicted type classification information is output.
5. The method according to claim 1, wherein the deep neural network model comprises a second feature extraction network, a dilated convolutional layer, a density map generation network, and a second object pose classification network; in, The step of inputting the training image into a deep neural network model and outputting a recognition result comprises: Inputting the training image into the second feature extraction network and outputting a fourth feature map; Inputting the fourth feature map into the second object posture classification network, and outputting the predicted posture classification information; Input the fourth feature map into the hole convolution layer, and output a fifth feature map; The fifth feature map is input into the density map generation network, and a predicted density map is output.
6. The method according to claim 1, further comprising: Obtaining multiple initial training images; When the pixel size of the initial training image does not meet the preset condition, adjusting the pixel size of the image to be recognized to obtain the training image; Obtaining the label data by annotating the training image; and The training sample data set is generated according to the plurality of training images and the label data corresponding to the training images.
7. An object classification prediction method, comprising: Acquire an image to be recognized, wherein the image to be recognized represents multiple postures of an object, and the object includes an animal; and Inputting the image to be recognized into an object classification model to obtain a recognition result, wherein the recognition result includes target posture classification information; Wherein, the object classification model is trained using the method described in any one of claims 1 to 6.
8. The method according to claim 7, wherein: The types of the objects include multiple types, and the animals include birds; the recognition result also includes target type classification information and / or a target density map, and the target density map represents the degree of aggregation of the objects at different positions in the image to be recognized; Wherein, the method further comprises: According to the target density map, target quantity information of the object is generated.
9. A training device for an object classification model, comprising: A first acquisition module is used to acquire a training sample data set, wherein the training samples in the training sample data set include training images and label data of the training images, wherein the training images represent multiple postures of objects, the objects include animals, the label data include real posture classification information for the postures, and the label data also includes a real density map generated according to the objects, wherein the real density map represents the real aggregation degree of the objects at multiple positions in the training images; an output module, configured to input the training image into a deep neural network model and output a recognition result, wherein the recognition result includes predicted posture classification information and a predicted density map, wherein the deep neural network model includes a first feature extraction network, a first object type classification network and a first object posture classification network, and the predicted density map represents the predicted aggregation degree of the object at multiple positions in the training image; A calculation module, used to calculate a loss function according to the recognition result and the label data to obtain a loss result; and An iterative training module is used to iteratively adjust the network parameters of the deep neural network model according to the loss result to generate a trained object classification model, so as to use the object classification model to predict the posture of the object, wherein the loss of the deep neural network model is generated by weighing the first object posture classification network, the first object type classification network and the predicted density map. During the training process, the first object posture classification network and the first object type classification network participate in gradient updating simultaneously with the predicted density map to generate the object classification model, which provides morphological prior knowledge for the object classification model from two aspects of the posture and type of the animal, thereby making the weight of the object classification model suitable for the statistics of the number of animals.
10. An object classification prediction device, comprising: A second acquisition module is used to acquire an image to be recognized, wherein the image to be recognized represents a variety of postures of an object, and the object includes an animal; and A prediction module, used for inputting the image to be recognized into an object classification model to obtain a recognition result, wherein the recognition result includes target posture classification information; Wherein, the object classification model is trained using the method described in any one of claims 1 to 6.
11. An electronic device, comprising: one or more processors; a memory for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of claims 1 to 6 or 7 to 8.
12. A computer-readable storage medium having executable instructions stored thereon, which, when executed by a processor, enables the processor to implement the method according to any one of claims 1 to 6 or 7 to 8.
13. A computer program product, comprising a computer program, wherein the computer program is used to implement the method according to any one of claims 1 to 6 or 7 to 8 when executed by a processor.
