Abnormal identification method, device, storage medium and electronic device
Through the two-stage feature extraction and the use of target guidance information, the problem of low abnormal recognition efficiency in the prior art is solved, and the rapid and accurate identification of past object objects is achieved.
Patent Information
- Application Number
- CN202311820905.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-12-26
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2043-12-26
AI Technical Summary
In the prior art, exception recognition efficiency is low, and the model needs to be retrained to identify past object objects, and model training requires high resource support.
By acquiring the image to be identified, two-stage feature extraction is performed. The first stage is to extract the basic visual features, and the second stage is to extract the second visual features related to the target object type through the target guidance information, and compare them with the standard visual features to determine the abnormal recognition result.
It realizes rapid identification of past objects, reduces the amount of calculation in the second stage feature extraction process, ensures the accuracy of recognition, and improves the efficiency of abnormal recognition.
Smart Images

Figure CN117788918B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and more specifically, to an abnormality identification method, device, storage medium, and electronic device. Background Art
[0002] In the anomaly recognition scenario, the trained model is usually used to identify the anomalies of objects. However, for past objects, the model still needs to be retrained to successfully identify the anomalies of past objects. At the same time, the model training itself also requires high resource support, which leads to the problem of low anomaly recognition efficiency. Therefore, there is a problem of low anomaly recognition efficiency.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide an abnormality identification method, device, storage medium and electronic device to at least solve the technical problem of low abnormality identification efficiency.
[0005] According to one aspect of an embodiment of the present application, a method for identifying anomalies is provided, comprising: acquiring a first image to be identified, wherein the first image is an image obtained by collecting an object; performing a first stage of feature extraction on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent the visual attributes presented on the surface of the object, and the surface of the object includes the surface of the object; determining, from at least one standard visual feature, a first visual feature whose feature similarity with the basic visual feature is greater than or equal to a preset threshold, wherein the standard visual feature is a feature obtained by performing the first stage of extraction on multiple sample images belonging to multiple object types, and the first visual feature is a feature obtained by performing the first stage of extraction on multiple sample images belonging to a target object type. performing the first-stage extraction on the second image of the image to obtain the features; obtaining target guidance information matching the first visual features, wherein the target guidance information is used to guide the features related to the target object type in the focus image; performing the second-stage feature extraction on the first image through the target guidance information to obtain at least one second visual feature related to the target object type; in the case of obtaining the standard visual features of the second image, comparing the at least one second visual feature with the standard visual features of the second image to obtain a comparison result, wherein the standard visual features are features obtained by performing the second-stage feature extraction on the second image; determining the abnormal recognition result of the first image through the comparison result.
[0006] According to another aspect of an embodiment of the present application, there is also provided an abnormality identification device, including: a first acquisition unit, used to acquire a first image to be identified, wherein the first image is an image obtained by collecting an object; a first extraction unit, used to perform a first stage of feature extraction on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent the visual attributes presented on the surface of the object, and the object surface includes the surface of the object; a first determination unit, used to determine, from at least one standard visual feature, a first visual feature whose feature similarity with the basic visual feature is greater than or equal to a preset threshold, wherein the standard visual feature is a feature obtained by performing the first stage of extraction on multiple sample images belonging to multiple object types, and the first visual feature is a feature obtained by performing the first stage of extraction on a second image belonging to a target object type. a second acquisition unit, used to acquire target guidance information matching the first visual feature, wherein the target guidance information is used to guide the features in the focus image related to the target object type; a second extraction unit, used to perform a second stage of feature extraction on the first image through the target guidance information, to obtain at least one second visual feature related to the target object type; a first comparison unit, used to compare the at least one second visual feature with the standard visual feature of the second image when the standard visual feature of the second image is acquired, to obtain a comparison result, wherein the standard visual feature is a feature obtained by performing the second stage of feature extraction on the second image; a second determination unit, used to determine the abnormality recognition result of the first image through the comparison result.
[0007] As an optional solution, the above-mentioned device also includes: a segmentation unit, which is used to perform region segmentation on the above-mentioned second image to obtain a first region and a second region before obtaining the target guidance information matching the above-mentioned first visual feature, wherein the feature similarity between each second visual feature in the above-mentioned first region or the above-mentioned second region is greater than or equal to a first threshold; a third extraction unit, which is used to perform the above-mentioned second stage feature extraction process on the image belonging to the above-mentioned target object type through the initial guidance information to extract the first sample feature and the second sample feature before obtaining the target guidance information matching the above-mentioned target object type, wherein the above-mentioned first sample feature is a feature with a first feature attribute, and the above-mentioned second sample feature is a feature with a first feature attribute. This feature is a feature with a second feature attribute, the first feature attribute is the feature attribute within the first area, and the second feature attribute is the feature attribute within the second area; the second comparison unit is used to compare the first sample feature with the second visual feature within the first area to obtain a first result, and to compare the second sample feature with the second visual feature within the second area to obtain a second result before obtaining the target guidance information matching the target object type; the third determination unit is used to adjust the initial guidance information according to the first result and the second result to obtain the target guidance information before obtaining the target guidance information matching the target object type.
[0008] As an optional scheme, the above-mentioned first comparison unit includes: a first acquisition module, used to obtain the first distance between each second visual feature of the above-mentioned at least one second visual feature and the above-mentioned standard visual feature in the feature space, wherein the distance in the above-mentioned feature space is inversely related to the similarity between the features; a first determination module, used to determine the first feature with the longest first distance and the second feature with the closest first distance from the above-mentioned at least one second visual feature; a second acquisition module, used to obtain the second distance between the above-mentioned first feature and the above-mentioned second feature in the above-mentioned feature space; and a third acquisition module, used to obtain the above-mentioned comparison result based on the above-mentioned second distance.
[0009] As an optional scheme, the above-mentioned third acquisition module includes: a calculation submodule, used to calculate the third feature adjacent to the above-mentioned second feature in the above-mentioned feature space, and the third distance of the above-mentioned first feature in the above-mentioned feature space; an optimization submodule, used to perform robust optimization on the above-mentioned second distance through the above-mentioned third distance to obtain the target distance, wherein the above-mentioned comparison result includes the above-mentioned target distance; the above-mentioned second determination unit includes: a second determination module, used to determine that the above-mentioned first image is in an abnormal state when the above-mentioned target distance is greater than or equal to a preset distance threshold; a third determination module, used to determine that the above-mentioned first image is in a normal state when the above-mentioned target distance is less than the above-mentioned preset distance threshold, wherein the above-mentioned abnormal recognition result indicates that the above-mentioned first image is in the above-mentioned abnormal state or the above-mentioned normal state.
[0010] As an optional scheme, the above-mentioned first extraction unit includes: a first segmentation module, used to segment the above-mentioned first image into a first number of image blocks, wherein the above-mentioned image blocks are used to represent the local image area of the above-mentioned first image; a first extraction module, used to perform the above-mentioned first stage feature extraction on the above-mentioned first number of image blocks, and obtain the first image features corresponding to each of the above-mentioned image blocks, wherein the above-mentioned basic visual features include the above-mentioned first image features; the above-mentioned second extraction unit includes: a second segmentation module, used to segment the above-mentioned first image into a second number of image blocks, wherein the above-mentioned image blocks are used to represent the local image area of the above-mentioned first image; a second extraction module, used to perform the above-mentioned second stage feature extraction on the above-mentioned second number of image blocks, and obtain the second image features corresponding to each of the above-mentioned image blocks, wherein the above-mentioned second visual features include the above-mentioned second image features.
[0011] As an optional solution, the above-mentioned device also includes: after performing the above-mentioned second stage feature extraction on the above-mentioned second number of image blocks to obtain the second image features corresponding to each of the above-mentioned image blocks, an execution module is used to perform the following steps until the number of key image features stored according to the above-mentioned target object type is greater than or equal to the number threshold: determining the current image feature from the second image features corresponding to each of the above-mentioned image blocks; calculating the fourth distance between the other image features except the above-mentioned current image feature in the second image features corresponding to each of the above-mentioned image blocks and the current image feature in the feature space, wherein the distance in the above-mentioned feature space is inversely related to the similarity between the features; determining the second image feature with the largest fourth distance as the above-mentioned key image feature; storing the above-mentioned key image features that have been obtained according to the above-mentioned target object type; when the number of the above-mentioned key image features that have been obtained is less than the number threshold, determining the next image feature from the second image features corresponding to each of the above-mentioned image blocks, and using the above-mentioned next image feature as the above-mentioned current image feature.
[0012] As an optional scheme, the above-mentioned device also includes: a setting unit, which is used to set the object type to which the above-mentioned object object belongs to an additional object type after performing the first stage of feature extraction on the above-mentioned first image to obtain at least one basic visual feature, when the feature similarity between each standard visual feature from at least one standard visual feature and the above-mentioned basic visual feature is less than the above-mentioned preset threshold, wherein the above-mentioned additional object type is a type other than the rated object type to which the above-mentioned multiple sample images belong; and a collection unit, which is used to collect standard object objects of the above-mentioned additional object type after performing the first stage of feature extraction on the above-mentioned first image to obtain at least one basic visual feature, to obtain multiple third images, and use the above-mentioned third images as the above-mentioned sample images.
[0013] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program including computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device performs the above abnormality identification method.
[0014] According to another aspect of an embodiment of the present application, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the above-mentioned abnormality identification method through the computer program.
[0015] In an embodiment of the present application, a first image to be identified is obtained, wherein the first image is an image obtained by collecting an object; a first stage of feature extraction is performed on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent the visual attributes presented on the surface of the object, and the surface of the object includes the surface of the object; from at least one standard visual feature, a first visual feature whose feature similarity with the basic visual feature is greater than or equal to a preset threshold is determined, wherein the standard visual feature is a feature obtained by performing the first stage of extraction on multiple sample images belonging to multiple object types, and the first visual feature is a feature obtained by performing the first stage of extraction on a second image belonging to the target object type. The features obtained by the first stage of extraction; obtaining target guidance information matching the first visual features, wherein the target guidance information is used to guide the features related to the target object type in the focus image; performing the second stage of feature extraction on the first image through the target guidance information to obtain at least one second visual feature related to the target object type; in the case of obtaining the standard visual features of the second image, comparing the at least one second visual feature with the standard visual features of the second image to obtain a comparison result, wherein the standard visual feature is the feature obtained by performing the second stage of feature extraction on the second image; determining the abnormal recognition result of the first image through the comparison result. By extracting the basic visual features and the first visual features and comparing them with the standard visual features of the second image, rapid recognition of passing objects is achieved. Furthermore, by introducing target guidance information, this embodiment can not only quickly identify past objects, but also focus on features related to the target object type, which not only reduces the amount of calculation in the second-stage feature extraction process, but also ensures the accuracy of identifying past objects, thereby achieving the purpose of quickly identifying past objects while ensuring the accuracy of identification, thereby achieving the technical effect of improving the efficiency of abnormal identification, and solving the technical problem of low abnormal identification efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0017] Figure 1 is a schematic diagram of an application environment of an optional abnormality identification method according to an embodiment of the present application;
[0018] Figure 2 is a schematic diagram of a process of an optional abnormality identification method according to an embodiment of the present application;
[0019] Figure 3is a schematic diagram of an optional abnormality identification method according to an embodiment of the present application;
[0020] Figure 4 is a schematic diagram of another optional abnormality identification method according to an embodiment of the present application;
[0021] Figure 5 is a schematic diagram of another optional abnormality identification method according to an embodiment of the present application;
[0022] Figure 6 is a schematic diagram of an optional abnormality identification device according to an embodiment of the present application;
[0023] Figure 7 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0024] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0025] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0026] For ease of understanding, the following terms are explained:
[0027] Artificial Intelligence (AI) is a theory, method, technology and application system that simulates, extends and expands human intelligence through digital computers or machines controlled by digital computers, perceives the environment, acquires knowledge and uses knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology in computer science that attempts to understand the essence of intelligence and produce a new type of intelligent machine that can respond in a similar way to human intelligence. Artificial intelligence is to study the design principles and implementation methods of various intelligent machines so that machines have the functions of perception, reasoning and decision-making.
[0028] Artificial intelligence technology is a comprehensive discipline that covers a wide range of fields, including both hardware-level and software-level technologies. Basic artificial intelligence technologies generally include sensors, dedicated artificial intelligence chips, cloud computing, distributed storage, big data processing technology, pre-trained model technology, operation / interaction systems, mechatronics, etc. Among them, pre-trained models are also called large models and basic models. After fine-tuning, they can be widely used in downstream tasks in various major directions of artificial intelligence. Artificial intelligence software technology mainly includes computer vision technology, speech processing technology, natural language processing technology, and machine learning / deep learning.
[0029] Computer Vision (CV) is a science that studies how to make machines "see". To put it more specifically, it refers to machine vision that uses cameras and computers to replace human eyes to identify, detect and measure targets, and further performs image processing to make computer processing into images that are more suitable for human eye observation or transmission to instruments for detection. As a scientific discipline, computer vision studies related theories and technologies, and attempts to establish an artificial intelligence system that can obtain information from images or multidimensional data. Large model technology has brought important changes to the development of computer vision technology. Pre-trained models in the visual field such as swin-transformer, ViT, V-MOE, and MAE can be quickly and widely applied to downstream specific tasks after fine tuning. Computer vision technology usually includes image processing, image recognition, image semantic understanding, image retrieval, OCR, video processing, video semantic understanding, video content / behavior recognition, three-dimensional object reconstruction, 3D technology, virtual reality, augmented reality, simultaneous positioning and map construction, and other technologies, as well as common biometric recognition technologies such as face recognition and fingerprint recognition.
[0030] Machine Learning (ML) is a multi-disciplinary interdisciplinary subject involving probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning usually include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning, and learning by teaching. The pre-trained model is the latest development of deep learning, which integrates the above technologies.
[0031] With the research and advancement of artificial intelligence technology, artificial intelligence technology has been studied and applied in many fields, such as common smart homes, smart wearable devices, virtual assistants, smart speakers, smart marketing, driverless cars, autonomous driving, drones, digital twins, virtual humans, robots, artificial intelligence generated content (AIGC), conversational interaction, smart medical care, smart customer service, game AI, etc. It is believed that with the development of technology, artificial intelligence technology will be applied in more fields and play an increasingly important role.
[0032] The solution provided in the embodiments of the present application involves artificial intelligence computer vision technology and other technologies, which are specifically described by the following embodiments:
[0033] According to one aspect of the embodiments of the present application, a method for identifying an abnormality is provided. Optionally, as an optional implementation, the method for identifying an abnormality may be applied to, but is not limited to, Figure 1 In the environment shown, the environment may include, but is not limited to, a user device 102 and a server 112 . The user device 102 may include, but is not limited to, a display 104 , a processor 106 , and a memory 108 . The server 112 includes a database 114 and a processing engine 116 .
[0034] The specific process can be as follows:
[0035] Step S102, the user device 102 obtains a first image to be identified, wherein the first image is an image obtained by capturing an object;
[0036] Step S104, sending the first image to the server 112 via the network 110;
[0037] In steps S106-S114, the server 112 performs a first-stage feature extraction on the first image through the processing engine 116 to obtain at least one basic visual feature; from at least one standard visual feature, a first visual feature whose feature similarity with the basic visual feature is greater than or equal to a preset threshold is determined; target guidance information matching the target object type is obtained; based on the target guidance information, a second-stage feature extraction is performed on the first image to obtain at least one second visual feature related to the target object type; when the standard visual feature of the second image is obtained, the at least one second visual feature is compared with the standard visual feature of the second image to obtain a comparison result;
[0038] Step S116 , sending the comparison result to the user device 102 via the network 110 , the user device 102 determines the abnormal recognition result of the first image through the comparison result through the processor 106 , displays the abnormal recognition result on the display 104 , and stores the above comparison result in the memory 108 .
[0039] remove Figure 1 In addition to the examples shown, the terminal device can be a terminal device configured with a target client, which can include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client can be a video client, an instant messaging client, a browser client, an education client, etc. The network can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The server can be a single server, or a server cluster composed of multiple servers, or a cloud server. The above is only an example, and no limitation is made to this in this embodiment.
[0040] Optionally, as an optional implementation, as Figure 2 As shown, the abnormality identification method can be executed by an electronic device, which can be, for example, Figure 1 The user device or server shown in the figure comprises:
[0041] S202, obtaining a first image to be identified, wherein the first image is an image acquired by capturing an object;
[0042] S204, performing a first stage feature extraction on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent a visual attribute presented by an object surface, and the object surface includes a surface of an object;
[0043] S206, determining, from at least one standard visual feature, a first visual feature whose feature similarity to the basic visual feature is greater than or equal to a preset threshold, wherein the standard visual feature is a feature obtained by performing a first stage of extraction on a plurality of sample images belonging to a plurality of object types, and the first visual feature is a feature obtained by performing a first stage of extraction on a second image belonging to the target object type;
[0044] S208, obtaining target guidance information matched by the first visual feature, wherein the target guidance information is used to guide features related to the target object type in the focus image;
[0045] S210, performing a second stage of feature extraction on the first image using the target guidance information to obtain at least one second visual feature related to the type of the target object;
[0046] S212, when the standard visual feature of the second image is obtained, comparing at least one second visual feature with the standard visual feature of the second image to obtain a comparison result, wherein the standard visual feature is a feature obtained by performing the second stage of feature extraction on the second image;
[0047] S214: Determine an abnormality recognition result of the first image through comparison results.
[0048] Optionally, in this embodiment, the above-mentioned abnormality identification method can be applied to, but not limited to, continuous detection scenarios of various industrial products to achieve abnormal product positioning results in continuous detection scenarios. For the model recognition method, every time the production line changes the items produced, the detection model needs to be retrained and deployed, even if the replaced items have appeared before; while the method proposed in this embodiment does not need to be retrained and deployed for items that have appeared in the past, and only requires additional training when the product replaced by the production line is a new product, which can greatly save the manpower, material resources and time costs of retraining and deploying when encountering old products.
[0049] Optionally, in this embodiment, the object object can be understood as, but not limited to, an object that actually exists or needs to be identified, and can be any form of entity, such as a product, a part, a creature, etc. Assuming that on a production line, each part produced needs to be identified for abnormality, then the part can be understood as an object object, and whenever a new part is produced and captured by a camera, the image captured by the camera can be regarded as the first image.
[0050] Optionally, in this embodiment, basic visual features that can describe the visual properties of the surface of the object are extracted from the image to capture various properties of the object surface, such as color, texture, shape, etc., to provide important information for subsequent abnormality identification. Among them, the body surface visual properties can refer to the characteristics presented by the surface of the object that can be perceived and recognized by the visual system. It is the basis for people to observe and identify objects, and is also an important basis for computer vision systems to analyze and understand images, such as gloss, color, texture, shape, transparency, etc.
[0051] In this embodiment, the basic visual features can be features extracted from the image to describe the visual properties of the object surface, covering multiple aspects and together constituting a comprehensive description of the visual characteristics of the object surface, such as color features, second visual features, shape features, spatial relationship features, local features, etc.
[0052] Optionally, in this embodiment, a first visual feature similar to a basic visual feature extracted from the first image is determined from a series of standard visual features, such as by comparing the similarity between the basic visual feature and the standard visual features extracted from multiple sample images, and finding the first visual feature whose similarity is greater than or equal to a preset threshold.
[0053] To further illustrate, it is optional to assume that there is a sample image library containing multiple fruits, and each fruit has multiple sample images. Standard visual features are extracted from these sample images. There is an apple image to be identified (first image), from which basic visual features are extracted. Next, this embodiment compares these basic visual features with the standard visual features in the sample image library to find the first visual features whose similarity with the apple image is greater than or equal to a preset threshold, and these first visual features will be used for subsequent abnormality identification.
[0054] Optionally, in this embodiment, the standard visual features may be representative visual features extracted from a plurality of sample images belonging to each object type. After being processed and refined, the standard visual features can accurately describe and represent the typical visual attributes of a certain object type. The extraction of standard visual features usually involves analyzing and learning a large number of sample images in order to extract the most representative and distinguishing features, which may be color, texture, shape, spatial relationship, etc., for describing the visual attributes of the object surface.
[0055] Optionally, in this embodiment, feature similarity can be an indicator for measuring the similarity between two visual features, which is usually obtained by calculating the distance or correlation between the two features. In abnormality recognition, feature similarity is used to compare the similarity between the basic visual features extracted from the image to be recognized and the standard visual features extracted from the sample image. The feature similarity can be calculated by, for example, Euclidean distance, cosine similarity, Pearson correlation coefficient, etc. When the similarity between two features is higher than a preset threshold, the features can be considered to be similar.
[0056] Optionally, in this embodiment, object type refers to a classification or category of objects with similar visual attributes and features. In abnormality recognition, object type can refer to a normal, non-abnormal object, or a specific type of abnormal object. For example, on an industrial production line, object type can refer to type A of product A, type B of product B, or type C of product C. By identifying and classifying object types, abnormal situations can be discovered and handled in a timely manner.
[0057] Optionally, in this embodiment, the sample images are image data sets used to extract standard visual features and first visual features. These data sets contain images of multiple different object types, and each object type has multiple sample images. By analyzing and learning the sample images, standard visual features representing each object type and first visual features for comparison and identification can be extracted.
[0058] Optionally, in this embodiment, in the process of obtaining target guidance information that matches the target object type, the role of the target guidance information is to guide the focus on features related to the target object type in the image so as to more accurately identify and analyze these features. Acquiring and using target guidance information that matches the target object type can significantly improve the accuracy and efficiency of abnormal identification. By guiding the image processing algorithm to focus on features related to the target object type, interference with irrelevant information can be reduced, and the accuracy and efficiency of feature extraction can be improved. This will help to more accurately identify abnormal objects or phenomena, and take corresponding treatment measures in a timely manner. At the same time, by using target guidance information, the need for manual intervention can be reduced, the degree of automated processing can be improved, and the cost and complexity of abnormal identification can be reduced.
[0059] To further illustrate, optionally, for example, an anomaly identification task for a specific type of fruit (such as apples) is being performed. In this case, the target guidance information may include information about the visual features of the apple, such as color, shape, texture, etc. This information will be used to guide the image processing algorithm to pay more attention to features related to apples, such as red or green areas, round or oval shapes, specific texture patterns, etc. By obtaining and using this target guidance information, the present embodiment can more accurately extract features related to apples from the image, and then perform anomaly identification.
[0060] Optionally, in this embodiment, the target guidance information may be information specifically designed to guide the image processing or analysis algorithm to pay more attention to features related to a specific object or task, and may be in various forms, such as pre-set rules, models or parameters learned from a large amount of data, or even guidance obtained through expert experience or user interaction. The target guidance information can be used to enhance the feature extraction process so that it is more focused on features related to the task. For example, in a face recognition task, guidance information may guide the algorithm to pay more attention to key areas such as eyes, nose, and mouth. In deep learning, the attention mechanism is a commonly used technique that dynamically adjusts the model's attention to different image areas through target guidance information. This can help the model better understand and interpret the image. At the same time, the target guidance information can also be used as a supervisory signal in the training process to help the model learn and converge to a good solution faster.
[0061] Optionally, in this embodiment, the second stage of feature extraction through target guidance information can significantly improve the accuracy and relevance of the second visual feature. By guiding the algorithm to focus on features related to the target object type, interference with irrelevant information can be reduced, thereby improving the accuracy and efficiency of feature extraction. This will help to more accurately identify objects in the image and distinguish subtle differences between different object types. At the same time, the extracted second visual features can also be used for further tasks, such as object classification, scene understanding, 3D reconstruction, etc., providing strong support for improving the performance of computer vision systems.
[0062] To further illustrate, it is optional to assume that there is an image dataset containing multiple fruits, and target guidance information matching the target object type of apple has been obtained. This information may include features such as the color, shape, and texture of the apple. Now, this embodiment can perform a second stage of feature extraction on an image containing apples through this guidance information, focusing on extracting second visual features related to apples. These features may include the smoothness of the apple skin, the presence or absence of spots or stripes, etc., which will be used to more accurately identify the apple in the image and distinguish it from other types of fruits.
[0063] Optionally, in this embodiment, the second visual feature may be expressed the same as but not limited to the first visual feature, or may be different, for example, the second visual feature may be a feature used to describe the texture structure of the surface of an object in an image. Texture is a visual attribute of the surface of an object, usually composed of many small, repetitive or periodic patterns. These patterns may be the result of the interaction of factors such as the microscopic geometry of the surface of the object, lighting conditions, and material properties, and can provide rich information about the surface structure and material properties of the object, thereby facilitating the recognition and classification of the object. Compared with other visual features such as color and shape, the second visual feature is usually more robust to changes in lighting and viewing angle.
[0064] Optionally, in this embodiment, texture attributes refer to specific texture characteristics exhibited by the surface of an object. These attributes may include roughness, smoothness, directionality, regularity, etc. For example, the surface of a stone may exhibit rough and irregular texture attributes, while the surface of a glass may exhibit smooth and reflective texture attributes.
[0065] Optionally, in this embodiment, at least one second visual feature related to the target object type refers to a second visual feature that is closely related to a specific object type. Each object type may have one or more unique second visual features, which are unique to that type of object or are the main differences between that type of object and other types of objects. Taking wood as an example, its typical second visual features may include annual rings, direction and density of wood grain, etc. These features can be used to distinguish different types of wood, such as oak, pine, etc. In image processing, second visual feature extraction and analysis of wood can help automatically identify and classify different types of wood.
[0066] Optionally, in this embodiment, by comparing at least one second visual feature extracted from the first image with the standard visual feature, a quantitative comparison result can be obtained, thereby accurately judging whether the first image has an abnormality. The accuracy and efficiency of abnormality identification can also be significantly improved, and false positives and false negatives can be reduced. At the same time, since the second visual feature is more robust to changes in illumination and viewing angle, this embodiment has good stability and reliability in practical applications.
[0067] To further illustrate, it is optional to assume that there is a data set containing normal apple images, and standard visual features are extracted from it. Now, for an apple image to be identified (i.e., the first image), this embodiment extracts at least one second visual feature. Next, this embodiment compares this feature with the standard visual feature of the second image to obtain a comparison result. If the comparison result shows that the two are very similar, then this embodiment can consider that the apple image to be identified is normal; if the comparison result shows that there is a large difference between the two, then this embodiment can consider that there is an abnormality in this image.
[0068] Optionally, in this embodiment, the standard visual features are second visual features extracted from images that are considered to be "normal" or "normal-free". These features represent the texture properties that this type of object should have under normal circumstances. The standard visual features play the role of a "benchmark" in abnormality identification. When a new image needs to be detected for abnormalities, its second visual features can be compared with the standard visual features to determine whether there are abnormalities. Typically, standard visual features are obtained by feature extraction and statistical analysis of a large number of normal sample images. This may require the use of specific algorithms or tools, such as deep learning models, image processing techniques, etc., to extract and describe these features.
[0069] Optionally, in this embodiment, the comparison result is the result obtained by comparing the second visual feature of the image to be detected with the standard visual feature. This result is usually a numerical value or a set of numerical values, which is used to quantify the similarity or difference between the two. The comparison result may include a similarity score, a difference score, a distance metric, etc. For example, if the Euclidean distance is used as the similarity metric, the comparison result will be a numerical value representing the degree of difference between the image to be detected and the standard image in the second visual feature.
[0070] Optionally, in this embodiment, the abnormality identification result is a conclusion on whether the image to be detected is abnormal based on the comparison result. This result is usually a binary classification label (normal or abnormal), or a continuous value indicating the degree of abnormality. The abnormality identification result is usually determined by comparing the comparison result with a preset threshold or comparison standard. If the comparison result exceeds the threshold or does not meet the comparison standard, the image to be detected is identified as abnormal; otherwise, it is identified as normal.
[0071] It should be noted that this embodiment can significantly improve the accuracy and efficiency of abnormality recognition by combining the two-stage feature extraction and comparison process, and using target guidance information to focus on features related to the target object type, and can effectively reduce false positives and false negatives, and improve the accuracy and efficiency of abnormality recognition. At the same time, due to the use of multiple features and guidance information, this embodiment also has high flexibility and adaptability, and can be applied to different types of objects and abnormality recognition tasks.
[0072] To further illustrate, the optional Figure 3As shown, a first image 302 to be identified is obtained, wherein the first image 302 is an image obtained by collecting an object; a first stage of feature extraction is performed on the first image 302 to obtain at least one basic visual feature 304, wherein the basic visual feature 304 is used to represent the visual attributes presented on the surface of the object, and the surface of the object includes the surface of the object; from at least one standard visual feature 306, a first visual feature 308 whose feature similarity with the basic visual feature 304 is greater than or equal to a preset threshold is determined, wherein the standard visual feature 306 is a feature obtained by performing the first stage of extraction on multiple sample images belonging to each object type, and the first visual feature 308 is a feature obtained by performing the first stage of extraction on a second image belonging to the target object type 310, and the multiple sample images include the second image, and the second image is a first image belonging to the target object type 310. 10; obtaining target guidance information 312 matching the target object type 310, wherein the target guidance information 312 is used to guide the features related to the target object type 310 in the focus image; performing a second stage of feature extraction on the first image 302 through the target guidance information 312 to obtain at least one second visual feature 314 related to the target object type 310, wherein the second visual feature is used to represent the texture attribute presented on the surface of the object; when the standard visual feature 316 of the second image is obtained, comparing the at least one second visual feature 314 with the standard visual feature 316 to obtain a comparison result 318, wherein the standard visual feature 316 is a feature obtained by performing the second stage of feature extraction on the second image; determining the abnormality recognition result 320 of the first image 302 through the comparison result 318.
[0073] Through the embodiment provided by the present application, the basic visual features and the first visual features are extracted and compared with the standard visual features of the second image, thereby realizing the rapid recognition of past objects. Furthermore, by introducing target guidance information, the present embodiment can not only quickly recognize past objects, but also focus on features related to the target object type, which not only reduces the amount of calculation in the second stage feature extraction process, but also ensures the recognition accuracy of past objects, thereby achieving the purpose of quickly recognizing past objects while ensuring the accuracy of recognition, thereby realizing the technical effect of improving the efficiency of abnormal recognition.
[0074] As an optional solution, before obtaining the target guidance information matched by the first visual feature, the method further includes:
[0075] S1-1, performing region segmentation on the second image to obtain a first region and a second region, wherein a feature similarity between each second visual feature in the first region or the second region is greater than or equal to a first threshold;
[0076] S1-2, guiding the process of performing the second stage of feature extraction on the image belonging to the target object type through the initial guidance information, extracting the first sample feature and the second sample feature, wherein the first sample feature is a feature with a first feature attribute, the second sample feature is a feature with a second feature attribute, the first feature attribute is a feature attribute in the first area, and the second feature attribute is a feature attribute in the second area;
[0077] S1-3, comparing the first sample feature with the second visual feature in the first area to obtain a first result, and comparing the second sample feature with the second visual feature in the second area to obtain a second result;
[0078] S1-4, adjusting the initial guidance information according to the first result and the second result to obtain target guidance information.
[0079] Optionally, in this embodiment, region segmentation can be a key step in image processing, involving dividing an image into multiple regions with similar visual attributes. These regions can be divided based on color, texture, shape or other image features. In region segmentation, the algorithm attempts to identify and aggregate visually similar parts of the image while retaining the boundaries between different parts. The main purpose of region segmentation is to simplify image representation, highlight important image structures, and reduce the complexity of subsequent processing tasks. By dividing the image into regions with similar attributes, it is easier to analyze and understand the image content and extract useful information. Region segmentation can be achieved by a variety of methods, including but not limited to threshold processing, edge detection, region growing, level set methods, clustering algorithms (such as K-means), graph cut methods, etc.
[0080] Optionally, in this embodiment, the characteristic attributes shared by the second visual features in the region refer to the common or similar visual characteristics exhibited by the texture in a specific region. These characteristic attributes can be descriptions based on the shape, size, direction, density, periodicity, roughness, etc. of the texture. Understanding the characteristic attributes shared by the second visual features in the region is very important for image processing and computer vision tasks. By identifying and analyzing these characteristic attributes, this embodiment can better understand the image content and extract useful information from it. For example, in an object recognition task, different objects may have different second visual feature attributes. By identifying and comparing these attributes, the classification and recognition of objects can be achieved.
[0081] Optionally, the initial guidance information provides the present embodiment with basic information or preliminary recognition results about the type of the target object. This information can be basic features such as the shape, color, texture, etc. of the object, or the results obtained from the first stage feature extraction. Based on this initial guidance information, the present embodiment can perform the second stage feature extraction on the image more specifically.
[0082] Optionally, in this embodiment, the image is divided into a plurality of image blocks. Each image block represents a local area of the image and contains information about pixels in the area. By analyzing and processing these image blocks, this embodiment can extract more detailed and specific feature information.
[0083] Specifically, this embodiment uses the initial guidance information to guide the feature extraction process of the image blocks. It may focus on those image blocks related to the initial guidance information and extract the features therein as the first sample features. At the same time, this embodiment also considers the relationship and context information between the image blocks and extracts higher-level features related to the target object type as the second sample features.
[0084] In this way, the image block acts as a carrier of local information. Under the guidance of the initial guidance information, this embodiment more accurately extracts feature information related to the target object type, thereby improving the efficiency and accuracy of feature extraction and providing strong support for subsequent classification, recognition or reconstruction tasks.
[0085] It should be noted that, in this embodiment, by first performing region segmentation and feature extraction on the second image, the second visual feature related to the target object type can be more accurately identified and extracted. Secondly, by guiding the algorithm to focus on textures with specific characteristic attributes, the pertinence and accuracy of feature extraction can be further improved. Finally, by comparing and verifying the sample features and the second visual features in the region, the effectiveness and accuracy of the final determined characteristic attributes can be ensured, thereby significantly improving the accuracy and efficiency of subsequent abnormality identification.
[0086] To further illustrate, it is optional to assume that a cloth with a special texture is to be identified. First, the present embodiment obtains a sample image (second image) of such a cloth and performs regional segmentation on it to obtain two regions with similar second visual features, the first region and the second region. Next, the present embodiment analyzes the second visual features in the two regions and extracts the first characteristic attributes and the second characteristic attributes they share, such as the density and direction of the texture. Then, the present embodiment guides the algorithm to focus on the texture with these characteristic attributes and extracts the first sample feature and the second sample feature from other images belonging to this cloth. Next, the present embodiment compares these sample features with the second visual features in the original region to obtain the first result and the second result. If both results indicate that the similarity between the sample feature and the second visual feature in the region exceeds the set threshold (the second threshold and the third threshold), then the present embodiment confirms that the first characteristic attribute and the second characteristic attribute are valid characteristic attributes of interest. Otherwise, the present embodiment needs to adjust these characteristic attributes and repeat the above process until the accurate characteristic attribute of interest is found.
[0087] Through the embodiments provided by the present application, the second image is segmented into regions to obtain a first region and a second region, wherein the feature similarity between each second visual feature in the first region or the second region is greater than or equal to a first threshold; the initial guidance information is used to guide the second stage of feature extraction of the image belonging to the target object type, and the first sample feature and the second sample feature are extracted, wherein the first sample feature is a feature with a first feature attribute, the second sample feature is a feature with a second feature attribute, the first feature attribute is a feature attribute in the first region, and the second feature attribute is a feature attribute in the second region; the first sample feature and the second visual feature in the first region are compared to obtain a first result, and the second sample feature and the second visual feature in the second region are compared to obtain a second result; the initial guidance information is adjusted according to the first result and the second result to obtain the target guidance information, thereby achieving the purpose of improving the pertinence and accuracy of feature extraction, thereby achieving the technical effect of providing effective support for subsequent efficient abnormality recognition.
[0088] As an optional solution, comparing the at least one second visual feature with the standard visual feature of the second image to obtain a comparison result includes:
[0089] S2-1, obtaining a first distance between each second visual feature of at least one second visual feature and the standard visual feature in a feature space, wherein the distance in the feature space is inversely related to the similarity between the features;
[0090] S2-2, determining, from at least one second visual feature, a first feature with the longest first distance and a second feature with the shortest first distance;
[0091] S2-3, obtaining a second distance between the first feature and the second feature in the feature space;
[0092] S2-4, obtaining a comparison result based on the second distance.
[0093] Optionally, in this embodiment, the feature space is a high-dimensional space for representing and comparing image features. In this space, each point represents a feature, and the coordinates of the point are composed of various dimensions of the feature. The feature space provides a method for visualizing and quantifying the relationship between features, making it easier to understand and compare the similarities and differences between different features.
[0094] Optionally, in this embodiment, in the feature space, distance is a metric used to quantify the similarity or difference between two features. This distance is usually calculated based on a specific distance metric function, such as Euclidean distance, Manhattan distance, cosine similarity, etc. Different distance metric functions may emphasize different feature attributes or characteristics. In the feature space, the distance between two points reflects the similarity between the features they represent. The closer the distance, the higher the similarity; the farther the distance, the lower the similarity. This similarity measurement can help us understand the relationship between different features and which features are more important or useful in a specific task.
[0095] It should be noted that this embodiment can obtain a quantitative evaluation of the similarity between at least one second visual feature and the standard visual feature, which can help identify the second visual features that are most similar and least similar to the standard visual feature and understand the degree of difference between them. This information is very valuable for subsequent image processing and analysis tasks (such as object recognition, scene understanding, etc.) because they can help understand and interpret the image content more accurately.
[0096] To further illustrate, optionally assume a set of second visual features A, B, C and a standard visual feature S. In the feature space, measure the distance between A, B, C and S, and find that the distance between A and S is the farthest, and the distance between C and S is the closest. Next, calculate the distance between A and C (the second distance). If this distance is large, it means that the differences between this set of second visual features are large, and the comparison result may indicate that this set of second visual features does not match the standard visual features well. If this distance is small, it means that the differences between this set of second visual features are small, and the comparison result may be more positive.
[0097] Through the embodiments provided by the present application, each second visual feature of at least one second visual feature and a first distance between the second visual feature and the standard visual feature in the feature space are obtained, wherein the distance in the feature space is inversely related to the similarity between the features; the first feature with the longest first distance and the second feature with the shortest first distance are determined from at least one second visual feature; the second distance between the first feature and the second feature in the feature space is obtained; based on the second distance, a comparison result is obtained, thereby achieving the purpose of more accurately understanding and interpreting the image content, thereby realizing the technical effect of improving the accuracy of the comparison result.
[0098] As an optional solution, based on the second distance, a comparison result is obtained, including:
[0099] S3-1, calculating a third feature adjacent to the second feature in the feature space and a third distance between the first feature in the feature space;
[0100] S3-2, performing robust optimization on the second distance by using the third distance to obtain a target distance, wherein the comparison result includes the target distance;
[0101] As an optional solution, the first stage of feature extraction is performed on the first image to obtain at least one basic visual feature, including:
[0102] S4-1, dividing the first image into a first number of image blocks, wherein the image blocks are used to represent local image regions of the first image;
[0103] S4-2, performing a first stage of feature extraction on a first number of image blocks to obtain first image features corresponding to each image block, wherein the basic visual features include the first image features;
[0104] Performing a second stage of feature extraction on the first image to obtain at least one second visual feature related to the type of the target object includes:
[0105] S5-1, dividing the first image into a second number of image blocks, wherein the image blocks are used to represent local image regions of the first image;
[0106] S5-2, performing a second stage of feature extraction on a second number of image blocks to obtain second image features corresponding to each image block, wherein the second visual feature includes the second image feature.
[0107] Optionally, in this embodiment, an image block can be a group of adjacent pixel regions in an image with the same characteristics (such as grayscale value). In image processing, these adjacent pixel regions are usually treated as a whole for processing and analysis. The concept of image blocks is applied in various image processing tasks, such as feature extraction, image compression, image enhancement, etc. By processing image blocks, information in the image can be extracted more effectively and the complexity of calculation can be reduced.
[0108] Optionally, in this embodiment, the first number and the second number may be different. For example, considering the features of the image blocks extracted from the first stage, these features constitute the basic visual features for determining the object type, and the accuracy requirement is not so strict, and then the first number with a smaller number may be used to coarsen the granularity of the image blocks to improve the feature extraction efficiency of the first stage. For the feature extraction of the second stage, it needs to be more relevant to the target object type, and the accuracy requirement becomes strict. The second number with a larger number may be used to refine the granularity of the image blocks to improve the feature extraction accuracy of the second stage. In other words, the first number in this embodiment may be smaller than the second number.
[0109] It should be noted that this embodiment can first obtain basic feature information from each local area of the image through a two-stage feature extraction method. Then, in the second stage, through more targeted processing, features closely related to the target object type can be further extracted, thereby improving the recognition accuracy of the target object, especially when the background is complex or the target object is not much different from the background.
[0110] To further illustrate, it is optional to assume that there is a first image of a basket containing fruit. In the first stage, the image is divided into multiple image blocks, each of which contains a part of a fruit. From these image blocks, basic visual features such as color and shape can be extracted as first image features. In the second stage, if it is known that the target object type is an apple, more attention may be paid to those image blocks related to apple features, and more specific features such as the red color of the apple, a specific shape or texture, etc. may be extracted from them as second image features.
[0111] Through the embodiments provided by the present application, a first image is cut into a first number of image blocks, wherein the image blocks are used to represent local image areas of the first image; a first stage of feature extraction is performed on the first number of image blocks to obtain first image features corresponding to each image block, wherein the basic visual features include the first image features; the first image is cut into a second number of image blocks, wherein the image blocks are used to represent local image areas of the first image; a second stage of feature extraction is performed on the second number of image blocks to obtain second image features corresponding to each image block, wherein the second visual features include the second image features, thereby achieving the purpose of performing two-stage feature extraction at the granularity of image blocks, thereby realizing the technical effect of improving the recognition accuracy of the target object.
[0112] As an optional solution, after performing the second stage of feature extraction on the second number of image blocks to obtain second image features corresponding to each image block, the method further includes:
[0113] Perform the following steps until the number of key image features stored according to the target object type is greater than or equal to the number threshold:
[0114] S6-1, determining a current image feature from the second image features corresponding to each image block;
[0115] S6-2: calculating a fourth distance between other image features except the current image feature in the second image features corresponding to each image block and the current image feature in the feature space, wherein the distance in the feature space is inversely related to the similarity between the features;
[0116] S6-3 determining the second image feature with the largest fourth distance as the key image feature;
[0117] S6-4, storing the obtained key image features according to the target object type;
[0118] S6-5: When the number of obtained key image features is less than the number threshold, determine the next image feature from the second image features corresponding to each image block, and use the next image feature as the current image feature.
[0119] Optionally, in this embodiment, key image features are used to update standard visual features belonging to the target object type. For example, when the second stage of feature extraction is performed on the second number of image blocks to obtain second image features corresponding to each of the image blocks, the standard visual features belonging to the target object type are the standard visual features of the second image. After obtaining the key image features, the standard visual features of the second image can be optimized by the key image features to be closer to the true expression of the target object type, thereby realizing the update of the target object type.
[0120] It should be noted that, through this embodiment, the key image features most relevant to the target object type can be gradually extracted. These key features are not only highly relevant to the target object type, but also have great differences between each other, so that some key features that can more comprehensively describe the target object type can be pre-stored. When a sufficient number of key image features are obtained, these features can be used for subsequent classification, recognition or reconstruction tasks, taking into account the accuracy and efficiency of abnormality recognition.
[0121] To further illustrate, it is optional to assume that there is an image containing multiple fruits, and the target object type is apple. After the second image features of multiple image blocks are extracted in the second stage, the iterative process begins. First, a feature of an image block is selected as the current image feature. Then, the fourth distance between the feature and all other image block features is calculated. Assuming that the feature of a certain image block is found to be the most different from the current image feature, then this feature is determined to be the key image feature and stored. If the number of stored key image features is insufficient, the feature of the next image block will continue to be selected as the current image feature and the above process will be repeated. If the number of stored key image features is sufficient, the repetition will end.
[0122] Through the embodiment provided by the present application, the following steps are performed until the key image features stored according to the target object type are obtained: the current image feature is determined from the second image features corresponding to each image block; the other image features except the current image feature are calculated from the second image features corresponding to each image block, and the fourth distance of the current image feature in the feature space is obtained, wherein the distance in the feature space is inversely related to the similarity between the features; the second image feature with the largest fourth distance is determined as the key image feature; when the number of the obtained key image features is greater than or equal to the number threshold, the obtained key image features are stored according to the target object type; when the number of the obtained key image features is less than the number threshold, the next image feature is determined from the second image features corresponding to each image block, and the next image feature is used as the current image feature, thereby achieving the purpose of pre-storing some key characteristics that can more comprehensively describe the target object type, thereby achieving the technical effect of taking into account both the accuracy and efficiency of abnormality recognition.
[0123] As an optional solution, after performing the first stage feature extraction on the first image to obtain at least one basic visual feature, the method further includes:
[0124] S7-1, when the feature similarity between each standard visual feature of at least one standard visual feature and the basic visual feature is less than a preset threshold, setting the object type to which the object belongs to as an additional object type, wherein the additional object type is a type other than the rated object type to which the plurality of sample images belong;
[0125] S7-2, collecting standard objects of the additional object type to obtain a plurality of third images, and using the third images as sample images.
[0126] Optionally, in this embodiment, in the field of image recognition and processing, a database (multiple sample images) containing multiple known object types is usually constructed. This database is used to train the algorithm so that it can recognize these known types. However, in actual applications, the system may encounter objects that are not in this database, and then a mechanism is needed to handle these unknown, additional object types. In other words, the additional object type is any object type that does not belong to the known or predefined rated object type.
[0127] To further illustrate, let's assume that there is a recognition system that can recognize two object types: "cat" and "dog". When the system encounters an image containing "rabbit", it extracts basic visual features. The system then compares these features with the standard visual features of "cat" and "dog". If the similarity with both is below a preset threshold, the system considers this to be an additional object type, namely "rabbit". Next, the system collects an image of the standard object of "rabbit", namely the third image, and adds it to the sample image.
[0128] It should be noted that the additional steps can enhance the ability of anomaly recognition, so that it can handle more types of objects. By dynamically adding newly recognized object types to the sample image library, it can gradually adapt to and recognize a wider range of scenes and objects. In addition, this embodiment can also improve the flexibility of anomaly recognition, so that it can better cope with various challenges and changes in practical applications.
[0129] Through the embodiments provided by the present application, when the feature similarity between each standard visual feature of at least one standard visual feature and the basic visual feature is less than a preset threshold, the object type to which the object belongs is set as an additional object type, wherein the additional object type is a type other than the rated object type to which multiple sample images belong; the standard object objects of the additional object type are collected to obtain multiple third images, and the third images are used as sample images, thereby achieving the purpose of the additional step being able to enhance the ability of anomaly recognition so that it can handle more types of object objects, thereby achieving the technical effect of improving the flexibility of anomaly recognition.
[0130] As an optional solution, for ease of understanding, the above anomaly recognition method is applied to continuous detection scenarios, such as Figure 4 As shown, abnormal product positioning results are achieved in a continuous detection scenario.
[0131] Optionally, in this embodiment, if Figure 5 As shown, the process of applying the above-mentioned abnormality recognition method includes a training process and a testing process, and is executed by a continuous prompting module (Continual Prompting Module / CPM) and a structure-based contrastive learning module (Structure-based Contrastive Learning / SCL).
[0132] Specifically, the continuous prompt module CPM is mainly divided into three parts. First, there is the Key for one-to-one retrieval from image to module; second, there is the Prompt for extracting category-specific features; and finally, there is the Knowledge part for storing category-specific features.
[0133] The Structure-based Contrastive Learning (SCL) module aims to distill the knowledge of SAM (Segment Everything Model) into the base ViT. By training Prompt, the feature representation of ViT for specific items can be changed. This Prompt is an additional parameter of a smaller magnitude and can be directly superimposed on each layer of ViT features to achieve fine-tuning of the model.
[0134] Optionally, in the training process, the training image is first feature extracted by ViT and stored in Key for use in testing. Then, the image is passed through SAM to obtain a segmentation map. Different regions in the segmentation map have consistent second visual features and corresponding labels. This information is then passed to the feature map extracted by ViT, so that it can be compared and learned based on the segmentation map of SAM.
[0135] After having the features extracted by ViT and the labels obtained by SAM, we can conduct comparative learning on this basis and obtain the gradient for feedback. Figure 5 The contrastive loss function used in is used to calculate the loss in the contrastive learning process. First, the feature map is normalized. Then, the similarity matrix of the patch features is calculated. A mask is created based on the consistency of the labels and the loss is calculated using this mask, ensuring that features with the same label are close to each other and features with different labels are far away from each other, as defined below:
[0136]
[0137] Furthermore, after 50 epochs of training, Prompt was optimized and combined with the features extracted by ViT, it can better characterize the specific second visual features of different items. Subsequently, the model extracts features from all images of each category and uses the farthest point sampling algorithm (FPS) to select the most representative features and store them in the Knowledge part of CPM.
[0138] During the testing process, Figure 5 The input image (Inference Image) in is first subjected to feature extraction through ViT. These features are compared one by one with the features of the Key module in CPM to find the product category and the corresponding CPM corresponding to the input image. Once the corresponding CPM is found, the input image is processed again through ViT, but this time the corresponding CPM's Prompt is additionally added to extract category-specific features. After obtaining these features, they are compared with the Knowledge in the corresponding CPM to calculate the anomaly score of the corresponding block. The method of retrieving the Key corresponding to the CPM based on the feature and retrieving the knowledge of the CPM based on the feature for comparison is the same. In this way, the method can accurately identify and locate abnormal areas in the input image, providing an important basis for subsequent anomaly processing and analysis.
[0139] Assume that all features of an image are x test , a certain block feature m test For x test If the Key or Knowledge to be retrieved is K and m is any feature in K, then you want to retrieve m test The closest feature in K can be obtained by PatchCore as shown in the following formulas (1), (2), and (3):
[0140] m test,* ,m * = argmax mtest∈P (x test )argmin m∈K ||m test -m||2 (1)
[0141] s * =||m test,* -m * ||2 (2)
[0142]
[0143] For any x testThe anomaly scores between x and K can be calculated by the above formulas (1), (2), and (3). Formula (1) can be used to find test The representative feature m of the distance from K test,* ,m * . m test,* is x test The feature farthest from K, and m * is the distance m in K test,* The closest feature. As shown in formula (2), the distance between the two can be calculated to obtain the basic anomaly score s * , and formula (3) further calculates m in K * Neighbors and m test,* The distance can make the score s more robust.
[0144] The unique features of a specific type are extracted and compared with the Knowledge in CPM, and the anomaly score of each block in the test image is determined. This completes the calculation of the overall anomaly score of the test image. In order to obtain a more detailed anomaly distribution, the test image will be divided into different blocks, and the score of each block will be calculated in the above manner, but at this time only the features of the block to be calculated are focused on and processed.
[0145] In this way, the anomaly score of each block in the test image can be obtained. In order to obtain a continuous and more intuitive anomaly distribution map, these discrete block scores are further processed by Gaussian smoothing. Gaussian smoothing can ensure that the anomaly scores form a continuous and gradual distribution in the image space, thereby generating the final anomaly score map. The anomaly score map can not only clearly show which areas in the image have anomalies, but also reflect the severity of the anomaly through the gradient of the score, providing an intuitive and powerful tool for subsequent anomaly processing and analysis.
[0146] Through the embodiments of the present application, the provided anomaly identification method demonstrates its high flexibility. Specifically, the algorithm used to calculate the anomaly score map is not limited to the Gaussian smoothing mentioned above, and it can be replaced with other suitable algorithms according to actual needs or application scenarios. This flexibility ensures that the method can adapt to different data distributions and anomaly types, thereby improving its practicality and accuracy.
[0147] In addition to the flexibility of the abnormal score map calculation algorithm, the training process in the embodiment also allows adjustment. For example, the contrastive learning loss function can be modified or replaced according to specific needs to adapt to different training goals and data characteristics. Similarly, the contrastive learning method during training can also be adjusted as needed, which provides the possibility of further optimizing model performance.
[0148] Furthermore, in this embodiment, Prompt is used to enhance the model's ability to extract corresponding types of information without changing the structure of the backbone network. This strategy effectively improves the model's characterization ability and accuracy. However, the embodiment also provides an alternative: adding an adaptation module after the backbone network. This adaptation module can have a similar effect to Prompt, that is, enhancing the model's sensitivity to specific information by fine-tuning or expanding the network structure. This flexibility ensures that the model can be optimized for performance without changing its core structure, thereby reducing the complexity and cost of model adjustment.
[0149] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0150] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0151] According to another aspect of the embodiments of the present application, an abnormality identification device for implementing the above abnormality identification method is also provided. Figure 6 As shown, the device comprises:
[0152] A first acquisition unit 602 is used to acquire a first image to be identified, wherein the first image is an image acquired by capturing an object;
[0153] A first extraction unit 604 is used to perform a first stage feature extraction on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent a visual attribute presented by an object surface, and the object surface includes a surface of an object;
[0154] A first determining unit 606 is configured to determine, from at least one standard visual feature, a first visual feature whose feature similarity to the basic visual feature is greater than or equal to a preset threshold, wherein the standard visual feature is a feature obtained by performing a first stage of extraction on a plurality of sample images belonging to a plurality of object types, and the first visual feature is a feature obtained by performing a first stage of extraction on a second image belonging to a target object type;
[0155] A second acquisition unit 608 is used to acquire target guidance information matched by the first visual feature, wherein the target guidance information is used to guide the features related to the target object type in the focus image;
[0156] A second extraction unit 610 is used to perform a second stage of feature extraction on the first image based on the target guidance information to obtain at least one second visual feature related to the target object type;
[0157] A first comparing unit 612 is configured to compare at least one second visual feature with the standard visual feature of the second image to obtain a comparison result when the standard visual feature of the second image is obtained, wherein the standard visual feature is a feature obtained by performing the second stage feature extraction on the second image;
[0158] The second determining unit 614 is used to determine the abnormality recognition result of the first image through the comparison result.
[0159] For the specific implementation, reference may be made to the example shown in the above-mentioned abnormality identification method, which will not be described in detail in this example.
[0160] As an optional solution, the device also includes:
[0161] a segmentation unit, configured to perform region segmentation on the second image to obtain a first region and a second region before obtaining target guidance information matching the target object type, wherein a feature similarity between each second visual feature in the first region or the second region is greater than or equal to a first threshold;
[0162] A third extraction unit is used for, before obtaining the target guidance information matched with the first visual feature, guiding the image belonging to the target object type through the initial guidance information to perform a second stage of feature extraction, extracting a first sample feature and a second sample feature, wherein the first sample feature is a feature with a first feature attribute, the second sample feature is a feature with a second feature attribute, the first feature attribute is a feature attribute within the first area, and the second feature attribute is a feature attribute within the second area;
[0163] A second comparison unit is used to compare the first sample feature with the second visual feature in the first area to obtain a first result, and compare the second sample feature with the second visual feature in the second area to obtain a second result before obtaining the target guidance information matching the target object type;
[0164] The third determining unit is used to adjust the initial guidance information according to the first result and the second result before acquiring the target guidance information matching the target object type, so as to obtain the target guidance information.
[0165] For the specific implementation, reference may be made to the example shown in the above-mentioned abnormality identification method, which will not be described in detail in this example.
[0166] As an optional solution, the first comparison unit 612 includes:
[0167] A first acquisition module, used for acquiring a first distance between each second visual feature of the at least one second visual feature and the standard visual feature in a feature space, wherein the distance in the feature space is inversely related to the similarity between the features;
[0168] A first determining module, used to determine, from at least one second visual feature, a first feature with the longest first distance and a second feature with the shortest first distance;
[0169] A second acquisition module, used to acquire a second distance between the first feature and the second feature in the feature space;
[0170] The third acquisition module is used to acquire the comparison result based on the second distance.
[0171] For the specific implementation, reference may be made to the example shown in the above-mentioned abnormality identification method, which will not be described in detail in this example.
[0172] As an optional solution, the third acquisition module includes:
[0173] a calculation submodule, used for calculating a third feature adjacent to the second feature in the feature space and a third distance between the first feature and the feature space;
[0174] an optimization submodule, configured to perform robust optimization on the second distance by using the third distance to obtain a target distance, wherein the comparison result includes the target distance;
[0175] The second determining unit 614 includes:
[0176] A second determination module, configured to determine that the first image is in an abnormal state when the target distance is greater than or equal to a preset distance threshold;
[0177] The third determination module is used to determine that the first image is in a normal state when the target distance is less than a preset distance threshold, wherein the abnormality recognition result indicates that the first image is in an abnormal state or a normal state.
[0178] For the specific implementation, reference may be made to the example shown in the above-mentioned abnormality identification method, which will not be described in detail in this example.
[0179] As an optional solution, the first extraction unit 604 includes:
[0180] A first segmentation module, used for segmenting the first image into a first number of image blocks, wherein the image blocks are used for representing local image regions of the first image;
[0181] A first extraction module is used to perform a first stage of feature extraction on a first number of image blocks to obtain a first image feature corresponding to each image block, wherein the basic visual feature includes the first image feature;
[0182] The second extraction unit 610 includes:
[0183] A second segmentation module, used for segmenting the first image into a second number of image blocks, wherein the image blocks are used to represent local image regions of the first image;
[0184] The second extraction module is used to perform a second stage of feature extraction on a second number of image blocks to obtain second image features corresponding to each image block, wherein the second visual features include second image features.
[0185] For the specific implementation, reference may be made to the example shown in the above-mentioned abnormality identification method, which will not be described in detail in this example.
[0186] As an optional solution, the device also includes:
[0187] After performing the second stage of feature extraction on the second number of image blocks to obtain the second image features corresponding to each image block, an execution module is used to perform the following steps until the number of key image features stored according to the target object type is greater than or equal to the number threshold:
[0188] Determining a current image feature from the second image features corresponding to each image block;
[0189] Calculating a fourth distance between other image features except the current image feature in the second image features corresponding to each image block and the current image feature in the feature space, wherein the distance in the feature space is inversely related to the similarity between the features;
[0190] determining the second image feature with the largest fourth distance as the key image feature;
[0191] When the number of obtained key image features is greater than or equal to the number threshold, the obtained key image features are stored according to the target object type;
[0192] When the number of the obtained key image features is less than the number threshold, the next image feature is determined from the second image features corresponding to each image block, and the next image feature is used as the current image feature.
[0193] For the specific implementation, reference may be made to the example shown in the above-mentioned abnormality identification method, which will not be described in detail in this example.
[0194] As an optional solution, the device also includes:
[0195] A setting unit is used for, after performing a first stage of feature extraction on the first image to obtain at least one basic visual feature, setting the object type to which the object belongs as an additional object type when the feature similarity between each standard visual feature in the at least one standard visual feature and the basic visual feature is less than a preset threshold, wherein the additional object type is a type other than the rated object type to which the plurality of sample images belong;
[0196] The acquisition unit is used to acquire standard object objects of additional object types after performing the first stage feature extraction on the first image to obtain at least one basic visual feature, to obtain multiple third images, and use the third images as sample images.
[0197] For the specific implementation, reference may be made to the example shown in the above-mentioned abnormality identification method, which will not be described in detail in this example.
[0198] According to another aspect of the embodiment of the present application, an electronic device for implementing the above-mentioned abnormality identification method is also provided. The electronic device can be but is not limited to being Figure 1 The user device 102 or the server 112 shown in FIG. 1 is used as an example to illustrate the electronic device as the user device 102. Figure 7 As shown, the electronic device includes a memory 702 and a processor 704. The memory 702 stores a computer program, and the processor 704 is configured to execute the steps in any of the above method embodiments through the computer program.
[0199] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0200] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0201] S1, obtaining a first image to be identified, wherein the first image is an image acquired by capturing an object;
[0202] S2, performing a first stage feature extraction on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent a visual attribute presented by an object surface, and the object surface includes a surface of an object;
[0203] S3, determining, from at least one standard visual feature, a first visual feature whose feature similarity with the basic visual feature is greater than or equal to a preset threshold, wherein the standard visual feature is a feature obtained by performing a first stage of extraction on a plurality of sample images belonging to a plurality of object types, and the first visual feature is a feature obtained by performing a first stage of extraction on a second image belonging to the target object type;
[0204] S4, obtaining target guidance information matched by the first visual feature, wherein the target guidance information is used to guide the features related to the target object type in the focus image;
[0205] S5, performing a second stage of feature extraction on the first image based on the target guidance information to obtain at least one second visual feature related to the type of the target object;
[0206] S6, when the standard visual feature of the second image is obtained, comparing at least one second visual feature with the standard visual feature of the second image to obtain a comparison result, wherein the standard visual feature is a feature obtained by performing the second stage of feature extraction on the second image;
[0207] S7, determining the abnormality recognition result of the first image through the comparison result.
[0208] Alternatively, a person skilled in the art may understand that: Figure 7 The structure shown is for illustration only. Figure 7 The structure of the electronic device is not limited. Figure 7 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 7 Different configurations are shown.
[0209] Among them, the memory 702 can be used to store software programs and modules, such as the program instructions / modules corresponding to the abnormality identification method and device in the embodiments of the present application. The processor 704 executes various functional applications and data processing by running the software programs and modules stored in the memory 702, that is, to implement the above-mentioned abnormality identification method. The memory 702 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 702 may further include a memory remotely located relative to the processor 704, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 702 can be specifically but not limited to being used to store information such as the first image, the second image, and the abnormality identification results. As an example, such as Figure 7As shown, the memory 702 may include, but is not limited to, the first acquisition unit 602, the first extraction unit 604, the first determination unit 606, the second acquisition unit 608, the second extraction unit 610, the first comparison unit 612, and the second determination unit 614 in the abnormality identification device. In addition, other module units in the abnormality identification device may also be included but are not limited to, which will not be repeated in this example.
[0210] Optionally, the transmission device 706 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 706 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 706 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0211] In addition, the electronic device further includes: a display 708 for displaying the first image, the second image, abnormality recognition results and other information; and a connection bus 710 for connecting various module components in the electronic device.
[0212] In other embodiments, the user device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, a peer-to-peer network may be formed between the nodes, and any form of computing device, such as a server, user device, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0213] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0214] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0215] It should be noted that the computer system of the electronic device is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0216] The computer system includes a central processing unit (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) or the program loaded from the storage part to the random access memory (RAM). In the random access memory, various programs and data required for system operation are also stored. The central processing unit, the read-only memory and the random access memory are connected to each other through a bus. The input / output interface (I / O interface) is also connected to the bus.
[0217] The following components are connected to the input / output interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a local area network card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the input / output interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0218] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions defined in the system of the present application are executed.
[0219] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0220] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0221] S1, obtaining a first image to be identified, wherein the first image is an image acquired by capturing an object;
[0222] S2, performing a first stage feature extraction on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent a visual attribute presented by an object surface, and the object surface includes a surface of an object;
[0223] S3, determining, from at least one standard visual feature, a first visual feature whose feature similarity with the basic visual feature is greater than or equal to a preset threshold, wherein the standard visual feature is a feature obtained by performing a first stage of extraction on a plurality of sample images belonging to a plurality of object types, and the first visual feature is a feature obtained by performing a first stage of extraction on a second image belonging to the target object type;
[0224] S4, obtaining target guidance information matched by the first visual feature, wherein the target guidance information is used to guide the features related to the target object type in the focus image;
[0225] S5, performing a second stage of feature extraction on the first image based on the target guidance information to obtain at least one second visual feature related to the type of the target object;
[0226] S6, when the standard visual feature of the second image is obtained, comparing at least one second visual feature with the standard visual feature of the second image to obtain a comparison result, wherein the standard visual feature is a feature obtained by performing the second stage of feature extraction on the second image;
[0227] S7, determining the abnormality recognition result of the first image through the comparison result.
[0228] Optionally, in the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0229] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the electronic device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0230] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0231] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods of each embodiment of the present application.
[0232] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0233] In the several embodiments provided in the present application, it should be understood that the disclosed user equipment can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0234] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0235] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0236] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for identifying anomalies, characterized in that: include: Acquire a first image to be identified, wherein the first image is an image acquired by capturing an object; Performing a first stage of feature extraction on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent a visual attribute presented by an object surface, and the object surface includes a surface of the object; Determine, from at least one standard visual feature, a first visual feature whose feature similarity with the basic visual feature is greater than or equal to a preset threshold, wherein the standard visual feature is a feature obtained by performing the first stage of extraction on a plurality of sample images belonging to a plurality of object types, and the first visual feature is a feature obtained by performing the first stage of extraction on a second image belonging to the target object type; Acquire target guidance information matched by the first visual feature, wherein the target guidance information is used to guide the features related to the target object type in the focus image; Performing a second stage of feature extraction on the first image using the target guidance information to obtain at least one second visual feature related to the type of the target object; When the standard visual feature of the second image is obtained, comparing the at least one second visual feature with the standard visual feature of the second image to obtain a comparison result, wherein the standard visual feature of the second image is a feature obtained by performing the second stage of feature extraction on the second image; The abnormality recognition result of the first image is determined through the comparison result.
2. The method according to claim 1, characterized in that Before obtaining the target guidance information matched by the first visual feature, the method further includes: Performing region segmentation on the second image to obtain a first region and a second region, wherein a feature similarity within the first region or within the second region is greater than or equal to a first threshold; Guide the process of performing the second stage of feature extraction on the image belonging to the target object type by using the initial guidance information, extracting a first sample feature and a second sample feature, wherein the first sample feature is a feature having a first feature attribute, the second sample feature is a feature having a second feature attribute, the first feature attribute is a feature attribute within the first area, and the second feature attribute is a feature attribute within the second area; Comparing the first sample feature with a second visual feature in the first area to obtain a first result, and comparing the second sample feature with a second visual feature in the second area to obtain a second result; The initial guidance information is adjusted according to the first result and the second result to obtain the target guidance information.
3. The method according to claim 1, characterized in that The comparing the at least one second visual feature with the standard visual feature of the second image to obtain a comparison result includes: Acquire a first distance between each second visual feature of the at least one second visual feature and the standard visual feature in a feature space, wherein the distance in the feature space is inversely related to the similarity between the features; Determine, from the at least one second visual feature, a first feature having the longest first distance and a second feature having the shortest first distance; Acquire a second distance between the first feature and the second feature in the feature space; Based on the second distance, the comparison result is obtained.
4. The method according to claim 3, characterized in that The obtaining the comparison result based on the second distance includes: calculating a third distance between a third feature adjacent to the second feature in the feature space and the first feature in the feature space; Performing robust optimization on the second distance by using the third distance to obtain a target distance, wherein the comparison result includes the target distance; Determining the abnormality recognition result of the first image through the comparison result includes: When the target distance is greater than or equal to a preset distance threshold, determining that the first image is in an abnormal state; In a case where the target distance is less than the preset distance threshold, it is determined that the first image is in a normal state, wherein the abnormality recognition result indicates that the first image is in the abnormal state or the normal state.
5. The method according to claim 1, characterized in that The first stage of feature extraction is performed on the first image to obtain at least one basic visual feature, including: Dividing the first image into a first number of image blocks, wherein the image blocks are used to represent local image regions of the first image; Performing the first stage of feature extraction on the first number of image blocks to obtain first image features corresponding to each of the image blocks, wherein the basic visual features include the first image features; The step of performing a second stage of feature extraction on the first image by using the target guidance information to obtain at least one second visual feature related to the type of the target object includes: Dividing the first image into a second number of image blocks, wherein the image blocks are used to represent local image regions of the first image; The second stage of feature extraction is performed on the second number of image blocks using the target guidance information to obtain second image features corresponding to each of the image blocks, wherein the second visual features include the second image features.
6. The method according to claim 5, characterized in that After performing the second stage of feature extraction on the second number of image blocks to obtain second image features corresponding to each of the image blocks, the method further includes: Perform the following steps until the number of key image features stored according to the target object type is greater than or equal to a quantity threshold, wherein the key image features are used to update standard visual features belonging to the target object type: Determining a current image feature from the second image features corresponding to each of the image blocks; Calculating a fourth distance in a feature space between other image features except the current image feature among the second image features corresponding to each of the image blocks and the current image feature, wherein the distance in the feature space is inversely related to the similarity between the features; Determining the second image feature with the largest fourth distance as the key image feature; Storing the obtained key image features according to the target object type; In the case that the number of the obtained key image features is less than the number threshold, a next image feature is determined from the second image features corresponding to each of the image blocks, and the next image feature is used as the current image feature.
7. The method according to any one of claims 1 to 6, characterized in that After performing the first stage feature extraction on the first image to obtain at least one basic visual feature, the method further includes: When the feature similarity between each standard visual feature of at least one standard visual feature and the basic visual feature is less than the preset threshold, setting the object type to which the object belongs to as an additional object type, wherein the additional object type is a type other than the rated object type to which the multiple sample images belong; The standard object of the additional object type is collected to obtain a plurality of third images, and the third images are used as the sample images.
8. An abnormality identification device, characterized in that: include: A first acquisition unit, configured to acquire a first image to be identified, wherein the first image is an image acquired by capturing an object; A first extraction unit, configured to perform a first stage of feature extraction on the first image to obtain at least one basic visual feature, wherein the basic visual feature is used to represent a visual attribute presented by an object surface, and the object surface includes a surface of the object; A first determining unit is used to determine, from at least one standard visual feature, a first visual feature whose feature similarity with the basic visual feature is greater than or equal to a preset threshold, wherein the standard visual feature is a feature obtained by performing the first stage of extraction on a plurality of sample images belonging to a plurality of object types, and the first visual feature is a feature obtained by performing the first stage of extraction on a second image belonging to a target object type; A second acquisition unit is used to acquire target guidance information matched by the first visual feature, wherein the target guidance information is used to guide the features related to the target object type in the focus image; A second extraction unit, configured to perform a second stage of feature extraction on the first image according to the target guidance information, to obtain at least one second visual feature related to the type of the target object; a first comparing unit, configured to compare the at least one second visual feature with the standard visual feature of the second image to obtain a comparison result when the standard visual feature of the second image is acquired, wherein the standard visual feature of the second image is a feature obtained by performing the second stage of feature extraction on the second image; The second determining unit is used to determine the abnormality recognition result of the first image according to the comparison result.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed by an electronic device.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.
11. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
Citation Information
Patent Citations
Hierarchical landmark identification method integrating global visual characteristics and local visual characteristics
CN102542058A
Medical image recognition method, electronic equipment and storage medium
CN114972751A
Cited By
Abnormality recognition method and apparatus, and storage medium, electronic device and program product
WO2025139040A1