Method, device and equipment for detecting target in scene and readable storage medium

By calculating the distance between samples and feature vectors and using a semantic segmentation model, the challenge of evaluating the classification capabilities of neural networks in medical image reading and image target detection was solved. This enabled efficient target detection and crowd density analysis, improving the efficiency of data utilization in public safety and business planning.

CN116433968BActive Publication Date: 2026-04-17PING AN TECH (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
PING AN TECH (SHENZHEN) CO LTD
Filing Date
2023-03-21
Publication Date
2026-04-17

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively measure and evaluate the classification capabilities of neural network models in medical image reading and image target detection, especially in crowd density analysis and public safety scenarios, where efficient target detection methods are lacking.

Method used

By acquiring a sample set, calculating the distance between the sample and the feature vector, selecting the sample with the smallest feature vector distance, calculating the classification probability, using a semantic segmentation model for segmentation, obtaining segmentation features, and training a neural network to construct a loss function, the final scene target is obtained.

Benefits of technology

It enables efficient target detection in complex scenarios, improves the accuracy of image recognition and text information classification, is suitable for security authentication of face recognition and text information, and enhances the data utilization capabilities for public safety and business planning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116433968B_ABST
    Figure CN116433968B_ABST
Patent Text Reader

Abstract

The present application relates to the technical field of artificial intelligence, and especially relates to a scene target detection method, device and equipment and readable storage medium, which is used for case data extraction in the medical field and detects scene targets through a neural network during medical image reading, wherein the method comprises the following steps: obtaining a sample set, calculating the distance between each sample in the sample set and each feature vector in a feature vector set to obtain a plurality of feature vector distances; selecting the minimum feature vector distance from the plurality of feature vector distances; calculating a classification probability according to the minimum feature vector distance; performing semantic segmentation on each sample based on the classification probability by using a semantic segmentation model to obtain a plurality of segmentation features, wherein the semantic segmentation model is obtained by training a neural network to be trained; and obtaining scene targets corresponding to the plurality of samples according to the plurality of segmentation features.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of artificial intelligence technology, and in particular to a method, apparatus and computer device for detecting targets in a scene. Background Technology

[0002] Currently, semantic segmentation, object detection, and other methods are used to measure and evaluate the uncertainty of neural network model classification capabilities when extracting medical case data and reading medical images. Many fields require finding targets in images or scenes, and with the rapid development of image object detection technology, it is gradually being applied to the field of people counting. Finding target individuals in image scenes has value in many scenarios. For example, in public safety, excessive crowds can easily lead to stampedes and other accidents; when crowd density reaches a certain level, the number of people can be controlled. In urban or commercial planning, analyzing pedestrian traffic in areas of interest allows for efficient planning of commercial layouts. Of course, if the location of each person in the area can be determined, more detailed crowd density information can be utilized. Summary of the Invention

[0003] The main objective of this application is to provide a method, apparatus, device, and readable storage medium for detecting targets in a scene, aiming to solve the technical problem of how to detect targets in a scene.

[0004] To achieve the aforementioned objectives, this application proposes a method for detecting targets in a scene, the method comprising:

[0005] Obtain a sample set, calculate the distance between each sample in the sample set and each feature vector in the feature vector set, and obtain multiple feature vector distances;

[0006] The minimum feature vector distance is selected from the plurality of feature vector distances;

[0007] Calculate the classification probability based on the minimum feature vector distance;

[0008] Based on the classification probability, a semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features. The semantic segmentation model is obtained by training a neural network to be trained.

[0009] The scene target corresponding to the multiple samples is obtained based on the multiple segmentation features.

[0010] Furthermore, training the neural network to be trained includes:

[0011] via i and Construct the first loss function;

[0012] via i and Construct a second loss function;

[0013] The first loss function and the second loss function are combined to obtain the final loss function;

[0014] The neural network to be trained is trained based on the final loss function;

[0015] Where i is the sample. For the target classification type, The index of the target subset.

[0016] Further, before the step of obtaining the sample set and calculating the distance between each sample in the sample set and each feature vector in the feature vector set to obtain multiple feature vector distances, the following steps are included:

[0017] Calculate the cosine similarity between the sample and each prototype subset;

[0018] Select the minimum cosine similarity from all the cosine similarities;

[0019] Use the subset index of the prototype subset corresponding to the minimum cosine similarity as the target subset index;

[0020] The classification type of the prototype subset corresponding to the minimum cosine similarity is taken as the target classification type.

[0021] Furthermore, the semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features, including:

[0022] Each sample and its classification probability are input into the region segmentation layer of the semantic segmentation model to perform region segmentation, resulting in multiple sample regions.

[0023] Each sample region is input into the feature segmentation layer of the semantic segmentation model to extract segmentation features for each sample region.

[0024] Furthermore, the classification probability is calculated using the following formula:

[0025]

[0026] Where P is the classification probability, S is the minimum feature vector distance, i is the sample index, and c is the sample category. Let be the probability that the i-th sample belongs to class C, exp be the exponential function, and C be the total number of classes.

[0027] Furthermore, the step of processing multiple segmentation features to obtain the scene target includes:

[0028] The obtained segmentation features are filtered to remove images with image quality problems, thereby obtaining the scene target corresponding to the multiple samples.

[0029] Further, the step of filtering based on the obtained multiple segmentation features includes:

[0030] The multiple segmentation features are used to identify elements and element relationships;

[0031] The identified elements and their relationships are then filtered to obtain images and scene targets with image quality issues.

[0032] This application embodiment also provides a target detection device in a scene, including:

[0033] The acquisition module is used to acquire a sample set, calculate the distance between each sample in the sample set and each feature vector in the feature vector set, and obtain multiple feature vector distances.

[0034] The filtering module is used to filter out the minimum feature vector distance from a plurality of feature vector distances;

[0035] The calculation module is used to calculate the classification probability based on the minimum feature vector distance;

[0036] The segmentation module is used to perform semantic segmentation on each of the samples based on the classification probability using a semantic segmentation model to obtain multiple segmentation features. The semantic segmentation model is obtained by training a neural network to be trained.

[0037] The processing module is used to obtain scene targets corresponding to the multiple samples based on the multiple segmentation features.

[0038] This application also provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the methods described above.

[0039] This application also provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.

[0040] The target detection method, apparatus, device, and readable storage medium in this application acquire a sample set composed of multiple samples. Preliminary processing is performed to calculate the distance between each sample in the sample set and the feature vector. The minimum feature vector distance is selected from the multiple feature vectors, where the minimum feature vector distance represents the cosine distance of the cosine similarity. Cosine distance calculation is mainly used in big data fields such as image recognition and text information classification. The test sample can be a test face image, and the reference sample is a target reference face image. Semantic segmentation is performed based on the classification probability using a semantic segmentation model to obtain multiple segmentation features. These semantic features can be obtained by training a neural network. The goal of semantic segmentation is to segment the input sample (i.e., the pair) based on semantic information and predict the semantic category of each pixel from a given label set. Processing is performed based on multiple segmentation features, where each feature of the sample has already been labeled. After obtaining the segmentation features based on the above semantic segmentation, filtering is required to remove some problematic samples, resulting in usable scene targets. Attached Figure Description

[0041] Figure 1 This is a schematic flowchart of a target detection method in a scenario according to an embodiment of this application;

[0042] Figure 2 This is a flowchart illustrating another embodiment of the target detection method in a scenario according to one embodiment of this application.

[0043] Figure 3 This is a schematic block diagram of the target detection device in a scenario according to an embodiment of this application;

[0044] Figure 4 This is a schematic block diagram of the structure of a computer device according to an embodiment of this application.

[0045] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0046] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0047] Reference Figure 1 This application provides a method for detecting a target in a scene, the method comprising:

[0048] S1. Obtain the sample set, calculate the distance between each sample in the sample set and each feature vector in the feature vector set, and obtain multiple feature vector distances;

[0049] S2. Select the minimum feature vector distance from the multiple feature vector distances;

[0050] S3. Calculate the classification probability based on the minimum feature vector distance;

[0051] S4. Based on the classification probability, a semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features. The semantic segmentation model is obtained by training a neural network to be trained.

[0052] S5. Obtain the scene target corresponding to the multiple samples based on the multiple segmentation features.

[0053] As described in step S1 above, a sample set composed of multiple samples is obtained. The distance between each sample in the sample set and the feature vector is calculated. The sample can be obtained through a surveillance camera. Ensuring the clarity of the surveillance camera used to obtain the samples ensures the clarity of the samples and the completeness of the sample set composed of each sample. Since the brightness conditions during the day need to be considered when obtaining samples, if the brightness conditions are not high, it will directly affect the quality of the samples obtained. The samples are images or pictures. By comparing the obtained samples with the feature vectors, the distance between the vectors can be calculated to obtain the distance between multiple feature vectors. Calculating the feature vector distance for multiple samples can eliminate the influence of the maximum features in the samples on the sample processing, making the features of the samples more uniform, and also allowing the minimum features in the samples to be expressed.

[0054] As described in steps S2-S3 above, the minimum feature vector distance is selected from multiple feature vectors. This minimum feature vector distance represents the cosine distance of the cosine similarity. Cosine distance calculation is mainly used in big data fields such as image recognition and text classification. The test sample can be a face image to be tested, and the control sample can be a target control face image. For example, in mobile phone security authentication, face recognition is used to improve authentication security, and the similarity of images depends on the cosine distance between the two samples. Alternatively, the test sample can be text information to be tested, and the control sample can be target control text information. The classification probability is then calculated based on the minimum feature vector distance, where the classification method involves adding labels to calculate the classification probability.

[0055] As described in step S4 above, based on the calculated classification probabilities, a semantic segmentation model is used to perform semantic segmentation on the classification probabilities, thereby obtaining multiple segmentation features. The semantic segmentation features can be obtained by training a neural network. The goal of semantic segmentation is to segment the input sample (image) based on semantic information and predict the semantic category of each pixel from a given label set. With the increasing intelligence of modern life, more and more applications require inferring relevant semantic information from images for subsequent processing, such as augmented reality, autonomous driving, and video surveillance. Semantic segmentation achieves fine-grained reasoning by intensively predicting and inferring labels for each pixel, thus labeling each pixel with its closed category.

[0056] As described in step S5 above, the process is performed based on multiple segmentation features. Each feature of the sample has been labeled in the segmentation features. After obtaining the segmentation features based on the semantic segmentation described above, filtering is required. Through filtering, some samples, i.e., samples with problems (images), can be filtered out, so that usable scene targets are obtained.

[0057] In one embodiment, a trained neural network is obtained by training the neural network to be trained. The trained neural network can be backpropagated by calculating the loss function value to update the parameters of the neural network to be trained. The updated network parameters include the learning rate and weight matrix of the graph neural network to be trained. The process of training the graph neural network to be trained includes multiple iterations. The greater the difference between the final loss function values ​​calculated in two adjacent iterations, the faster the network parameters of the graph neural network to be trained are updated.

[0058] As described above, a sample set consisting of multiple samples is obtained. Preliminary processing is performed to calculate the distance between each sample in the sample set and the feature vector. The minimum feature vector distance is selected from the multiple feature vectors. This minimum feature vector distance represents the cosine distance of the cosine similarity. Cosine distance calculation is mainly used in big data fields such as image recognition and text information classification. The test sample can be a test face image, and the reference sample is a target reference face image. Semantic segmentation is performed based on the classification probability using a semantic segmentation model, resulting in multiple segmentation features. Semantic segmentation features can be obtained by training a neural network. The goal of semantic segmentation is to segment the input sample (i.e., the pair) based on semantic information and predict the semantic category of each pixel from a given label set. Multiple segmentation features are processed, where each feature of the sample has already been labeled. After obtaining the segmentation features based on the semantic segmentation described above, filtering is required. This filtering process removes problematic samples, resulting in usable scene targets.

[0059] It is worth mentioning that with the development of medical informatization and the massive increase in clinical information data, knowledge graphs are playing an increasingly important role in the medical field. The medical field is highly specialized, possessing a wealth of high-quality medical concept resources and many specialized subfields. By employing scene-based target detection methods, targets in disease image knowledge graphs can be detected, thereby improving the development of medical informatization.

[0060] In one embodiment, training the neural network to be trained includes:

[0061] S41, via i and Construct the first loss function;

[0062] S42, via i and Construct a second loss function;

[0063] S43. Combine the first loss function and the second loss function to obtain the final loss function;

[0064] S44. Train the neural network to be trained according to the final loss function.

[0065] As described in the steps above, via i and In constructing the first loss function, i represents a sample, or an image formed by pixels, and the loss function is constructed by i and... In constructing the second loss function, i represents a sample, or the image formed by pixels. The index of the target subset.

[0066] In this embodiment, the final loss function is obtained by processing the constructed loss function. Since the loss function can be trained, a trained neural network is obtained by training the neural network to be trained. The trained neural network can be backpropagated by calculating the loss function value to update the parameters of the neural network to be trained. The updated network parameters include the learning rate and weight matrix of the neural network to be trained. The process of training the neural network to be trained includes multiple iterations. The larger the difference between the final loss function values ​​calculated in two adjacent iterations, the faster the network parameters of the neural network to be trained are updated. Thus, the neural network to be trained is trained by the final loss function to form a trained loss function, completing one iteration. Finally, the model is repeatedly trained by a determined number of iterations to obtain the optimal neural network model.

[0067] Reference Figure 2 In one embodiment, before the step of obtaining a sample set and calculating the distance between each sample in the sample set and each feature vector in the feature vector set to obtain multiple feature vector distances, the method includes:

[0068] S11. Calculate the cosine similarity between the sample and each prototype subset;

[0069] S12. Select the minimum cosine similarity from all the cosine similarities;

[0070] S13. Use the subset number of the prototype subset corresponding to the minimum cosine similarity as the target subset number;

[0071] S14. The classification type of the prototype subset corresponding to the minimum cosine similarity is taken as the target classification type.

[0072] As described in step S11 above, the prototype subsets can be classified and identified by calculating the similarity of each prototype subset of the samples, thereby achieving effective classification of the samples. The key to applying the cosine similarity algorithm is to calculate the cosine value of the angle between the inner product space of the vectors representing each image feature, thereby measuring the similarity between images. There are two standards for measuring similarity:

[0073] One approach is to set a similarity threshold, with images within this threshold belonging to the same category. This criterion can classify images into multiple types; for example, skyscrapers can be classified as both cityscapes and office building landscapes. Another approach is to select the image whose cosine similarity to the sample vector is closest to 1 as the image of that category. This criterion can only classify images into one category.

[0074] As described in step S12 above, selecting the minimum cosine similarity among all cosine similarities means selecting the class with the smallest cosine value of the inner product space of the vectors of each image feature in the cosine similarity. The terminal sets a predetermined threshold and selects the class with the smallest cosine value of the inner product space according to the preset range. The class with the smallest cosine value is then filtered to obtain the required sample class.

[0075] As described in steps S13-S14 above, the similarity between images is measured by calculating the cosine of the inner product space of the vectors representing each image feature. A lower similarity indicates a higher similarity. The subset index of the prototype subset corresponding to the minimum cosine similarity obtained through filtering is used as the target subset index; and the classification type corresponding to the minimum cosine similarity obtained through filtering is used as the target classification type. Furthermore, the target subset index can be labeled as... The target classification type is labeled as .

[0076] In one embodiment, the method via i and The steps for constructing the first loss function include:

[0077] The specific formula for the first loss function is as follows:

[0078]

[0079] in, Let i be the target classification type, and i be the sample.

[0080] As mentioned above, by solving the first loss function ,according to The target classification type and the obtained samples are used to determine the classification type. This pushes sample i closer to the category corresponding to the prototype. exp refers to the exponential function with the natural constant e as its base in advanced mathematics. This refers to the distance between feature vectors. This refers to the feature vector distance that is closest to the original text.

[0081] In one specific embodiment, the method via i and The steps to construct the second loss function include:

[0082] The specific formula for the second loss function is as follows:

[0083]

[0084] Where i is the sample, and i and The target subset index is used, and all are obtained through... 2. Formed after regularization.

[0085] As mentioned above, the second loss function The sample can be power T and the target subset index can be used. The product of the samples, minus the T-th power of the sample number and the target subset index, is then calculated. The result of the product is raised to the power of square, thus obtaining the second loss function, based on the calculated first loss function and the second loss function.

[0086] In one embodiment, the semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features, including:

[0087] Each sample and its classification probability are input into the region segmentation layer of the semantic segmentation model to perform region segmentation, resulting in multiple sample regions.

[0088] Each sample region is input into the feature segmentation layer of the semantic segmentation model to extract segmentation features for each sample region.

[0089] As described in the steps above, a semantic segmentation model is used to perform semantic segmentation on each sample. The segmentation method can be to segment the masked samples at the pixel level to obtain sample regions. Each sample region is a multiple partitioned region in the sample. For example, the human image and the background are divided into different regions. After segmentation, the human image can be segmented. Each sample region is then input into the semantic segmentation model for feature segmentation, and the segmentation features of each sample region are extracted.

[0090] In one embodiment, the classification probability is calculated using the following formula:

[0091]

[0092] Where P is the classification probability, S is the minimum feature vector distance, i is the sample index, and c is the sample category. Let be the probability that the i-th sample belongs to class C, exp be the exponential function, and C be the total number of classes.

[0093] In one embodiment, the step of processing multiple segmentation features to obtain the scene target includes:

[0094] S51. Filter the obtained segmentation features to remove images with image quality problems and obtain the scene target corresponding to the multiple samples.

[0095] As described above, by filtering multiple segmentation features and selecting images with quality issues, extraction can be performed based on the image's inherent features or through a feature classifier. Filtering out the selected images yields the scene target, i.e., the feature points to be extracted from the image. For example, extracting a person holding a phone from an image, the segmentation features may have already extracted the person holding the phone. However, some extracted images may have pixel blurring or quality issues due to insufficient brightness adaptation or incomplete neural network iteration. Therefore, filtering out problematic images yields the final scene target. It's worth noting that segmentation features separate multiple features by dividing the image (sample) pixels. For example, the entire image can be divided into many small regions, which can be categorized into three types: objects and background only, objects only, and background only. Each small region is segmented using segmentation features. Filtering these segmented features allows for identification, determining if they have quality issues, and filtering out images with quality problems yields the scene target.

[0096] In one embodiment, the step of filtering based on the obtained plurality of segmentation features includes:

[0097] S511. Identify elements and element relationships among the multiple segmentation features;

[0098] S512. The identified elements and element relationships are filtered to obtain images and scene targets with image quality problems.

[0099] As described above, the terminal identifies elements and relationships among multiple segmentation features, processes the identified elements and relationships, and tracks and adjusts the relationships to preprocess each segmentation feature. The preprocessed elements and relationships are then filtered to obtain images and scene targets with image quality problems. Based on the extracted images with quality problems, the scene targets are finally obtained.

[0100] In one feasible embodiment, if the extracted scene target is a person, since the graphic of the human body surface includes the person and the background, and the image of the human body includes curved surfaces, it is necessary to select and lock the target, and then extract features from the selected and locked target. For example, for the human head, it is necessary to identify the corresponding curved surface features of the human head. This can be done by first extracting the contour surface of the ear by dividing it into two parts, and then dividing it according to the curved contour of the nose. Therefore, it is necessary to identify the curved surface. After identification, partial features are selected and locked using curves. After identification, partial features are extracted using curves. After feature extraction, multiple segmented features are obtained based on feature segmentation, and then filtered.

[0101] The target detection method in this application acquires a sample set composed of multiple samples. Preliminary processing calculates the distance between each sample in the sample set and its feature vector. The method then selects the minimum feature vector distance from these vectors, where the minimum feature vector distance represents the cosine distance of the cosine similarity. Cosine distance calculation is primarily used in big data fields such as image recognition and text classification. The test sample can be a test face image, and the reference sample is a target reference face image. Semantic segmentation is performed based on the classification probability using a semantic segmentation model, resulting in multiple segmentation features. These semantic features can be obtained by training a neural network. The goal of semantic segmentation is to segment the input sample (i.e., the pair) based on semantic information and predict the semantic category of each pixel from a given label set. Processing is performed based on these multiple segmentation features, where each feature of the sample has already been labeled. After obtaining the segmentation features from the semantic segmentation, filtering is required to remove problematic samples, resulting in usable scene targets.

[0102] Reference Figure 3 This application also provides a target detection device in a scene, comprising:

[0103] The acquisition module is used to acquire a sample set, calculate the distance between each sample in the sample set and each feature vector in the feature vector set, and obtain multiple feature vector distances.

[0104] The filtering module is used to filter out the minimum feature vector distance from a plurality of feature vector distances;

[0105] The calculation module is used to calculate the classification probability based on the minimum feature vector distance;

[0106] The segmentation module is used to perform semantic segmentation on each of the samples based on the classification probability using a semantic segmentation model to obtain multiple segmentation features. The semantic segmentation model is obtained by training a neural network to be trained.

[0107] The processing module is used to obtain scene targets corresponding to the multiple samples based on the multiple segmentation features.

[0108] In one embodiment, the segmentation module includes:

[0109] The first construction unit, used to connect i and Construct the first loss function;

[0110] The second construction unit is used to connect i and Construct a second loss function;

[0111] The combined unit is used to combine the first loss function and the second loss function to obtain the final loss function.

[0112] A training unit is used to train the neural network to be trained based on the final loss function.

[0113] In one embodiment, the acquisition module includes:

[0114] The computational unit is used to calculate the cosine similarity between the sample and each prototype subset;

[0115] A filtering unit is used to filter out the minimum cosine similarity from all the said cosine similarities;

[0116] A sequence number generation unit is used to take the subset number of the prototype subset corresponding to the minimum cosine similarity as the target subset number.

[0117] A classification unit is generated to take the classification type of the prototype subset corresponding to the minimum cosine similarity as the target classification type.

[0118] In one embodiment, the processing module includes:

[0119] The filtering unit is used to filter the obtained multiple segmentation features, and filter out images with image quality problems to obtain the scene target corresponding to the multiple samples.

[0120] In one embodiment, the filtering unit includes:

[0121] A relationship processing subunit is used to identify elements and element relationships among the multiple segmentation features;

[0122] The element filtering subunit is used to filter the identified elements and element relationships to obtain images and scene targets with image quality problems.

[0123] As described above, it is understood that each component of the target detection device in the scenario proposed in this application can realize the function of any of the target detection methods in the scenario described above, and the specific structure will not be described in detail.

[0124] Reference Figure 4 This application also provides a computer device, which may be a server, and its internal structure may be as follows: Figure 4 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The database stores data such as monitoring data. The network interface is used for communication with external terminals via a network connection. When the computer program is executed by the processor, it implements a method for detecting targets in a scene.

[0125] The processor described above executes the target detection method in the above scenario, including:

[0126] Obtain a sample set, calculate the distance between each sample in the sample set and each feature vector in the feature vector set, and obtain multiple feature vector distances;

[0127] The minimum feature vector distance is selected from the plurality of feature vector distances;

[0128] Calculate the classification probability based on the minimum feature vector distance;

[0129] Based on the classification probability, a semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features. The semantic segmentation model is obtained by training a neural network to be trained.

[0130] The scene target corresponding to the multiple samples is obtained based on the multiple segmentation features.

[0131] The target detection method in the above scenario acquires a sample set composed of multiple samples. Preliminary processing calculates the distance between each sample in the sample set and its feature vector. The method then selects the minimum feature vector distance from these vectors, where the minimum feature vector distance represents the cosine distance of the cosine similarity. Cosine distance calculation is primarily used in big data fields such as image recognition and text classification. The test sample can be a test face image, and the reference sample is a target reference face image. Semantic segmentation is performed based on the classification probability using a semantic segmentation model, resulting in multiple segmentation features. These semantic features can be obtained by training a neural network. The goal of semantic segmentation is to segment the input sample (i.e., the pair) based on semantic information and predict the semantic category of each pixel from a given label set. Processing is performed based on these multiple segmentation features, where each feature of the sample has already been labeled. After obtaining the segmentation features from the semantic segmentation, filtering is required to remove problematic samples, resulting in usable scene targets.

[0132] In one embodiment, training the neural network to be trained includes:

[0133] via i and Construct the first loss function;

[0134] via i and Construct a second loss function;

[0135] The first loss function and the second loss function are combined to obtain the final loss function;

[0136] The neural network to be trained is trained based on the final loss function;

[0137] Where i is the sample. For the target classification type, The index of the target subset.

[0138] In one embodiment, before the steps of obtaining the sample set, calculating the distance between each sample in the sample set and each feature vector in the feature vector set, and obtaining multiple feature vector distances, the method includes:

[0139] Calculate the cosine similarity between the sample and each prototype subset;

[0140] Select the minimum cosine similarity from all the cosine similarities;

[0141] Use the subset index of the prototype subset corresponding to the minimum cosine similarity as the target subset index;

[0142] The classification type of the prototype subset corresponding to the minimum cosine similarity is taken as the target classification type.

[0143] In one embodiment, the semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features, including:

[0144] Each sample and its classification probability are input into the region segmentation layer of the semantic segmentation model to perform region segmentation, resulting in multiple sample regions.

[0145] Each sample region is input into the feature segmentation layer of the semantic segmentation model to extract the segmentation features of each sample region.

[0146] In one embodiment, the classification probability is calculated using the following formula:

[0147]

[0148] Where P is the classification probability, S is the minimum feature vector distance, i is the sample index, and c is the sample category. Let be the probability that the i-th sample belongs to class C, exp be the exponential function, and C be the total number of classes.

[0149] In one embodiment, the step of processing multiple segmentation features to obtain the scene target includes:

[0150] The obtained segmentation features are filtered to remove images with image quality problems, thereby obtaining the scene target corresponding to the multiple samples.

[0151] In one embodiment, the step of filtering based on the obtained plurality of segmentation features includes:

[0152] The multiple segmentation features are used to identify elements and element relationships;

[0153] The identified elements and their relationships are then filtered to obtain images and scene targets with image quality issues.

[0154] One embodiment of this application also provides a computer-readable storage medium storing a computer program thereon. When executed by a processor, the computer program implements a method for detecting a target in a scene, including the following steps:

[0155] Obtain a sample set, calculate the distance between each sample in the sample set and each feature vector in the feature vector set, and obtain multiple feature vector distances;

[0156] The minimum feature vector distance is selected from the plurality of feature vector distances;

[0157] Calculate the classification probability based on the minimum feature vector distance;

[0158] Based on the classification probability, a semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features. The semantic segmentation model is obtained by training a neural network to be trained.

[0159] The scene target corresponding to the multiple samples is obtained based on the multiple segmentation features.

[0160] The target detection method in the above scenario acquires a sample set composed of multiple samples. Preliminary processing calculates the distance between each sample in the sample set and its feature vector. The method then selects the minimum feature vector distance from these vectors, where the minimum feature vector distance represents the cosine distance of the cosine similarity. Cosine distance calculation is primarily used in big data fields such as image recognition and text classification. The test sample can be a test face image, and the reference sample is a target reference face image. Semantic segmentation is performed based on the classification probability using a semantic segmentation model, resulting in multiple segmentation features. These semantic features can be obtained by training a neural network. The goal of semantic segmentation is to segment the input sample (i.e., the pair) based on semantic information and predict the semantic category of each pixel from a given label set. Processing is performed based on these multiple segmentation features, where each feature of the sample has already been labeled. After obtaining the segmentation features from the semantic segmentation, filtering is required to remove problematic samples, resulting in usable scene targets.

[0161] In one embodiment, training the neural network to be trained includes:

[0162] via i and Construct the first loss function;

[0163] via i and Construct a second loss function;

[0164] The first loss function and the second loss function are combined to obtain the final loss function;

[0165] The neural network to be trained is trained based on the final loss function;

[0166] Where i is the sample. For the target classification type, The index of the target subset.

[0167] In one embodiment, before the steps of obtaining the sample set, calculating the distance between each sample in the sample set and each feature vector in the feature vector set, and obtaining multiple feature vector distances, the method includes:

[0168] Calculate the cosine similarity between the sample and each prototype subset;

[0169] Select the minimum cosine similarity from all the cosine similarities;

[0170] Use the subset index of the prototype subset corresponding to the minimum cosine similarity as the target subset index;

[0171] The classification type of the prototype subset corresponding to the minimum cosine similarity is taken as the target classification type.

[0172] In one embodiment, the semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features, including:

[0173] Each sample and its classification probability are input into the region segmentation layer of the semantic segmentation model to perform region segmentation, resulting in multiple sample regions.

[0174] Each sample region is input into the feature segmentation layer of the semantic segmentation model to extract the segmentation features of each sample region.

[0175] In one embodiment, the classification probability is calculated using the following formula:

[0176]

[0177] Where P is the classification probability, S is the minimum feature vector distance, i is the sample index, and c is the sample category. Let be the probability that the i-th sample belongs to class C, exp be the exponential function, and C be the total number of classes.

[0178] In one embodiment, the step of processing multiple segmentation features to obtain the scene target includes:

[0179] The obtained segmentation features are filtered to remove images with image quality problems, thereby obtaining the scene target corresponding to the multiple samples.

[0180] In one embodiment, the step of filtering based on the obtained plurality of segmentation features includes:

[0181] The multiple segmentation features are used to identify elements and element relationships;

[0182] The identified elements and their relationships are then filtered to obtain images and scene targets with image quality issues.

[0183] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium. When executed, the computer program can include the processes of the embodiments of the above methods. Any references to memory, storage, databases, or other media used in this application and in the embodiments can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual-speed SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

[0184] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, apparatus, article, or method. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, apparatus, article, or method that includes that element.

[0185] The above description is only a preferred embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural changes made based on the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.

Claims

1. A method for detecting a target in a scene, characterized in that, The method includes: Obtain a sample set, calculate the distance between each sample in the sample set and each feature vector in the feature vector set to obtain multiple feature vector distances; wherein, before calculating the distance, first calculate the cosine similarity between the sample and each prototype subset, select the minimum cosine similarity from all the cosine similarities, take the subset index of the prototype subset corresponding to the minimum cosine similarity as the target subset index, and take the classification type of the prototype subset corresponding to the minimum cosine similarity as the target classification type; The minimum feature vector distance is selected from the plurality of feature vector distances; Calculate the classification probability based on the minimum feature vector distance; Based on the classification probability, a semantic segmentation model is used to perform semantic segmentation on each of the samples to obtain multiple segmentation features. The semantic segmentation model is obtained by training a neural network to be trained, and the semantic segmentation includes: inputting each sample and the classification probability into the region division layer of the semantic segmentation model to perform region division to obtain multiple sample regions; inputting each sample region into the feature segmentation layer of the semantic segmentation model to extract the segmentation features of each sample region. The scene target corresponding to the multiple samples is obtained based on the multiple segmentation features; The step of obtaining the scene target corresponding to the multiple samples based on the multiple segmentation features includes: The obtained segmentation features are filtered to remove images with image quality problems, thereby obtaining the scene target corresponding to the multiple samples. The step of filtering the obtained multiple segmentation features includes: The multiple segmentation features are used to identify elements and element relationships; The identified elements and their relationships are then filtered to obtain images and scene targets with image quality issues.

2. The method for detecting targets in a scene according to claim 1, characterized in that, The training of the neural network to be trained includes: via i and Construct the first loss function; via i and Construct a second loss function; The first loss function and the second loss function are combined to obtain the final loss function; The neural network to be trained is trained based on the final loss function; Where i is the sample. For the target classification type, The index of the target subset.

3. The method for detecting targets in a scene according to claim 1, characterized in that, The classification probability is calculated using the following formula: Where P is the classification probability, S is the minimum feature vector distance, i is the sample index, and c is the sample category. Let be the probability that the i-th sample belongs to class C, exp be an exponential function, and C be the total number of classes.

4. A target detection device in a scene, used to perform the target detection method in a scene as described in any one of claims 1-3, characterized in that, include: The acquisition module is used to acquire a sample set, calculate the distance between each sample in the sample set and each feature vector in the feature vector set, and obtain multiple feature vector distances. The filtering module is used to filter out the minimum feature vector distance from a plurality of feature vector distances; The calculation module is used to calculate the classification probability based on the minimum feature vector distance; The segmentation module is used to perform semantic segmentation on each of the samples based on the classification probability using a semantic segmentation model to obtain multiple segmentation features. The semantic segmentation model is obtained by training a neural network to be trained. The processing module is used to obtain scene targets corresponding to the multiple samples based on the multiple segmentation features.

5. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 3.

6. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 3.

Citation Information

Patent Citations

  • Unsupervised image semantic segmentation method based on attention mechanism

    CN114758135A