Image recognition method and device
By reducing the dimensionality of high-resolution sample images to low resolution for model training, combined with convolutional neural network and other technologies, the labeling and detection efficiency problems caused by the reduction of image resolution in UAV rat hole detection are solved, and efficient Rat hole identification and detection.
Patent Information
- Application Number
- CN202410738471.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-07
- Publication Date
- 2024-10-01
AI Technical Summary
Due to the increase in flight height of existing UAVs in mouse hole detection, the image resolution is reduced, which increases the difficulty of manual annotation of data sets, and it is difficult for traditional methods to effectively solve the problems of mouse hole labeling, training and detection efficiency under low spatial resolution. .
By reducing the dimensionality of high-resolution sample images to the same low resolution as the image to be tested for model training, high-resolution images are used for annotation and training to achieve rapid target recognition at lower resolutions, and combined with convolutional neural networks , feature pyramid network and detection head for image recognition.
It significantly improves the efficiency of mouse hole detection, reduces computing resource requirements and processing speed, enhances the generalization ability and robustness of the model, and reduces data storage space requirements and computing resource consumption.
Smart Images

Figure CN118736192A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present specification relate to the field of image recognition technology, and more particularly to an image recognition method and device. Background Art
[0002] Inner Mongolia is rich in natural grassland resources. In recent years, rodent infestation in grassland ecosystems has become increasingly serious. Rodent infestation can lead to reduced grass production, grassland degradation and desertification, and can also spread diseases, affecting the healthy growth of livestock. Therefore, it is particularly important to prevent and control rat holes. Rat hole detection is one of the important means of rodent control. The traditional method of rat hole detection is manual detection. In recent years, drones have been widely used for rat hole detection. Business scenarios have put forward higher requirements on the efficiency of drone-based rat hole detection technology.
[0003] With the extensive application of drones in rodent pest monitoring, higher requirements are placed on the accuracy and efficiency of rat hole detection based on drone remote sensing images. Summary of the invention
[0004] In view of this, an embodiment of this specification provides an image recognition method. One or more embodiments of this specification also relate to an image recognition device, a computing device, a computer-readable storage medium and a computer program to solve the technical defects existing in the prior art.
[0005] According to a first aspect of an embodiment of this specification, there is provided an image recognition method, comprising:
[0006] Acquire an image to be measured collected by an aerial photography device for the area to be measured, wherein the image to be measured is an image of a first resolution;
[0007] Inputting the image to be tested into an image recognition model to obtain a target position of a target recognition object in the image to be tested;
[0008] Wherein, the image recognition model is trained based on sample images and object position labels, the sample images are obtained by converting a captured image of a second resolution to a first resolution, the object position labels are obtained by annotating the captured image of the second resolution and converting it to a sample image of the first resolution, and the second resolution is greater than the first resolution.
[0009] In one or more embodiments of the present specification, the image recognition model includes an input layer, a convolutional layer, a feature pyramid network and a detection head; the step of inputting the image to be tested into the image recognition model to obtain the target position of the target recognition object in the image to be tested includes:
[0010] Inputting the image to be tested into the input layer to obtain a standard image to be tested;
[0011] Inputting the standard image to be tested into the convolution layer to obtain spatial feature information corresponding to the standard image to be tested;
[0012] Inputting the spatial feature information into the feature pyramid network to obtain multi-scale feature information;
[0013] The multi-scale feature information is input into the detection head, and the target position of the target recognition object is output.
[0014] In one or more embodiments of the present specification, after inputting the image to be tested into the image recognition model and obtaining the target position of the target recognition object in the image to be tested, the method further includes:
[0015] The target recognition object in the image to be tested is marked according to the target position to obtain an object marking map corresponding to the area to be tested.
[0016] In one or more embodiments of the present specification, the number of images to be measured collected for the area to be measured is at least two, and correspondingly, the number of object annotation images is at least two;
[0017] After labeling the target recognition object in the image to be tested according to the target position and obtaining the object labeling map corresponding to the area to be tested, the method further includes:
[0018] Determine at least two object annotation images corresponding to the area to be tested;
[0019] According to the collection positions of the at least two object annotation images, the at least two object annotation images are spliced to obtain an object recognition result image.
[0020] In one or more embodiments of the present specification, after inputting the image to be tested into the image recognition model and obtaining the target position of the target recognition object in the image to be tested, the method further includes:
[0021] Determine the area density of the target recognition object according to the target position;
[0022] Corresponding response measures are determined according to the regional density.
[0023] In one or more embodiments of the present specification, the step of obtaining the image to be measured collected by the aerial photography device for the area to be measured includes:
[0024] The aerial photography device is controlled to fly above the area to be tested and higher than a set height, and moves above the area to be tested with set movement parameters, and images are collected at a set frequency to obtain a plurality of images to be tested with a first resolution.
[0025] In one or more embodiments of this specification, the image recognition model is trained in the following manner:
[0026] Controlling the sampling device to fly above the sampling area and below a set height, and moving above the sampling area with set movement parameters, performing image acquisition at a set frequency, obtaining a plurality of acquired images with a second resolution, and marking a reference position of the target identification object in the acquired images;
[0027] Converting the acquired image to a first resolution to obtain the sample image, and converting the reference position to the sample image to obtain the object position label;
[0028] The initial model is trained according to the sample image and the object position label until a training stop condition is reached, thereby obtaining the trained image recognition model.
[0029] According to a second aspect of the embodiments of this specification, there is provided an image recognition device, including:
[0030] An acquisition module is configured to acquire an image to be measured collected by an aerial photography device for the area to be measured, wherein the image to be measured is an image of a first resolution;
[0031] A target position acquisition module is configured to input the image to be tested into an image recognition model to obtain the target position of the target recognition object in the image to be tested; wherein the image recognition model is trained based on a sample image and an object position label, the sample image is obtained by converting an acquired image of a second resolution to a first resolution, the object position label is obtained by annotating the acquired image of the second resolution and converting it to a sample image of the first resolution, and the second resolution is greater than the first resolution.
[0032] According to a third aspect of an embodiment of this specification, a computing device is provided, including:
[0033] Memory and processor;
[0034] The memory is used to store computer executable instructions, and the processor is used to execute the computer executable instructions. When the computer executable instructions are executed by the processor, the steps of the above-mentioned image recognition method are implemented.
[0035] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the above-mentioned image recognition method are implemented.
[0036] According to a fifth aspect of the embodiments of this specification, a computer program is provided, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned image recognition method.
[0037] An embodiment of the present specification achieves rapid target recognition at lower resolutions by reducing the dimensionality of high-resolution sample images to the same low resolution as the image to be tested for model training. This not only reduces the demand for computing resources, but also significantly improves the processing speed. In addition, by using high-resolution images for annotation and training, even if lower-resolution images are used in actual applications, the model can still perform effective recognition based on the learned high-detail features, which helps the model maintain good recognition performance between images of different clarity and enhances the generalization and robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0038] Figure 1 is a flow chart of an image recognition method provided by an embodiment of this specification;
[0039] Figure 2 is a processing flow chart of an image recognition method provided by an embodiment of this specification;
[0040] Figure 3 is a structural schematic diagram of an image recognition device provided by an embodiment of this specification;
[0041] Figure 4 It is a structural block diagram of a computing device provided by an embodiment of this specification. DETAILED DESCRIPTION
[0042] Many specific details are described in the following description to facilitate a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar generalizations without violating the connotation of this specification, so this specification is not limited to the specific implementation disclosed below.
[0043] The terms used in one or more embodiments of this specification are only for the purpose of describing specific embodiments, and are not intended to limit one or more embodiments of this specification. The singular forms of "a", "said" and "the" used in one or more embodiments of this specification and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0044] It should be understood that although the terms first, second, etc. may be used to describe various information in one or more embodiments of this specification, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of this specification, the first may also be referred to as the second, and similarly, the second may also be referred to as the first. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".
[0045] In addition, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0046] With the extensive application of drones in rodent pest monitoring, higher requirements are placed on the accuracy and efficiency of rat hole detection based on drone remote sensing images. However, if the drone flies at a high altitude, the resolution will be reduced, which greatly increases the difficulty of manually annotating data sets, and it is often even impossible. Although patent No. CN202311087548.X "A grassland rat hole detection method based on drone images" does not clearly state the spatial resolution of the images it uses, according to its published master's thesis "Research on grassland rat hole detection method based on drone images", it uses the Mavic 2 zoom version (Mavic2Zoom) with a flight altitude of 2 meters, FOV of 48°-83°, image size of 4000x3000, and effective pixels of 12 million pixels. For the test data set of the present invention, the device is M3M, the flight altitude is 12 meters, the FOV is 84°, and the image size is 5280*3956, which is about 20.88 million pixels. Calculation shows that the ground sampling distance (GSD) of the photos taken by Mavic 2Zoom at 2 meters is 2*tan(48° / 2) / (4000 / 2)-2*tan(83° / 2) / (3000 / 2), that is, between 0.44-1.18mm, while the GSD of M3M is: 12*tan(84° / 2) / (5280 / 2)-12*tan(84° / 2) / (3956 / 2), that is, between 4.10-5.46mm, which is 4.6 times lower than the resolution of patent CN202311087548.X. Therefore, it is a low-resolution data. However, with this resolution, the operating efficiency of the drone can be greatly improved. However, in this scenario, since the drone increases the flight altitude and reduces the ground resolution, the difficulty of the manual annotation stage before training the network increases. Therefore, the present invention proposes a method for labeling, training and detecting ratholes in drone data with low spatial resolution, thereby improving the efficiency of rathole detection.
[0047] In this specification, an image recognition method is provided. This specification also relates to an image recognition device, a computing device, and a computer-readable storage medium, which are described in detail one by one in the following embodiments.
[0048] See also Figure 1 , Figure 1 A flowchart of an image recognition method provided according to an embodiment of the present specification is shown, which specifically includes the following steps.
[0049] Step 102: Acquire an image to be measured collected by an aerial photography device for the area to be measured, wherein the image to be measured is an image with a first resolution.
[0050] Specifically, the aerial photography equipment specifically refers to any equipment that can take photos in the sky, such as drones, helicopters, multi-axis aircraft, hot air balloons, etc. The aerial photography equipment may include one or more devices for collecting images of the area to be tested. The area to be tested specifically refers to the area that needs to be monitored.
[0051] In specific implementation, the present invention does not limit the specific type of aerial photography equipment, nor does it require its flight parameters. Those skilled in the art only need to ensure that the above parameters can achieve clear shooting of the image to be measured collected in the area to be measured to reach the first resolution. It should be noted that due to the large spatial variability of grasslands and the high heterogeneity of the ground, in order to improve the recognizability of aerial images collected by aerial photography equipment, sample plots can be set in the area to be measured, and appropriate scales and marks can be set in the sample plots so that the aerial images have reference objects for classification and size resolution, and the scales and marks can be set differently for the specific conditions of different sample plots.
[0052] Since the flying altitude of the drone has a great influence on the resolution of the image to be measured, the flight parameters of the aerial photography equipment can be adjusted according to the resolution in the future, so that the aerial photography equipment can collect images above the set altitude. It should be noted that the flying altitude of the aerial photography equipment is not necessarily the same for each aerial photography, so the resolution is not necessarily the same, and because the aerial photography equipment will produce bumps during flight, the images to be measured may not be clear or do not meet the preset resolution when collecting the images to be measured. Therefore, in the process of collecting the images to be measured, the parameters such as the route, altitude, speed, etc. of the aerial photography equipment and the frequency of image acquisition can be set.
[0053] Specifically, in one or more embodiments of the present specification, the step of obtaining the image to be measured collected by the aerial photography device for the area to be measured includes:
[0054] The aerial photography device is controlled to fly above the area to be tested and higher than a set height, and moves above the area to be tested with set movement parameters, and images are collected at a set frequency to obtain a plurality of images to be tested with a first resolution.
[0055] The movement parameters include: one or more parameters such as flight area, route, speed, etc.
[0056] During specific implementation, the aerial photography task is planned according to the geographical location and range of the area to be measured and the characteristics of the target to be observed. For example: determine the flight path, altitude and movement mode of the aerial photography equipment. The set altitude needs to ensure that the area to be measured is fully covered while avoiding the impact of ground obstacles (such as trees and buildings) on the image quality, while complying with relevant airspace management and safety regulations. The flight altitude of the aerial photography equipment is set so that the image to be measured will not be distorted due to being too close, and will not lose details due to being too far away, while improving the efficiency of collection. The height of the aerial photography equipment needs to be set according to the size of the object to be measured, the degree of detail that needs to be identified, and the performance of the camera, and this application is not limited here.
[0057] Furthermore, the movement parameters are set according to the planned aerial photography mission. The movement parameters may include one or more of the flight speed, direction and path design, which directly affect the continuity and coverage integrity of image acquisition. In order to obtain an evenly distributed and non-missing image sequence, the movement parameters need to be carefully calculated to ensure that the entire area to be measured is covered within a given time, while considering the influence of natural factors such as wind direction and wind speed.
[0058] The set image acquisition frequency is determined by the size of the aerial photography area, the flight speed, and the requirements for image resolution and overlap. A higher acquisition frequency can provide more dense data points, which is helpful for later stitching and 3D reconstruction, but it will also increase the data processing burden. Therefore, finding the right acquisition frequency is the key to balancing data quality and processing efficiency.
[0059] According to the above plan, the drone is controlled to rise to the preset height and fly steadily along the planned path at the set speed. During the flight, the camera is automatically triggered to shoot at the set frequency, and each shot generates an image of the first resolution. These images serve as the basic data for subsequent image recognition and analysis.
[0060] After the aerial photography is completed, all the first-resolution images taken are collected. These images may need preliminary correction and preprocessing, such as geometric correction, brightness and color balance adjustment to eliminate image deviations caused by factors such as light changes and lens distortion. In addition, the images can also be enhanced to prepare for subsequent image recognition model input.
[0061] It should be noted that for the same aerial photography equipment, when an image with a second resolution at a set height is collected, since the image with the second resolution is converted to an image with the first resolution at the corresponding height during training, in order to improve the collection efficiency, when performing image recognition on the area to be tested, the height of the aerial photography equipment can be set between the height of the first resolution and the height of the second resolution.
[0062] In summary, acquiring images of the first resolution by this method improves the acquisition efficiency of the images to be tested and also increases the richness of the samples in the sample set.
[0063] Step 104: Input the image to be tested into an image recognition model to obtain the target position of the target recognition object in the image to be tested; wherein the image recognition model is trained based on sample images and object position labels, the sample images are obtained by converting a captured image of a second resolution to a first resolution, the object position labels are obtained by annotating the captured image of the second resolution and converting it to a sample image of the first resolution, and the second resolution is greater than the first resolution.
[0064] Specifically, the image to be tested refers to an image of the first resolution of the original data collected by the aerial photography equipment at a specific height and movement parameters, which is used to analyze and identify the image of the target area; the image recognition model specifically refers to identifying specific objects or features in the image. The model learns the patterns in the sample images through a training process, so that it can locate and identify the same or similar objects in new images. In one or more embodiments of the present disclosure, the image recognition model can be a convolutional neural network, and specifically, the image recognition model can be a YOLOv8 model.
[0065] The target position refers to the specific coordinates of the target object successfully identified by the image recognition model in the image to be tested. The target object specifically refers to the target object to be detected, such as: when identifying a prairie mouse hole, the target object can be a mouse hole or a mouse.
[0066] The sample image is a set of images with known object positions, which are used to train the image recognition model. In specific implementation, the position of the target object is obtained by marking on the second resolution image, and then converted into the object position of the first resolution to form an object position label.
[0067] Specifically, the first resolution and the second resolution can be a range, such as: the first resolution can be 640*480~800*600, and the second resolution can be 1024*768~1600*1200. Of course, the first resolution and the second resolution can also be specific values, and this application does not limit this.
[0068] In specific implementation, since the conversion from high resolution to low resolution involves a downsampling process, if the resolution is reduced, the coordinate information annotated for the acquired image of the second resolution cannot be used for the training of the acquired image of the first resolution, so the annotated coordinates can be scaled down. For example, if the acquired image of the second resolution is 2000x2000 pixels, and the acquired image of the first resolution is 800x800 pixels, then the scale factor in the width and height directions is 0.4 (i.e., 800 / 2000=0.4). Multiplying the coordinate information annotated for the acquired image of the second resolution by this scale factor can obtain the corresponding coordinates on the low-resolution image.
[0069] In one or more embodiments of the present specification, the image recognition model includes an input layer, a convolutional layer, a feature pyramid network and a detection head; the step of inputting the image to be tested into the image recognition model to obtain the target position of the target recognition object in the image to be tested includes:
[0070] Inputting the image to be tested into the input layer to obtain a standard image to be tested;
[0071] Inputting the standard image to be tested into the convolution layer to obtain spatial feature information corresponding to the standard image to be tested;
[0072] Inputting the spatial feature information into the feature pyramid network to obtain multi-scale feature information;
[0073] The multi-scale feature information is input into the detection head, and the target position of the target recognition object is output.
[0074] Specifically, the input layer standardizes the image to be tested, scales the image to be tested to the size specified by the model or normalizes the image to be tested, and maps the pixel value range of the image from [0,255] to [0,1], or to the interval [-1,1]; the convolution layer extracts features and processes spatial information of the standard image to be tested to obtain the spatial feature information corresponding to the standard image to be tested; the feature pyramid network processes spatial feature information of different scales, which helps to improve the detection accuracy of target recognition objects of different sizes; the detection head contains multiple convolutional layers for generating the target position of the target recognition object, in addition, it can also generate confidence, etc.
[0075] In addition, the image recognition model can also include residual blocks and pooling layers. The residual blocks are used to deepen the number of network layers and solve the gradient vanishing problem, thereby improving model performance. The pooling layers are used to reduce the dimension of the feature map while retaining important features, reducing the amount of computation and improving the stability and generalization ability of the model.
[0076] Specifically, in one or more embodiments of this specification, the image recognition model is trained in the following manner:
[0077] Controlling the sampling device to fly above the sampling area and below a set height, and moving above the sampling area with set movement parameters, performing image acquisition at a set frequency, obtaining a plurality of acquired images with a second resolution, and marking a reference position of the target identification object in the acquired images;
[0078] Converting the acquired image to a first resolution to obtain the sample image, and converting the reference position to the sample image to obtain the object position label;
[0079] The initial model is trained according to the sample image and the object position label until a training stop condition is reached, thereby obtaining the trained image recognition model.
[0080] Among them, the sampling equipment and the aerial photography equipment can be the same or different. In order to make the resolution of the collected image higher and accurately mark the target recognition image to be identified, in the specific implementation, sampling can be performed below the set height; the sampling area and the area to be tested can be the same or different.
[0081] In specific implementation, converting high-resolution images to low-resolution images can be achieved through a variety of means, such as: using image editing software, resolution conversion tools, scripts and programming languages, etc. Specifically, the collected image can be converted to the first resolution through the Reproject Image() method in the GDAL library in the Python language. It is important to note that the conversion from high resolution to low resolution usually results in loss of details, so it is necessary to choose a suitable first resolution to avoid the image becoming too blurred.
[0082] In specific implementation, for the same aerial photography equipment, its camera performance is the same. When collecting at the same altitude, the resolution of the collected images is the same or similar. In order to improve the collection efficiency and expand the collection range, the flying altitude of the aerial photography equipment can be adjusted to increase the altitude of the aerial photography equipment. However, the higher the flying altitude of the aerial photography equipment, the resolution of the collected images will be lower and lower. Therefore, in order to improve the collection efficiency, the resolution of the images collected by the aerial photography equipment will inevitably be reduced. Therefore, in order to improve the efficiency of data collection, by converting high-resolution sample images to low-resolution images during training, and marking the target recognition objects in the high-resolution images to obtain the position coordinates of the target recognition objects, and converting the position coordinates, the position coordinates of the target recognition objects in the low-resolution image can be obtained, and the low-resolution image is input into the image recognition model to predict the predicted position coordinates of the target recognition object. The image recognition model is trained according to the predicted position coordinates and the position coordinates, and finally a trained image recognition model that can accurately recognize low-resolution images is obtained.
[0083] In specific implementation, the loss value (such as cross entropy loss, mean square error loss, etc.) of the initial detection model is calculated based on the sample image and the object position label, and the parameters of the initial image recognition model are adjusted according to the loss value, and the operation steps of training the initial model according to the sample image and the object position label are returned to execute until the training stop condition is reached, that is, the loss value is less than the preset threshold error value, and the trained image recognition model is obtained.
[0084] After obtaining the position of the target recognition image, in order to clearly display the recognition result, the target position of the target recognition image can be annotated to obtain a visualized object annotation map of the area to be tested.
[0085] In one or more embodiments of the present specification, after inputting the image to be tested into the image recognition model and obtaining the target position of the target recognition object in the image to be tested, the method further includes:
[0086] The target recognition object in the image to be tested is marked according to the target position to obtain an object marking map corresponding to the area to be tested.
[0087] Specifically, the object annotation graph may be a graph that connects multiple target recognition objects in series, or may annotate each target recognition object separately.
[0088] In one or more embodiments of the present specification, the number of images to be measured collected for the area to be measured is at least two, and correspondingly, the number of object annotation images is at least two;
[0089] After labeling the target recognition object in the image to be tested according to the target position and obtaining the object labeling map corresponding to the area to be tested, the method further includes:
[0090] Determine at least two object annotation images corresponding to the area to be tested;
[0091] According to the collection positions of the at least two object annotation images, the at least two object annotation images are spliced to obtain an object recognition result image.
[0092] Specifically, the area of the area to be tested may be very large, and only collecting one image to be tested may not be able to capture the panoramic view of the area to be tested. Therefore, the area to be tested can be divided into different sub-areas, and each sub-area is collected. After obtaining the object annotation map, the object annotation maps of different sub-areas are spliced to obtain the object recognition result map of the area to be tested.
[0093] After obtaining the object recognition result map, the object recognition result map can be rendered and displayed, so that the user can clearly understand the situation of the target recognition object in the test area, and can analyze the current test area and make decisions based on the situation.
[0094] After obtaining the target position of the target recognition object, the target recognition objects in the test area can be counted, and corresponding response measures can be determined according to the statistical results. In one or more embodiments of the present disclosure, after inputting the image to be tested into the image recognition model and obtaining the target position of the target recognition object in the image to be tested, the method further includes:
[0095] Determine the area density of the target recognition object according to the target position;
[0096] Corresponding response measures are determined according to the regional density.
[0097] Specifically, the area of the area to be tested can be measured in advance, and after the target position of the target object is obtained, the number of target recognition objects can be determined according to the target position. Since the image recognition model will generate a corresponding target position of the target object each time it recognizes a target recognition object, the number of target recognition objects can be determined according to the number of target positions. After obtaining the number of target recognition objects and the area of the area to be tested, the regional density of the target recognition objects is calculated according to the number of target recognition objects and the area of the area to be tested, and the response measures are determined according to the regional density.
[0098] In addition, the image recognition model can also identify the confidence of the target recognition object, and obtain the number of target recognition objects based on the confidence screening. Specifically, a confidence threshold can be set. When the confidence of the target recognition object is not less than the confidence threshold, the target recognition object is counted. When the confidence of the target recognition object is less than the confidence threshold, it is not counted, and then the position of the target recognition object is counted.
[0099] Taking the target identification object as a rat hole as an example, different response levels can be pre-set, and the ranges for different response levels can be divided. The regional density of rat holes is calculated according to the number of rat holes and the area of the area to be tested, and the corresponding response level and corresponding response measures are determined. For example: the first level is 0-5 / hectare, and the response measure is to lay 10 mousetraps; the second level is 6-30 / hectare, and the response measure is to lay 50 mousetraps; the third level is 31-50 / hectare, and the response measure is to lay 100 mousetraps or improve the soil quality. The corresponding level is determined according to the calculated regional density, and different levels have corresponding response measures. In specific implementation, those skilled in the art can set the regional density level and the corresponding response measures according to their own needs, and this application is not limited here.
[0100] In addition to the above-mentioned response measures of laying mousetraps, one or more other response measures can also be used, such as:
[0101] (1) Natural enemy control: Utilize biological control mechanisms in natural ecosystems to protect and attract natural enemies of rodents, such as birds of prey (hawks, owls), cats, snakes, foxes, and mustelids.
[0102] (2) Physical control methods: clamp method, mouse cage, bow and arrow method and ground arrow method, etc.
[0103] (3) Chemical control: Use anticoagulant drugs, such as chlorfenapyr sodium and bromadiolone, to make poison baits and place them in areas where rodents are active.
[0104] (4) Ecological management: Improve grassland vegetation structure, restore and protect grassland ecological balance, and reduce suitable habitats for rodents. Improve grassland productivity through rotational grazing, rational fertilization and other measures, and indirectly inhibit rodent reproduction.
[0105] In summary, this embodiment achieves rapid target recognition at lower resolutions by reducing the dimensionality of high-resolution sample images to the same low resolution as the image to be tested for model training. This not only reduces the demand for computing resources, but also significantly improves the processing speed. In addition, high-resolution images are used for annotation and training. Even if lower-resolution images are used in actual applications, the model can still perform effective recognition based on the learned high-detail features, which helps the model maintain good recognition performance between images of different clarity and enhances the generalization and robustness of the model.
[0106] This method uses high resolution to improve model accuracy during the training phase, while using lower resolution images in actual applications, effectively reducing data storage space requirements, transmission bandwidth occupancy and computing resource consumption, thereby reducing overall operating costs.
[0107] In summary, this process optimizes processing speed and resource efficiency while maintaining recognition accuracy by combining high-resolution sample training with low-resolution practical application strategies.
[0108] The following combination Figure 2 , taking the application of the image recognition method provided in this specification in image recognition as an example, the image recognition method is further described. Among them, Figure 2 A processing flow chart of an image recognition method provided by an embodiment of the present specification is shown, which specifically includes the following steps.
[0109] Step 202: Control the sampling device to fly above the sampling area and below the set height, and move above the sampling area with set movement parameters, perform image acquisition at a set frequency, obtain multiple acquired images of the second resolution, and mark the reference position of the rat hole in the acquired images.
[0110] In order to improve the efficiency of data recognition and reduce the workload of the image recognition model, after the sampling device is used to collect images, the collected images can be preprocessed. Specifically, the sampled images can be screened to screen images with higher resolution. The collected images can also be enhanced. The methods of data enhancement include but are not limited to: flip (Flip), 90° rotation (90°Rotate), crop (Crop), rotation (Rotation), grayscale (Grayscale), blur (Bluur), and adding noise (Noise).
[0111] Specifically, any annotation tool can be used to annotate the data of multiple collected images, such as Roboflow, Label Box, SuperAnnotate and other tools. According to different initial recognition models, the corresponding annotation tool is selected to convert it into a data format that can be directly used by the model. After annotating the collected images, the location of the rat hole is recorded as the reference location.
[0112] Step 204: convert the acquired image to a first resolution to obtain the sample image, and convert the reference position to the sample image to obtain the object position label.
[0113] Specifically, the second resolution captured image can be downgraded to the first resolution in a variety of ways, such as using image editing software, command line tools, etc. to process the captured image. In order to improve data processing efficiency, the captured image can also be automatically processed using programming languages such as Python. For example, the Reproject Image() method in the GDAL library in Python can be used to downgrade the captured image to obtain a sample image.
[0114] The reference position of the rat hole in the acquired image of the second resolution is mapped to the sample image. Since the resolution is reduced when the image is converted from the second resolution to the first resolution, when converting the reference position, it is necessary to scale the reference position according to the ratio of the first resolution to the second resolution to obtain the object position of the rat hole in the sample image, and use it as the object position label when training the model.
[0115] Step 206: Train the initial model according to the sample image and the object position label until the training stop condition is reached, thereby obtaining the trained image recognition model.
[0116] Specifically, the training termination condition can be determined according to a specific loss function, and when a threshold is reached, the training is stopped. A specific loss function (such as cross entropy loss, mean square error loss, etc.) is used to optimize the model parameters so that the model can accurately predict the location and category of the target.
[0117] Step 208: Control the aerial photography device to fly above the area to be tested and higher than a set height, and move above the area to be tested with set movement parameters, perform image acquisition at a set frequency, and obtain multiple images to be tested with a first resolution.
[0118] Step 210: input the image to be tested into an image recognition model to obtain the target position of the rat hole in the image to be tested.
[0119] In a specific implementation, the image to be tested is input into the input layer to obtain a standard image to be tested;
[0120] Inputting the standard image to be tested into the convolution layer to obtain spatial feature information corresponding to the standard image to be tested;
[0121] Inputting the spatial feature information into the feature pyramid network to obtain multi-scale feature information;
[0122] The multi-scale feature information is input into the detection head, and the target position of the rat hole is output.
[0123] In addition, the detection head can also output the category confidence of the rathole.
[0124] The image recognition model can also include: pooling layers and residual blocks; the pooling layer is used to reduce the dimension of the feature map while retaining important features, reducing the amount of calculation and improving the stability and generalization ability of the model; the residual block is used to deepen the number of network layers and solve the gradient disappearance problem, thereby improving model performance.
[0125] Step 212: marking the target recognition object in the image to be tested according to the target position, and obtaining an object marking map corresponding to the area to be tested.
[0126] Specifically, at least two object annotation images corresponding to the area to be detected are determined; and according to the acquisition positions of the at least two object annotation images, the at least two object annotation images are spliced to obtain an object recognition result image.
[0127] Step 214: Determine the regional density of the target recognition object according to the target position; and determine corresponding response measures according to the regional density.
[0128] In summary, the embodiments disclosed in this specification achieve rapid target recognition at lower resolutions by reducing the dimensionality of high-resolution sample images to the same low resolution as the image to be tested for model training. This not only reduces the demand for computing resources, but also significantly improves the processing speed. In addition, by using high-resolution images for annotation and training, even if lower-resolution images are used in actual applications, the model can still perform effective recognition based on the learned high-detail features, which helps the model maintain good recognition performance between images of different clarity and enhances the generalization and robustness of the model.
[0129] This method uses high resolution to improve model accuracy during the training phase, while using lower resolution images in actual applications, effectively reducing data storage space requirements, transmission bandwidth occupancy and computing resource consumption, thereby reducing overall operating costs.
[0130] In summary, this process optimizes processing speed and resource efficiency while maintaining recognition accuracy by combining high-resolution sample training with low-resolution practical application strategies.
[0131] Corresponding to the above method embodiment, this specification also provides an image recognition device embodiment, Figure 3 FIG. 1 shows a schematic diagram of the structure of an image recognition device provided by an embodiment of the present specification. Figure 3 As shown, the device comprises:
[0132] The acquisition module 302 is configured to acquire an image to be measured collected by an aerial photography device for the area to be measured, wherein the image to be measured is an image of a first resolution;
[0133] The target position acquisition module 304 is configured to input the image to be tested into an image recognition model to obtain the target position of the target recognition object in the image to be tested; wherein the image recognition model is trained based on a sample image and an object position label, the sample image is obtained by converting an acquired image of a second resolution to a first resolution, the object position label is obtained by annotating the acquired image of the second resolution and converting it to a sample image of the first resolution, and the second resolution is greater than the first resolution.
[0134] In one or more embodiments of the present specification, the image recognition model includes an input layer, a convolution layer, a feature pyramid network and a detection head; the target position acquisition module is further configured to input the image to be tested into the input layer to obtain a standard image to be tested; input the standard image to be tested into the convolution layer to obtain spatial feature information corresponding to the standard image to be tested; input the spatial feature information into the feature pyramid network to obtain multi-scale feature information; input the multi-scale feature information into the detection head to output the target position of the target recognition object.
[0135] In one or more embodiments of the present specification, the device further includes a labeling module configured to label the target recognition object in the image to be tested according to the target position to obtain an object labeling map corresponding to the area to be tested.
[0136] In one or more embodiments of the present specification, there are at least two images to be tested collected for the area to be tested, and correspondingly, there are at least two object annotation maps; the stitching module is configured to determine at least two object annotation maps corresponding to the area to be tested; and according to the collection positions of the at least two object annotation maps, the at least two object annotation maps are stitched to obtain an object recognition result map.
[0137] In one or more embodiments of the present specification, the determination module is configured to determine the area density of the target recognition object according to the target position; and determine the corresponding response measures according to the area density.
[0138] In one or more embodiments of the present specification, the acquisition module is further configured to control the aerial photography device to fly above the area to be tested and higher than a set height, and move above the area to be tested with set movement parameters, perform image acquisition at a set frequency, and obtain multiple images to be tested with a first resolution.
[0139] In one or more embodiments of the present specification, the apparatus further includes: a model training module, configured to control the sampling device to fly above a sampling area and below a set height, and move above the sampling area with set movement parameters, perform image acquisition at a set frequency, obtain a plurality of acquired images of a second resolution, and mark the reference position of the target recognition object in the acquired image; convert the acquired image to the first resolution to obtain the sample image, and convert the reference position to the sample image to obtain the object position label; train the initial model according to the sample image and the object position label until the training stop condition is reached, and obtain the trained image recognition model.
[0140] The above is a schematic scheme of an image recognition device of this embodiment. It should be noted that the technical scheme of the image recognition device and the technical scheme of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical scheme of the image recognition device can be referred to the description of the technical scheme of the above-mentioned image recognition method.
[0141] Figure 4 The block diagram of a computing device 400 according to one embodiment of the present specification is shown. The components of the computing device 400 include but are not limited to a memory 410 and a processor 420. The processor 420 is connected to the memory 410 via a bus 430, and the database 450 is used to store data.
[0142] The computing device 400 also includes an access device 440 that enables the computing device 400 to communicate via one or more networks 460. Examples of these networks include a public switched telephone network (PSTN), a local area network (LAN), a wide area network (WAN), a personal area network (PAN), or a combination of communication networks such as the Internet. The access device 440 may include one or more of any type of network interface, wired or wireless (e.g., a network interface card (NIC)), such as an IEEE 802.11 wireless local area network (WLAN) wireless interface, a World Wide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a universal serial bus (USB) interface, a cellular network interface, a Bluetooth interface, and a near field communication (NFC).
[0143] In one embodiment of the present specification, the above components of the computing device 400 and Figure 4 Other components not shown in the figure may also be connected to each other, for example, via a bus. It should be understood that Figure 4 The computing device structure block diagram shown is only for the purpose of illustration, and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0144] The computing device 400 may be any type of stationary or mobile computing device, including a mobile computer or mobile computing device (e.g., a tablet computer, a personal digital assistant, a laptop computer, a notebook computer, a netbook, etc.), a mobile phone (e.g., a smart phone), a wearable computing device (e.g., a smart watch, smart glasses, etc.), or other types of mobile devices, or a stationary computing device such as a desktop computer or a personal computer (PC). The computing device 400 may also be a mobile or stationary server.
[0145] The processor 420 is used to execute the following computer executable instructions, which implement the steps of the above-mentioned image recognition method when executed by the processor.
[0146] The above is a schematic scheme of a computing device of this embodiment. It should be noted that the technical scheme of the computing device and the technical scheme of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical scheme of the computing device can be referred to the description of the technical scheme of the above-mentioned image recognition method.
[0147] An embodiment of the present specification further provides a computer-readable storage medium storing computer-executable instructions, which can implement the steps of the above-mentioned image recognition method when executed by a processor.
[0148] The above is a schematic scheme of a computer-readable storage medium of this embodiment. It should be noted that the technical scheme of the storage medium and the technical scheme of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical scheme of the storage medium can be referred to the description of the technical scheme of the above-mentioned image recognition method.
[0149] An embodiment of the present specification further provides a computer program, wherein when the computer program is executed in a computer, the computer is caused to execute the steps of the above-mentioned image recognition method.
[0150] The above is an illustrative solution of a computer program of this embodiment. It should be noted that the technical solution of the computer program and the technical solution of the above-mentioned image recognition method belong to the same concept, and the details not described in detail in the technical solution of the computer program can be referred to the description of the technical solution of the above-mentioned image recognition method.
[0151] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0152] The computer instructions include computer program codes, which may be in source code form, object code form, executable files or some intermediate forms, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium, etc. It should be noted that the content contained in the computer-readable medium may be appropriately increased or decreased according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media do not include electric carrier signals and telecommunication signals.
[0153] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the embodiments of this specification are not limited by the order of the actions described, because according to the embodiments of this specification, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the embodiments of this specification.
[0154] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0155] The preferred embodiments of this specification disclosed above are only used to help explain this specification. The optional embodiments do not describe all the details in detail, nor do they limit the invention to only the specific implementation methods described. Obviously, many modifications and changes can be made according to the content of the embodiments of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the embodiments of this specification, so that technicians in the relevant technical field can well understand and use this specification. This specification is only limited by the claims and their full scope and equivalents.
Claims
1. An image recognition method, characterized in that: include: Acquire an image to be measured collected by an aerial photography device for the area to be measured, wherein the image to be measured is an image of a first resolution; Inputting the image to be tested into an image recognition model to obtain a target position of a target recognition object in the image to be tested; Wherein, the image recognition model is trained based on sample images and object position labels, the sample images are obtained by converting a captured image of a second resolution to a first resolution, the object position labels are obtained by annotating the captured image of the second resolution and converting it to a sample image of the first resolution, and the second resolution is greater than the first resolution.
2. The image recognition method according to claim 1, characterized in that: The image recognition model includes an input layer, a convolution layer, a feature pyramid network and a detection head; the step of inputting the image to be tested into the image recognition model to obtain the target position of the target recognition object in the image to be tested includes: Inputting the image to be tested into the input layer to obtain a standard image to be tested; Inputting the standard image to be tested into the convolution layer to obtain spatial feature information corresponding to the standard image to be tested; Inputting the spatial feature information into the feature pyramid network to obtain multi-scale feature information; The multi-scale feature information is input into the detection head, and the target position of the target recognition object is output.
3. The image recognition method according to claim 1, characterized in that: After inputting the image to be tested into the image recognition model and obtaining the target position of the target recognition object in the image to be tested, the method further includes: The target recognition object in the image to be tested is marked according to the target position to obtain an object marking map corresponding to the area to be tested.
4. The image recognition method according to claim 3, characterized in that: The number of images to be tested collected for the area to be tested is at least two, and correspondingly, the number of object annotation images is at least two; After labeling the target recognition object in the image to be tested according to the target position and obtaining the object labeling map corresponding to the area to be tested, the method further includes: Determine at least two object annotation images corresponding to the area to be tested; According to the collection positions of the at least two object annotation images, the at least two object annotation images are spliced to obtain an object recognition result image.
5. The image recognition method according to claim 1, characterized in that: After inputting the image to be tested into the image recognition model and obtaining the target position of the target recognition object in the image to be tested, the method further includes: Determine the area density of the target recognition object according to the target position; Corresponding response measures are determined according to the regional density.
6. The image recognition method according to claim 1, characterized in that: The step of obtaining the image to be tested collected by the aerial photography device for the area to be tested includes: The aerial photography device is controlled to fly above the area to be tested and higher than a set height, and moves above the area to be tested with set movement parameters, and images are collected at a set frequency to obtain a plurality of images to be tested with a first resolution.
7. The image recognition method according to any one of claims 1 to 5, characterized in that: The image recognition model is trained in the following way: Controlling the sampling device to fly above the sampling area and below a set height, and moving above the sampling area with set movement parameters, performing image acquisition at a set frequency, obtaining a plurality of acquired images with a second resolution, and marking a reference position of the target identification object in the acquired images; Converting the acquired image to a first resolution to obtain the sample image, and converting the reference position to the sample image to obtain the object position label; The initial model is trained according to the sample image and the object position label until a training stop condition is reached, thereby obtaining the trained image recognition model.
8. An image recognition device, characterized in that: include: An acquisition module is configured to acquire an image to be measured collected by an aerial photography device for the area to be measured, wherein the image to be measured is an image of a first resolution; A target position acquisition module is configured to input the image to be tested into an image recognition model to obtain the target position of the target recognition object in the image to be tested; wherein the image recognition model is trained based on a sample image and an object position label, the sample image is obtained by converting an acquired image of a second resolution to a first resolution, the object position label is obtained by annotating the acquired image of the second resolution and converting it to a sample image of the first resolution, and the second resolution is greater than the first resolution.
9. A computing device, characterized in that include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions. When the computer-executable instructions are executed by the processor, the steps of the image method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: It stores computer executable instructions, which, when executed by a processor, can implement the steps of the image method described in any one of claims 1 to 7.
Citation Information
Cited By
Intelligent nursing video monitoring processing method and system
CN119893053A
Riverbed sediment measurement method and device based on image and storage medium
CN120655507A
