Training method of object statistical model, object statistical method and device
By training a deep neural network model to calculate the predictive density graph of the target image, the problem of cumbersome and high cost of manual statistics is solved, and efficient statistics and density prediction of the number of objects are achieved.
Patent Information
- Application Number
- CN202111173473.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-08
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2041-10-08
AI Technical Summary
The method of manually counting the number of objects is cumbersome and expensive, making it difficult to efficiently reflect the ecological environment.
By obtaining the training sample data set, the deep neural network model is trained to generate an object statistical model, and the target image is used to calculate the predictive density map, and then the number of objects is counted.
It improves the convenience of counting objects, reduces statistical costs, reduces the cumbersomeness of manual statistics, and realizes accurate prediction of animal and plant density.
Smart Images

Figure CN113902703B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and more specifically, to a training method for an object statistical model, an object statistical method, a training device for an object statistical model, an object statistical device, an electronic device, a computer-readable storage medium, and a computer program product. Background Art
[0002] In the ecological field, different objects have different sensitivities to their living environment, so the ecological environment can be judged to a certain extent based on the number of a certain object. For example, birds are used as indicator species of the ecological environment because of their strong sensitivity to their living environment. The number of birds in key areas of a nature reserve can reflect the environmental status of the entire ecological reserve, so that corresponding protection policies can be formulated in a timely manner.
[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 manual method of counting the number of objects is relatively cumbersome and the labor cost is high. Summary of the invention
[0004] In view of this, the embodiments of the present disclosure provide a training method for an object statistical model, an object statistical method, a training device for an object statistical model, an object statistical 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 statistical model, comprising:
[0006] Acquire the 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 include multiple objects, and the objects include animals and / or plants;
[0007] Input the above training images into the deep neural network model and output the predicted density map;
[0008] Calculate the loss function according to the predicted density map 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 statistical model of the object.
[0010] According to an embodiment of the present disclosure, the above-mentioned deep neural network model includes a feature extraction layer, a convolution layer, a plurality of hole convolution layers, an upsampling layer and a density generation network;
[0011] The step of inputting the training image into the deep neural network model and outputting a predicted density map includes:
[0012] Input the training sample data set into the feature extraction layer and output a first feature map;
[0013] Input the first feature map into the plurality of the dilated convolutional layers, and output a second feature map;
[0014] Input the second feature map into the convolution layer and output the third feature map;
[0015] Input the third feature map into the upsampling layer, and output a fourth feature map; and
[0016] The fourth feature map is input into the density generation network, and the predicted density map is output.
[0017] Another aspect of the disclosed embodiment provides an object statistics method, including:
[0018] Acquire a target image, wherein the target image includes a plurality of objects, and the objects include animals and / or plants; and
[0019] Inputting the target image into the object statistical model to obtain a recognition result, wherein the recognition result includes a statistical density map;
[0020] Among them, the above object statistical model method is trained based on the method described above.
[0021] According to an embodiment of the present disclosure, the number of the target images includes a plurality;
[0022] The above method further includes:
[0023] Merging the plurality of density maps into a total density map using an object statistical model; and
[0024] Generate statistics based on the above density summary map.
[0025] According to an embodiment of the present disclosure, the object statistics method further includes:
[0026] Acquire a plurality of captured images, wherein the captured images include a plurality of the objects;
[0027] Preprocessing the plurality of captured images to obtain images to be identified, wherein the images to be identified are super-resolution images; and
[0028] The above-mentioned image to be recognized is cropped to obtain multiple above-mentioned target images.
[0029] According to an embodiment of the present disclosure, the number of the target images is N, and the calculation formula of the number of the target images N is as follows:
[0030]
[0031] Among them, x represents the real length pixel value of the image to be identified, y represents the real height pixel value of the image to be identified, and x 0 Represents the preset length pixel value, y 0 represents the preset height pixel value, a represents the integer obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value and rounding down, b represents the integer obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value and rounding up, m represents the remainder obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value, and λ is a preset constant, which represents the proportion of adjusting the real height pixel value.
[0032] According to an embodiment of the present disclosure, the above-mentioned cropping process is performed on the above-mentioned image to be identified to obtain a plurality of the above-mentioned target images, including:
[0033] If the pixel size of the image to be identified does not meet a preset condition, adjusting the pixel size of the image to be identified to obtain an adjusted image to be identified; and
[0034] The adjusted image to be recognized is cropped to obtain a plurality of target images.
[0035] According to an embodiment of the present disclosure, the target image includes an image number;
[0036] The object statistics method further includes:
[0037] According to the image number of each of the target images, multiple target images are spliced to generate an output image.
[0038] According to an embodiment of the present disclosure, the preprocessing of the plurality of captured images to obtain the image to be recognized includes:
[0039] Using a statistical method to screen the plurality of captured images to obtain screened captured images; and
[0040] The plurality of the above-mentioned filtered captured images are stitched together to obtain the above-mentioned image to be identified.
[0041] According to an embodiment of the present disclosure, the above-mentioned animals include birds.
[0042] Another aspect of the embodiments of the present disclosure provides a training device for an object statistical model, including:
[0043] A first acquisition module is used to acquire the 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 include multiple objects, and the objects include animals and / or plants;
[0044] A first output module, used to input the above training image into a deep neural network model and output a predicted density map;
[0045] A second output module is used to calculate a loss function according to the predicted density map and the label data to obtain a loss result; and
[0046] A generation 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 the trained statistical model of the above-mentioned object.
[0047] Another aspect of the embodiments of the present disclosure provides an object statistics device, including:
[0048] a second acquisition module, configured to acquire a target image, wherein the target image includes a plurality of objects, and the objects include animals and / or plants; and
[0049] An obtaining module, used for inputting the target image into the object statistical model to obtain a recognition result, wherein the recognition result includes a statistical density map;
[0050] Among them, the above object statistical model method is trained based on the method described above.
[0051] 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.
[0052] 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.
[0053] 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.
[0054] According to the embodiments of the present disclosure, an object statistical model is obtained by training a deep neural network model, so that the density of animals and / or plants can be predicted using the object statistical model. This at least partially overcomes the technical problems of cumbersome manual counting of the number of objects and high labor costs, thereby achieving the technical effect of improving the convenience of object quantity counting and reducing statistical costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] 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:
[0056] Figure 1 An exemplary system architecture of a training method for an application object statistical model or an object statistical method according to an embodiment of the present disclosure is schematically shown;
[0057] Figure 2 A flowchart of a method for training an object statistical model according to an embodiment of the present disclosure is schematically shown;
[0058] Figure 3 A flowchart of a method for outputting a prediction density map of a deep neural network model according to an embodiment of the present disclosure is schematically shown;
[0059] Figure 4 A flowchart of an object statistics method according to an embodiment of the present disclosure is schematically shown;
[0060] Figure 5 A schematic diagram of a method for object statistics according to an embodiment of the present disclosure is schematically shown;
[0061] Figure 6 A block diagram schematically shows a training device for an object statistical model according to an embodiment of the present disclosure;
[0062] Figure 7 A block diagram schematically shows an object statistics device according to an embodiment of the present disclosure; and
[0063] Figure 8 A block diagram of an electronic device for implementing a training method for an object statistical model or an object statistical method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0064] 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.
[0065] 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.
[0066] 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.
[0067] 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.).
[0068] In the related art, cameras are used to collect images of key areas in the protected area, and then objects in the images are counted manually, such as the number of birds in the images. However, the manual counting process is complicated and consumes a lot of manpower and financial resources.
[0069] In view of this, the inventors discovered that a deep neural network model can be trained using a training sample data set including objects such as birds, and a trained object statistical model can be obtained. The object statistical model can be used to realize the number statistics of objects such as birds, thereby avoiding the waste of manpower and financial resources caused by manual statistical methods.
[0070] The embodiments of the present disclosure provide a training method for an object statistical model, an object statistical method, a training device for an object statistical model, an object statistical device, an electronic device, a computer-readable storage medium, and a computer program product. The method 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 include multiple objects, and the objects include animals and / or plants; inputting the training images into a deep neural network model and outputting a predicted density map; calculating a loss function based on the predicted density map 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 statistical model.
[0071] Figure 1 The exemplary system architecture 100 to which the training method of the object statistical model or the object statistical 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.
[0072] like Figure 1As 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.
[0073] 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 a target image. Various client applications can be installed on the terminal devices 101, 102, 103, such as object statistics applications, web browser applications, search applications, instant messaging tools, email clients and / or social platform software (only as examples).
[0074] 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.
[0075] The server 105 may be a server that provides various services, such as a background management server (only as an example) that provides support for data transmitted by users using the terminal devices 101, 102, and 103. The background management server may analyze the received data and feed back the processing results (such as an object statistical model or statistical density map generated based on the user's data) to the terminal device.
[0076] It should be noted that the training method or object statistical method of the object statistical model provided in the embodiment of the present disclosure can generally be executed by the server 105. Accordingly, the training device or object statistical device of the object statistical model provided in the embodiment of the present disclosure can generally be set in the server 105. The training method or object statistical method of the object statistical 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 statistical device of the object statistical 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 statistical method of the object statistical 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 statistical model training device or object statistical device provided in the embodiments of the present disclosure may also be arranged in the terminal device 101 , 102 , or 103 , or in other terminal devices different from the terminal device 101 , 102 , or 103 .
[0077] For example, the training sample data set or the target image may be originally stored in any one of the terminal devices 101, 102, or 103 (for example, the terminal device 101, but not limited thereto), or may be stored on an external storage device and may be imported into the terminal device 101. Then, the terminal device 101 may locally execute the object statistical model training method or the object statistical method provided in the embodiment of the present disclosure, or send the training sample data set or the target image to other terminal devices, servers, or server clusters, and the training sample data set or the target image may be received by other terminal devices, servers, or server clusters to execute the object statistical model training method or the object statistical method provided in the embodiment of the present disclosure.
[0078] 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.
[0079] Figure 2 The flowchart of the object statistical model training method according to the embodiment of the present disclosure is schematically shown.
[0080] like Figure 2 As shown, the object statistical model training method may include operations S210 to S240.
[0081] In operation S210, a training sample data set is obtained, wherein the training samples in the training sample data set include training images and label data of the training images. The training images may include multiple objects, and the objects may include animals and / or plants.
[0082] In operation S220, the training image is input into the deep neural network model, and a predicted density map is output.
[0083] In operation S230 , a loss function is calculated according to the predicted density map and the label data to obtain a loss result.
[0084] In operation S240, network parameters of the deep neural network model are iteratively adjusted according to the loss result to generate a trained object statistical model.
[0085] According to an embodiment of the present disclosure, the training image may include an image taken by a camera. Animals may include but are not limited to fish, reptiles, birds, amphibians or mammals. Plants may include but are not limited to seed plants, algae, mosses, ferns, etc.
[0086] According to an embodiment of the present disclosure, the object may also include other objects, such as a car, a train, a ship, or items in a warehouse.
[0087] According to an embodiment of the present disclosure, a labeling tool may be used to label the training image, obtain the position coordinates of the object in the target image, and generate label data according to the position coordinates. The file format of the label data may include a mat file.
[0088] In order to facilitate the description of the present invention, the following embodiments are illustrated by using birds.
[0089] According to an embodiment of the present disclosure, the feature extraction part of the deep neural network model can use a deep residual network (ResNet). For example, since the background of the sample data set is relatively complex and contains information of multiple objects, the ResNet34 network with good effect in the field of image recognition can be used as the feature extraction part of the deep neural network model. The loss function can use the Euclidean distance.
[0090] It should be noted that the deep neural network of this embodiment is not limited to deep residual networks such as ResNet34 networks, but may also be other types of neural networks. This disclosure embodiment is not limited to this.
[0091] According to an embodiment of the present disclosure, the acquired training image is input into a deep neural network model, a predicted density map is output, and a loss function is calculated based on the predicted density map 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 statistical model can be obtained.
[0092] According to the embodiments of the present disclosure, an object statistical model is obtained by training a deep neural network model, so that the density of animals and / or plants can be predicted using the object statistical model. This at least partially overcomes the technical problems of cumbersome manual counting of the number of objects and high labor costs, thereby achieving the technical effect of improving the convenience of object quantity counting and reducing statistical costs.
[0093] According to an embodiment of the present disclosure, the deep neural network model may include a feature extraction layer, a convolution layer, multiple hole convolution layers, an upsampling layer, and a density generation network.
[0094] 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.
[0095] According to an embodiment of the present disclosure, the feature extraction layer of the ResNet34 network serves as the feature extraction part of the deep neural network model. In order to connect with the density generation network, the fully connected layer of the ResNet34 network can be removed.
[0096] According to an embodiment of the present disclosure, the ResNet34 network has been pre-trained based on a tens of millions-level data set (such as the ImageNet data set) before training. Therefore, the weights of the ResNet34 network contain rich target feature information. Therefore, using the ResNet34 network as the feature extraction part can effectively accelerate the convergence speed of deep neural network model training.
[0097] Figure 3 A flowchart of a method for outputting a prediction density map from a deep neural network model according to an embodiment of the present disclosure is schematically shown.
[0098] like Figure 3 As shown, inputting a training image into a deep neural network model and outputting a predicted density map may include operations S310 to S350.
[0099] In operation S310, a training sample data set is input into a feature extraction layer, and a first feature map is output.
[0100] In operation S320, the first feature map is input into a plurality of dilated convolutional layers, and a second feature map is output.
[0101] In operation S330, the second feature map is input into a convolutional layer, and a third feature map is output.
[0102] In operation S340, the third feature map is input to an upsampling layer, and a fourth feature map is output.
[0103] In operation S350, the fourth feature map is input into a density generation network, and a predicted density map is output.
[0104] According to an embodiment of the present disclosure, the size of the first feature map output by the feature extraction layer of the ResNet34 network may be 128×96, 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.
[0105] According to the embodiments of the present disclosure, since the individual birds in the training images are relatively small and individual occlusion is relatively common, more abundant and complete local feature information is needed to assist in generating feature maps. This embodiment increases the receptive field of the convolution operation by inputting the first feature map into multiple dilated convolution layers for dilated calculations, and achieves that the feature map output by each dilated convolution layer contains a larger range of information without performing feature extraction of the convolution network. In addition, in order to retain the feature information of the birds in the training images as much as possible, the deep neural network model in this embodiment does not use a pooling layer.
[0106] According to an embodiment of the present disclosure, in order to reduce the impact of label data errors on the training of the object statistical model, the third feature map can be input into the density generation network for upsampling before the density generation network, and the size of the fourth feature map output by the upsampling layer can be 256×192.
[0107] Figure 4 The flowchart of the object statistics method according to the embodiment of the present disclosure is schematically shown.
[0108] Figure 5 A method diagram of an object statistics method according to an embodiment of the present disclosure is schematically shown.
[0109] like Figure 4 and Figure 5 As shown, the object statistics method may include operations S410 to S420.
[0110] In operation S410, a target image is acquired, wherein the target image includes a plurality of objects, and the objects include animals and / or plants.
[0111] In operation S420, the target image is input into the object statistical model to obtain a recognition result, wherein the recognition result includes a statistical density map. The object statistical model method is trained based on the method described above.
[0112] According to an embodiment of the present disclosure, the animal may include a bird.
[0113] According to an embodiment of the present disclosure, by using a trained object statistical model to identify an object in a target image, a statistical density map of the object can be obtained, so that the degree of aggregation of the object in the target image can be determined.
[0114] According to the embodiments of the present disclosure, an object statistical model is obtained by training a deep neural network model, so that the density of animals and / or plants can be predicted using the object statistical model. This at least partially overcomes the technical problems of cumbersome manual counting of the number of objects and high labor costs, thereby achieving the technical effect of improving the convenience of object quantity counting and reducing statistical costs.
[0115] According to an embodiment of the present disclosure, the number of target images includes a plurality.
[0116] like Figure 5 As shown, the object statistics method may further include the following operations.
[0117] Combine multiple density maps into a total density map using an object statistics model. Generate statistics based on the total density map.
[0118] According to an embodiment of the present disclosure, in order to more easily understand the total number of birds in multiple target images, a density map stitching module can be used to merge the density maps generated according to each target image to obtain a total density map. The total density map can be integrated to obtain the total number of birds in the multiple target images.
[0119] According to the embodiments of the present disclosure, the method of calculating the number of birds by integrating the density map can reduce the tediousness of manually counting the number of objects, which is convenient, fast and low-cost.
[0120] like Figure 5 As shown, the object statistics method may further include the following operations.
[0121] A plurality of captured images are obtained, wherein the captured images include a plurality of objects. The plurality of captured images are preprocessed to obtain images to be identified. The images to be identified are super-resolution images. The images to be identified are cropped to obtain a plurality of target images.
[0122] According to an embodiment of the present disclosure, the captured image may include multiple frames of images in a video captured by a camera. The captured image may be a three-channel RGB image.
[0123] According to the embodiments of the present disclosure, since the viewing angle of the camera is limited, in order to ensure that the image frames in the captured video are clear enough, the camera needs to be rotated at a certain speed to obtain a video containing the global scene range where bird counting is required. Since there may be invalid images that overlap and cross in the multiple frames of captured images, the multiple frames of captured images can be pre-processed by screening, etc., so as to obtain a captured image that can represent the global scene to be counted that is completely spliced.
[0124] According to an embodiment of the present disclosure, the multiple captured images obtained by screening are spliced to obtain a super-resolution image in a global wide-viewing angle scene, wherein the super-resolution image may include a size greater than or equal to 30720 × 1080. The obtained super-resolution image is cropped to obtain multiple target images with a size of 1024 × 768.
[0125] It should be noted that the pixel values of 30720×1080 or 1024×768 etc. involved in the embodiments of the present disclosure and below 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 their specific values can be set according to specific needs.
[0126] like Figure 5 As shown, the image to be recognized is cropped to obtain multiple target images, which may include the following operations.
[0127] When the pixel size of the image to be identified does not meet the preset condition, the pixel size of the image to be identified is adjusted to obtain an adjusted image to be identified, and the adjusted image to be identified is cropped to obtain multiple target images.
[0128] According to an embodiment of the present disclosure, the preset condition may include a length pixel of N×1024 and a width pixel of 768, where N is a positive integer greater than or equal to 1.
[0129] According to an embodiment of the present disclosure, when the pixel size of the image to be identified does not meet a preset condition, the pixels of the image to be identified need to be adjusted, wherein the adjustment can be performed using a pixel operation algorithm, and the pixel operation algorithm includes but is not limited to a Resize algorithm.
[0130] According to an embodiment of the present disclosure, N 1024×768 target images may be obtained by cropping the adjusted image to be recognized.
[0131] According to an embodiment of the present disclosure, the number of target images is N, and the calculation formula of the number of target images N is as follows:
[0132]
[0133] Among them, x represents the real length pixel value of the image to be identified, y represents the real height pixel value of the image to be identified, and x 0 Represents the preset length pixel value, y 0 represents the preset height pixel value, a represents the integer obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value and rounding down, b represents the integer obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value and rounding up, m represents the remainder obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value, and λ is a preset constant, which represents the proportion of adjusting the real height pixel value.
[0134] According to an embodiment of the present disclosure, the preset length pixel value may be 1024, and the preset height pixel value may be 768.
[0135] According to an embodiment of the present disclosure, before making an adjustment, it is necessary to determine the number N of target images, and determine the adjustment ratio according to the number N of target images. For example, it can be determined by a formula that the image to be identified can be cropped into 4.5 target images, and the number of final target images is determined to be 5 according to the principle of rounding, so the size of the image to be identified can be adjusted to (5×1024)×768.
[0136] According to an embodiment of the present disclosure, the target image includes an image number.
[0137] The object counting method may further include the following operations.
[0138] The multiple target images are concatenated according to the image number of each target image to generate an output image.
[0139] According to an embodiment of the present disclosure, the image number of the target image may be numbered during the cropping process of the image to be identified. For example, the target image may be numbered according to the following naming method: “original image name_xx.jpg”.
[0140] According to an embodiment of the present disclosure, while outputting the density map, the output image can be output, and the area corresponding to each target image in the output image includes the density map and count data of the target image. The total density map and statistical data of the image to be identified can also be output in other areas of the output image. The count data can be generated by integrating the density map of each target image.
[0141] According to an embodiment of the present disclosure, preprocessing a plurality of captured images to obtain an image to be recognized may include the following operations.
[0142] A plurality of captured images are screened using a statistical method to obtain a screened captured image.
[0143] Multiple filtered captured images are stitched together to obtain an image to be identified.
[0144] According to the embodiments of the present disclosure, when the angle and speed of rotation of the camera are determined, the number of frames in the video recorded by the camera that can be completely spliced into an image to be identified in the global scene to be counted can be determined by statistical methods, a video key frame extraction method is designed to obtain valid frames in the video, and an image stitching module is used to stitch multiple valid frames into a super-resolution image to be identified.
[0145] For example, by determining which object in the captured image is the object that needs to be counted, after determining the object to be counted, determine the characteristics of the object, and perform statistics in multiple captured images based on the characteristics. However, since there are overlapping areas in multiple captured images, it is determined which captured image is an invalid frame based on the statistical results, thereby determining the valid frame of the image to be identified that can represent the global scene to be counted.
[0146] Figure 6 A block diagram of a training device for an object statistical model according to an embodiment of the present disclosure is schematically shown.
[0147] like Figure 6 As shown, the training device 600 for the object statistical model may include a first acquisition module 610 , a first output module 620 , a second output module 630 and a generation module 640 .
[0148] The first acquisition module 610 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 include multiple objects, and the objects include animals and / or plants.
[0149] The first output module 620 is used to input the training image into the deep neural network model and output the predicted density map.
[0150] The second output module 630 is used to calculate the loss function according to the predicted density map and the label data to obtain a loss result.
[0151] The generation 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 statistical model.
[0152] According to the embodiments of the present disclosure, an object statistical model is obtained by training a deep neural network model, so that the density of animals and / or plants can be predicted using the object statistical model. This at least partially overcomes the technical problems of cumbersome manual counting of the number of objects and high labor costs, thereby achieving the technical effect of improving the convenience of object quantity counting and reducing statistical costs.
[0153] According to an embodiment of the present disclosure, the deep neural network model may include a feature extraction layer, a convolution layer, multiple hole convolution layers, an upsampling layer, and a density generation network.
[0154] According to an embodiment of the present disclosure, the first output module 620 may include a first output unit, a second output unit, a third output unit, a fourth output unit, and a fifth output unit.
[0155] The first output unit is used to input the training sample data set into the feature extraction layer and output a first feature map.
[0156] The second output unit is used to input the first feature map into multiple hole convolution layers and output the second feature map.
[0157] The third output unit is used to input the second feature map into the convolution layer and output the third feature map.
[0158] The fourth output unit is used to input the third feature map into the upsampling layer and output a fourth feature map.
[0159] The fifth output unit is used to input the fourth feature map into the density generation network and output the predicted density map.
[0160] Figure 7 The block diagram of the object statistics device according to the embodiment of the present disclosure is schematically shown.
[0161] like Figure 7 As shown, the object statistics device 700 may include a second acquisition module 710 and an obtaining module 720 .
[0162] The second acquisition module 710 is used to acquire a target image, wherein the target image includes a plurality of objects, and the objects include animals and / or plants.
[0163] The obtaining module 720 is used to input the target image into the object statistical model to obtain a recognition result, wherein the recognition result includes a statistical density map.
[0164] Among them, the object statistical model method is trained based on the method described above.
[0165] According to the embodiments of the present disclosure, an object statistical model is obtained by training a deep neural network model, so that the density of animals and / or plants can be predicted using the object statistical model. This at least partially overcomes the technical problems of cumbersome manual counting of the number of objects and high labor costs, thereby achieving the technical effect of improving the convenience of object quantity counting and reducing statistical costs.
[0166] According to an embodiment of the present disclosure, the number of target images may include multiple ones.
[0167] According to an embodiment of the present disclosure, the object statistics device 700 may further include a merging module and a generating module.
[0168] The merging module is used to merge multiple density maps into a total density map using an object statistical model.
[0169] The generation module is used to generate statistical data based on the total density map.
[0170] According to an embodiment of the present disclosure, the object statistics device 700 may further include a third acquisition module, a preprocessing module and a cropping module.
[0171] The third acquisition module is used to acquire a plurality of captured images, wherein the captured images include a plurality of objects.
[0172] The preprocessing module is used to preprocess a plurality of captured images to obtain an image to be identified, wherein the image to be identified is a super-resolution image.
[0173] The cropping module is used to crop the image to be recognized to obtain multiple target images.
[0174] According to an embodiment of the present disclosure, the number of target images may be N, and the calculation formula of the number of target images N is as follows:
[0175]
[0176] Among them, x represents the real length pixel value of the image to be identified, y represents the real height pixel value of the image to be identified, and x 0 Represents the preset length pixel value, y 0 represents the preset height pixel value, a represents the integer obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value and rounding down, b represents the integer obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value and rounding up, m represents the remainder obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value, and λ is a preset constant, which represents the proportion of adjusting the real height pixel value.
[0177] According to an embodiment of the present disclosure, the cropping module may include an adjustment unit and a cropping unit.
[0178] The adjusting unit is used to adjust the pixel size of the image to be identified when the pixel size of the image to be identified does not meet a preset condition, so as to obtain an adjusted image to be identified.
[0179] The cropping unit is used to crop the adjusted image to be recognized to obtain multiple target images.
[0180] According to an embodiment of the present disclosure, the target image may include an image number.
[0181] According to an embodiment of the present disclosure, the object statistics device 700 may further include a splicing module.
[0182] The stitching module is used to stitch multiple target images according to the image number of each target image to generate an output image.
[0183] According to an embodiment of the present disclosure, the preprocessing module may include a screening unit and a splicing unit.
[0184] The screening unit is used to screen the multiple captured images using a statistical method to obtain screened captured images.
[0185] The stitching unit is used to stitch a plurality of filtered captured images to obtain an image to be identified.
[0186] According to an embodiment of the present disclosure, the animal may include a bird.
[0187] 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.
[0188] For example, any of the first acquisition module 610, the first output module 620, the second output module 630 and the generation module 640, or the second acquisition module 710 and the acquisition module 720 can be combined in one module / unit for implementation, or any one of the modules / units can be split into multiple modules / units. Alternatively, at least part of the functions of one or more of 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 first output module 620, the second output module 630 and the generation module 640, or the second acquisition module 710 and the acquisition 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 first output module 620, the second output module 630 and the generation module 640, or at least one of the second acquisition module 710 and the obtaining module 720 can be at least partially implemented as a computer program module, which can perform corresponding functions when executed.
[0189] It should be noted that the training device part of the object statistical model in the embodiment of the present disclosure corresponds to the training method part of the object statistical model in the embodiment of the present disclosure, and the description of the training device part of the object statistical model specifically refers to the training method part of the object statistical model, and the object statistical device part in the embodiment of the present disclosure corresponds to the object statistical method part in the embodiment of the present disclosure, and the description of the object statistical device part specifically refers to the object statistical method part, which will not be repeated here.
[0190] 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.
[0191] 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.
[0192] 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.
[0193] 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.
[0194] 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.
[0195] The object statistical model can be used in parallel reasoning. For example, if the weight of a model is 980MB, the space of the processor 801 occupied by the object statistical process is about 1200MB, and the number of images counted in parallel by a processor 801 is 9, in order to ensure the margin of the processor 801 space, the number of parallel statistical threads is designed to be 8, so as to obtain the density map and count data corresponding to the target image.
[0196] 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.
[0197] 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.
[0198] 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 .
[0199] 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 statistical model training method or object statistical method provided by the embodiment of the present disclosure.
[0200] 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.
[0201] 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.
[0202] 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).
[0203] 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.
[0204] 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 training method for an object statistical model, comprising: Get the training sample data set, where The training samples in the training sample data set include training images and label data of the training images, wherein the training images include multiple objects, and the objects include animals and / or plants; Inputting the training image into a deep neural network model and outputting a predicted density map; Calculate the loss function according to the predicted density map and the label data to obtain a loss result; and Iteratively adjusting the network parameters of the deep neural network model according to the loss result to generate a trained statistical model of the object; The deep neural network model includes a feature extraction layer, a convolution layer, a plurality of hole convolution layers, an upsampling layer and a density generation network, and the deep neural network model does not use a pooling layer to retain feature information of objects in the training image; The step of inputting the training image into the deep neural network model and outputting a predicted density map includes: Input the training sample data set into the feature extraction layer and output a first feature map; Inputting the first feature map into a plurality of the dilated convolutional layers for dilation calculation to increase the receptive field of the convolution operation, thereby outputting a second feature map; Input the second feature map into a convolutional layer and output a third feature map; Inputting the third feature map into the upsampling layer, and outputting a fourth feature map; and The fourth feature map is input into the density generation network, and the predicted density map is output.
2. An object counting method, comprising: Acquiring a target image, wherein the target image includes a plurality of objects, the objects including animals and / or plants; and Inputting the target image into an object statistical model to obtain a recognition result, wherein the recognition result includes a statistical density map; Wherein, the object statistical model method is trained based on the method as claimed in claim 1.
3. The method according to claim 2, wherein: The number of the target images includes a plurality; The method further comprises: merging the plurality of density maps into a total density map using an object statistical model; and Statistics are generated based on the density map.
4. The method according to claim 2, further comprising: Acquire a plurality of captured images, wherein the captured images include a plurality of the objects; Preprocessing the plurality of captured images to obtain images to be identified, wherein the images to be identified are super-resolution images; and The image to be identified is cropped to obtain a plurality of target images.
5. The method according to claim 4, wherein: The number of the target images is N, and the calculation formula of the number of the target images N is as follows: Among them, x represents the real length pixel value of the image to be identified, and y represents the real height pixel value of the image to be identified. Represents the preset length pixel value, represents the preset height pixel value, a represents the integer obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value and rounding down, b represents the integer obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value and rounding up, m represents the remainder obtained by dividing the real length pixel value of the image to be identified by the preset length pixel value, 𝜆 is a preset constant, which represents the proportion of adjusting the real height pixel value.
6. The method according to claim 4, wherein: The step of performing cropping on the image to be identified to obtain a plurality of target images comprises: If the pixel size of the image to be identified does not meet a preset condition, adjusting the pixel size of the image to be identified to obtain an adjusted image to be identified; and The adjusted image to be identified is cropped to obtain a plurality of target images.
7. The method according to claim 4, wherein: The target image includes an image number; The method further comprises: According to the image number of each of the target images, multiple target images are spliced to generate an output image.
8. The method according to claim 4, wherein: The preprocessing of the plurality of captured images to obtain an image to be identified includes: screening the plurality of captured images using a statistical method to obtain screened captured images; and The plurality of filtered captured images are spliced together to obtain the image to be identified.
9. The method according to any one of claims 2 to 8, wherein The animals include birds.
10. A training device for an object statistical 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 include multiple objects, and the objects include animals and / or plants; A first output module, used to input the training image into a deep neural network model and output a predicted density map; A second output module is used to calculate a loss function according to the predicted density map and the label data to obtain a loss result; and A generating module, used for iteratively adjusting the network parameters of the deep neural network model according to the loss result to generate a trained statistical model of the object; Among them, the deep neural network model may include a feature extraction layer, a convolution layer, multiple hole convolution layers, an upsampling layer, and a density generation network; Wherein, the first output module includes: A first output unit, used to input the training sample data set into the feature extraction layer and output a first feature map; A second output unit is used to input the first feature map into multiple dilated convolutional layers for dilation calculation to increase the receptive field of the convolution operation, thereby outputting a second feature map; A third output unit, used for inputting the second feature map into the convolution layer and outputting a third feature map; a fourth output unit, configured to input the third feature map into the upsampling layer and output a fourth feature map; The fifth output unit is used to input the fourth feature map into the density generation network and output the predicted density map.
11. An object statistics device, comprising: a second acquisition module, configured to acquire a target image, wherein the target image includes a plurality of objects, including animals and / or plants; and An obtaining module, used for inputting the target image into an object statistical model to obtain a recognition result, wherein the recognition result includes a statistical density map; Wherein, the object statistical model method is trained based on the method as claimed in claim 1.
12. An electronic device comprising: one or more processors; a memory for storing one or more programs, When the multiple programs are executed by the one or more processors, the one or more processors implement the method described in any one of claims 1 or 2 to 9.
13. 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 or 2 to 9.
14. 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 or 2 to 9 when executed by a processor.
