Bird recognition model training method and device, equipment and storage medium
By superimposing bird images in complex background images to form training samples, the problem of low recognition accuracy of bird recognition models in complex scenarios is solved, and a higher recognition accuracy is achieved.
Patent Information
- Application Number
- CN202311509382.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-14
- Publication Date
- 2025-07-18
AI Technical Summary
The bird recognition model trained by the prior art is not very accurate in bird recognition in complex scenarios.
By acquiring complex background images and bird images, intercepting bird images and superimposing them into complex background images, forming training sample images, and training the bird recognition model based on these images.
The recognition accuracy of bird recognition models in complex scenarios has been improved.
Smart Images

Figure CN120339738A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of wetland monitoring, and particularly relates to a method, device, equipment and storage medium for training a bird recognition model. Background Art
[0002] A wetland intelligent monitoring system mainly monitors the species and quantity of species in the wetland environment, identifies the factors of human interference in the wetland environment, and monitors the water quality. Among them, birds are the most representative group of wetland wild animals and an important part of the wetland ecosystem, which sensitively and profoundly reflect the changes of the wetland environment. Therefore, the identification of bird species and the monitoring of quantity are crucial.
[0003] Due to the complex background of the wetland scene and the variable postures of birds, when the existing technical solutions train a bird recognition model to achieve automatic bird recognition, the training sample images will be processed by means such as random scaling and cropping, random rotation and flipping, random brightness and contrast adjustment, random noise and blur processing, etc., so that the training samples contain more bird samples in complex scenarios, thereby improving the recognition effect of the trained bird recognition model on birds in complex scenarios.
[0004] However, the bird recognition model trained by the existing technology has a low recognition accuracy for birds in complex scenarios. Summary of the Invention
[0005] The purpose of the embodiments of the present application is to provide a method for training a bird recognition model, aiming to solve the problem that the bird recognition model trained by the existing technology has a low recognition accuracy for birds in complex scenarios.
[0006] The embodiments of the present application are implemented as follows. A method for training a bird recognition model includes:
[0007] Obtain a complex background image and a bird image;
[0008] Extract a bird extraction image from the bird image and overlay the bird extraction image on the complex background image to obtain a training sample image;
[0009] Train a preset bird recognition model based on the training sample image.
[0010] Another purpose of the embodiments of the present application lies in a device for training a bird recognition model, including:
[0011] An image acquisition module, configured to obtain a complex background image and a bird image;
[0012] A training sample image determination module, configured to extract a bird cropped image from the bird images, and superimpose the bird cropped image onto the complex background image to obtain a training sample image; and,
[0013] A bird recognition model training module, configured to train a preset bird recognition model based on the training sample image.
[0014] Another object of the embodiments of the present application is a bird recognition method, including:
[0015] A bird recognition model trained by the above-mentioned bird recognition model training method;
[0016] Based on the bird recognition model, identify the bird image to be recognized to obtain a bird recognition result.
[0017] Another object of the embodiments of the present application is a computer device, including a memory and a processor. A computer program is stored in the memory. When the computer program is executed by the processor, the processor is caused to execute the steps of the above-mentioned bird recognition model training method.
[0018] Another object of the embodiments of the present application is a computer-readable storage medium. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor is caused to execute the steps of the above-mentioned bird recognition model training method.
[0019] A bird recognition model training method provided by the embodiments of the present application, by obtaining a complex background image and bird images; extracting a bird cropped image from the bird images, and superimposing the bird cropped image onto the complex background image to obtain a training sample image, and this training sample image is based on a complex background. Based on this training sample image, a bird recognition model is trained, so that the trained bird recognition model has a higher recognition accuracy for birds in complex scenes. Description of the Drawings
[0020] Figure 1 It is an application environment diagram of a bird recognition model training method provided by the embodiments of the present application;
[0021] Figure 2 It is a flowchart of a bird recognition model training method provided by the embodiments of the present application;
[0022] Figure 3 It is a flowchart of a training sample determination method provided by the embodiments of the present application;
[0023] Figure 4 It is a flowchart of another training sample determination method provided by the embodiments of the present application;
[0024] Figure 5 The structural block diagram of a bird recognition model training device provided by an embodiment of the present application;
[0025] Figure 6 It is the internal structural block diagram of a computer device in an embodiment. Specific implementation manners
[0026] In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0027] It can be understood that the terms "first", "second", etc. used in the present application can be used herein to describe various elements, but unless otherwise specified, these elements are not limited by these terms. These terms are only used to distinguish the first element from another element. For example, without departing from the scope of the present application, the first xx script can be called the second xx script, and similarly, the second xx script can be called the first xx script.
[0028] Figure 1 It is an application environment diagram of a bird recognition model training method provided by an embodiment of the present application. As Figure 1 shown, in this application environment, it includes a terminal 110 and a computer device 120.
[0029] The computer device 120 can be an independent physical server or terminal, or a server cluster composed of multiple physical servers, and can be a cloud server providing basic cloud computing services such as cloud servers, cloud databases, cloud storage, and CDN.
[0030] The terminal 110 can be a smart phone, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart watch, etc., but is not limited thereto. The terminal 110 and the computer device 120 can be connected through a network, and the present application does not limit this here.
[0031] In one embodiment, as Figure 2 shown, a bird recognition model training method. In this embodiment, the application of this method to Figure 1 the computer device 120 in is taken as an example for illustration. Of course, those skilled in the art can also make adaptive modifications to it so that it can run on the terminal 110. The shown bird recognition model training method includes:
[0032] Step S202: Obtain complex background images and bird images.
[0033] Among them, the complex background image can be automatically obtained or manually obtained from the picture information taken in real time by the video terminal deployed in the wetland reserve. The present application does not limit the acquisition method of the complex background image. When adopting automatic acquisition, it can be determined whether the background image is a complex background image according to the number of habitat elements in the image, that is, the number of habitat tags, and the quantity threshold for judgment can be freely set. The above-mentioned habitat elements are generally water surface, trees, grasslands, swamps, etc. Among them, the trees can be further subdivided into shrubs, arbors, etc. The present application does not specifically limit the subdivision scale of the habitat elements, and various object detection models in the prior art can be used to identify the habitat elements, which will not be introduced in detail here. When acquiring the complex background image, those skilled in the art can also choose whether to calculate the similarity between the newly acquired complex background image and multiple complex background images in the complex background image library, so that there are no or only a small number of complex background images with high similarity in the complex background image library.
[0034] The bird images can be obtained through the monitoring devices set in the reserve or directly obtained from the Internet. It should be noted that after obtaining the bird images, the bird images need to be labeled. This labeling process can be carried out by ecological experts or by using a trained bird recognition model. When using the bird recognition model for labeling, the confidence level of the recognition result of the bird recognition model needs to be considered, and only the recognition results with higher confidence levels are adopted, so that there are no or only a small number of errors in the labeling information of the bird images, and there are no or only a small number of incorrect information in the labeling information of the final training samples. Preferably, when using the bird recognition model for automatic recognition and labeling, the bird recognition model for labeling is the same bird recognition model as the bird recognition model for training in the following text, so as to continuously improve the recognition ability of the bird recognition model.
[0035] Step S204: Crop the bird cropped image from the bird image, and superimpose the bird cropped image on the complex background image to obtain a training sample image.
[0036] Among them, since the birds in the bird image have been labeled, the bird cropped image can be quickly cropped from the bird image. The bird cropped image is the bird in the bird image. Then, the bird cropped image is superimposed on the complex background image to obtain a training sample under the complex background, and the training sample comes with labeling information.
[0037] Step S206: Train a preset bird recognition model based on the training sample image.
[0038] After obtaining a sufficient number of training samples in a complex background according to the above steps, the training samples can be added to the ordinary training samples to train the bird recognition model, or the bird recognition model can be directly trained based on the training samples. The bird recognition model is an object detection model in the prior art and will not be introduced in detail here. Preferably, the bird recognition model for training is the same as the bird recognition model for annotating bird images in the above text (in the case of automatic annotation using the bird recognition model), so as to gradually improve the recognition ability of the bird recognition model for complex scenes.
[0039] In one embodiment, as Figure 3 shown, step S204 includes:
[0040] Step S302: Crop the bird image to obtain a cropped bird image.
[0041] Among them, since the birds in the bird image have been annotated, the cropped bird image can be quickly cropped from the bird image, and the cropped bird image is the bird in the bird image.
[0042] Step S304: Perform semantic segmentation on the complex background image to obtain the habitat label of the complex background image.
[0043] Among them, performing semantic segmentation on the complex background image to obtain the habitat label of the complex background image is essentially to detect the complex background image through an object detection model to obtain the classification of each part, that is, to identify which part is the sky and which part is the grassland in the complex background image. That is to say, identify the habitat types of each part in the complex background and label them to obtain the habitat labels of each part, so as to facilitate the subsequent overlay of the cropped bird image to the corresponding area in the complex background image. The above object detection model is the prior art and will not be elaborated here. Preferably, the recognition fineness of various habitats in the complex background image does not need to be too high, and it only needs to be recognized as a tree, and the tree species does not need to be recognized, so as to improve the processing speed.
[0044] Step S306: Based on the preset bird-habitat mapping relationship, overlay the cropped bird image onto the complex background image to obtain a training sample image.
[0045] Among them, the bird-habitat mapping relationship means the types of environments where birds generally move. For example, magpies generally appear in woods and rarely on water surfaces. Therefore, there is a mapping relationship between magpies and woods. Of course, a bird species may have mapping relationships with multiple habitat labels, and the habitat labels can be further refined. For example, magpies only have a mapping relationship with specific types of trees, rather than all trees. According to the mapping relationship between birds and habitats, the intercepted bird images are superimposed on the areas with corresponding habitat labels in the complex background images, making the processed training sample images more reasonable and as close to the real situation as possible. The above bird-habitat mapping relationship is provided by ecological experts or obtained from relevant databases on the Internet. This application places no restrictions on its acquisition method.
[0046] In one embodiment, as Figure 4 shown, step 306 includes:
[0047] Step S402: Based on the preset bird-habitat mapping relationship, superimpose the intercepted bird images on the complex background images to obtain candidate sample images.
[0048] Among them, according to the mapping relationship between birds and habitats, the intercepted bird images are superimposed on the areas with corresponding habitat labels in the complex background images to obtain candidate sample images.
[0049] Step S404: Determine the foreground elements according to the positions of the intercepted bird images in the complex background images.
[0050] Among them, the foreground elements are generally elements such as leaves, waterweeds, and weeds. Of course, the entire image can also be directly used as the foreground element. For example, some images are selected from the complex background image library as the foreground elements, and then habitat labels are added to them. Appropriate foreground elements are selected according to the habitat labels corresponding to the positions of the intercepted bird images in the complex background images. For example, if the bird is a magpie and it is located in the tree area of the complex background image, the foreground element leaf can be selected instead of waterweed, so that the finally obtained training sample images do not deviate from reality.
[0051] Step S406: Superimpose the foreground elements on the intercepted bird images in the candidate sample images to obtain training sample images.
[0052] When superimposing the foreground element on the intercepted bird image, the occlusion ratio is controlled to avoid unrecognizability. For example, in the above example, the leaves occlude the magpie, and then by controlling the occlusion ratio, it is avoided that the leaves occlude all the features of the magpie, thereby preventing the bird recognition model from recognizing the features of the foreground element as bird features during the training of the bird recognition model and reducing the recognition accuracy of the trained bird recognition model. After the foreground and the bird are both synthesized into the complex background image, a training sample image with annotation information in a complex environment can be obtained. Then, a series of synthesized training sample images are added to the training samples of the bird recognition model to train the bird recognition model, thereby improving the recognition accuracy of the bird recognition model for birds in a complex environment.
[0053] In one embodiment, as Figure 5 shown, a device for training a bird recognition model includes:
[0054] An image acquisition module 510, configured to acquire a complex background image and a bird image;
[0055] A training sample image determination module 520, configured to intercept an intercepted bird image from the bird image and superimpose the intercepted bird image on the complex background image to obtain a training sample image; and,
[0056] A bird recognition model training module 530, configured to train a preset bird recognition model based on the training sample image.
[0057] In one embodiment, the training sample image determination module 520 includes:
[0058] An identification and interception module, configured to intercept the bird image to obtain an intercepted bird image;
[0059] A semantic segmentation module, configured to perform semantic segmentation on the complex background image to obtain a habitat label of the complex background image; and,
[0060] A first superimposing module, configured to superimpose the intercepted bird image on the complex background image based on a preset bird-habitat mapping relationship to obtain a training sample image.
[0061] In one embodiment, the first superimposing module includes:
[0062] A candidate sample image determination module, configured to superimpose the intercepted bird image on the complex background image based on a preset bird-habitat mapping relationship to obtain a candidate sample image;
[0063] A foreground element acquisition module, configured to determine a foreground element according to the position of the intercepted bird image in the complex background image;
[0064] A second superimposing module, configured to superimpose the foreground element onto the bird cropped image in the candidate sample image to obtain a training sample image.
[0065] In one embodiment, a bird recognition method includes:
[0066] A bird recognition model trained based on the bird recognition model training method described in the above embodiment;
[0067] Based on the bird recognition model, perform recognition on the bird image to be recognized to obtain a bird recognition result.
[0068] In one embodiment, as Figure 6 shown, a computer device includes a memory and a processor. A computer program is stored in the memory. When the computer program is executed by the processor, the processor performs the following steps:
[0069] Obtain a complex background image and a bird image;
[0070] Crop a bird cropped image from the bird image, and superimpose the bird cropped image onto the complex background image to obtain a training sample image;
[0071] Based on the training sample image, train a preset bird recognition model.
[0072] In one embodiment, a computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the processor performs the following steps:
[0073] Obtain a complex background image and a bird image;
[0074] Crop a bird cropped image from the bird image, and superimpose the bird cropped image onto the complex background image to obtain a training sample image;
[0075] Based on the training sample image, train a preset bird recognition model.
[0076] It should be understood that although the steps in the flowcharts of the embodiments of the present application are shown in sequence according to the indication of the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear description in this article, there is no strict order limit for the execution of these steps, and these steps can be executed in other orders. Moreover, at least a part of the steps in each embodiment may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or sub-steps or stages of other steps.
[0077] Those of ordinary skill in the art can understand that all or part of the processes of implementing the methods in the above embodiments can be completed by instructing relevant hardware through a computer program. The program can be stored in a non-volatile computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memories. Non-volatile memories can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0078] The technical features of the above-described embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this specification.
[0079] The above-described embodiments merely represent several implementation manners of the present application. The description is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the appended claims.
[0080] The above is only the preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, and improvements made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A method for training a bird recognition model, characterized in that, The method includes: Obtaining a complex background image and a bird image; Cropping a bird cropped image from the bird image and superimposing the bird cropped image onto the complex background image to obtain a training sample image; Training a preset bird recognition model based on the training sample image.
2. The method for training a bird recognition model according to claim 1, wherein The step of cropping a bird cropped image from the bird image and superimposing the bird cropped image onto the complex background image to obtain a training sample image includes: Cropping the bird image to obtain a bird cropped image; Performing semantic segmentation on the complex background image to obtain a habitat label of the complex background image; Based on a preset bird-habitat mapping relationship, superimposing the bird cropped image onto the complex background image to obtain a training sample image.
3. The method for training a bird recognition model according to claim 2, wherein, The step of, based on a preset bird-habitat mapping relationship, superimposing the bird cropped image onto the complex background image to obtain a training sample image includes: Based on a preset bird-habitat mapping relationship, superimposing the bird cropped image onto the complex background image to obtain a candidate sample image; Determining foreground elements according to the position of the bird cropped image in the complex background image; Superimposing the foreground elements onto the bird cropped image in the candidate sample image to obtain a training sample image.
4. A bird recognition model training device, characterized in that, It includes: An image acquisition module for obtaining a complex background image and a bird image; A training sample image determination module for cropping a bird cropped image from the bird image and superimposing the bird cropped image onto the complex background image to obtain a training sample image; and A bird recognition model training module for training a preset bird recognition model based on the training sample image.
5. The bird recognition model training device according to claim 4, characterized in that, The training sample image determination module includes: A recognition and cropping module for cropping the bird image to obtain a bird cropped image; A semantic segmentation module for performing semantic segmentation on the complex background image to obtain a habitat label of the complex background image; and A first superimposing module for superimposing the bird cropped image onto the complex background image based on a preset bird-habitat mapping relationship to obtain a training sample image.
6. The bird recognition model training device according to claim 5, characterized in that, The first superimposing module includes: A candidate sample image determination module for superimposing the bird cropped image onto the complex background image based on a preset bird-habitat mapping relationship to obtain a candidate sample image; A foreground element acquisition module for determining foreground elements according to the position of the bird cropped image in the complex background image; and A second superimposing module for superimposing the foreground elements onto the bird cropped image in the candidate sample image to obtain a training sample image.
7. A method for bird identification, characterized in that, It includes: A bird recognition model trained by the method for training a bird recognition model according to any one of claims 1 to 3; Identifying a bird image to be recognized based on the bird recognition model to obtain a bird recognition result.
8. A computer device, characterized in that, It includes a memory and a processor. A computer program is stored in the memory. When the computer program is executed by the processor, the processor is caused to execute the steps of a method for training a bird recognition model as described in any one of claims 1 to 3.
9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, the processor is caused to execute the steps of a method for training a bird recognition model as described in any one of claims 1 to 3.