Target identification method, product, equipment and medium
By separating the target detection and feature extraction models on the embedded device, and using a generative adversarial network to generate simulated sample images, the real-time deployment and over-fitting problems of target detection in the existing technology are solved, and the recognition accuracy and generalization ability are improved. , especially suitable for identifying diverse animal categories in complex scenes.
Patent Information
- Application Number
- CN202410633316.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-21
- Publication Date
- 2024-08-27
AI Technical Summary
Existing target detection technology is difficult to deploy in real-time in embedded devices, and due to insufficient training data or uneven sample distribution, it can easily lead to overfitting and high false detection and missed detection rates, especially in the face of deformation, occlusion and environment It is difficult to accurately identify targets in changing and complex scenes.
Using separate target detection models and feature extraction models, the target detection model is used to initially detect whether the target exists, and then the feature extraction model is used to determine the category. The generative adversarial network is used to generate simulated sample images to expand the standard feature vector library and improve the generalization of the model. ization ability.
Implemented a target recognition method that can be deployed lightweight on embedded devices, improving detection accuracy and real-time performance, reducing training difficulty and computing power requirements, and effectively improving recognition accuracy, especially when identifying diverse animal categories. recognition ability.
Smart Images

Figure CN118552977A
Abstract
Description
Technical Field
[0001] The present application relates to the field of image technology, and in particular to a target recognition method, a computer program product, a target recognition device, and a computer-readable storage medium. Background Art
[0002] Object detection is a research hotspot in the field of images. Combined with deep learning algorithms, it can accurately express and locate objects in input images, and has important applications in many fields.
[0003] Taking the application field of sighting equipment as an example, in actual scenes, the deformation, occlusion, observation angle, environmental changes and many other factors of the target object will cause the appearance characteristics of the target to change greatly, which will increase the difficulty of detection; on the other hand, the same type of targets will change in shape, posture and type, which will increase the difference within the same category, and there may be a small difference between different categories, all of which bring great challenges to target detection. In order to solve the detection and recognition of a large number of targets, deep learning methods require a large amount of image data with balanced labeled samples, which requires large computing resources and high computing power, and cannot be deployed in real time to embedded devices such as sighting equipment. Moreover, if the training data is insufficient, the distribution of various samples is uneven, or the model structure is complex, it may lead to overfitting risks, that is, the model performs well on the training set, but performs poorly on unseen data, which can easily lead to high false detection and missed detection rates in target detection. Summary of the invention
[0004] In order to solve the existing technical problems, the present application provides a target recognition method, a computer program product, a target recognition device and a computer-readable storage medium that are more lightweight and easy to deploy to various terminals and have higher target detection accuracy.
[0005] In a first aspect, a target recognition method is provided, comprising:
[0006] Obtain an image to be recognized;
[0007] Detecting the image to be identified by using a target detection model to determine whether there is a target in the image to be identified;
[0008] If there is a target in the image to be identified, extract features of the target using a feature extraction model to obtain a target feature vector of the target;
[0009] The target feature vector is compared with the standard feature vector in the feature vector library to determine the category of the target; wherein the categories of the target include human targets and animal type targets, and the standard feature vector is obtained by inputting human sample images including human targets and animal sample images of various animal type targets into the feature extraction model; the animal sample images include collected real animal sample images and simulated animal sample images generated by a generative adversarial network model with the real animal sample images as input.
[0010] In a second aspect, a computer program product is also provided, including a computer program, which, when executed by a processor, implements the target recognition method described in any embodiment of the present application.
[0011] In a third aspect, a target recognition device is provided, comprising a memory for storing a computer program; and a processor for executing the computer program to implement the target recognition method described in any embodiment of the present application.
[0012] In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the target recognition method described in any embodiment of the present application is implemented.
[0013] In the target recognition method provided in the above embodiment, the target recognition process is divided into two stages: target detection of whether a target exists through a target detection model, and target recognition of determining the target category through a feature extraction model. The target detection model and the feature extraction model are two separate models. For the target detection model, the model outputs only one classification result (i.e., whether a target exists). In this way, the difficulty of training data collection and model training is relatively low, and the detection accuracy is also easy to ensure. The trained model has a simple structure and low requirements for platform computing power, and can be more easily deployed in various terminals, such as aiming devices; and the feature extraction model is based on the result of the target detection model detecting the target. The model only needs to focus on the feature extraction capability of the determined target position, so that the real-time performance of target recognition is better, and it also helps to effectively improve the accuracy of target detection. The target recognition method is divided into two steps, first detecting the target, and then extracting the features of the target. The corresponding target detection model and feature extraction model used are two small models with low training requirements, which can meet the requirements of real-time deployment on terminals such as aiming devices.
[0014] In addition, for animal categories with a large number of categories, it is difficult to obtain balanced labeled samples for each category of animals. Using the generative adversarial network model to obtain simulated animal sample images to expand the standard feature vectors of various animal categories can effectively improve the generalization ability of the model and improve recognition accuracy.
[0015] In the above embodiments, the computer program product, the target recognition device and the computer-readable storage medium belong to the same concept as the corresponding target recognition method embodiments, and thus have the same technical effects as the target recognition method embodiments, which will not be described in detail herein. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 Schematic diagram of a flow chart of a target recognition method in one embodiment.
[0017] Figure 2 A schematic diagram of multiple real animal sample images in an example.
[0018] Figure 3 Generate an adversarial network model in an example based on Figure 2 The animal category elements of the real animal sample image shown are used to generate a schematic diagram of multiple simulated animal sample images.
[0019] Figure 4 Schematic diagram of a flow chart of a training method for generating an adversarial network model in one embodiment.
[0020] Figure 5 Schematic diagram of the principle of a training method for generating an adversarial network model in one embodiment.
[0021] Figure 6 Schematic diagram of the structure of a target recognition device in one embodiment.
[0022] Figure 7 Schematic diagram of the structure of a target recognition device in one embodiment. DETAILED DESCRIPTION
[0023] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0024] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.
[0025] In the following description, the expression "some embodiments" is involved, which describes a subset of all possible embodiments. It should be noted that "some embodiments" may be the same subset or different subsets of all possible embodiments, and may be combined with each other without conflict.
[0026] In the following description, the terms "first, second, third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first, second, third" can be interchanged with a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.
[0027] See also Figure 1 , a target recognition method provided in an embodiment of the present application, comprising the following steps:
[0028] S101, obtaining an image to be recognized.
[0029] The image to be identified may refer to an image acquired in real time by the target identification device for the current field of view during use, or may refer to an image acquired previously, or may refer to an image obtained from other terminals.
[0030] S103: Detect the image to be identified by using a target detection model to determine whether there is a target in the image to be identified.
[0031] Target refers to the object of interest in the image detection in the image to be identified. In the embodiment of the present application, the target is divided into an aiming target and a human target. For example, in a hunting scene, the aiming target mainly includes various animals in the image to be identified in the hunting scene. A human target refers to the full or partial imaging of any human body contained in the image to be identified.
[0032] The target detection model detects whether there is a target in the image to be identified, and outputs the detection result of whether there is a target, and if the target is detected in the image to be identified, the target position is output. As an optional example, when the target detection model detects that there is a target in the image to be identified, the target detection model outputs the position coordinate information corresponding to the target in the image to be identified.
[0033] S105: If there is a target in the image to be identified, extract features of the target using a feature extraction model to obtain a target feature vector of the target.
[0034] The feature extraction model extracts features of the position of the target in the image to be identified based on the output of the target detection model to obtain a target feature vector corresponding to the target. It can be understood that the target feature vector refers to feature extraction information of the imaging part of the target in the image to be identified.
[0035] S107, comparing the target feature vector with the standard feature vector in the feature vector library to determine the category of the target; wherein the category of the target includes human targets and animal type targets, and the standard feature vector is obtained by inputting human sample images including human targets and animal sample images of various animal type targets into the feature extraction model; the animal sample images include collected real animal sample images and simulated animal sample images generated by a generative adversarial network model using the real animal sample images as input.
[0036] The standard feature vector refers to the feature extraction information of the imaging images of various human targets and animal type targets. For example, the standard feature vector can be divided into standard human feature vectors and standard animal feature vectors. Each standard human feature vector corresponds to the feature extraction information of the imaging image of a human target with a certain specific posture, viewing angle, and occlusion degree; each standard animal feature vector corresponds to the feature extraction information of the imaging image of an animal type target with a certain specific posture, viewing angle, and occlusion degree of a certain animal type.
[0037] The feature vector library refers to a vector library containing standard feature vectors of various human targets and animal type targets. For the current image to be identified, the target detection model detects the existence of the target in the image and outputs the target position information. Then, the feature extraction model extracts the features of the imaging part of the target according to the target position information output by the target detection model to obtain the target feature vector. The target feature vector is compared with the standard feature vector in the feature vector library to determine whether the current target is a human or an animal type.
[0038] In view of the diversity of animal types and the richness of the scenes in which different animals are located, how to obtain sufficiently rich standard feature vectors of various animal types is a great challenge, and it is also an important factor that affects whether the target recognition method can better solve the category recognition of diverse different animal types when it is applied. For example, wild boars need data of various postures, such as walking, running, lying, and lying. Data of different body parts or different degrees of occlusion by trees, grass, etc. are required. Data of various forms of each posture from different perspectives such as the front and side are also required. If each animal type is taken into account, how to obtain sufficiently rich standard animal feature vectors to identify the category of the animal using the feature extraction model to extract the target feature vector is a difficult problem. In this embodiment, a generative adversarial network model is used to generate simulated animal sample images with real animal sample images as input. The generative adversarial network model can learn the animal category elements in different real animal sample images to generate simulated animal sample images of specific angles and specific postures that cannot be collected by certain animal types, so as to expand the target data of these animal types, which can effectively solve the category recognition problem of diverse different animal types. The acquisition of sufficiently rich standard animal feature vectors can effectively improve the generalization ability of the feature extraction model, thereby improving the recognition accuracy.
[0039] In the target recognition method provided in the above embodiment, the target recognition process is divided into two stages: target detection of whether a target exists through a target detection model, and target recognition of determining the target category through a feature extraction model. The target detection model and the feature extraction model are two separate models. For the target detection model, the model outputs only one classification result (i.e., whether a target exists). At this time, there is no need to realize the recognition of the target category. In this way, the difficulty of training data collection and model training is relatively low, and the detection accuracy is also easy to ensure. The trained model has a simple structure and low requirements on platform computing power. It can be more lightweight and easy to deploy to various terminals, such as aiming equipment; and the feature extraction model is based on target detection. The detection model detects the target and performs feature extraction on the result, so as to confirm the category of the current target according to the feature extraction result of the current target. The feature extraction model only needs to focus on the feature extraction capability of the determined target position, which is also conducive to reducing training requirements and achieving the purpose of being lighter and easier to deploy in the aiming device. The real-time performance of target recognition is better. The separate setting and functional combination of the target detection model and the feature extraction model can effectively improve the accuracy of target detection as a whole. The target recognition method is divided into two steps. First, the target is detected and then the feature is extracted. The corresponding target detection model and feature extraction model are two small models with low training requirements, which can meet the requirements of real-time deployment on terminals such as aiming devices.
[0040] In some embodiments, the standard feature vector includes a standard human feature vector, and step S107 includes:
[0041] The target feature vector is compared with the standard human feature vector, the distance between the target feature vector and each of the standard human feature vectors in the feature vector library is calculated, and whether the current target is a human target is determined based on the distance.
[0042] Optionally, the feature vector library includes standard human feature vectors of different postures, different viewing angles and different occlusion degrees; wherein each standard human feature vector corresponds to a human body sample of a specific posture, a specific viewing angle and different occlusion degrees.
[0043] Among them, comparing the target feature vector with the standard human feature vector in the feature vector library is equivalent to comparing the target feature vector with the standard human feature vectors of different postures, different viewing angles and different occlusion degrees in the feature vector library, calculating the distance between the target feature vector and each standard human feature vector, such as Euclidean distance or cosine similarity, and obtaining the confidence that the target is a human target. If the confidence is greater than the set threshold, the target is considered to be a human target and the human target is framed at the corresponding position. Otherwise, the target is considered to be a non-human target.
[0044] In the above embodiment, a special feature extraction model is used to extract the feature vector of the target and establish a feature vector library containing standard human feature vectors. The similarity of the feature vectors is judged by calculating the distance between the vectors, so that whether the target currently detected in the image to be identified is a human target. Taking the target recognition method provided in the embodiment of the present application as an example of the application of the aiming device of shooting equipment, for the current scene image of the current field of view collected in real time, the current scene image can be used as the image to be identified, the target currently aimed at by the shooting equipment can be detected and whether the target is a human target can be judged. If so, an alarm can be issued or the normal use of the aiming device can be restricted to remind the user of the shooting equipment that he cannot shoot at present, which can effectively avoid the situation of misshooting or harming others in some cases of insufficient illumination or unforeseen circumstances, thereby improving the safety of the use of civilian shooting equipment.
[0045] In a specific example, the feature extraction model uses a pre-trained Openpose feature extractor. A large-scale data set containing human images is collected to ensure the diversity and representativeness of the human image data, including different human postures, perspectives, occlusion levels, and environmental backgrounds. The human images are then preprocessed, such as noise removal, grayscale, normalization, and accurate bounding box annotation to form a specific target data set. The Openpose feature extractor is trained in a self-learning manner based on the specific target data set. During the training process, the output of the part before the last fully connected layer is used as a standard human feature vector. It can be understood that these standard human feature vectors have a fixed length and are highly abstract, and can effectively capture the structural information of the human body and its infrared visual features. Finally, these standard human feature vectors are stored for the purpose of establishing a feature vector library.
[0046] In some embodiments, the standard feature vector also includes a standard animal feature vector, and step 107 further includes:
[0047] The target feature vector is compared with the standard animal feature vector, the distance between the target feature vector and each standard animal feature vector in the feature vector library is calculated, and whether the current target is an animal target and the corresponding animal type are determined based on the distance.
[0048] Similar to the recognition of human targets, the target feature vector is compared with the standard animal feature vector in the feature vector library, which is equivalent to comparing the target feature vector with the standard animal feature vectors of different postures, different viewing angles and different occlusion degrees in the feature vector library, and calculating the distance between the target feature vector and each standard animal feature vector, such as Euclidean distance or cosine similarity, to obtain the confidence of which animal type the target is. If the confidence is greater than the set threshold, the target is considered to be the corresponding animal type target, and the animal type of the target at the corresponding position is output. Otherwise, the target is considered to be a non-animal target.
[0049] In the above embodiment, by extracting the feature vector of the target and establishing a feature vector library containing standard animal feature vectors, the distance between the vectors is calculated to judge the similarity of the feature vectors, so as to determine the corresponding animal type when the target is currently detected as an animal target.
[0050] In some embodiments, the target identification method further includes:
[0051] Acquire collected real animal sample images; wherein the real animal sample images include a first image containing a first animal category element and a second image containing a second animal category element; the animal category elements include scene, posture, viewing angle, and occlusion degree;
[0052] The trained generative adversarial network model is used to generate simulated animal sample images with the real animal sample images as input; the simulated animal sample images include a third image that is a combination of different first animal category elements and second animal category elements.
[0053] Animal category elements refer to elements that can affect and determine the identification of animal categories in an image. In this embodiment, in the image recognition process, the elements that affect and determine the identification of animal categories in an image include at least scene, posture, perspective, and degree of occlusion. The generative adversarial network model can learn different real animal sample images, such as animal category elements in the first image and the second image, and use the combination of animal category elements in different real animal sample images to generate simulated animal sample images of specific angles and specific postures that cannot be collected, so as to expand the target data of these animal types.
[0054] For ease of understanding, take the example that the animal category elements contained in the first image are the first scene, the first posture, the first perspective and the first occlusion degree; the animal category elements contained in the second image are the second scene, the second posture, the second perspective and the second occlusion degree. In this way, the animal category elements contained in the simulated animal sample images generated by the generative adversarial network model may be as follows: the first scene, the second posture, the first perspective and the first occlusion degree; the first scene, the second posture, the second perspective and the first occlusion degree; the first scene, the second posture, the second perspective and the second occlusion degree; the second scene, the first posture, the first perspective and the first occlusion degree, etc. Please refer to Figure 2 and Figure 3 In an optional example, taking the animal categories of deer and wild boar as examples, it is relatively difficult to collect real sample images of wild boars in various postures and scenes, while it is relatively easy to collect real sample images of deer in various postures and scenes. Figure 2 In the figure, No. 1, No. 2, No. 3, No. 5, No. 6 and No. 7 are real sample images of deer, and No. 4 and No. 8 are real sample images of wild boar. Figure 3 In the example, by combining the animal category elements in the real sample images No. 1 to No. 8 through the generative adversarial network model, we can get the simulated animal sample images of wild boars No. 9 to No. 12. Specifically, the simulated sample image of wild boar No. 9 contains the combination of animal category elements in No. 4 and No. 2; the simulated sample image of wild boar No. 10 contains the combination of animal category elements in No. 4 and No. 3; the simulated sample image of wild boar No. 11 contains the combination of animal category elements in No. 3, No. 6, and No. 8; the simulated sample image of wild boar No. 12 contains the combination of animal category elements in No. 1 and No. 8. It should be noted that Figure 2 and Figure 3The example is only to facilitate the principle of generating adversarial network models based on combining animal category elements of different real animal sample images to generate new simulated animal sample images. In fact, the combination of real sample images and corresponding simulated sample images is not limited to this.
[0055] In the above embodiment, a generative adversarial network model is used to generate new simulated animal sample images by combining animal category elements of different real animal sample images, so as to expand the standard animal feature vectors of certain animal types for which sufficiently rich sample images cannot be collected.
[0056] In some embodiments, see Figure 4 , the target recognition method further includes:
[0057] S201, constructing an initial generative adversarial network model, a first recognition model that shares a training set with the generative adversarial network model, and a second recognition model that uses simulated animal sample images output by the generative adversarial network model as training data;
[0058] S202, acquiring collected real animal sample images to form a training set;
[0059] The training set is input into the generative adversarial network model, the generator of the generative adversarial network model generates corresponding simulated animal sample images, and the discriminator judges the generated simulated animal sample images and their corresponding real animal sample images to iteratively optimize the network parameters of the generator according to the differences;
[0060] S203, the first recognition model uses the training set as input to perform target detection to obtain a first target recognition result;
[0061] S204, the second recognition model uses the training set and the simulated animal sample image generated by the generative adversarial network model as input to perform target detection to obtain a second target recognition result;
[0062] S205, iteratively optimizing network parameters of the generative adversarial network model according to the difference between the first target recognition result and the second target recognition result;
[0063] S206, until the prediction accuracy of the first target recognition result and the second target recognition result meets the preset conditions, and the generative adversarial network model meets the preset training termination conditions, the trained generative adversarial network model is obtained.
[0064] The generative adversarial network model is trained to obtain a trained generative adversarial network model, which is used to generate simulated animal sample images that meet the requirements. Figure 4 and Figure 5 , the generative adversarial network model (GAN network) includes a generator (G) and a discriminator (D), and the training process includes: S1, the original data set refers to the real animal sample images collected, and the original data set is divided into a training set (train) and a test set (val); S2, the train images are sent to the GAN network for training to obtain the G and D of the GAN; S3, at the same time, the train images are sent to the CNN network for training to obtain the first recognition model; S4, some noise points are randomly generated and input into the G trained in S2 to obtain several output simulated animal sample images (fake images); S5, the fake images obtained in S4 are combined with the train images to obtain a new training set that is expanded by adding fake images to the original data set; S6, the new training set is sent to the same CNN network as the first recognition model in S1 to train to obtain the second recognition model.
[0065] Among them, adding fake pictures generated by GAN to the training of the recognition model can effectively improve the generalization ability of the recognition model and thus improve the recognition accuracy. The val pictures can be input into the first recognition model and the second recognition model to verify the prediction accuracy of the two recognition models. The difference between the recognition accuracy of the fake pictures output by the trained CNN network by the second recognition model and the recognition accuracy of the first recognition model can meet the requirements of the preset conditions, so as to ensure that the quality of the fake pictures generated by the generative adversarial network model can meet the requirements. In the training process of the generative adversarial network model, the difference between the recognition results of the fake pictures and the recognition results of the real images by the second recognition model whose recognition accuracy meets the requirements can also act inversely on the training iteration of GAN to iteratively optimize its network parameters, so that the prediction accuracy of the first recognition model and the second recognition model can meet the preset conditions, and the generative adversarial network model also meets the preset training termination conditions, such as the number of iterations reaching a threshold or the loss function convergence, so as to obtain the trained generative adversarial network model. In the target recognition method, the trained generative adversarial network model mainly provides the feature extraction module with enough sample images of different animal categories, so as to extract sufficiently rich standard animal feature vectors of different animal categories, different scenes, different postures, different perspectives and different occlusion degrees, and expand the feature vector library.
[0066] In the above embodiment, a training method for a generative adversarial network model that can generate simulated animal sample images using real animal sample images as input is provided, so that more simulated animal sample images can be generated using the generative adversarial network model. These simulated animal sample images can be used for feature extraction by a feature extraction model to obtain sufficiently rich standard animal feature vectors, which can effectively solve the category recognition problem of diverse different animal types.
[0067] In some embodiments, the target identification method further includes:
[0068] Build an initial target detection model based on a convolutional neural network;
[0069] Acquire collected real general target sample images to form a general target training set, and train an initial target detection model using the general target training set to obtain the trained target detection model; wherein the target detection model is used to detect whether the real general target sample images contain targets and target positions;
[0070] Build an initial feature extraction model based on convolutional neural network;
[0071] The feature extraction model is trained by using the general target training set and the image data containing the target detection results output by the target detection model to obtain the trained feature extraction model; wherein the feature extraction model is used to extract the feature vector corresponding to the target position according to the target detection results containing the target and the target position output by the target detection model.
[0072] Among them, the target detection model is a general target detection model that detects whether there is a target in the image to be identified.
[0073] In one example, training a generic object detection model includes:
[0074] 1) Create a general target dataset
[0075] A large number of real-scene images of real hunting scenes are obtained through actual shooting and other methods, and the specific locations of the targets are marked in them, eventually forming data pairs such as image-annotation files. A large number of such data pairs constitute the general target dataset, which is randomly divided into training set and test set in a ratio of 8:2.
[0076] 2) Training the target detection model
[0077] Build a convolutional neural network model, train the model based on the training set data, and then verify the model detection accuracy on the test set. Repeat this process. When the model accuracy on the test set reaches 95%, it can be considered that a general target detection model with high credibility has been obtained.
[0078] The feature extraction model is to extract features of the imaging part of the target when the target detection model detects the target in the image to be identified.
[0079] In one example, training a feature extraction model includes:
[0080] 1) Collect sample images
[0081] Collect a large-scale dataset containing human images to ensure the diversity and representativeness of human image data, including different human postures, perspectives, occlusion levels, and environmental backgrounds. Then preprocess the human images, such as noise removal, grayscale, normalization, and accurate bounding box annotation, to facilitate subsequent model training. The real scene images collected for the general object detection model mentioned above can be used as sample images of animal types.
[0082] 2) Train and obtain standard feature vectors
[0083] The Openpose feature extractor designed specifically for human recognition is selected as the feature extraction model, and the model is trained by self-learning based on the aforementioned sample image data set. The trained feature extractor can be used for sample images, and the output of the part before the last fully connected layer is used as the standard feature vector corresponding to each target. These standard feature vectors have a fixed length and are highly abstract, which can effectively capture the structural information of the target. Finally, the standard feature vectors of each human target and animal target are stored to form a feature vector library. Each standard human feature vector corresponds to a human target sample with a specific posture, a specific perspective, and different degrees of occlusion. Each standard animal feature vector corresponds to an animal target sample with a specific posture, a specific perspective, and different degrees of occlusion of a specific animal category.
[0084] In the above embodiment, an improved target recognition method for detecting human targets based on deep learning is provided. By combining a general target detection model with a dedicated feature extraction model for extracting features of target parts, less sample data is required and the operation speed is faster than that of the known end-to-end deep learning method for directly learning human target features. The overfitting risk caused by insufficient training data, uneven distribution of various samples or complex model structure is avoided, that is, the model performs well on the training set but performs poorly on unseen data. The model has better generalization performance and is easier to be transplanted to small embedded devices such as sighting devices.
[0085] In contrast, existing target recognition methods mainly include traditional algorithms and end-to-end deep learning algorithms. Among them, the traditional algorithm first uses the Canny edge detection algorithm or morphological operations to preliminarily separate the potential human body area in the image, and then uses histogram analysis, wavelet transform and other methods to extract features from the potential area, further distinguish the effective features of the human body and other backgrounds, and obtain the target feature vector of the potential area. Finally, support vector machines, decision trees, random forests or Bayesian networks are used to determine whether there is a human target in the potential area based on the feature vector to achieve the detection of human targets. However, the traditional algorithm has poor robustness. When faced with complex environmental changes (such as changes in lighting, occlusion, changes in human posture, etc.), it is usually unable to respond flexibly, resulting in high false detection rates and missed detection rates; moreover, the traditional algorithm lacks a self-learning mechanism, cannot identify unseen samples, and has poor generalization performance.
[0086] Regarding the known end-to-end deep learning methods, the core is to use the powerful feature extraction and classification capabilities of convolutional neural networks. Since it is necessary to directly learn a large number of human target features with different postures, different perspectives and different occlusion levels, and a large number of animal target features of different animal categories, a large amount of sample image data with balanced samples of these labels is required. These methods rely heavily on manually designed features and labels, and it is difficult to automatically adapt to changes in target features in different scenarios. The computing resources required are large, and when faced with complex environmental changes (such as changes in lighting, occlusion, changes in target posture, etc.), it will lead to high false detection and missed detection rates. If the training data in the same scene is insufficient, the samples of various targets are unevenly distributed, or the model structure is complex, it may lead to overfitting risks, that is, the model performs well on the training set, but performs poorly on unseen data, and has poor generalization performance.
[0087] The target recognition method provided in the embodiment of the present application regards the two main tasks in target recognition: determining the target position and identifying the target category, as independent tasks of two separate models. The corresponding target detection model and feature extraction model used are two small models with low training requirements, which can meet the requirements of real-time deployment on small terminal devices.
[0088] On the other hand, the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the target recognition method described in any embodiment of the present application.
[0089] Among them, in the computer program product, the optional implementation form of the program module architecture of the computer program that implements each step of the target identification method can be a target identification device. Figure 6The target recognition device includes: an acquisition module 311, used to acquire an image to be recognized; a target detection model 312, used to detect the image to be recognized and determine whether there is a target in the image to be recognized; a feature extraction model 313, used to extract features of the target if there is a target in the image to be recognized, and obtain a target feature vector of the target; a category judgment module 314, used to compare the target feature vector with the standard feature vector in the feature vector library to determine the category of the target; wherein the category of the target includes human targets and animal type targets, and the standard feature vector is obtained by inputting a human sample image containing a human target and an animal sample image containing various animal type targets into the feature extraction model; the animal sample image includes a collected real animal sample image and a simulated animal sample image generated by a generative adversarial network model with the real animal sample image as input.
[0090] Optionally, the category judgment module 314 is used to compare the target feature vector with the standard human feature vector, calculate the distance between the target feature vector and each of the standard human feature vectors in the feature vector library, and judge whether the current target is a human target based on the distance.
[0091] Optionally, the feature vector library includes standard human feature vectors of different postures, different viewing angles and different occlusion degrees; wherein each standard human feature vector corresponds to a human body sample of a specific posture, a specific viewing angle and different occlusion degrees.
[0092] Optionally, the category judgment module 314 is used to compare the target feature vector with the standard animal feature vector, calculate the distance between the target feature vector and each standard animal feature vector in the feature vector library, and judge whether the current target is an animal target and the corresponding animal type based on the distance.
[0093] Optionally, the acquisition module 311 is used to acquire collected real animal sample images; wherein the real animal sample images include a first image containing first animal category elements and a second image containing second animal category elements; the animal category elements include scene, posture, viewing angle and degree of occlusion; through the trained generative adversarial network model, the real animal sample images are used as input to generate simulated animal sample images; the simulated animal sample images include a third image that is a combination of different first animal category elements and second animal category elements.
[0094] Optionally, it also includes a generative adversarial network training module, which is used to construct an initial generative adversarial network model, a first recognition model that shares a training set with the generative adversarial network model, and a second recognition model that uses the simulated animal sample images output by the generative adversarial network model as training data; obtain the collected real animal sample images to form a training set; input the training set into the generative adversarial network model, the generator of the generative adversarial network model generates corresponding simulated animal sample images, and the discriminator judges the generated simulated animal sample images and their corresponding real animal sample images to iteratively optimize the network parameters of the generator according to the differences; the first recognition model uses the training set as input to perform target detection to obtain a first target recognition result; the second recognition model uses the training set and the simulated animal sample images generated by the generative adversarial network model as training data as input to perform target detection to obtain a second target recognition result; according to the difference between the first target recognition result and the second target recognition result, the network parameters of the generative adversarial network model are iteratively optimized; until the prediction accuracy of the first target recognition result and the second target recognition result meets the preset conditions, and the generative adversarial network model meets the preset training termination conditions, the trained generative adversarial network model is obtained.
[0095] Optionally, it also includes a target detection network training module, which is used to construct an initial target detection model based on a convolutional neural network; acquires collected real general target sample images to form a general target training set, and trains the initial target detection model through the general target training set to obtain the trained target detection model; wherein the target detection model is used to detect whether the real general target sample image contains the target and the target position; and includes a feature extraction network training module, which is used to construct an initial feature extraction model based on a convolutional neural network; trains the feature extraction model through the general target training set and the image data containing the target detection results output by the target detection model to obtain the trained feature extraction model; wherein the feature extraction model is used to extract the feature vector corresponding to the target position according to the target detection result containing the target and the target position output by the target detection model.
[0096] It should be noted that: the target recognition device provided in the above embodiment only uses the division of the above program modules as an example to illustrate the process of performing target recognition. However, in actual applications, the above processing flow can be assigned to different program modules as needed, that is, the internal structure of the device can be divided into different program modules to complete all or part of the method steps described above. In addition, the target recognition device provided in the above embodiment and the target recognition method embodiment belong to the same concept, and the specific implementation process is detailed in the corresponding method embodiment, which will not be repeated here.
[0097] On the other hand, the present application also provides a target recognition device, see Figure 7 , is an optional hardware structure diagram of a target recognition device, the target recognition device includes a processor 211 and a memory 212 connected to the processor 211, and the memory 212 stores a computer program for implementing the target recognition method provided by any embodiment of the present application, so that when the corresponding computer program is executed by the processor, the steps of the target recognition method provided by any embodiment of the present application are implemented. The target recognition device loaded with the corresponding computer program has the same technical effect as the corresponding method embodiment, and to avoid repetition, it is not repeated here.
[0098] Optionally, an application example of the target recognition device may refer to an aiming device. In this case, the target recognition device further includes an image sensor and a display module, wherein the image sensor is used to capture the image to be recognized and send the image to be recognized to the processor and the display module; the display module is used to execute the display in the current aiming mode, such as displaying the target and target category recognized for the image to be recognized.
[0099] On the other hand, the embodiment of the present application also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the process of implementing the above-mentioned target recognition method embodiments can be achieved, and the same technical effect can be achieved. To avoid repetition, it is not repeated here. Among them, the computer-readable storage medium, such as a read-only memory (Read-Only Memor, referred to as ROM), a random access memory (Random Access Memory, referred to as RAM), a disk or an optical disk, etc.
[0100] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0101] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, computer, server, infrared thermal imager or network equipment, etc.) to execute the methods described in each embodiment of the present invention.
[0102] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A target recognition method, characterized in that: include: Obtain an image to be recognized; Detecting the image to be identified by using a target detection model to determine whether there is a target in the image to be identified; If there is a target in the image to be identified, extract features of the target using a feature extraction model to obtain a target feature vector of the target; The target feature vector is compared with the standard feature vector in the feature vector library to determine the category of the target; wherein the categories of the target include human targets and animal type targets, and the standard feature vector is obtained by inputting human sample images including human targets and animal sample images of various animal type targets into the feature extraction model; the animal sample images include collected real animal sample images and simulated animal sample images generated by a generative adversarial network model with the real animal sample images as input.
2. The target recognition method according to claim 1, characterized in that: The standard feature vector includes a standard human feature vector, and comparing the target feature vector with the standard feature vector in the feature vector library to determine the category of the target includes: The target feature vector is compared with the standard human feature vector, the distance between the target feature vector and each of the standard human feature vectors in the feature vector library is calculated, and whether the current target is a human target is determined based on the distance.
3. The target recognition method according to claim 2, characterized in that: The feature vector library includes standard human feature vectors of different postures, different viewing angles and different occlusion degrees; wherein each standard human feature vector corresponds to a human body sample of a specific posture, a specific viewing angle and different occlusion degrees.
4. The target recognition method according to claim 2, characterized in that: The standard feature vector also includes a standard animal feature vector, and comparing the target feature vector with the standard feature vector in the feature vector library to determine the category of the target includes: The target feature vector is compared with the standard animal feature vector, the distance between the target feature vector and each standard animal feature vector in the feature vector library is calculated, and whether the current target is an animal target and the corresponding animal type are determined based on the distance.
5. The target recognition method according to claim 1, characterized in that: Also includes: Acquire collected real animal sample images; wherein the real animal sample images include a first image containing a first animal category element and a second image containing a second animal category element; the animal category elements include scene, posture, viewing angle, and occlusion degree; The trained generative adversarial network model is used to generate simulated animal sample images with the real animal sample images as input; the simulated animal sample images include a third image that is a combination of different first animal category elements and second animal category elements.
6. The target recognition method according to claim 5, characterized in that: Also includes: Constructing an initial generative adversarial network model, a first recognition model that shares a training set with the generative adversarial network model, and a second recognition model that uses simulated animal sample images output by the generative adversarial network model as training data; Acquire collected real animal sample images to form a training set; The training set is input into the generative adversarial network model, the generator of the generative adversarial network model generates corresponding simulated animal sample images, and the discriminator judges the generated simulated animal sample images and their corresponding real animal sample images to iteratively optimize the network parameters of the generator according to the differences; The first recognition model uses the training set as input to perform target detection to obtain a first target recognition result; The second recognition model uses the training set and the simulated animal sample image generated by the generative adversarial network model as inputs to perform target detection to obtain a second target recognition result; Iteratively optimizing network parameters of the generative adversarial network model according to a difference between the first target recognition result and the second target recognition result; Until the prediction accuracy of the first target recognition result and the second target recognition result meets the preset conditions, and the generative adversarial network model meets the preset training termination conditions, the trained generative adversarial network model is obtained.
7. The target recognition method according to claim 1, characterized in that: Also includes: Build an initial target detection model based on a convolutional neural network; Acquire collected real general target sample images to form a general target training set, and train an initial target detection model using the general target training set to obtain the trained target detection model; wherein the target detection model is used to detect whether the real general target sample images contain targets and target positions; Build an initial feature extraction model based on convolutional neural network; The feature extraction model is trained by using the general target training set and the image data containing the target detection results output by the target detection model to obtain the trained feature extraction model; wherein the feature extraction model is used to extract the feature vector corresponding to the target position according to the target detection results containing the target and the target position output by the target detection model.
8. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the target recognition method according to any one of claims 1 to 7 is implemented.
9. A target recognition device, characterized in that: include: Memory, used to store computer programs; A processor, configured to execute the computer program to implement the target recognition method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the target recognition method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Biological feature image recognition method and device, electronic equipment and readable storage medium
CN112396005A
Moving target detection method based on frame difference method and twin network and application thereof
CN117809210A
