A multi-object recognition method and system based on animal image features
By standardizing image size, balancing grayscale and deep learning model construction of animal images, the problem of low accuracy of multi-objective recognition of animal images caused by manual observation is solved, and efficient and automated multi-objective recognition is achieved.
Patent Information
- Application Number
- CN202411531985.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-30
- Publication Date
- 2025-07-08
- Estimated Expiration
- 2044-10-30
AI Technical Summary
In the prior art, multi-object recognition of animal images relies on manual observation and is susceptible to subjective factors, resulting in low accuracy and time-consuming and labor-consuming.
By obtaining the animal images to be identified, setting the target animal ID set for standard image query, normalizing image size and equalizing grayscale, extracting grayscale profile feature values and grayscale feature groups, and building a deep learning model for multi-objective recognition.
It improves the accuracy of multi-objective recognition of animal images, reduces time and human resources consumption, and realizes automated multi-objective recognition.
Smart Images

Figure CN119418115B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of animal image recognition, and particularly to a multi-target recognition method and system based on animal image features. Background Art
[0002] Animal images are important resources for studying biodiversity and play an important role in ecological monitoring, animal protection, etc. By performing multi-target recognition on animal images, it can help relevant workers and researchers quickly understand the morphological characteristics, living habits, and geographical distributions of different animals, which is crucial for the protection and research of biodiversity.
[0003] Currently, the multi-target recognition of animal images mainly relies on manual observation and classification. Although this method can achieve the multi-target recognition of animal images, the results of manual observation and classification are easily affected by subjective factors, thereby reducing the accuracy of multi-target recognition. At the same time, it also consumes a large amount of time and human resources. Summary of the Invention
[0004] The present invention provides a multi-target recognition method and system based on animal image features, and its main purpose is to improve the accuracy of multi-target recognition of animal images and reduce the excessive consumption of time and human resources.
[0005] To achieve the above object, a multi-target recognition method based on animal image features provided by the present invention includes:
[0006] Obtain an animal image to be recognized, set a target animal ID set according to the animal image to be recognized, and perform a query for standard animal images based on the target animal ID set to obtain a set of target animal image groups. Among them, each target animal ID in the target animal ID set corresponds to a target animal image group in the set of target animal image groups, and the animal image to be recognized includes animal images corresponding to multiple target animal IDs;
[0007] Normalize the image sizes of the set of target animal image groups to obtain a set of standard animal image groups. Sequentially extract target animal IDs from the target animal ID set, and based on the target animal IDs, identify groups of conspecific animal images in the set of standard animal image groups;
[0008] Sequentially extract conspecific animal images from the groups of conspecific animal images, and perform equalized grayscale processing on the conspecific animal images to obtain grayscale animal images;
[0009] Perform contour recognition on the grayscale animal images to obtain grayscale animal contours, identify the grayscale contour areas of the grayscale animal contours, and record the grayscale contour areas as target contour feature values;
[0010] Animal gray feature recognition is performed based on the gray animal image to obtain a target gray feature value group;
[0011] Perform key-value pairing on the target animal ID, target contour feature value, and target gray feature value group to obtain a target animal feature group, and summarize the target animal feature group to obtain a target animal feature group set;
[0012] Construct an animal recognition model based on the target animal feature group set to obtain a target animal recognition model, where the target animal recognition model is a deep learning model trained by the target animal feature group set;
[0013] Use the target animal recognition model to perform multi-target recognition on the animal image to be recognized to obtain a multi-target animal image, and complete multi-target recognition based on the animal image features.
[0014] Optionally, the step of normalizing the image size of the target animal image set to obtain a standard animal image set includes:
[0015] Sequentially extract the target animal images in the target animal image set, and obtain the original image ratio of the target animal images;
[0016] Scale the target animal images according to the original image ratio and a preset standard image ratio to obtain standard animal images;
[0017] Summarize the standard animal images to obtain a standard animal image set, and use the standard animal image set to update the target animal image set to obtain a standard animal image set.
[0018] Optionally, the step of equalizing the gray scale of the same-family animal images to obtain gray animal images includes:
[0019] Gray-scale the same-family animal images to obtain original gray-scale images, where the gray-scale conversion refers to converting the color space of the same-family animal images from the RGB space to the gray-scale space;
[0020] Sequentially extract the original gray-scale points in the original gray-scale images, identify the original gray-scale values of the original gray-scale points, and summarize the original gray-scale values to obtain an original gray-scale value set;
[0021] Perform frequency statistics on the original gray-scale value set to obtain an original gray-scale frequency set, where the original gray-scale frequencies in the original gray-scale frequency set are arranged in ascending order;
[0022] Sequentially extract the original gray-scale frequencies in the original gray-scale frequency set, and calculate the frequency proportion of the original gray-scale frequencies, where the frequency proportion is expressed as:
[0023]
[0024] Among them, Q represents the frequency ratio, n represents the number of original gray frequencies in the original gray frequency concentration, and L i represents the i-th original gray frequency, and L represents the original gray frequency;
[0025] Judge whether the frequency ratio is greater than a preset standard ratio;
[0026] If the frequency ratio is greater than the standard ratio, record the frequency ratio as the dense ratio and identify multiple dense gray points of the dense ratio;
[0027] If the frequency ratio is not greater than the standard ratio, record the frequency ratio as the sparse ratio and identify multiple sparse gray points of the sparse ratio;
[0028] Summarize the multiple dense gray points and multiple sparse gray points respectively to obtain a dense gray point set and a sparse gray point set. According to the dense gray point set and the sparse gray point set, perform gray-scale enhancement on the original gray-scale image to obtain a gray-scale animal image.
[0029] Optionally, the performing gray-scale enhancement on the original gray-scale image according to the dense gray point set and the sparse gray point set to obtain a gray-scale animal image includes:
[0030] Obtain the original gray-scale range of the original gray-scale image, where the original gray-scale range includes the original minimum gray value and the original maximum gray value, and the original minimum gray value is 0;
[0031] Set an equalized gray-scale range, where the equalized gray-scale range includes: an equalized minimum gray value and an equalized maximum gray value, and the equalized minimum gray value is 0;
[0032] Successively extract dense gray points from the dense gray point set, identify the dense gray value and the dense gray frequency of the dense gray points, and perform gray point equalization according to the dense gray value and the dense gray frequency to obtain an equalized dense gray value, where the equalized dense gray value is expressed as:
[0033]
[0034] where H′ m represents the equalized dense gray value, H m represents the dense gray value, H y represents the original maximum gray value, H h represents the equalized maximum gray value;
[0035] Update the dense gray points with the equalized dense gray value to obtain equalized dense points, and summarize the equalized dense points to obtain an equalized dense point set;
[0036] Perform gray level equalization on the sparse gray level point set according to the balanced dense point set to obtain a balanced sparse point set;
[0037] Update the original gray level image by using the balanced sparse point set and the balanced dense point set to obtain a gray level animal image.
[0038] Optionally, the performing gray level equalization on the sparse gray level point set according to the balanced dense point set to obtain a balanced sparse point set includes:
[0039] Based on the balanced dense point set, calculate the dense gray level mean value, where the dense gray level mean value is the average of the gray level values of the balanced dense points in the balanced dense point set;
[0040] Successively extract sparse gray level points in the sparse gray level point set, identify the sparse gray level values of the sparse gray level points, and determine whether the sparse gray level values are greater than the dense gray level mean value;
[0041] If the sparse gray level value is greater than the dense gray level mean value, update the sparse gray level point by using the balanced maximum gray level value to obtain a balanced sparse point;
[0042] If the sparse gray level value is not greater than the dense gray level mean value, update the sparse gray level point by using the balanced minimum gray level value to obtain a balanced sparse point;
[0043] Summarize the balanced sparse points to obtain a balanced sparse point set.
[0044] Optionally, the performing animal gray level feature recognition according to the gray level animal image to obtain a target gray level feature value group includes:
[0045] Set a neighborhood step size, successively extract gray level pixel points in the gray level animal image, perform neighborhood extraction on the gray level pixel points based on the neighborhood step size to obtain a neighborhood pixel point group, and identify the neighborhood gray level value group of the neighborhood pixel point group;
[0046] Construct a neighborhood pixel point matrix according to the neighborhood gray level value group, where the neighborhood pixel point matrix is expressed as:
[0047]
[0048] where, H l represents the neighborhood pixel point matrix, i represents the abscissa of the gray level pixel point, j represents the ordinate of the gray level pixel point, d represents the neighborhood step size, H i+d,j represents the neighborhood gray level value corresponding to the neighborhood pixel point with the coordinate (i + d, j), H i-d,j represents the neighborhood gray level value corresponding to the neighborhood pixel point with the coordinate (i - d, j), Hi,j+d denotes the neighborhood gray value corresponding to the neighborhood pixel point with coordinates (i, j + d), H i,j-d denotes the neighborhood gray value corresponding to the neighborhood pixel point with coordinates (i, j - d);
[0049] According to the neighborhood pixel point matrix, calculate the pixel deviation value and the pixel deviation angle by using the following formula:
[0050]
[0051] where ΔH represents the pixel deviation value, |*| represents the absolute value symbol, F represents the pixel deviation angle, and arctan(*) represents the arctangent symbol;
[0052] Perform gray feature calculation according to the pixel deviation value and the pixel deviation angle to obtain a target gray feature value group.
[0053] Optionally, the performing gray feature calculation according to the pixel deviation value and the pixel deviation angle to obtain a target gray feature value group includes:
[0054] Determine whether the pixel deviation angle is greater than a preset standard deviation angle;
[0055] If the pixel deviation angle is greater than the standard deviation angle, record the gray pixel point as a feature pixel point, identify the feature gray value of the feature pixel point, and calculate a deviation feature value based on the feature gray value, the pixel deviation value, and the pixel deviation angle, where the deviation feature value is expressed as:
[0056] P = H t × cos(F)+ΔH
[0057] where P represents the deviation feature value, H t represents the feature gray value, and cos(*) represents the cosine function;
[0058] Summarize the deviation feature values to obtain a deviation feature value set, and identify an average deviation feature value, a maximum deviation feature value, a minimum deviation feature value, and a median deviation feature value in the deviation feature value set;
[0059] Perform key-value pairing on the average deviation feature value, the maximum deviation feature value, the minimum deviation feature value, and the median deviation feature value to obtain a target gray feature value group.
[0060] Optionally, the performing multi-target recognition on the animal image to be recognized by using a target animal recognition model to obtain a multi-target animal image includes:
[0061] Obtain the ratio of the image to be recognized of the animal image to be recognized. According to the ratio of the image to be recognized and the ratio of the standard image, set multiple moving recognition blocks. Among them, the image ratio of the moving recognition block is the ratio of the standard image, and the number of moving recognition blocks is:
[0062]
[0063] where n′ represents the number of moving recognition blocks, Z(*) represents the ceiling function, C s represents the ratio of the image to be recognized, and C b represents the ratio of the standard image;
[0064] Identify the upper left vertex of the animal image to be recognized, and record the upper left vertex as the starting point of block movement. Based on the starting point of block movement, add the multiple moving recognition blocks to the animal image to be recognized to obtain the block animal image. Among them, the multiple moving recognition blocks are arranged in sequence from top to bottom on the left side of the animal image to be recognized, and there is no spatial overlap between different moving recognition blocks;
[0065] Identify the right side of the block animal image, and record the right side as the ending point of block movement;
[0066] Record the current starting time of movement. According to the starting time of movement and the preset block movement speed, and use the multiple moving recognition blocks to move right in the block animal image to obtain a set of intercepted animal regions, where the intercepted animal regions in the set of intercepted animal regions correspond to the moving recognition blocks in the multiple moving recognition blocks;
[0067] Extract the intercepted animal regions in the set of intercepted animal regions in sequence, and perform the following operations on the intercepted animal regions:
[0068] Obtain the intercepted animal feature group of the intercepted animal region. Among them, the intercepted animal feature group includes: an intercepted contour feature value and a group of intercepted gray-scale feature values. Among them, the intercepted contour feature value is the area ratio of the intercepted animal contour in the intercepted animal region;
[0069] Input the intercepted animal feature group into the target animal recognition model to obtain a candidate animal ID and a candidate animal similarity, and determine whether the candidate animal similarity is greater than the preset standard animal similarity;
[0070] If the candidate animal similarity is greater than the standard animal similarity, record the candidate animal ID as the recognized animal ID, and use the recognized animal ID to identify the intercepted animal contour in the intercepted animal region to obtain the identified animal region;
[0071] Summarize the identified animal areas to obtain an identified animal area group, and return to the step of recording the current movement start time until the movement identification block contacts the block movement terminal edge;
[0072] The identified animal region groups are summarized to obtain an identified animal region set, and multi-target recognition is performed on the animal image to be identified based on the identified animal region set to obtain a multi-target animal image.
[0073] Optionally, performing multi-target recognition on the animal image to be recognized according to the identified animal region set to obtain multi-target animal images includes:
[0074] Extracting identified animal regions in sequence from the identified animal region set, and identifying a region group of animals of the same family as the identified animal region in the identified animal region set, wherein the ID of the same family animal in the region of the same family is the same as the ID of the identified animal in the identified animal region;
[0075] Sequentially extracting animal regions of the same species from the same species animal region group, and determining whether the identified animal region is connected to the same species animal region;
[0076] If the marked animal region is connected to the region of animals of the same species, the marked animal region and the region of animals of the same species are merged to obtain a merged animal region;
[0077] Summarizing the merged animal regions to obtain a merged animal region set, using the merged animal region set to update the identified animal region set, and returning to the step of sequentially extracting identified animal regions from the identified animal region set until there is no region group of animals of the same family in the identified animal region set;
[0078] The image of the animal to be identified is updated using the merged animal region set to obtain a multi-target animal image.
[0079] To achieve the above object, the present invention also provides a multi-target recognition system based on animal image features, comprising:
[0080] An animal image acquisition module is used to acquire an animal image to be identified, set a target animal ID set according to the animal image to be identified, perform an animal standard image query based on the target animal ID set, and obtain a target animal image group set, wherein each target animal ID in the target animal ID set corresponds to a target animal image group in the target animal image group set, and the animal image to be identified includes animal images corresponding to multiple target animal IDs;
[0081] The grayscale image conversion module is used to standardize the image sizes of the target animal image set to obtain a standard animal image set, sequentially extract the target animal IDs from the target animal ID set, based on the target animal IDs, identify the same-family animal image groups in the standard animal image set, sequentially extract the same-family animal images from the same-family animal image groups, and perform equalized grayscale processing on the same-family animal images to obtain grayscale animal images;
[0082] The animal feature calculation module is used to perform contour recognition on the grayscale animal images to obtain grayscale animal contours, identify the grayscale contour areas of the grayscale animal contours, record the grayscale contour areas as target contour feature values, perform animal grayscale feature recognition based on the grayscale animal images to obtain a target grayscale feature value set, perform key-value pairing on the target animal IDs, target contour feature values, and target grayscale feature value set to obtain a target animal feature set, and summarize the target animal feature set to obtain a target animal feature set group;
[0083] The recognition model construction module is used to construct an animal recognition model based on the target animal feature set group to obtain a target animal recognition model. Among them, the target animal recognition model is a deep learning model trained by the target animal feature set group, and the target animal recognition model is used to perform multi-target recognition on the animal image to be recognized to obtain a multi-target animal image.
[0084] To solve the above problems, the present invention also provides an electronic device, which includes:
[0085] A memory that stores at least one instruction; and
[0086] A processor that executes the instructions stored in the memory to implement the above-mentioned multi-target recognition method based on animal image features.
[0087] To solve the above problems, the present invention also provides a computer-readable storage medium, in which at least one instruction is stored, and the at least one instruction is executed by a processor in an electronic device to implement the above-mentioned multi-target recognition method based on animal image features.
[0088] To solve the problems described in the background art, the present invention first obtains the animal image to be recognized and sets a target animal ID set according to the animal image to be recognized. This step determines the possible animal species contained in the animal image to be recognized and sets the target animal ID set accordingly, providing a clear goal and direction for the subsequent recognition process, improving the pertinence and accuracy of recognition. Then, based on the target animal ID set, an animal standard image query is performed to obtain a set of target animal image groups. By performing the animal standard image query, a reference benchmark can be established for the animal image to be recognized, ensuring a reliable control group in the recognition process and thus improving the accuracy of recognition. Next, the set of target animal image groups is standardized in terms of image size to obtain a set of standard animal image groups. Standardizing the image size can eliminate the influence of different image sizes on subsequent multi-target recognition, ensuring that the target animal recognition model can uniformly process images of various sizes. In the next step, the target animal IDs are sequentially extracted from the target animal ID set. Based on the target animal IDs, the same-family animal image groups are recognized in the set of standard animal image groups. The same-family animal images are sequentially extracted from the same-family animal image groups, and the same-family animal images are equalized in grayscale to obtain grayscale animal images. Equalizing the grayscale can reduce the influence of lighting conditions on image recognition, making the morphological features in the animal image more prominent for subsequent animal feature recognition. Further, contour recognition is performed on the grayscale animal images to obtain grayscale animal contours. The grayscale contour area of the grayscale animal contours is recognized, and the grayscale contour area is recorded as the target contour feature value. Animal grayscale feature recognition is performed based on the grayscale animal images to obtain a set of target grayscale feature values. This step extracts the animal feature values in the grayscale animal images, providing basic data for the subsequent training of the deep learning model. Then, the target animal ID, the target contour feature value, and the set of target grayscale feature values are paired by key values to obtain a target animal feature group. The target animal feature groups are summarized to obtain a set of target animal feature groups, and an animal recognition model is constructed based on the set of target animal feature groups to obtain a target animal recognition model. The construction of the target animal recognition model can achieve automated multi-target recognition of animal images in a specific environment, reducing the excessive consumption of time and human resources. Finally, the target animal recognition model is used to perform multi-target recognition on the animal image to be recognized to obtain a multi-target animal image, completing the multi-target recognition based on the animal image features. Therefore, the present invention can improve the accuracy of multi-target recognition of animal images and reduce the excessive consumption of time and human resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0089] Figure 1 FIG. is a schematic flowchart of a multi-target recognition method based on animal image features provided by an embodiment of the present invention;
[0090] Figure 2 FIG. is a functional module diagram of a multi-target recognition system based on animal image features provided by an embodiment of the present invention;
[0091] Figure 3 The structural schematic diagram of an electronic device for implementing the multi-target recognition method based on animal image features provided by an embodiment of the present invention.
[0092] The implementation, functional features and advantages of the present invention will be further described in conjunction with the embodiments with reference to the accompanying drawings. Specific embodiments
[0093] 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.
[0094] An embodiment of the present application provides a multi-target recognition method based on animal image features. The execution subject of the multi-target recognition method based on animal image features includes, but is not limited to, at least one of electronic devices such as a server, a terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. In other words, the multi-target recognition method based on animal image features can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes, but is not limited to: a single server, a server cluster, a cloud server, or a cloud server cluster, etc.
[0095] Refer to Figure 1 As shown, it is a flowchart of a multi-target recognition method based on animal image features provided by an embodiment of the present invention. In this embodiment, the multi-target recognition method based on animal image features includes:
[0096] S1. Obtain an animal image to be recognized, set a target animal ID set according to the animal image to be recognized, and perform an animal standard image query based on the target animal ID set to obtain a target animal image group set. Among them, each target animal ID in the target animal ID set corresponds to a target animal image group in the target animal image group set, and the animal image to be recognized includes animal images corresponding to multiple target animal IDs.
[0097] It should be explained that the animal image to be recognized refers to an image that needs to perform multi-target recognition. The animal image to be recognized is obtained by manual field shooting or drone shooting. In this animal image to be recognized, there may be one or more target animals, or no target animals.
[0098] It can be understood that the target animal ID refers to a set of animal IDs that may appear in the multi-target identification. The target animal ID set is set manually according to the actual multi-target identification environment. The target animal image group refers to the image of the target animal corresponding to the target animal ID. The target animal image only contains the target animal corresponding to the target animal ID, and a target animal image only contains one target animal. It should be noted that since the feature value of the corresponding target animal ID needs to be obtained based on the target animal image later, the shooting environment of the target animal image group should be consistent with the shooting environment of the animal image to be identified. For example, if the shooting environment of the animal image to be identified is a woodland, then the shooting environment of the target animal image group should be the same woodland.
[0099] For example, Xiao Zhang is an animal management personnel. One day, Xiao Zhang needs to perform multi-target recognition on an image of an animal to be identified. Xiao Zhang finds that the shooting environment of the image of the animal to be identified is a forest. Then Xiao Zhang queries the relevant database and learns that the animals that appear in the forest are: animal a, animal b and animal c, that is, the target animal ID set is {animal a, animal b, animal c}. Then Xiao Zhang obtains the relevant images of each animal in the target animal ID set in the forest, that is, the target animal image set, where the relevant images of each animal in the forest are obtained by on-site photography by the data collection personnel of the forest, and the photographed images are stored in the animal management database for retrieval at any time.
[0100] S2. Standardize the image size of the target animal image set to obtain a standard animal image set, extract the target animal IDs in the target animal ID set in sequence, and identify the same family animal image set in the standard animal image set based on the target animal IDs.
[0101] It can be understood that the standard animal image set refers to the target animal image set after size standardization. Since the sizes of different target animal images in the target animal image set are not necessarily the same, in order to reduce the error of image comparison later, the target animal image set needs to be size standardized. The same-family animal image group refers to the standard animal image group corresponding to the target animal ID in the standard animal image group, that is, the animal ID represented by all the same-family animal images in the same-family animal image group is the target animal ID.
[0102] In detail, the step of normalizing the image size of the target animal image set to obtain a standard animal image set includes:
[0103] Extracting target animal images in sequence from the target animal image set, and obtaining original image ratios of the target animal images;
[0104] Scale the target animal image according to the original image ratio and the preset standard image ratio to obtain a standard animal image;
[0105] Summarize the standard animal images to obtain a set of standard animal images, and use the set of standard animal images to update the set of target animal image groups to obtain a set of standard animal image groups.
[0106] It can be understood that the original image ratio refers to the scale between the target animal image and the actual environment, and this original image ratio should be marked when taking the target animal image. The standard image ratio refers to the image ratio set artificially.
[0107] Exemplarily, Xiao Zhang extracts a certain target animal image. The original image ratio of this target animal image is 1:10000, and the set standard image ratio is 1:5000. So Xiao Zhang scales this target animal image: (1:5000) / (1:10000) = 2, that is, magnify the target animal image by two times to obtain a standard animal image.
[0108] S3. Sequentially extract the homologous animal images from the group of homologous animal images, and perform equalized graying on the homologous animal images to obtain gray animal images.
[0109] It can be understood that the gray animal image refers to the homologous animal image after equalized graying. Since the color channel in the original homologous animal image is the RGB color channel, in order to reduce the computational complexity of the subsequent processing of the homologous animal image, it is necessary to convert this RGB color channel into a gray channel. At the same time, since the gray distribution in the gray animal image is not necessarily uniform, which will lead to the unclear gray features of the animals in the gray animal image, it is necessary to further perform gray equalization on the gray animal image so that the entire gray animal image is more evenly distributed within the entire gray range.
[0110] Specifically, performing equalized graying on the homologous animal images to obtain gray animal images includes:
[0111] Gray the homologous animal images to obtain an original gray image, where graying refers to converting the color space of the homologous animal images from the RGB space to the gray space;
[0112] Sequentially extract the original gray points in the original gray image, identify the original gray values of the original gray points, and summarize the original gray values to obtain a set of original gray values;
[0113] Perform frequency statistics on the set of original gray values to obtain a set of original gray frequencies, where the original gray frequencies in the set of original gray frequencies are arranged in ascending order;
[0114] The original grayscale frequencies are sequentially extracted from the original grayscale frequency set, and the frequency proportions of the original grayscale frequencies are calculated, wherein the frequency proportions are expressed as:
[0115]
[0116] Among them, Q represents the frequency proportion, n represents the number of original grayscale frequencies in the original grayscale frequency set, and L i represents the i-th original grayscale frequency, L represents the original grayscale frequency;
[0117] Determining whether the frequency weight is greater than a preset standard weight;
[0118] If the frequency weight is greater than the standard weight, the frequency weight is recorded as a dense weight, and a plurality of dense grayscale points of the dense weight are identified;
[0119] If the frequency weight is not greater than the standard weight, the frequency weight is recorded as a sparse weight, and a plurality of sparse grayscale points of the sparse weight are identified;
[0120] The plurality of dense grayscale points and the plurality of sparse grayscale points are respectively summarized to obtain a dense grayscale point set and a sparse grayscale point set, and grayscale enhancement is performed on the original grayscale image according to the dense grayscale point set and the sparse grayscale point set to obtain a grayscale animal image.
[0121] It can be understood that the original grayscale image refers to the image of the same species of animals after grayscale conversion. Unlike the grayscale animal image, the original grayscale image has not undergone grayscale equalization operation. The original grayscale point refers to the pixel point in the original grayscale image. The original grayscale value refers to the grayscale value of the original grayscale point. The original grayscale frequency refers to the number of times the original grayscale value appears in the original grayscale value set. The frequency ratio refers to the proportion of the original grayscale frequency in the original grayscale frequency set. The standard ratio refers to a constant set artificially. The dense grayscale point refers to the original grayscale point corresponding to the dense ratio. The sparse grayscale point refers to the original grayscale point corresponding to the sparse ratio.
[0122] In detail, the grayscale enhancement of the original grayscale image is performed according to the dense grayscale point set and the sparse grayscale point set to obtain the grayscale animal image, including:
[0123] Acquire an original grayscale range of the original grayscale image, wherein the original grayscale range includes an original minimum grayscale value and an original maximum grayscale value, and the original minimum grayscale value is 0;
[0124] Setting a balanced grayscale range, wherein the balanced grayscale range includes: a balanced minimum grayscale value and a balanced maximum grayscale value, and the balanced minimum grayscale value is 0;
[0125] Successively extract dense gray points from the dense gray point set, identify the dense gray value and dense gray frequency of the dense gray points, perform gray point equalization based on the dense gray value and dense gray frequency to obtain an equalized dense gray value, where the equalized dense gray value is expressed as:
[0126]
[0127] where H′ m represents the equalized dense gray value, H m represents the dense gray value, H y represents the original maximum gray value, H h represents the equalized maximum gray value;
[0128] Use the equalized dense gray value to update the dense gray points to obtain equalized dense points, and summarize the equalized dense points to obtain an equalized dense point set;
[0129] According to the equalized dense point set, perform gray equalization on the sparse gray point set to obtain an equalized sparse point set;
[0130] Use the equalized sparse point set and the equalized dense point set to update the original gray image to obtain a gray animal image.
[0131] It should be explained that the original gray range refers to the range of gray values in the original gray image, and the equalized gray range refers to the range of gray values set artificially, and this equalized gray range should be less than the original gray range. For example: the original gray range is from 0 to 255, and the equalized gray range can be set from 0 to 100. The equalized dense point refers to the dense gray point with the equalized dense gray value.
[0132] Specifically, the step of performing gray equalization on the sparse gray point set according to the equalized dense point set to obtain an equalized sparse point set includes:
[0133] Based on the equalized dense point set, calculate the dense gray mean value, where the dense gray mean value is the average value of the gray values of the equalized dense points in the equalized dense point set;
[0134] Successively extract sparse gray points from the sparse gray point set, identify the sparse gray value of the sparse gray points, and determine whether the sparse gray value is greater than the dense gray mean value;
[0135] If the sparse gray value is greater than the dense gray mean value, use the equalized maximum gray value to update the sparse gray point to obtain an equalized sparse point;
[0136] If the sparse gray value is not greater than the dense gray mean value, use the equalized minimum gray value to update the sparse gray point to obtain an equalized sparse point;
[0137] Summarize the above-mentioned balanced sparse points to obtain a set of balanced sparse points.
[0138] It can be understood that the dense gray mean value refers to the average value of the gray values of the balanced dense points in the balanced dense point set, which is used to divide the sparse gray values. The sparse gray value refers to the gray value corresponding to the sparse gray points.
[0139] S4. Perform contour recognition on the gray animal image to obtain a gray animal contour, identify the gray contour area of the gray animal contour, and record the gray contour area as the target contour feature value.
[0140] It can be understood that the gray animal contour refers to the contour used to represent the appearance of the animal in the gray animal image, and the gray contour area refers to the proportion of the area of the gray animal contour in the gray animal image.
[0141] It should be explained that edge detection can be performed on the gray animal image through an edge detection algorithm, and the detection of the gray animal contour can be completed through a contour extraction algorithm. Among them, the edge detection algorithms include, for example, Canny edge detection, Sobel edge detection, and Laplacian edge detection, etc. The contour extraction algorithms include, for example, the findContours function in the OpenCV library. The above methods have been widely used in practical applications and will not be elaborated here.
[0142] S5. Perform animal gray feature recognition based on the gray animal image to obtain a group of target gray feature values.
[0143] It can be understood that the group of target gray feature values refers to the numerical set used to represent the gray features in the gray animal image, and this group of target gray feature values will be used in the subsequent training of the deep learning model.
[0144] Specifically, the performing animal gray feature recognition based on the gray animal image to obtain a group of target gray feature values includes:
[0145] Set a neighborhood step size, sequentially extract gray pixel points in the gray animal image, perform neighborhood extraction on the gray pixel points based on the neighborhood step size to obtain a group of neighborhood pixel points, and identify the group of neighborhood gray values of the group of neighborhood pixel points;
[0146] Construct a neighborhood pixel point matrix according to the group of neighborhood gray values, where the neighborhood pixel point matrix is expressed as:
[0147]
[0148] where, H ldenotes the neighborhood pixel point matrix, i denotes the abscissa of the grayscale pixel point, j denotes the ordinate of the grayscale pixel point, d denotes the neighborhood step size, and H i+d,j denotes the neighborhood grayscale value corresponding to the neighborhood pixel point with coordinates (i + d, j), and H i-d,j denotes the neighborhood grayscale value corresponding to the neighborhood pixel point with coordinates (i - d, j), and H i,j+d denotes the neighborhood grayscale value corresponding to the neighborhood pixel point with coordinates (i, j + d), and H i,j-d denotes the neighborhood grayscale value corresponding to the neighborhood pixel point with coordinates (i, j - d);
[0149] According to the neighborhood pixel point matrix, calculate the pixel deviation value and the pixel deviation angle by using the following formula:
[0150]
[0151] where, ΔH denotes the pixel deviation value, |*| denotes the absolute value symbol, F denotes the pixel deviation angle, and arctan(*) denotes the arctangent symbol;
[0152] Perform grayscale feature calculation according to the pixel deviation value and the pixel deviation angle to obtain a target grayscale feature value group.
[0153] It can be understood that the neighborhood step size refers to a constant set artificially for representing the distance between a pixel point and its surrounding pixel points, the grayscale pixel point refers to the pixel point in the grayscale animal image, the neighborhood pixel point refers to the pixel point at a distance of d from the grayscale pixel point, where d denotes the neighborhood step size, the neighborhood grayscale value refers to the grayscale value of the neighborhood pixel point, the neighborhood pixel point matrix refers to the matrix constructed according to the neighborhood pixel values, which represents the grayscale change relationship between the grayscale pixel point and the neighborhood pixel points, the pixel deviation value refers to the value used to represent the difference in grayscale values between neighborhood pixel points, the pixel deviation angle refers to the value used to represent the degree of grayscale deviation between the neighborhood pixel point and the grayscale pixel point, and the greater the deviation of the pixel deviation angle from 0 degrees, the greater the deviation degree of the current neighborhood pixel point from the grayscale pixel point.
[0154] Specifically, the performing grayscale feature calculation according to the pixel deviation value and the pixel deviation angle to obtain a target grayscale feature value group includes:
[0155] Judge whether the pixel deviation angle is greater than a preset standard deviation angle;
[0156] If the pixel deviation angle is greater than the standard deviation angle, then record the grayscale pixel point as a feature pixel point, identify the feature grayscale value of the feature pixel point, and calculate a deviation feature value based on the feature grayscale value, the pixel deviation value, and the pixel deviation angle, where the deviation feature value is expressed as:
[0157] P = H t×cos(F) + ΔH
[0158] where P represents the deviation from the eigenvalue, and H t represents the characteristic gray value, and cos(*) represents the cosine function;
[0159] Summarize the deviation eigenvalues to obtain a set of deviation eigenvalues, and identify the average deviation eigenvalue, the maximum deviation eigenvalue, the minimum deviation eigenvalue, and the median deviation eigenvalue in the set of deviation eigenvalues;
[0160] Pair the average deviation eigenvalue, the maximum deviation eigenvalue, the minimum deviation eigenvalue, and the median deviation eigenvalue to obtain a target gray feature value group.
[0161] It should be explained that the standard deviation angle refers to the pixel deviation angle set artificially, and this standard deviation angle should be a relatively small value, for example: 5 degrees. The characteristic gray value refers to the gray value of the characteristic pixel point, the deviation eigenvalue refers to the value used to represent the gray feature of the gray pixel point, the average deviation eigenvalue refers to the average value in the set of deviation eigenvalues, the maximum deviation eigenvalue and the minimum deviation eigenvalue respectively refer to the maximum value and the minimum value in the set of deviation eigenvalues, and the median deviation eigenvalue refers to the median in the set of deviation eigenvalues.
[0162] S6. Pair the target animal ID, the target contour feature value, and the target gray feature value group to obtain a target animal feature group, and summarize the target animal feature group to obtain a set of target animal feature groups.
[0163] It should be explained that the target animal feature group refers to the group used to represent the animal features of the target animal ID. Since this target animal feature group marks the target animal ID, it can be used for deep learning model training to obtain a target animal recognition model that can recognize the target animal ID.
[0164] S7. Construct an animal recognition model based on the set of target animal feature groups to obtain a target animal recognition model, where the target animal recognition model is a deep learning model trained by the set of target animal feature groups.
[0165] It is understandable that the target animal recognition model can recognize animals in images in a specific environment. Its construction method is: divide the set of target animal feature groups into a training set, a validation set, and a test set. Among them, the training set is used to train the selected deep learning model, the validation set is used to verify the trained model to prevent overfitting of the model, and the test set is used to test the performance of the deep learning model. And train, verify, and test the selected deep learning model through the training set, the validation set, and the test set respectively to obtain the target animal recognition model. Among them, the deep learning model can be selected: convolutional neural network model, etc.
[0166] It should be explained that after the obtained target animal feature group is input into the trained target animal recognition model, the target animal recognition model will output an animal ID and a recognition success rate. Through the animal ID and the recognition success rate, the determination of the input target animal feature group can be completed.
[0167] S8. Use the target animal recognition model to perform multi-target recognition on the animal image to be recognized, obtain a multi-target animal image, and complete multi-target recognition based on the animal image features.
[0168] It can be understood that the multi-target animal image refers to the animal image to be recognized after multi-target animal recognition, and the animal contours in the multi-target animal image will be marked with the corresponding target animal IDs.
[0169] Specifically, using the target animal recognition model to perform multi-target recognition on the animal image to be recognized and obtain a multi-target animal image includes:
[0170] Obtain the ratio of the image to be recognized of the animal image to be recognized. According to the ratio of the image to be recognized and the ratio of the standard image, set a plurality of moving recognition blocks. Among them, the image ratio of the moving recognition block is the ratio of the standard image, and the number of moving recognition blocks is:
[0171]
[0172] where n′ represents the number of moving recognition blocks, Z(*) represents the ceiling function, C s represents the ratio of the image to be recognized, and C b represents the ratio of the standard image;
[0173] Identify the upper left vertex of the animal image to be recognized, record the upper left vertex as the block movement starting point, and based on the block movement starting point, add the plurality of moving recognition blocks to the animal image to be recognized to obtain a block animal image. Among them, the plurality of moving recognition blocks are arranged in sequence from top to bottom on the left side of the animal image to be recognized, and there is no spatial overlap between different moving recognition blocks;
[0174] Identify the right side of the block animal image and record the right side as the block movement ending point;
[0175] Record the current movement start time, according to the movement start time and the preset block movement speed, and use the plurality of moving recognition blocks to move right in the block animal image to obtain an intercepted animal area set, where the intercepted animal areas in the intercepted animal area set correspond to the moving recognition blocks in the plurality of moving recognition blocks;
[0176] Extract the intercepted animal regions in sequence from the intercepted animal region set, and perform the following operations on the intercepted animal regions:
[0177] Obtain the intercepted animal feature group of the intercepted animal region, where the intercepted animal feature group includes: an intercepted contour feature value and an intercepted gray-scale feature value group. The intercepted contour feature value is the area ratio of the intercepted animal contour in the intercepted animal region;
[0178] Input the intercepted animal feature group into the target animal recognition model to obtain a candidate animal ID and a candidate animal similarity, and determine whether the candidate animal similarity is greater than a preset standard animal similarity;
[0179] If the candidate animal similarity is greater than the standard animal similarity, record the candidate animal ID as the recognized animal ID, and use the recognized animal ID to mark the intercepted animal contour in the intercepted animal region to obtain a marked animal region;
[0180] Summarize the marked animal regions to obtain a marked animal region set, and return to the step of recording the current movement start time until the moving recognition block touches the end side of the block movement;
[0181] Summarize the marked animal region set to obtain a marked animal region collection. According to the marked animal region collection, perform multi-target recognition on the animal image to be recognized to obtain a multi-target animal image.
[0182] It is understandable that the ratio of the image to be recognized refers to the scale size when the animal image to be recognized is taken. The moving recognition block refers to a rectangular area with a size of the standard image ratio. The movement start time refers to the current time when the moving recognition block starts to move. The block movement speed refers to a constant set artificially. The intercepted animal region refers to the animal image to be recognized selected by the moving recognition block. The intercepted animal feature group refers to the numerical value used to represent the animal features in the intercepted animal region, which includes: an intercepted contour feature value and an intercepted gray-scale feature value group. The intercepted contour feature value is the area ratio of the intercepted animal contour in the intercepted animal region. The intercepted gray-scale feature value group refers to the numerical value group used to represent the gray-scale features of the intercepted animal region, and its calculation method is the same as that of the target gray-scale feature value group of the gray-scale animal image, which will not be elaborated here.
[0183] It is understandable that the candidate animal ID refers to the target animal ID obtained after being recognized by the target animal recognition model. The candidate animal similarity refers to the accuracy of this recognition obtained after being recognized by the target animal recognition model. The standard animal similarity refers to the animal similarity set artificially. The marked animal region refers to the intercepted animal region marked by the recognized animal ID.
[0184] Specifically, for the to-be-recognized animal image, multi-object recognition is performed according to the set of identified animal regions, and a multi-object animal image is obtained, including:
[0185] Successively extract the identified animal regions from the set of identified animal regions, and identify the group of conspecific animal regions of the identified animal regions in the set of identified animal regions, where the conspecific animal ID in the conspecific animal regions is the same as the identified animal ID in the identified animal regions;
[0186] Successively extract the conspecific animal regions from the group of conspecific animal regions, and determine whether the identified animal region is connected to the conspecific animal region;
[0187] If the identified animal region is connected to the conspecific animal region, then merge the identified animal region and the conspecific animal region to obtain a merged animal region;
[0188] Summarize the merged animal regions to obtain a set of merged animal regions, use the set of merged animal regions to update the set of identified animal regions, and return to the step of successively extracting the identified animal regions from the set of identified animal regions until there is no group of conspecific animal regions in the set of identified animal regions;
[0189] Use the set of merged animal regions to update the to-be-recognized animal image to obtain a multi-object animal image.
[0190] It should be explained that the group of conspecific animal regions refers to the identified animal regions in the set of identified animal regions that have the same recognized animal ID mark as the identified animal region, and the merged animal region refers to the merged region of the identified animal region and the connected conspecific animal region.
[0191] To solve the problems described in the background art, the present invention first obtains an animal image to be recognized and sets a target animal ID set based on the animal image to be recognized. This step determines the possible animal species contained in the animal image to be recognized and sets the target animal ID set accordingly, providing a clear goal and direction for the subsequent recognition process, improving the pertinence and accuracy of recognition. Then, based on the target animal ID set, an animal standard image query is performed to obtain a set of target animal image groups. By performing the animal standard image query, a reference benchmark can be established for the animal image to be recognized, ensuring a reliable control group in the recognition process and thus improving the recognition accuracy. Next, the set of target animal image groups is standardized in terms of image size to obtain a set of standard animal image groups. Standardizing the image size can eliminate the influence of different image sizes on subsequent multi-target recognition, ensuring that the target animal recognition model can uniformly process images of various sizes. In the next step, the target animal IDs are sequentially extracted from the target animal ID set. Based on the target animal IDs, the same-family animal image groups are recognized in the set of standard animal image groups. The same-family animal images are sequentially extracted from the same-family animal image groups, and the same-family animal images are evenly gray-scaled to obtain gray-scale animal images. Evenly gray-scaling can reduce the influence of lighting conditions on image recognition, making the morphological features in the animal images more prominent for subsequent animal feature recognition. Further, contour recognition is performed on the gray-scale animal images to obtain gray-scale animal contours. The gray-scale contour area of the gray-scale animal contours is recognized, and the gray-scale contour area is recorded as the target contour feature value. Animal gray-scale feature recognition is performed based on the gray-scale animal images to obtain a set of target gray-scale feature values. This step extracts the animal feature values in the gray-scale animal images, providing basic data for subsequent training of the deep learning model. Then, the target animal IDs, the target contour feature value, and the set of target gray-scale feature values are paired by key values to obtain a set of target animal feature groups. The set of target animal feature groups is summarized to obtain a set of target animal feature groups, and an animal recognition model is constructed based on the set of target animal feature groups to obtain a target animal recognition model. The construction of the target animal recognition model can achieve automatic multi-target recognition of animal images in a specific environment, reducing the excessive consumption of time and human resources. Finally, the target animal recognition model is used to perform multi-target recognition on the animal image to be recognized to obtain a multi-target animal image, completing the multi-target recognition based on the animal image features. Therefore, the present invention can improve the accuracy of multi-target recognition of animal images and reduce the excessive consumption of time and human resources.
[0192] As Figure 2 shown, it is a functional module diagram of a multi-target recognition system based on animal image features provided by an embodiment of the present invention.
[0193] The multi-object recognition system 100 based on animal image features according to the present invention can be installed in an electronic device. According to the implemented functions, the multi-object recognition system 100 based on animal image features can include an animal image acquisition module 101, a grayscale image conversion module 102, an animal feature calculation module 103, and a recognition model construction module 104. The modules described in the present invention can also be referred to as units, which refer to a series of computer program segments that can be executed by the processor of the electronic device and can complete fixed functions, and are stored in the memory of the electronic device.
[0194] The animal image acquisition module 101 is configured to acquire an animal image to be recognized, set a target animal ID set according to the animal image to be recognized, perform an animal standard image query based on the target animal ID set, and obtain a target animal image group set. Among them, each target animal ID in the target animal ID set corresponds to a target animal image group in the target animal image group set, and the animal image to be recognized includes animal images corresponding to multiple target animal IDs;
[0195] The grayscale image conversion module 102 is configured to standardize the image size of the target animal image group set to obtain a standard animal image group set, sequentially extract target animal IDs in the target animal ID set, based on the target animal IDs, identify homologous animal image groups in the standard animal image group set, sequentially extract homologous animal images in the homologous animal image groups, and perform equalized grayscale processing on the homologous animal images to obtain grayscale animal images;
[0196] The animal feature calculation module 103 is configured to perform contour recognition on the grayscale animal image to obtain a grayscale animal contour, identify the grayscale contour area of the grayscale animal contour, record the grayscale contour area as a target contour feature value, perform animal grayscale feature recognition according to the grayscale animal image to obtain a target grayscale feature value group, perform key-value pairing on the target animal ID, the target contour feature value, and the target grayscale feature value group to obtain a target animal feature group, and summarize the target animal feature groups to obtain a target animal feature group set;
[0197] The recognition model construction module 104 is configured to construct an animal recognition model based on the target animal feature group set to obtain a target animal recognition model. Among them, the target animal recognition model is a deep learning model trained by the target animal feature group set, and the multi-object recognition of the animal image to be recognized is performed by using the target animal recognition model to obtain a multi-object animal image.
[0198] Specifically, each module in the multi-object recognition system 100 based on animal image features in the embodiment of the present invention is used in the same way as the above Figure 1The same technical means as the multi-object recognition method based on animal image features described in [reference] can be used, and the same technical effects can be achieved. Details are not described herein again.
[0199] As Figure 3 shown, it is a schematic structural diagram of an electronic device for implementing the multi-object recognition method based on animal image features according to an embodiment of the present invention.
[0200] The electronic device 1 may include a processor 10, a memory 11, and a bus 12, and may further include a computer program stored in the memory 11 and executable on the processor 10, such as a multi-object recognition method program based on animal image features.
[0201] Among them, the memory 11 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, mobile hard disk, multimedia card, card-type memory (such as SD or DX memory, etc.), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of the electronic device 1, such as the mobile hard disk of the electronic device 1. In other embodiments, the memory 11 may also be an external storage device of the electronic device 1, such as a plug-in mobile hard disk, a Smart Media Card (SMC), a Secure Digital (SD) card, a Flash Card, etc. equipped on the electronic device 1. Further, the memory 11 further includes the internal storage unit of the electronic device 1 and also includes an external storage device. The memory 11 can be used not only to store application software installed in the electronic device 1 and various types of data, such as the code of the multi-object recognition method program based on animal image features, etc., but also to temporarily store data that has been output or will be output.
[0202] In some embodiments, the processor 10 may be composed of integrated circuits. For example, it may be composed of a single packaged integrated circuit, or may be composed of multiple integrated circuits with the same or different functions, including a combination of one or more Central Processing Units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips. The processor 10 is the control core of the electronic device, connecting various components of the entire electronic device through various interfaces and lines, and by running or executing programs or modules stored in the memory 11 (such as the multi-object recognition method program based on animal image features, etc.), and calling data stored in the memory 11, to perform various functions of the electronic device 1 and process data.
[0203] The bus 12 can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The bus 12 can be divided into an address bus, a data bus, a control bus, etc. The bus 12 is configured to implement connection and communication between the memory 11 and at least one processor 10, etc.
[0204] Figure 3 Only an electronic device with components is shown. Those skilled in the art can understand that Figure 3 the shown structure does not constitute a limitation on the electronic device 1, and it may include fewer or more components than shown, or combine certain components, or have different component arrangements.
[0205] For example, although not shown, the electronic device 1 may further include a power source (such as a battery) for supplying power to each component. Preferably, the power source can be logically connected to the at least one processor 10 through a power management system, so as to implement functions such as charge management, discharge management, and power consumption management through the power management system. The power source may also include any components such as one or more DC or AC power sources, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator. The electronic device 1 may also include various sensors, a Bluetooth module, a Wi-Fi module, etc., which will not be elaborated here.
[0206] Furthermore, the electronic device 1 may further include a network interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device 1 and other electronic devices.
[0207] Optionally, the electronic device 1 may further include a user interface. The user interface may be a display, an input unit (such as a keyboard), and optionally, the user interface may also be a standard wired interface or a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch liquid crystal display, and an OLED (Organic Light-Emitting Diode) toucher, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display the information processed in the electronic device 1 and to display a visual user interface.
[0208] The multi-target recognition method program based on animal image features stored in the memory 11 of the electronic device 1 is a combination of multiple instructions. When running in the processor 10, it can achieve:
[0209] Acquire an animal image to be identified, set a target animal ID set according to the animal image to be identified, perform an animal standard image query based on the target animal ID set, and obtain a target animal image group set, wherein each target animal ID in the target animal ID set corresponds to a target animal image group in the target animal image group set, and the animal image to be identified includes animal images corresponding to multiple target animal IDs;
[0210] Standardizing the image size of the target animal image set to obtain a standard animal image set, extracting target animal IDs in the target animal ID set in sequence, and identifying a group of images of animals of the same species in the standard animal image set based on the target animal IDs;
[0211] Extracting the same family animal images in sequence from the same family animal image group, performing balanced grayscale conversion on the same family animal images, and obtaining grayscale animal images;
[0212] Performing contour recognition in the grayscale animal image to obtain a grayscale animal contour, identifying a grayscale contour area of the grayscale animal contour, and recording the grayscale contour area as a target contour feature value;
[0213] Perform animal grayscale feature recognition based on the grayscale animal image to obtain a target grayscale feature value group;
[0214] Key-pairing the target animal ID, target contour feature value, and target grayscale feature value group to obtain a target animal feature group, and summarizing the target animal feature group to obtain a target animal feature group set;
[0215] An animal recognition model is constructed based on the target animal feature set to obtain a target animal recognition model, wherein the target animal recognition model is a deep learning model trained with the target animal feature set;
[0216] The target animal recognition model is used to perform multi-target recognition on the animal image to be recognized, to obtain multi-target animal images, and to complete multi-target recognition based on animal image features.
[0217] Specifically, the specific implementation method of the processor 10 for the above instructions can refer to Figures 1 to 3 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0218] Furthermore, if the modules / units integrated in the electronic device 1 are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or system capable of carrying the computer program code, recording medium, USB flash drive, mobile hard disk, magnetic disk, optical disc, computer memory, read-only memory (ROM, Read-Only Memory).
[0219] The present invention also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor of an electronic device, it can implement:
[0220] Obtain an animal image to be recognized, set a target animal ID set according to the animal image to be recognized, perform an animal standard image query based on the target animal ID set, and obtain a set of target animal image groups. Each target animal ID in the target animal ID set corresponds to a target animal image group in the set of target animal image groups, and the animal image to be recognized includes animal images corresponding to multiple target animal IDs;
[0221] Standardize the image sizes of the set of target animal image groups to obtain a set of standard animal image groups. Sequentially extract target animal IDs from the target animal ID set, and based on the target animal IDs, identify groups of animal images of the same family in the set of standard animal image groups;
[0222] Sequentially extract animal images of the same family from the groups of animal images of the same family, perform equalized graying on the animal images of the same family, and obtain gray animal images;
[0223] Perform contour recognition on the gray animal images to obtain gray animal contours, identify the gray contour areas of the gray animal contours, and record the gray contour areas as target contour feature values;
[0224] Perform animal gray feature recognition based on the gray animal images to obtain a set of target gray feature values;
[0225] Perform key-value pairing on the target animal IDs, target contour feature values, and set of target gray feature values to obtain a set of target animal feature groups, and summarize the set of target animal feature groups to obtain a set of target animal feature groups;
[0226] Construct an animal recognition model based on the set of target animal feature groups to obtain a target animal recognition model, where the target animal recognition model is a deep learning model trained by the set of target animal feature groups;
[0227] Perform multi-target recognition on the animal image to be recognized using the target animal recognition model to obtain a multi-target animal image, and complete multi-target recognition based on the animal image features.
[0228] In several embodiments provided by the present invention, it should be understood that the disclosed devices, systems, and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative, and there may be other partitioning methods in actual implementation.
[0229] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0230] In addition, the functional modules in each embodiment of the present invention can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated unit can be implemented in the form of hardware or in the form of a hardware plus software functional module.
[0231] For those skilled in the art, it is obvious that the present invention is not limited to the details of the above exemplary embodiments, and without departing from the spirit or basic characteristics of the present invention, the present invention can be implemented in other specific forms.
[0232] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and not to limit them. Although the present invention has been described in detail with reference to the preferred embodiments, those of ordinary skill in the art should understand that the technical solutions of the present invention can be modified or equivalently replaced without departing from the spirit and scope of the technical solutions of the present invention.
Claims
1. A multi-object recognition method based on animal image features, characterized in that, The method comprises: Acquire an animal image to be identified, set a target animal ID set according to the animal image to be identified, perform an animal standard image query based on the target animal ID set, and obtain a target animal image group set, wherein each target animal ID in the target animal ID set corresponds to a target animal image group in the target animal image group set, and the animal image to be identified includes animal images corresponding to multiple target animal IDs; The target animal image set is subjected to image size standardization to obtain a standard animal image set, the target animal ID is sequentially extracted from the target animal ID set, and based on the target animal ID, a same-family animal image set is identified in the standard animal image set, wherein the same-family animal image set refers to a standard animal image set corresponding to the target animal ID in the standard animal image set, and the animal IDs represented by all the same-family animal images in the same-family animal image set are the target animal IDs; Extracting the same-family animal images in sequence from the same-family animal image group, performing balanced grayscale conversion on the same-family animal images, and obtaining grayscale animal images; Performing contour recognition in the grayscale animal image to obtain a grayscale animal contour, identifying a grayscale contour area of the grayscale animal contour, and recording the grayscale contour area as a target contour feature value; Perform animal grayscale feature recognition based on the grayscale animal image to obtain a target grayscale feature value group; Key-pairing the target animal ID, target contour feature value and target grayscale feature value group to obtain a target animal feature group, and summarizing the target animal feature group to obtain a target animal feature group set; An animal recognition model is constructed based on the target animal feature set to obtain a target animal recognition model, wherein the target animal recognition model is a deep learning model trained with the target animal feature set; The target animal recognition model is used to perform multi-target recognition on the animal image to be recognized, to obtain multi-target animal images, and to complete multi-target recognition based on animal image features.
2. The multi-object recognition method based on animal image features according to claim 1, characterized in that The step of normalizing the image size of the target animal image set to obtain a standard animal image set includes: Extracting target animal images in sequence from the target animal image set, and obtaining original image ratios of the target animal images; Scaling the target animal image according to the original image ratio and the preset standard image ratio to obtain a standard animal image; The standard animal images are aggregated to obtain a standard animal image set, and the target animal image set is updated using the standard animal image set to obtain a standard animal image set.
3. The multi-object recognition method based on animal image features according to claim 2, wherein, The step of performing balanced grayscale conversion on the images of animals of the same species to obtain grayscale animal images includes: Graying the image of the same family animal to obtain an original grayscale image, wherein graying refers to converting the color space of the image of the same family animal from RGB space to grayscale space; Extracting original grayscale points in the original grayscale image in sequence, identifying original grayscale values of the original grayscale points, and summarizing the original grayscale values to obtain an original grayscale value set; Perform frequency statistics on the original grayscale value set to obtain an original grayscale frequency set, where the original grayscale frequencies in the original grayscale frequency set are arranged in ascending order; Successively extract the original grayscale frequencies in the original grayscale frequency set, and calculate the frequency ratio of the original grayscale frequencies, where the frequency ratio is expressed as: Among them, Q represents the frequency ratio, n represents the number of original gray-scale frequencies in the original gray-scale frequency concentration, and L i represents the i-th original gray-scale frequency, and L represents the original gray-scale frequency; Judge whether the frequency ratio is greater than a preset standard ratio; If the frequency ratio is greater than the standard ratio, record the frequency ratio as a dense ratio, and identify multiple dense grayscale points of the dense ratio; If the frequency ratio is not greater than the standard ratio, record the frequency ratio as a sparse ratio, and identify multiple sparse grayscale points of the sparse ratio; Summarize the multiple dense grayscale points and multiple sparse grayscale points respectively to obtain a dense grayscale point set and a sparse grayscale point set. According to the dense grayscale point set and the sparse grayscale point set, perform grayscale enhancement on the original grayscale image to obtain a grayscale animal image.
4. The multi-object recognition method based on animal image features according to claim 3, wherein The step of performing grayscale enhancement on the original grayscale image according to the dense grayscale point set and the sparse grayscale point set to obtain a grayscale animal image includes: Obtain the original grayscale range of the original grayscale image, where the original grayscale range includes an original minimum grayscale value and an original maximum grayscale value, and the original minimum grayscale value is 0; Set an equalized grayscale range, where the equalized grayscale range includes an equalized minimum grayscale value and an equalized maximum grayscale value, and the equalized minimum grayscale value is 0; Successively extract dense grayscale points in the dense grayscale point set, identify the dense grayscale values and dense grayscale frequencies of the dense grayscale points, and perform grayscale point equalization according to the dense grayscale values and dense grayscale frequencies to obtain an equalized dense grayscale value, where the equalized dense grayscale value is expressed as: Among them, H' m represents the balanced dense gray value, H m represents the dense gray value, H y represents the original maximum gray value, H h represents the balanced maximum gray value; Use the equalized dense grayscale value to update the dense grayscale points to obtain equalized dense points, and summarize the equalized dense points to obtain an equalized dense point set; According to the equalized dense point set, perform grayscale equalization on the sparse grayscale point set to obtain an equalized sparse point set; Use the equalized sparse point set and the equalized dense point set to update the original grayscale image to obtain a grayscale animal image.
5. The multi-object recognition method based on animal image features according to claim 4, wherein The step of performing grayscale equalization on the sparse grayscale point set according to the equalized dense point set to obtain an equalized sparse point set includes: Based on the equalized dense point set, calculate the dense grayscale mean value, where the dense grayscale mean value is the average of the grayscale values of the equalized dense points in the equalized dense point set; Successively extract sparse grayscale points in the sparse grayscale point set, identify the sparse grayscale values of the sparse grayscale points, and judge whether the sparse grayscale value is greater than the dense grayscale mean value; If the sparse grayscale value is greater than the dense grayscale mean value, use the equalized maximum grayscale value to update the sparse grayscale point to obtain an equalized sparse point; If the sparse grayscale value is not greater than the dense grayscale mean value, use the equalized minimum grayscale value to update the sparse grayscale point to obtain an equalized sparse point; Summarize the equalized sparse points to obtain an equalized sparse point set.
6. The multi-object recognition method based on animal image features according to claim 5, wherein The step of performing animal grayscale feature recognition on the grayscale animal image to obtain a target grayscale feature value group includes: Set the neighborhood step size, sequentially extract grayscale pixel points in the grayscale animal image, and based on the neighborhood step size, perform neighborhood extraction on the grayscale pixel points to obtain a neighborhood pixel point group, and identify the neighborhood grayscale value group of the neighborhood pixel point group; Construct a neighborhood pixel point matrix according to the neighborhood grayscale value group, where the neighborhood pixel point matrix is expressed as: Among them, H l represents the neighborhood pixel point matrix, i represents the abscissa of the grayscale pixel point, j represents the ordinate of the grayscale pixel point, d represents the neighborhood step size, and H i+d,j represents the neighborhood grayscale value corresponding to the neighborhood pixel point with coordinates (i + d, j), and H i-d,j represents the neighborhood grayscale value corresponding to the neighborhood pixel point with coordinates (i - d, j), and H i,j+d represents the neighborhood grayscale value corresponding to the neighborhood pixel point with coordinates (i, j + d), and H i,j-d represents the neighborhood grayscale value corresponding to the neighborhood pixel point with coordinates (i, j - d); According to the neighborhood pixel point matrix, use the following formula to calculate the pixel deviation value and the pixel deviation angle: Where ΔH represents the pixel deviation value, |*| represents the absolute value symbol, F represents the pixel deviation angle, and arctan(*) represents the arctangent symbol; Perform grayscale feature calculation according to the pixel deviation value and the pixel deviation angle to obtain a target grayscale feature value group.
7. The multi-object recognition method based on animal image features according to claim 6, wherein The performing grayscale feature calculation according to the pixel deviation value and the pixel deviation angle to obtain a target grayscale feature value group includes: Judge whether the pixel deviation angle is greater than a preset standard deviation angle; If the pixel deviation angle is greater than the standard deviation angle, record the grayscale pixel point as a feature pixel point, identify the feature grayscale value of the feature pixel point, and calculate a deviation feature value based on the feature grayscale value, the pixel deviation value, and the pixel deviation angle, where the deviation feature value is expressed as: P = H t × cos(F) + ΔH where P represents the deviation eigenvalue, H t represents the characteristic gray value, and cos(*) represents the cosine function; Summarize the deviation feature values to obtain a deviation feature value set, and identify the average deviation feature value, the maximum deviation feature value, the minimum deviation feature value, and the median deviation feature value in the deviation feature value set; Perform key-value pairing on the average deviation feature value, the maximum deviation feature value, the minimum deviation feature value, and the median deviation feature value to obtain a target grayscale feature value group.
8. The multi-object recognition method based on animal image features according to claim 7, characterized in that, The performing multi-target recognition on the animal image to be recognized by using the target animal recognition model to obtain a multi-target animal image includes: Obtain the proportion of the image to be recognized of the animal image to be recognized, and set a plurality of moving recognition blocks according to the proportion of the image to be recognized and the proportion of the standard image, where the image proportion of the moving recognition block is the proportion of the standard image, and the number of the moving recognition blocks is: where n' represents the number of moving recognition blocks, Z(*) represents the ceiling function, C s represents the ratio of the image to be recognized, C b represents the ratio of the standard image; Identify the upper left vertex of the animal image to be recognized, record the upper left vertex as the block moving starting point, and based on the block moving starting point, add the plurality of moving recognition blocks to the animal image to be recognized to obtain a block animal image, where the plurality of moving recognition blocks are arranged in sequence from top to bottom on the left side of the animal image to be recognized, and there is no spatial overlap between different moving recognition blocks; Identify the right side of the block animal image and record the right side as the block moving ending side; Record the current moving start time, and according to the moving start time and the preset block moving speed, and use the plurality of moving recognition blocks to perform right movement on the block animal image to obtain an intercepted animal area set, where the intercepted animal areas in the intercepted animal area set correspond to the moving recognition blocks in the plurality of moving recognition blocks; Sequentially extract the intercepted animal areas in the intercepted animal area set, and perform the following operations on the intercepted animal areas: Obtain the intercepted animal feature group of the intercepted animal area, where the intercepted animal feature group includes: an intercepted contour feature value and an intercepted grayscale feature value group, where the intercepted contour feature value is the area ratio of the intercepted animal contour in the intercepted animal area; Input the intercepted animal feature group into the target animal recognition model to obtain a candidate animal ID and a candidate animal similarity, and determine whether the candidate animal similarity is greater than a preset standard animal similarity; If the candidate animal similarity is greater than the standard animal similarity, record the candidate animal ID as the recognized animal ID, and use the recognized animal ID to label the intercepted animal contour in the intercepted animal area to obtain a labeled animal area; Summarize the labeled animal areas to obtain a set of labeled animal areas, and return to the step of recording the current movement start time until the moving recognition block touches the end side of the block movement; Summarize the set of labeled animal areas to obtain a set of labeled animal areas, and perform multi-target recognition on the animal image to be recognized according to the set of labeled animal areas to obtain a multi-target animal image.
9. The multi-object recognition method based on animal image features according to claim 8, wherein The performing multi-target recognition on the animal image to be recognized according to the set of labeled animal areas to obtain a multi-target animal image includes: Sequentially extract labeled animal areas from the set of labeled animal areas, and identify a group of homologous animal areas of the labeled animal areas in the set of labeled animal areas, where the homologous animal IDs in the homologous animal areas are the same as the labeled animal IDs in the labeled animal areas; Sequentially extract homologous animal areas from the group of homologous animal areas, and determine whether the labeled animal area is connected to the homologous animal area; If the labeled animal area is connected to the homologous animal area, merge the labeled animal area and the homologous animal area to obtain a merged animal area; Summarize the merged animal areas to obtain a set of merged animal areas, use the set of merged animal areas to update the set of labeled animal areas, and return to the step of sequentially extracting labeled animal areas from the set of labeled animal areas until there is no group of homologous animal areas in the set of labeled animal areas; Use the set of merged animal areas to update the animal image to be recognized to obtain a multi-target animal image.
10. A multi-target recognition system based on animal image features, characterized in that, The system includes: An animal image acquisition module for acquiring an animal image to be recognized, setting a set of target animal IDs according to the animal image to be recognized, and querying for a set of target animal image groups based on the set of target animal IDs, where each target animal ID in the set of target animal IDs corresponds to a target animal image group in the set of target animal image groups, and the animal image to be recognized includes animal images corresponding to multiple target animal IDs; A grayscale image conversion module for standardizing the image sizes of the set of target animal image groups to obtain a set of standard animal image groups, sequentially extracting target animal IDs from the set of target animal IDs, and identifying a group of homologous animal images in the set of standard animal image groups based on the target animal IDs, where the group of homologous animal images refers to the set of standard animal images corresponding to the target animal ID in the set of standard animal image groups, and all the homologous animal images in the group of homologous animal images represent the target animal ID, sequentially extracting homologous animal images from the group of homologous animal images, and performing equalized grayscale processing on the homologous animal images to obtain grayscale animal images; The animal feature calculation module is used to perform contour recognition in the grayscale animal image to obtain the grayscale animal contour, identify the grayscale contour area of the grayscale animal contour, record the grayscale contour area as the target contour feature value, perform animal grayscale feature recognition based on the grayscale animal image to obtain the target grayscale feature value group, pair the target animal ID, the target contour feature value and the target grayscale feature value group by key-value to obtain the target animal feature group, and summarize the target animal feature group to obtain the target animal feature group set; The recognition model construction module is used to construct an animal recognition model based on the target animal feature group set to obtain the target animal recognition model. Among them, the target animal recognition model is a deep learning model trained by the target animal feature group set, and the target animal recognition model is used to perform multi-target recognition on the animal image to be recognized to obtain the multi-target animal image.
Citation Information
Patent Citations
Migrating bird monitoring and identifying method and device
CN116704428A
Method and device for recognizing image, storage medium and electronic device
WO2020221177A1