WO2023087636A1 - Anomaly detection method and apparatus, and electronic device, storage medium and computer program product - Google Patents

Anomaly detection method and apparatus, and electronic device, storage medium and computer program product Download PDF

Info

Publication number
WO2023087636A1
WO2023087636A1 PCT/CN2022/092205 CN2022092205W WO2023087636A1 WO 2023087636 A1 WO2023087636 A1 WO 2023087636A1 CN 2022092205 W CN2022092205 W CN 2022092205W WO 2023087636 A1 WO2023087636 A1 WO 2023087636A1
Authority
WO
WIPO (PCT)
Prior art keywords
feature map
feature
map
original image
maps
Prior art date
Application number
PCT/CN2022/092205
Other languages
French (fr)
Chinese (zh)
Inventor
余家伟
汪翔
郑烨
李韡
吴立威
赵瑞
Original Assignee
上海商汤智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 上海商汤智能科技有限公司 filed Critical 上海商汤智能科技有限公司
Publication of WO2023087636A1 publication Critical patent/WO2023087636A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/0002Inspection of images, e.g. flaw detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/045Combinations of networks
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/08Learning methods
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/02Affine transformations
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20081Training; Learning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20084Artificial neural networks [ANN]

Definitions

  • the present disclosure relates to but not limited to the technical field of computer vision, and in particular relates to an anomaly detection method and device, electronic equipment, storage media and computer program products.
  • the purpose of anomaly detection and localization in the field of computer vision is to identify and locate abnormal areas in images, and is widely used in industrial defect detection, medical image detection, and security detection.
  • the current mainstream anomaly detection method is based on deep learning for abnormal location.
  • due to the lack of abnormal samples it is very difficult to collect and label a large amount of abnormal data in practice, which is not conducive to training a model with high detection accuracy.
  • the industry has proposed unsupervised anomaly detection and positioning technology.
  • the unsupervised anomaly detection and positioning technology detects and locates abnormal areas in the image by modeling normal samples without using any labeling information.
  • Embodiments of the present disclosure provide an anomaly detection method and device, electronic equipment, a storage medium, and a computer program product, which are beneficial to improving the accuracy of image anomaly detection.
  • an embodiment of the present disclosure provides an anomaly detection method, including: performing feature extraction on an original image to obtain a first feature map; mapping the first feature map to a second feature map; and obtaining the original image according to the second feature map The anomaly heat map; according to the anomaly heat map, the abnormal detection result of the original image is obtained.
  • an embodiment of the present disclosure provides an abnormality detection device, including a feature extraction part and a processing part, wherein the feature extraction part is configured to perform feature extraction on an original image to obtain a first feature map, and is also configured to extract The first feature map is mapped to a second feature map; the processing part is configured to obtain an abnormal heat map of the original image according to the second feature map, and is also configured to obtain an abnormal detection result of the original image according to the abnormal heat map.
  • an embodiment of the present disclosure provides an electronic device, including an input device and an output device, and also includes a processor and a computer storage medium; the processor is adapted to implement one or more instructions; and the computer storage medium stores One or more instructions adapted to be loaded by the processor and execute the method as described above.
  • an embodiment of the present disclosure provides a computer storage medium, where one or more instructions are stored in the computer storage medium, and the one or more instructions are suitable for being loaded by a processor and executing the method as described above.
  • an embodiment of the present disclosure provides a computer program product.
  • the computer program product includes a non-transitory computer storage medium storing a computer program.
  • the computer program is read by a computer and executes the method as described above.
  • the first feature map is obtained by extracting the features of the original image; the first feature map is mapped to the second feature map; according to the second feature map, the abnormal heat map of the original image is obtained ; According to the anomaly heat map, the anomaly detection result of the original image is obtained.
  • the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the abnormal heat map obtained can more accurately represent the abnormal distribution (or abnormal region) in the original image, which is conducive to improving the accuracy of image anomaly detection.
  • FIG. 1 is an architecture diagram of an application environment provided by an embodiment of the present disclosure
  • FIG. 2 is a schematic diagram of a deep learning architecture provided by an embodiment of the present disclosure
  • FIG. 3 is a schematic flowchart of an abnormality detection method provided by an embodiment of the present disclosure
  • FIG. 4 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 5 is a schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 7 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure.
  • FIG. 8 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 9 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure.
  • FIG. 10 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 11 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure.
  • FIG. 12 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 13 is a schematic diagram of a reversible conversion provided by an embodiment of the present disclosure.
  • FIG. 14 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 15 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 16 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 17 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 18 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 19 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • FIG. 20 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • Fig. 21 is a diagram of defect prediction results of detecting defects in an image through the anomaly detection method provided by the implementation of the present disclosure provided by the embodiment of the present disclosure;
  • FIG. 22 is a schematic structural diagram of an abnormality detection device provided by an embodiment of the present disclosure.
  • FIG. 23 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • the unsupervised anomaly detection and localization algorithm aims to directly model normal samples, that is, it can detect anomalies and locate abnormal areas.
  • the training data does not contain any label information except for the normal samples themselves.
  • the current technical solutions in this field mainly include image reconstruction, feature distance measurement and feature probability density estimation.
  • Image reconstruction algorithms can achieve image pixel-level segmentation, but the modeling accuracy of high-frequency information is limited.
  • the feature distance measurement depends on maintaining the normal sample feature dictionary, and the nearest neighbor search is required during the test, which is not high in time and space efficiency.
  • the feature probability density estimation is mainly based on the standardized flow model for the maximum likelihood estimation of normal sample features. During the test, the long-tail area of the probability distribution model is judged as abnormal, which has a complete theoretical basis and universal applicability.
  • related algorithms pool the global average of feature maps to obtain a feature vector, and related algorithms Feature maps are modeled block-by-block and differentiated using positional encoding.
  • the former cannot be accurately segmented due to the loss of feature space information, while the latter needs to traverse all small blocks to complete the anomaly detection and location of the whole image, and because it is a local rather than global modeling, the anomaly detection accuracy of this method is limited.
  • the embodiment of the present disclosure provides an abnormality detection method, which can be implemented based on the application environment shown in FIG. 1 .
  • the image acquisition device 101, the user equipment 102 and the electronic device 103 are connected through a wired or wireless network.
  • the image acquisition device 101 can be an image acquisition device in the fields of industry and medical treatment, such as auxiliary medical equipment, depth camera, high-speed rail line patrol, etc.
  • the camera under inspection, etc., the image acquisition device 101 can be configured to perform image acquisition in a specific scene, and send the collected original image to the electronic device 103, and the electronic device 103 performs anomaly detection on the original image, such as extracting
  • the multi-level features of the original image, the multi-level features are reversibly transformed to map the features into probability density estimates, the probability density estimates are post-processed, and the abnormal regions in the original image are located based on the post-processed probability density estimates.
  • a neural network model is deployed in the electronic device 103, and some or all of the steps in the anomaly detection method can be executed by the neural network model, wherein the user device 102 can be configured to provide the electronic device 103 with a positive sample image set , the electronic device 103 can train the neural network through the positive sample image set, and deploy the trained neural network model locally or on other devices.
  • the training device and the invoking device of the neural network model can be the same device or different devices.
  • the electronic device 103 can be a device in a server cluster. After a device has trained the neural network model, it can Deployed on other devices in the cluster, the other devices invoke the neural network model to detect anomalies in images. Since the electronic device 103 better captures the relationship between local information and global information of the original image and retains feature space information when performing anomaly detection, it is beneficial to improve the accuracy of anomaly detection.
  • the electronic device 103 can be an independent physical server, an embedded device or an artificial intelligence device, or a server cluster or a distributed system, and can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, or big data and artificial intelligence platforms are not limited in this disclosure.
  • FIG. 2 is a schematic diagram of a deep learning architecture provided by an embodiment of the present disclosure.
  • the deep learning architecture may at least include a feature extractor 202 and a neural network.
  • the neural network can be a two-dimensional normalized flow (FastFlow) 204
  • the two-dimensional normalized flow 204 can also be called a two-dimensional convolution flow, including at least two reversible transformation blocks f, and the corresponding The convolution kernel sizes in adjacent reversible transformation modules are different.
  • the feature extractor 202 is configured to perform feature extraction on the input image 201 to obtain a feature map 203 with a width of W, a height of H, and a number of channels of C;
  • the two-dimensional normalization flow 204 is configured to use At least two reversible transformation blocks f process the feature map 203 output by the feature extractor 202 to obtain a probability density estimate 205 of the features of the input image 201 .
  • the at least two reversible transformation blocks f may adopt a method of alternating 3*3 convolution and 1*1 convolution (referred to as the method of alternating large and small convolutions), so as to preserve the feature space information of the original image.
  • an affine coupling layer is used in each reversible transformation block f to map the input features.
  • the probability density estimate 205 can be post-processed to obtain the abnormal heat map 206, and the abnormal score in the abnormal heat map 206 is compared with the preset value, and the image The region where the abnormality score is infinitely close to the preset value is determined as a normal region, and the region where the abnormality score is far from the preset value is determined as an abnormal region.
  • the feature extractor 202 can better capture the relationship between the local information and the global information of the input image 201, and the two-dimensional normalization flow 204 adopts alternating large and small convolutions
  • the processing method is conducive to retaining the feature space information of the input image 201, so that a more accurate probability density estimation 205 can be obtained, which in turn is conducive to improving the accuracy of image anomaly detection.
  • FIG. 3 is a schematic flowchart of an anomaly detection method provided by an embodiment of the present disclosure. The method can be implemented based on the application environment shown in FIG. 1 and applied to electronic equipment, as shown in FIG. 3, including S301 to S304:
  • the original image refers to an image collected in actual scenes such as medical care and industry.
  • the sliding window method is usually used in the related art to model the feature map block by block (Patch)
  • use position coding to distinguish, block-by-block modeling requires a large number of image blocks for model training and testing, the computational complexity is relatively high, and because it is modeled for the local area, it is easy to lose the global information of the image, in the subsequent reasoning It is difficult to make full use of the correlation between global information and local information.
  • a residual network (Residual Network, ResNet) or a visual converter (Vision Transformers, ViT) with a distillation token (Token) is used as a feature extractor.
  • the residual network can be a resnet18 network, wide_resnet50_2 network, etc.
  • the visual converter can be a data-efficient image converter (Data-efficient image Transformers, DeiT), a deeper image converter (Going deeper with Image Transformers, CaiT), etc.
  • the feature extractor can also use other pre-trained classification networks, target detection networks, segmentation networks, reconstruction networks, image repair networks and super-resolution networks and other task networks, which are highly scalable.
  • a feature extractor can also be a combination of multiple vision transformers.
  • the feature extractor can be pre-trained, and the datasets it uses are not limited to common vision task datasets and public datasets, and can also be some private datasets.
  • the visual converter since the visual converter has a global receptive field, it has a stronger ability to capture the relationship between the local and the global.
  • the first feature map can be a visual converter The feature map output by a hidden layer in , that is, the feature map of a single level.
  • the ability of the residual network to capture the local and global relationship is relatively lower than that of the visual converter.
  • the first feature map can be the feature map output by multiple residual blocks in the residual network, that is, a multi-level feature map. For example, you can select the feature map output by the first residual block of the residual network, the second residual
  • the feature map output by the block and the feature map output by the third residual block are used as the input of the subsequent neural network model, that is, the input of the two-dimensional normalized flow model.
  • mapping the first feature map to the second feature map is actually performing a reversible conversion process on the first feature map to obtain the probability density estimation of the features of the original image, that is, the feature representation in the second feature map The probability density estimate of the feature at the corresponding location in the original image.
  • the reversible transformation process can be completed through a two-dimensional normalized flow model.
  • the features in the first feature map undergo at least two reversible transformation processes to obtain the corresponding hidden variable, which can be used as the probability density estimation of the corresponding feature .
  • FIG. 4 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. Based on FIG. 3 , S302 can be implemented through S401 , which will be described in conjunction with the steps shown in FIG. 4 .
  • the first feature map is input into the first reversible conversion block f1 of the two-dimensional normalized flow model 204 to perform the first reversible conversion process, and the output is the first reversible conversion process
  • the obtained probability density estimate, the probability density estimate obtained by the first reversible transformation process is input into the second reversible transformation block f2 of the two-dimensional normalized flow model 204 for the second reversible transformation process, and the output is the second reversible transformation
  • the probability density estimate obtained by processing, ..., the probability density estimate obtained by the r-th reversible transformation process is input into the (r+1)th reversible transformation block fr+1 of the two-dimensional normalized flow model 204 for the (r+ 1)
  • the reversible transformation process, the output is the probability density estimate obtained by the (r+1)th reversible transformation process, after at least two reversible transformation processes, the second feature map is obtained.
  • the feature map output by the second reversible transformation process or the feature map output by any reversible transformation process after the second reversible transformation process can be used as the second feature map, specifically see the two-dimensional normalized flow model 204 Depends on the number of reversible transformation blocks f.
  • normalizing flows Normalizing Flows, NF
  • NF Normalizing Flows
  • the mapping of the first feature map in the embodiment of the present disclosure should also be bidirectionally reversible. Assuming that the first feature map is X1 and the probability density estimate is Z, then the mapping of X1 to Z should satisfy formula (1) and formula ( 2):
  • H denotes the reversibly transformed feature map
  • K denotes the number of reversibly transformed blocks f.
  • the size of the two-dimensional convolution kernel used in the first invertible transformation process in at least two invertible transformation processes is different from the size of the two-dimensional convolution kernel used in the second invertible transformation process, and the second The first reversible conversion process is the previous reversible conversion process of the second reversible conversion process.
  • the size of the two-dimensional convolution kernels used by at least two reversible transformation blocks f may be in a manner of alternating 3*3 convolutions and 1*1 convolutions. It should be noted that the alternating appearance is intended to emphasize the alternating appearance of large and small convolution kernels, and is not limited to the alternating appearance of 3*3 convolution and 1*1 convolution.
  • the first feature map extracted by the feature extractor it is mapped through the two-dimensional normalized flow model, and the method of alternating large and small convolution kernels is used in the model, which is conducive to retaining the feature space of the original image information, which is conducive to the subsequent obtaining of the first probability density estimation with higher accuracy.
  • the second feature map is a feature map obtained by mapping the single-level feature map.
  • Figure 5 is a schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure. As shown in Figure 5, for an original image of 3*256*256, it is assumed that 256*64 The first feature map of *64, the first feature map is mapped by at least two reversible transformation blocks f in the two-dimensional normalized flow model to obtain the second feature map of 256*64*64.
  • the visual converter when the first feature map is a single-level feature map, since the visual converter itself has excellent global capture capabilities, its output is used as the input of the two-dimensional normalized flow model, which can fully The local-global relationship between the features of the original image is used, which is beneficial to improving the accuracy of the first probability density estimation.
  • FIG. 6 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. Implementation will be described in conjunction with the steps shown in FIG. 6 .
  • multiple second feature maps are obtained.
  • the multiple second feature maps correspond to the multi-level feature maps one-to-one.
  • the features in the multiple second feature maps Represents the probability density estimate of the feature at the corresponding location in the original image.
  • FIG. 7 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure.
  • the first feature map of the level are 256*64*64, 512*32*32 and 1024*16*16 respectively
  • the first feature maps of the three levels are respectively passed through at least two reversible two-dimensional normalized flow models
  • the mapping of the transformation block f results in a plurality of second feature maps corresponding to the scales.
  • the first feature map is a multi-level feature map
  • multiple two-dimensional normalized flow models perform reversible conversion processing on the feature maps of each level in parallel, which is beneficial to improve the inference speed.
  • FIG. 8 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. The implementation to S803 will be described in conjunction with the steps shown in FIG. 8 .
  • For the third feature map obtain a second feature map through at least two reversible transformation processes.
  • FIG. 9 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure.
  • the scales are 512*32*32, 1024*16*16 and 2048*8*8 respectively
  • the reference scale can be determined from the scales of the three first feature maps, for example, 16*16 as the reference scale, that is, the first feature map of 1024*16*16 can be kept unchanged, and the first feature map of 512*32*32 is down-sampled to obtain the first feature to be stitched of 2048*16*16
  • the first feature map of 2048*8*8 is up-sampled to obtain the first feature map to be stitched of 512*16*16
  • the target second feature map of 1024*16*16 is also used as the first feature map to be stitched
  • the feature map is spliced, and then the three first feature maps, for example, 16*16 as the reference scale, that is, the first feature map of 1024*16*16 can be kept unchanged, and the first feature map of
  • the third feature map is mapped by at least two reversible transformation blocks f in the two-dimensional normalized flow model to obtain a second feature map corresponding to the scale.
  • the multi-level feature maps are normalized and concatenated, which is beneficial to reduce the number of two-dimensional normalized flow models and reduce the need to deploy multiple two-dimensional normalized flow models. The overhead brought by the inference of the streaming model.
  • FIG. 10 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • S302 can also pass The implementation of S1001 to S1004 will be described in conjunction with the steps shown in FIG. 10 .
  • For the fifth feature map obtain a second feature map through at least two reversible transformation processes.
  • FIG. 11 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure.
  • four residual blocks are processed , to generate the first feature maps of three levels, the scales are 512*32*32, 1024*16*16 and 2048*8*8 respectively, the first feature maps of the three levels are respectively passed through the two-dimensional normalized flow model
  • the mapping of at least two reversible transformation blocks f results in three fourth feature maps corresponding to the scales. Determine the reference scale from the scales of the three fourth feature maps.
  • 16*16 can be used as the reference scale, that is, the fourth feature map of 1024*16*16 can remain unchanged, and the fourth feature map of 512*32*32
  • the feature map is down-sampled to obtain the second feature map to be stitched of 2048*16*16, and the fourth feature map of 2048*8*8 is up-sampled to obtain the second feature map to be stitched of 512*16*16, and , the fourth feature map of 1024*16*16 is also used as the second feature map to be stitched, and then the three second feature maps to be stitched are stitched into a fifth feature map of (2048+1024+512)*16*16.
  • the fifth feature map is mapped by at least two reversible transformation blocks f in the two-dimensional normalized flow model to obtain the second feature map corresponding to the scale.
  • the first feature map is a multi-level feature map
  • multiple two-dimensional normalized flow models perform reversible conversion processing on the feature maps of each level in parallel, which is beneficial to improve the inference speed.
  • normalizing and splicing multi-scale feature maps in the two-dimensional normalized flow model is conducive to making full use of multi-level features for probability density estimation.
  • the two-dimensional normalized flow model can also be used to process the feature map. The flexibility of the model setting is high, not only for multiple inputs and multiple outputs, but also for multiple inputs and single outputs.
  • FIG. 12 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. As shown in FIG. 12, any one of the at least two reversible conversion processes in S401 can pass through The implementation of S1203 will be described in conjunction with the steps shown in FIG. 12 .
  • the target feature map For the target feature map to be subjected to reversible conversion processing, split the target feature map into a first sub-target feature map and a second sub-target feature map; the number of channels of the first sub-target feature map and the second sub-target feature map are equal ;
  • the second to-be-connected feature map of the first affine coupling operation in the at least one affine coupling operation is the first sub-target feature map or the second sub-target feature map; the at least one affine coupling
  • the second to-be-connected feature map of the non-first affine coupling operation in operation is the feature map obtained by the last affine coupling operation of the non-first affine coupling operation.
  • FIG. 13 is a schematic diagram of a reversible transformation provided by an embodiment of the present disclosure.
  • FIG. 13 shows the processing flow in each reversible transformation block f, and the input target feature map in the affine coupling layer y1301, for example:
  • the target feature map y1301 can be the first feature map, the third feature map or the fifth feature map, first perform zero initialization through the scaling and bias layer (Actnorm) with data-dependent initialization, and then perform channel transformation (Channel Permute), and then split it into the first sub-target feature map y a 1302 and the second sub-target feature map y b 1303 with the number of channels C/2, and its formula is expressed as formula (3):
  • the input y a and y b it is processed by at least one affine coupling operation, and the output of the last affine coupling operation is used as the first feature map to be connected.
  • the output of the first is connected (Concat) with y a or y b to obtain the feature map 1304 after reversible transformation, that is, a reversible transformation process is completed.
  • the first feature map to be connected is connected to y a , and the second feature map to be connected is y a at this time;
  • the affine coupling operation is to perform two-dimensional convolution processing on y b , then connect the first feature map to be connected with y b , and at this time the second feature map to be connected is y b .
  • the first feature map to be connected output by one of the affine coupling operations is connected with the feature map output by the previous affine coupling operation of this affine coupling operation to obtain a reversible transformation
  • the final feature map 1304 is to complete a reversible transformation process.
  • the second feature map to be connected is the feature map obtained by one of the affine coupling operations.
  • connecting the first feature map to be connected with the second feature map to be connected may be splicing feature maps based on channels.
  • FIG. 14 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. As shown in FIG. 14, any one of the at least one affine coupling operation in S1202 can pass S1401 The implementation to S1404 will be described in conjunction with the steps shown in FIG. 14 .
  • any affine coupling operation is the first affine coupling operation
  • any affine coupling operation is a non-first affine coupling operation
  • y′ b represents the output of the first affine coupling operation.
  • this y′ b can be used as the first feature map to be connected, and it can be connected with y a .
  • the feature map after reversible transformation can be obtained, and its formula is expressed as formula (5):
  • y′ represents the reversibly transformed feature map
  • y′ a represents the identity map of y a
  • concat( ) represents the concatenation
  • any affine coupling operation is the mth affine coupling operation, such as the second affine coupling operation
  • the first affine coupling operation is performed through two subnetworks s( ⁇ ) and b( ⁇ )
  • the output y′ b of the operation is subjected to two-dimensional convolution to obtain the second scaling coefficient s2 and the second translation coefficient b2, and the exponent operation exp with the natural logarithm base e as the base number is performed on s2 to obtain s(y′ b ), using s( y′ b ) and b2 calculate the linear combination of y′ b and the input y a of the two-dimensional convolution processing in the first affine coupling operation, and obtain the output of the second affine coupling operation.
  • affine coupling operations refer to the description in the second affine coupling operation.
  • the two-dimensional convolution layer is used in the two subnets s( ⁇ ) and b( ⁇ ) to perform two-dimensional convolution, which is beneficial to retain the spatial position information of the features of the original image.
  • the embodiment of the present disclosure adopts a two-dimensional convolutional layer in the two-dimensional normalized flow model, so that the model supports tensor as input, and can realize the estimation of the tensor probability density end-to-end.
  • the probability density estimates corresponding to positions in all 64*64 second feature maps are summed by squares , calculate the mean value of the sum of squares at each position to obtain a 1*64*64 abnormal heat map, and scale the abnormal heat map to obtain an abnormal heat map of the target scale, such as a 1*256*256 abnormal heat map, where, Scaling can be upsampling, eg linear interpolation.
  • the features in the abnormal heat map of 1*256*256 are used to represent the abnormal score of the corresponding position in the original image.
  • FIG. 6 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • S303 can be implemented through S602 to S603 , which will continue to be described in conjunction with the steps shown in FIG. 6 .
  • FIG. 15 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • S603 can be implemented through S1501 to S1502 , which will be described in conjunction with the steps shown in FIG. 15 .
  • S1502. Perform scale normalization on the feature map to be normalized, and fuse the scale-normalized feature maps to obtain an abnormal heat map.
  • the abnormal heat map of 1*64*64, the abnormal heat map of 1*32*32 and the abnormal heat map of 1*16*16 are the feature maps to be normalized, and the feature maps to be normalized are scaled to the target scale , get the feature map after scale normalization, and fuse it to get the final anomaly heat map.
  • the scaling can be upsampling, specifically linear interpolation, where the target scale can be the scale of the original image (256*256), or the scale of the feature map to be normalized, which is not limited here.
  • the multi-scale second feature map output by each two-dimensional normalized flow model is scaled and fused, which is conducive to fully utilizing multi-level features to estimate the probability density.
  • FIG. 16 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. Based on FIG. 8, in the case where the first feature map includes multi-level feature maps, it corresponds to FIG. 9 or FIG. 11 In the illustrated embodiment, S303 may be implemented through S1601 to S1603, which will be described in conjunction with the steps shown in FIG. 16 .
  • the second feature map of (2048+1024+512)*16*16 is obtained, and for all 16*16 Calculate the sum of the squares of the probability density corresponding to the position in the two feature maps, calculate the mean value of the sum of squares at each position to obtain a 1*16*16 abnormal heat map (that is, the feature map to be scaled), and scale the feature map to be scaled Obtain an abnormal score map of the target scale, such as a 1*256*256 abnormal heat map, and the features in the 1*256*256 abnormal heat map are used to represent the abnormal score of the corresponding position in the original image.
  • scaling may be upsampling, for example, may be linear interpolation.
  • FIG. 17 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure.
  • S304 can be implemented through S1701 to S1702 , which will be described in conjunction with the steps shown in FIG. 17 .
  • the preset value is determined based on the distribution parameters of the normal image, that is, compare the abnormality score in the abnormality heat map with the preset value to obtain the difference between the two;
  • S1702. Determine the abnormal region in the original image according to the difference between the abnormality score and the preset value, and obtain an abnormality detection result.
  • the preset value is determined based on the distribution parameters of the normal image.
  • the preset value can be the center 0 of the normal distribution of the normal image.
  • the abnormal score in the original image can be calculated The area close to 0 is determined as a normal area, and the area with an abnormal score much greater than 0 or far less than 0 is determined as an abnormal area.
  • the embodiment of the present disclosure obtains the first feature map by performing feature extraction on the original image; maps the first feature map to the second feature map; obtains the abnormal heat map of the original image according to the second feature map; Heat map to get the anomaly detection results of the original image.
  • the first feature map is beneficial to better capture the relationship between the local and the global image of the original image
  • the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the local and global features of the original image relationship, feature space information, and post-processing the second feature map, the obtained anomaly heat map can more accurately represent the abnormal area in the original image, which is conducive to improving the accuracy of image anomaly detection.
  • FIG. 18 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure, which can also be implemented based on the application environment shown in FIG. 1, as shown in FIG. 18, including S1801 to S1804:
  • the size of the two-dimensional convolution kernel used in the first reversible transformation process in the at least two reversible transformation processes is different from the size of the two-dimensional convolution kernel used in the second reversible transformation process, and the first reversible transformation process The last reversible conversion process that is processed as the second reversible conversion process.
  • FIG. 19 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. As shown in FIG. 19, before performing feature extraction on the original image to obtain the first feature map, the method also includes S1901 Steps to S1904 will be described in conjunction with the steps shown in FIG. 19 .
  • the positive sample image can be an image in the anomaly detection or positioning data set MVTec AD, BTAD BeanTech or CIFAR-10, and the feature extractor shown in Figure 2 can be used to perform feature extraction on the positive sample image.
  • the feature extractor It can be a residual network or a visual converter, and the sixth feature map can be a single-level feature map or a multi-level feature map.
  • the neural network refers to a two-dimensional normalized flow including at least two reversible transformation blocks f
  • the sixth feature map is input into the two-dimensional normalized flow for at least two reversible transformation processes to obtain the seventh feature map, that is, by At least two reversible conversion blocks f map the feature x in the sixth feature map X2 to a normal distribution Q with a mean of 0 and a variance of 1 to obtain a probability density estimate q of the features of the positive sample image.
  • the purpose is to make the model Learn the distribution of positive sample images (i.e. normal images).
  • FIG. 20 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. 19, as shown in FIG. Outlined steps are described.
  • mapping x to q is expressed as formula (6):
  • the mapping of the two-dimensional normalized flow to the sixth feature map X2, that is, the process of performing reversible conversion processing on the sixth feature map X2, can refer to the reversible conversion processing of the first feature map in the embodiment shown in Figure 3 description of.
  • FIG. 21 is a diagram of defect prediction results of defects in an image detected by the anomaly detection method provided by the implementation of the present disclosure provided by the embodiment of the present disclosure.
  • FIG. 21 shows a diagram of defect prediction results for images of four items, where each item includes three original images.
  • the original image 2101 is first input, the first feature map is obtained through feature extraction, and then the first feature map is mapped to the second feature map, and the original image 2101 is obtained according to the second feature map
  • the defect prediction result can be obtained, that is, the defect prediction result schematic diagram 2102 corresponding to the original image 2101 is obtained. From the defect prediction result diagram 2102 , it can be seen that the abnormal region location result corresponding to the defect part in the original image 2101 is obtained.
  • the embodiment of the present disclosure obtains the first feature map by performing feature extraction on the original image; maps the first feature map to the second feature map; obtains the abnormal heat map of the original image according to the second feature map; Heat map to get the anomaly detection results of the original image.
  • the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the obtained anomaly heat map can more accurately represent the abnormal area in the original image, which is conducive to improving the accuracy of image anomaly detection.
  • FIG. 22 is a schematic structural diagram of an anomaly detection device 2200 provided by the embodiment of the present disclosure, as shown in FIG. 22 , the device includes a feature extraction part 2201 and a processing part 2202; wherein, the feature extraction part 2201 is configured to perform feature extraction on the original image to obtain a first feature map; the feature extraction part 2201 is also configured to convert the first feature map The mapping is the second feature map; the processing part 2202 is configured to obtain the abnormal heat map of the original image according to the second feature map; the processing part 2202 is also configured to obtain the abnormal detection result of the original image according to the abnormal heat map.
  • the first feature map is obtained by performing feature extraction on the original image; the first feature map is mapped to the second feature map; according to the second feature map, the abnormality of the original image is obtained Heat map: According to the abnormal heat map, the abnormal detection results of the original image are obtained. Since the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the obtained anomaly heat map can more accurately represent the abnormal area in the original image, which is conducive to improving the accuracy of image anomaly detection.
  • the feature extraction part 2201 is further configured to: map the first feature map to the second feature map through at least two reversible transformation processes; wherein , the size of the two-dimensional convolution kernel used in the first reversible transformation process in at least two reversible transformation processes is different from the size of the two-dimensional convolution kernel used in the second reversible transformation process, the first reversible transformation process The last reversible transformation processed for the second reversible transformation.
  • the feature extraction part 2201 is further configured to: for multi-level feature maps Scale normalization is performed to obtain a plurality of first feature maps to be stitched, and the plurality of first feature maps to be stitched are in one-to-one correspondence with multi-level feature maps; the plurality of first feature maps to be stitched is stitched into a third feature map; For the third feature map, the second feature map is obtained through at least two reversible transformation processes.
  • the feature extraction part 2201 is further configured to: for the multi-level feature map , through at least two reversible transformation processes, multiple fourth feature maps are obtained, and multiple fourth feature maps are in one-to-one correspondence with multi-level feature maps; scale normalization is performed on multiple fourth feature maps to obtain multiple fourth feature maps Two feature maps to be spliced, a plurality of second feature maps to be spliced are in one-to-one correspondence with a plurality of fourth feature maps; multiple second feature maps to be spliced are spliced into a fifth feature map; for the fifth feature map, through at least two The second reversible transformation process is performed to obtain the second feature map.
  • the features in the second feature map represent the probability density estimates of the features at corresponding positions in the original image; in terms of obtaining the abnormal heat map of the original image according to the second feature map, the processing part 2202 is further configured to: In the channel dimension, the sum of the squares of the probability density estimates corresponding to the positions in the second feature map is calculated; based on the mean value of the sum of squares, the feature map to be scaled is obtained; the feature map to be scaled is scaled to obtain an abnormal heat map.
  • the feature extraction part 2201 is further configured to: for the multi-level feature map , through at least two reversible transformation processes, a plurality of second feature maps are obtained, and the plurality of second feature maps correspond to the multi-level feature maps one by one, and the features in the plurality of second feature maps represent the features of the corresponding positions in the original image Probability density estimation of ; in terms of obtaining the abnormal heat map of the original image according to the second feature map, the processing part 2202 is also configured to: for each second feature map in a plurality of second feature maps, in the channel dimension, for Calculate the sum of squares of the probability density estimates corresponding to the positions in each second feature map; and obtain an abnormal heat map according to the sum of squares.
  • the processing part 2202 is further configured to: calculate the mean value of the sum of squares to obtain the feature map to be normalized corresponding to each second feature map; Scale normalization is performed on the scale-normalized feature maps, and the scale-normalized feature maps are fused to obtain an abnormal heat map.
  • the feature extraction part 2101 is further configured to: for the target feature map to be subjected to the reversible transformation process, split the target feature map into the first A sub-target feature map and a second sub-target feature map; the number of channels of the first sub-target feature map and the second sub-target feature map are equal; for the first sub-target feature map and the second sub-target feature map, Through at least one affine coupling operation, the first feature map to be connected is obtained; the first feature map to be connected is connected to the second feature map to be connected to obtain a reversibly transformed feature map; wherein, the at least one affine The second feature map to be connected in the first affine coupling operation in the coupling operation is the first sub-target feature map or the second sub-target feature map; the non-first affine coupling in the at least one affine coupling operation The second to-be-connected feature map of the operation is the feature map obtained by the last affin
  • the feature extraction part 2201 is further configured to: when any one of the affine coupling operations is the first affine coupling operation, Perform two-dimensional convolution processing on the first sub-target feature map or the second sub-target feature map to obtain the first scaling coefficient and the first translation coefficient; using the first scaling coefficient and the first translation coefficient, the two-dimensional convolution will not be performed
  • the processed second sub-target feature map or the first sub-target feature map is linearly combined with the input of the two-dimensional convolution processing in the first affine coupling operation to obtain the output of the first affine coupling operation; in any affine coupling
  • the operation is a non-first affine coupling operation
  • two-dimensional convolution processing is performed on the output of the last affine coupling operation of the non-first affine coupling operation to obtain a second scaling coefficient and a second translation coefficient; using the first The second scaling coefficient and the second translation coefficient linearly combine the output of the last affin
  • the second feature map is a feature map obtained by mapping a single-level feature map
  • the features in the second feature map represent the original Probability density estimation of features corresponding to positions in the image
  • the processing part 2202 is also configured to: in the channel dimension, the probability density corresponding to the position in the second feature map Estimate the sum of squares; based on the mean of the sum of squares, obtain the feature map to be scaled; scale the feature map to be scaled to obtain an abnormal heat map.
  • the features in the abnormal heat map are used to represent the abnormal score of the corresponding position in the original image.
  • the processing part 2202 is further configured to: obtain the abnormal score The difference with the preset value, the preset value is determined based on the distribution parameters of the normal image; the abnormal region in the original image is determined according to the difference between the abnormality score and the preset value, and the abnormality detection result is obtained.
  • performing feature extraction on the first feature map to obtain the second feature map is performed through a neural network model
  • the processing part 2202 is further configured to: perform feature extraction on the positive sample image to obtain the sixth feature map; Mapping the sixth feature map to a seventh feature map through a neural network, the features in the seventh feature map represent the probability density estimates of the features in the corresponding positions in the positive sample image; determine the target loss according to the probability density estimation in the seventh feature map; Adjust the parameters of the neural network based on the target loss to obtain the neural network model.
  • the processing part 2202 in determining the target loss from the probability density estimate in the seventh feature map, is further configured to: determine the pair of features in the sixth feature map from the probability density estimate in the seventh feature map Log-likelihood estimation; The negative log-likelihood estimation of the features in the sixth feature map is used as the target loss.
  • various parts in the abnormality detection device 2200 shown in FIG. Divided into multiple functionally smaller parts, this can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present disclosure.
  • the above parts are divided based on logical functions.
  • the functions of one part can also be realized by multiple parts, or the functions of multiple parts can be realized by one part.
  • the anomaly detection device 2200 may also include other parts.
  • these functions may also be implemented with the assistance of other parts, and may be implemented by cooperation of multiple parts.
  • a central processing unit or called CPU (Central Processing Unit, central processing unit)
  • RAM Random Access Memory
  • ROM read-only storage medium
  • Read-Only Memory other processing elements and storage elements
  • computer general-purpose computing devices run computer programs (including program codes) that can execute the steps involved in the corresponding methods as shown in Figure 3 or Figure 18, to
  • An anomaly detection device as shown in FIG. 22 is constructed to implement the anomaly detection method of the embodiment of the present disclosure.
  • the computer program can be recorded in, for example, a computer-readable recording medium, loaded into the above-mentioned computing device through the computer-readable recording medium, and executed therein.
  • an embodiment of the present disclosure further provides an electronic device 2300 .
  • the electronic device at least includes a processor 2310 , an input device 2320 , an output device 2330 and a computer storage medium 2340 .
  • the processor 2310, the input device 2320, the output device 2330 and the computer storage medium 2340 in the electronic device 2300 may be connected through a bus or other means.
  • the computer storage medium 2340 may be stored in the memory of the electronic device 2300, the computer storage medium 2340 is used to store a computer program, the computer program includes program instructions, and the processor 2310 is used to execute the program stored in the computer storage medium 2340.
  • the processor 2310 is the computing core and control core of the electronic device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to realize corresponding method procedures or corresponding functions.
  • the processor 2310 of the electronic device 2300 provided by the embodiments of the present disclosure may be configured to perform a series of anomaly detection processes: perform feature extraction on the original image to obtain a first feature map; map the first feature map to The second feature map; according to the second feature map, an abnormal heat map of the original image is obtained; according to the abnormal heat map, an abnormal detection result of the original image is obtained.
  • the first feature map is obtained by performing feature extraction on the original image; the first feature map is mapped to the second feature map; and the original image is obtained according to the second feature map
  • the anomaly heat map according to the anomaly heat map, the abnormal detection result of the original image is obtained. Since the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the obtained anomaly heat map can more accurately represent the abnormal area in the original image, which is conducive to improving the accuracy of image anomaly detection.
  • the processor 2310 performing the mapping of the first feature map to the second feature map includes: mapping the first feature map to the second feature map through at least two reversible conversion processes; wherein the at least two The size of the two-dimensional convolution kernel used in the first reversible conversion process in the second reversible conversion process is different from the size of the two-dimensional convolution kernel used in the second reversible conversion process, and the first reversible conversion process is The previous reversible conversion process of the second reversible conversion process.
  • the processor 2310 executes mapping the first feature map to the second feature map, including: performing scale normalization on the multi-level feature maps , to obtain a plurality of first feature maps to be spliced, and a plurality of first feature maps to be spliced are in one-to-one correspondence with multi-level feature maps; a plurality of first feature maps to be spliced are spliced into a third feature map; for the third feature map , through at least two reversible transformation processes to obtain the second feature map.
  • the processor 2310 executes mapping the first feature map to the second feature map, including: for a multi-level feature map, pass at least twice Reversible conversion processing to obtain multiple fourth feature maps, which correspond to multi-level feature maps one by one; scale normalization for multiple fourth feature maps to obtain multiple second feature maps to be stitched , multiple second feature maps to be spliced correspond to multiple fourth feature maps one-to-one; multiple second feature maps to be spliced are spliced into a fifth feature map; for the fifth feature map, through at least two reversible conversion processes, Get the second feature map.
  • the features in the second feature map represent the probability density estimation of the features corresponding to the position in the original image; the processor 2310 executes to obtain the abnormal heat map of the original image according to the second feature map, including: in the channel dimension, Calculate the sum of the squares of the probability density estimates corresponding to the positions in the second feature map; obtain the feature map to be scaled based on the mean of the sum of squares; and scale the feature map to be scaled to obtain an abnormal heat map.
  • the processor 2301 executes mapping the first feature map to the second feature map, including: for a multi-level feature map, pass at least twice Reversible conversion processing to obtain a plurality of second feature maps, the plurality of second feature maps correspond to the multi-level feature maps one by one, and the features in the plurality of second feature maps represent probability density estimates of features at corresponding positions in the original image;
  • the processor 2310 executes to obtain the abnormal heat map of the original image according to the second feature map, including: for each second feature map in multiple second feature maps, in the channel dimension, corresponding to the position in each second feature map Calculate the sum of the squares of the probability density estimate; according to the sum of squares, an abnormal heat map is obtained.
  • the processor 2310 executes obtaining the abnormal heat map according to the sum of squares, including: obtaining the feature map to be normalized corresponding to each second feature map based on the mean value of the sum of squares; Scale normalization and fusion of the scale-normalized feature maps to obtain an abnormal heat map.
  • the processor 2201 performs any one of the at least two reversible transformation processes, including: for the target feature map to be subjected to the reversible transformation process, splitting the target feature map into a first sub-target feature map and The second sub-target feature map; the number of channels of the first sub-target feature map and the second sub-target feature map are equal; for the first sub-target feature map and the second sub-target feature map, through at least one affine coupling operation to obtain the first feature map to be connected; connect the first feature map to be connected with the second feature map to be connected to obtain a reversibly transformed feature map; wherein, the first affine in the at least one affine coupling operation
  • the second to-be-connected feature map of the affine coupling operation is the first sub-target feature map or the second sub-target feature map; the second to-be-connected feature map of the non-first affine coupling operation in the at least one affine coupling operation
  • the feature map is the feature map obtained by the last affine
  • the processor 2310 executes any one of the at least one affine coupling operation, including: when any one of the affine coupling operations is the first affine coupling operation, performing the first sub-target feature Two-dimensional convolution processing is performed on the map or the second sub-target feature map to obtain the first scaling coefficient and the first translation coefficient; the second sub-target that has not been subjected to two-dimensional convolution processing is obtained by using the first scaling coefficient and the first translation coefficient
  • the feature map or the first sub-target feature map is linearly combined with the input of the two-dimensional convolution processing in the first affine coupling operation to obtain the output of the first affine coupling operation; any affine coupling operation is a non-first affine
  • two-dimensional convolution processing is performed on the output of the last affine coupling operation of the non-first affine coupling operation to obtain a second scaling coefficient and a second translation coefficient; the second scaling coefficient and the second The translation coefficient, the output of the last
  • the second feature map is a feature map obtained by mapping a single-level feature map
  • the features in the second feature map represent the original The probability density estimation of the features corresponding to the position in the image
  • the processor 2310 executes according to the second feature map to obtain the abnormal heat map of the original image, including: in the channel dimension, calculate the sum of the squares of the probability density estimates corresponding to the positions in the second feature map ; Based on the mean value of the sum of squares, the feature map to be scaled is obtained; the feature map to be scaled is scaled to obtain an abnormal heat map.
  • the features in the anomaly heat map are used to represent the anomaly score of the corresponding position in the original image
  • the processor 2310 executes to obtain the abnormality detection result of the original image according to the anomaly heat map, including: obtaining the anomaly score and the preset value The default value is determined based on the distribution parameters of the normal image; the abnormal area in the original image is determined according to the difference between the abnormal score and the preset value, and the abnormal detection result is obtained.
  • performing feature extraction on the first feature map to obtain the second feature map is performed through a neural network model
  • the processor 2310 executes the training of the neural network model, including: performing feature extraction on the positive sample image to obtain the second feature map Six feature maps; the sixth feature map is mapped to the seventh feature map through the neural network, and the features in the seventh feature map represent the probability density estimation of the features corresponding to the position in the positive sample image; according to the probability density estimation in the seventh feature map Determine the target loss; adjust the parameters of the neural network based on the target loss to obtain a neural network model.
  • the processor 2310 performing determining the target loss according to the probability density estimation in the seventh feature map includes: determining the log likelihood estimation of the features in the sixth feature map according to the probability density estimation in the seventh feature map ; Estimate the negative log-likelihood of the features in the sixth feature map as the target loss.
  • the electronic device 2310 may include but not limited to a processor 2310, an input device 2320, an output device 2330, a computer storage medium 2340, a memory 2350, a power supply 2360 and an application client part 2370, and the input device 2320 may be a keyboard 2321, a touch screen 2322, a radio frequency receiver 2323, etc., and the output device 2330 may be a speaker 2331, a display 2332, a radio frequency transmitter 2333, etc.
  • the schematic diagram is only an example of the electronic device 2300, and does not constitute a limitation to the electronic device 2300. part.
  • the processor 2310 of the electronic device 2300 executes the computer program to implement the steps in the above-mentioned anomaly detection method
  • the embodiments of the above-mentioned anomaly detection method are all applicable to the electronic device 2300, and can achieve the same or similar beneficial effect.
  • An embodiment of the present disclosure also provides a computer storage medium (Memory).
  • the computer storage medium may be a volatile storage medium or a non-volatile storage medium, and is a memory device in the electronic device 2200 for storing programs and data. It can be understood that the computer storage medium here may include a built-in storage medium in the terminal, and of course may also include an extended storage medium supported by the terminal.
  • the computer storage medium provides storage space, and the storage space stores the operating system of the terminal.
  • one or more instructions suitable for being loaded and executed by the processor 2310 are also stored in the storage space, and these instructions may be one or more computer programs (including program codes).
  • the computer storage medium here can be a high-speed random access memory (Random Access Memory, RAM) memory, or a non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory; It may be at least one computer-readable storage medium located away from the aforementioned processor 2310.
  • the processor 2310 can load and execute one or more instructions stored in the computer storage medium, so as to realize the corresponding steps of the above-mentioned anomaly detection method.
  • the computer program on the computer storage medium includes computer program code
  • the computer program code may be in the form of source code, object code, executable file or some intermediate form.
  • the computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (Read-Only Memory, ROM) , random access memory (Random Access Memory, RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
  • An embodiment of the present disclosure further provides a computer program product, wherein the above computer program product includes a computer program, and the above computer program is operable to cause a computer to execute the steps in the above anomaly detection method.
  • the computer program product may be a software installation package.
  • the disclosed device may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the parts is only a logical function division.
  • multiple parts or components can be combined or can be Integrate into another system, or some features may be ignored, or not implemented.
  • the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or parts may be in electrical or other forms.
  • the parts described as separate components may or may not be physically separated, and the components displayed as "parts" may or may not be physical parts, that is, they may be located in one place, or may be distributed to multiple network parts superior. Some or all of them can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional "part" in each embodiment of the present disclosure may be integrated into one processing part, each part may exist separately physically, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units can be implemented not only in the form of hardware, but also in the form of software program modules.
  • the integrated parts may be stored in a computer-readable memory if implemented in the form of software program modules and sold or used as independent products. Based on such an understanding, the essence of the technical solution disclosed in this disclosure 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, and the computer software product is stored in a memory.
  • Several instructions are included to make a computer device (which may be a personal computer, server or network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present disclosure.
  • the first feature map is obtained by extracting features from the original image; the first feature map is mapped to the second feature map; according to the second feature map, the abnormal heat map of the original image is obtained; according to the abnormal heat map, Get the anomaly detection results of the original image. Since the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the abnormal heat map obtained can more accurately represent the abnormal distribution (or abnormal region) in the original image, which is conducive to improving the accuracy of image anomaly detection.

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Artificial Intelligence (AREA)
  • General Engineering & Computer Science (AREA)
  • Computational Linguistics (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Software Systems (AREA)
  • Mathematical Physics (AREA)
  • Computing Systems (AREA)
  • Health & Medical Sciences (AREA)
  • Biomedical Technology (AREA)
  • Biophysics (AREA)
  • Molecular Biology (AREA)
  • Evolutionary Biology (AREA)
  • Probability & Statistics with Applications (AREA)
  • Quality & Reliability (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Image Analysis (AREA)

Abstract

The embodiments of the present disclosure provide an anomaly detection method and apparatus, and an electronic device, a storage medium and a computer program product. The method comprises: performing feature extraction on an original image to obtain a first feature map; mapping the first feature map into a second feature map; obtaining an anomaly heat map of the original image according to the second feature map; and obtaining an anomaly detection result of the original image according to the anomaly heat map.

Description

异常检测方法及装置、电子设备、存储介质和计算机程序产品Abnormality detection method and device, electronic device, storage medium and computer program product
相关申请的交叉引用Cross References to Related Applications
本专利申请要求2021年11月16日提交的中国专利申请号为202111359576.3,申请人为上海商汤智能科技有限公司,申请名称为“异常检测方法及装置、电子设备和存储介质”的优先权,该申请的全文以引用的方式并入本公开中。This patent application claims the priority of the Chinese patent application number 202111359576.3 submitted on November 16, 2021, the applicant is Shanghai Shangtang Intelligent Technology Co., Ltd., and the application name is "abnormal detection method and device, electronic equipment and storage medium". The entirety of the application is incorporated by reference into this disclosure.
技术领域technical field
本公开涉及但不限于计算机视觉技术领域,尤其涉及一种异常检测方法及装置、电子设备、存储介质和计算机程序产品。The present disclosure relates to but not limited to the technical field of computer vision, and in particular relates to an anomaly detection method and device, electronic equipment, storage media and computer program products.
背景技术Background technique
计算机视觉领域的异常检测和定位的目的是识别和定位出图像中的异常区域,被广泛应用于工业缺陷检测、医学图像检测和安全检测等领域。目前主流的异常检测方法是基于深度学习进行异常定位,然而,由于异常样本的缺失使得在实践中收集和标注大量的异常数据变得十分困难,不利于训练出检测精度较高的模型。为解决这一问题,业内提出了无监督异常检测定位技术,无监督异常检测定位技术通过对正常样本建模,不采用任何标注信息检测并定位出图像中的异常区域。The purpose of anomaly detection and localization in the field of computer vision is to identify and locate abnormal areas in images, and is widely used in industrial defect detection, medical image detection, and security detection. The current mainstream anomaly detection method is based on deep learning for abnormal location. However, due to the lack of abnormal samples, it is very difficult to collect and label a large amount of abnormal data in practice, which is not conducive to training a model with high detection accuracy. In order to solve this problem, the industry has proposed unsupervised anomaly detection and positioning technology. The unsupervised anomaly detection and positioning technology detects and locates abnormal areas in the image by modeling normal samples without using any labeling information.
发明内容Contents of the invention
本公开实施例提供了一种异常检测方法及装置、电子设备、存储介质和计算机程序产品,有利于提升图像异常检测的精度。Embodiments of the present disclosure provide an anomaly detection method and device, electronic equipment, a storage medium, and a computer program product, which are beneficial to improving the accuracy of image anomaly detection.
一方面,本公开实施例提供一种异常检测方法,包括:对原始图像进行特征提取,得到第一特征图;将第一特征图映射为第二特征图;根据第二特征图,得到原始图像的异常热力图;根据异常热力图,得到原始图像的异常检测结果。On the one hand, an embodiment of the present disclosure provides an anomaly detection method, including: performing feature extraction on an original image to obtain a first feature map; mapping the first feature map to a second feature map; and obtaining the original image according to the second feature map The anomaly heat map; according to the anomaly heat map, the abnormal detection result of the original image is obtained.
另一方面,本公开实施例提供一种异常检测装置,包括特征提取部分和处理部分,其中,特征提取部分,被配置为对原始图像进行特征提取,得到第一特征图,还被配置为将所述第一特征图映射为第二特征图;处理部分,被配置为根据第二特征图,得到原始图像的异常热力图,还被配置为根据异常热力图,得到原始图像的异常检测结果。On the other hand, an embodiment of the present disclosure provides an abnormality detection device, including a feature extraction part and a processing part, wherein the feature extraction part is configured to perform feature extraction on an original image to obtain a first feature map, and is also configured to extract The first feature map is mapped to a second feature map; the processing part is configured to obtain an abnormal heat map of the original image according to the second feature map, and is also configured to obtain an abnormal detection result of the original image according to the abnormal heat map.
再一方面,本公开实施例提供一种电子设备,包括输入设备和输出设备,还包括处理器和计算机存储介质;处理器,适于实现一条或多条指令;以及,计算机存储介质,存储有一条或多条指令,所述一条或多条指令适于由所述处理器加载并执行如上述所述的方法。In yet another aspect, an embodiment of the present disclosure provides an electronic device, including an input device and an output device, and also includes a processor and a computer storage medium; the processor is adapted to implement one or more instructions; and the computer storage medium stores One or more instructions adapted to be loaded by the processor and execute the method as described above.
又一方面,本公开实施例提供一种计算机存储介质,计算机存储介质存储有一条或多条指令,所述一条或多条指令适于由处理器加载并执行如上述所述的方法。In yet another aspect, an embodiment of the present disclosure provides a computer storage medium, where one or more instructions are stored in the computer storage medium, and the one or more instructions are suitable for being loaded by a processor and executing the method as described above.
又一方面,本公开实施例提供一种计算机程序产品,计算机程序产品包括存储了计算机程序的非瞬时性计算机存储介质,所述计算机程序被计算机读取并执行如上述所述的方法。In yet another aspect, an embodiment of the present disclosure provides a computer program product. The computer program product includes a non-transitory computer storage medium storing a computer program. The computer program is read by a computer and executes the method as described above.
实施本公开实施例,具有如下有益效果:Implementing the embodiments of the present disclosure has the following beneficial effects:
可以看出,在本公开实施例中,通过对原始图像进行特征提取,得到第一特征图;将第一特征图映射为第二特征图;根据第二特征图,得到原始图像的异常热力图;根据异常热力图,得到原始图像的异常检测结果。由于第一特征图有利于更好地捕获原始图像局部与全局的关系,同时,对第一特征图进行映射得到的第二特征图保留了原始图像的特征空间信息,这样基于原始图像局部与全局的关系、特征空间信息及对第二特征图进行后处理,得到的异常热力图能够更准确地表示出原始图像中的异常分布(或异常区域),从而有利于提升图像异常检测的精度。It can be seen that in the embodiment of the present disclosure, the first feature map is obtained by extracting the features of the original image; the first feature map is mapped to the second feature map; according to the second feature map, the abnormal heat map of the original image is obtained ; According to the anomaly heat map, the anomaly detection result of the original image is obtained. Since the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the abnormal heat map obtained can more accurately represent the abnormal distribution (or abnormal region) in the original image, which is conducive to improving the accuracy of image anomaly detection.
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,而非限制本公开。It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
附图说明Description of drawings
为了更清楚地说明本公开实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only These are some embodiments of the present disclosure. Those skilled in the art can also obtain other drawings based on these drawings without creative work.
此处的附图被并入说明书中并构成本说明书的一部分,这些附图示出了符合本公开的实施例,并与说明书一起用于说明本公开的技术方案。The accompanying drawings here are incorporated into the description and constitute a part of the present description. These drawings show embodiments consistent with the present disclosure, and are used together with the description to explain the technical solution of the present disclosure.
图1为本公开实施例提供的一种应用环境的架构图;FIG. 1 is an architecture diagram of an application environment provided by an embodiment of the present disclosure;
图2为本公开实施例提供的一种深度学习架构的示意图;FIG. 2 is a schematic diagram of a deep learning architecture provided by an embodiment of the present disclosure;
图3为本公开实施例提供的一种异常检测方法的流程示意图;FIG. 3 is a schematic flowchart of an abnormality detection method provided by an embodiment of the present disclosure;
图4为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 4 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图5为本公开实施例提供的一种获取异常热力图的示意图;FIG. 5 is a schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure;
图6为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 6 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图7为本公开实施例提供的另一种获取异常热力图的示意图;FIG. 7 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure;
图8为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 8 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图9为本公开实施例提供的另一种获取异常热力图的示意图;FIG. 9 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure;
图10为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 10 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图11为本公开实施例提供的另一种获取异常热力图的示意图;FIG. 11 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure;
图12为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 12 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图13为本公开实施例提供的一种可逆转换的示意图;FIG. 13 is a schematic diagram of a reversible conversion provided by an embodiment of the present disclosure;
图14为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 14 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图15为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 15 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图16为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 16 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图17为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 17 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图18为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 18 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图19为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 19 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图20为本公开实施例提供的另一种异常检测方法的流程示意图;FIG. 20 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure;
图21为本公开实施例提供的通过本公开实施提供的异常检测方法对图像中的缺陷进行检测的缺陷预测结果示图;Fig. 21 is a diagram of defect prediction results of detecting defects in an image through the anomaly detection method provided by the implementation of the present disclosure provided by the embodiment of the present disclosure;
图22为本公开实施例提供的一种异常检测装置的结构示意图;FIG. 22 is a schematic structural diagram of an abnormality detection device provided by an embodiment of the present disclosure;
图23为本公开实施例提供的一种电子设备的结构示意图。FIG. 23 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
具体实施方式Detailed ways
下面将结合本公开实施例中的附图,对本公开实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本公开一部分实施例,而不是全部的实施例。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。The following will clearly and completely describe the technical solutions in the embodiments of the present disclosure with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are part of the embodiments of the present disclosure, not all of them. Based on the embodiments in the present disclosure, all other embodiments obtained by persons of ordinary skill in the art without creative efforts fall within the protection scope of the present disclosure.
本公开的说明书和权利要求书及所述附图中的术语“第一”、“第二”、“第三”和“第四”等是用于区别不同对象,而不是用于描述特定顺序。此外,术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或部分的过程、方法、系统、产品或设备没有限定于已列出的步骤或部分,而是可能还包括没有列出的步骤或部分,或可能还包括对于这些过程、方法、产品或设备固有的其它步骤或发。The terms "first", "second", "third" and "fourth" in the description and claims of the present disclosure and the drawings are used to distinguish different objects, not to describe a specific order . Furthermore, the terms "include" and "have", as well as any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or device that includes a series of steps or parts is not limited to the steps or parts listed, but may also include steps or parts that are not listed, or may also include for these processes, other steps or developments inherent in the method, product, or apparatus.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结果或特性可以包含在本公开的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference herein to an "embodiment" means that a particular feature, result, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present disclosure. The occurrences of this phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is understood explicitly and implicitly by those skilled in the art that the embodiments described herein can be combined with other embodiments.
无监督异常检测定位算法旨在直接对正常样本建模,即能检测异常并定位异常区域,训练数据除了正常样本本身,不包含任何标注信息。当前该领域的技术方案主要包括图像重建、特征距离度量和特征概率密度估计。The unsupervised anomaly detection and localization algorithm aims to directly model normal samples, that is, it can detect anomalies and locate abnormal areas. The training data does not contain any label information except for the normal samples themselves. The current technical solutions in this field mainly include image reconstruction, feature distance measurement and feature probability density estimation.
图像重建类算法可以做到图像像素级分割,但对高频信息的建模精度有限。特征距离度量依赖于维护正常样本特征字典,测试时需做最近邻搜索,在时间和空间效率上都不高。特征概率密度估计主要是基于标准化流模型做正常样本特征的最大似然估计,测试时将概率分布模型的长尾区域判定为异常,其具有完备的理论依据和普适性。Image reconstruction algorithms can achieve image pixel-level segmentation, but the modeling accuracy of high-frequency information is limited. The feature distance measurement depends on maintaining the normal sample feature dictionary, and the nearest neighbor search is required during the test, which is not high in time and space efficiency. The feature probability density estimation is mainly based on the standardized flow model for the maximum likelihood estimation of normal sample features. During the test, the long-tail area of the probability distribution model is judged as abnormal, which has a complete theoretical basis and universal applicability.
但目前相关算法内部实现上述技术方案均为全连接网络,所以仅支持一维特征向量的概率密度估计,例如,相关的算法将特征图全局平均池化,得到一条特征向量,还有相关的算法对特征图逐块建模,并利用位置编码加以区分。前者由于丢失了特征空间信息而无法精确分割,后者则需要遍历所有小块才能完成全图的异常检测与定位,且由于是对局部而非全局的建模,该方法的异常检测精度有限。However, at present, the above-mentioned technical solutions in related algorithms are all fully connected networks, so they only support probability density estimation of one-dimensional feature vectors. For example, related algorithms pool the global average of feature maps to obtain a feature vector, and related algorithms Feature maps are modeled block-by-block and differentiated using positional encoding. The former cannot be accurately segmented due to the loss of feature space information, while the latter needs to traverse all small blocks to complete the anomaly detection and location of the whole image, and because it is a local rather than global modeling, the anomaly detection accuracy of this method is limited.
本公开实施例提供了一种异常检测方法,可基于图1所示的应用环境实施,如图1所示,该应用环境中至少可以包括图像采集设备101、用户设备102和电子设备103。其中,图像采集设备101、用户设备102和电子设备103通过有线或无线的网络连接,图像采集设备101可以是工业和医疗等领域中的图像采集装置,比如辅助医疗设备、深度相机、高铁线路巡检中的摄像机,等等,图像采集设备101可被配置为在特定场景中进行图像采集,并向电子设备103发送采集的原始图像,由电子设备103对该原始图像进行异常检测,比如提取出原始图像的多层级特征,对多层级特征进行可逆转换处理以将特征映射为概率密度 估计,对概率密度估计进行后处理,基于经过后处理的概率密度估计定位出原始图像中的异常区域。The embodiment of the present disclosure provides an abnormality detection method, which can be implemented based on the application environment shown in FIG. 1 . As shown in FIG. Among them, the image acquisition device 101, the user equipment 102 and the electronic device 103 are connected through a wired or wireless network. The image acquisition device 101 can be an image acquisition device in the fields of industry and medical treatment, such as auxiliary medical equipment, depth camera, high-speed rail line patrol, etc. The camera under inspection, etc., the image acquisition device 101 can be configured to perform image acquisition in a specific scene, and send the collected original image to the electronic device 103, and the electronic device 103 performs anomaly detection on the original image, such as extracting The multi-level features of the original image, the multi-level features are reversibly transformed to map the features into probability density estimates, the probability density estimates are post-processed, and the abnormal regions in the original image are located based on the post-processed probability density estimates.
在一些实施例中,电子设备103中部署有神经网络模型,异常检测方法中的部分或全部步骤可通过神经网络模型执行,其中,用户设备102可被配置为向电子设备103提供正样本图像集,电子设备103可通过正样本图像集对神经网络进行训练,并将训练好的神经网络模型部署在本地或其他设备。需要说明的是,神经网络模型的训练设备和调用设备可以是同一设备,也可以是不同设备,比如电子设备103可以是服务器集群中的设备,一设备在训练好神经网络模型后,可将其部署在集群中的其他设备上,由该其他设备调用该神经网络模型对图像进行异常检测。由于电子设备103在进行异常检测时,更好地捕获了原始图像局部信息与全局信息的关系,且保留了特征空间信息,因此,有利于提升异常检测的精度。In some embodiments, a neural network model is deployed in the electronic device 103, and some or all of the steps in the anomaly detection method can be executed by the neural network model, wherein the user device 102 can be configured to provide the electronic device 103 with a positive sample image set , the electronic device 103 can train the neural network through the positive sample image set, and deploy the trained neural network model locally or on other devices. It should be noted that the training device and the invoking device of the neural network model can be the same device or different devices. For example, the electronic device 103 can be a device in a server cluster. After a device has trained the neural network model, it can Deployed on other devices in the cluster, the other devices invoke the neural network model to detect anomalies in images. Since the electronic device 103 better captures the relationship between local information and global information of the original image and retains feature space information when performing anomaly detection, it is beneficial to improve the accuracy of anomaly detection.
示例性的,电子设备103可以是独立的物理服务器、嵌入式设备或人工智能设备,也可以是服务器集群或者分布式系统,还可以是提供云服务、云数据库、云计算、云函数、云存储、网络服务、云通信、中间件服务、域名服务、安全服务或大数据和人工智能平台等基础云计算服务的云服务器,本公开对此不作限定。Exemplarily, the electronic device 103 can be an independent physical server, an embedded device or an artificial intelligence device, or a server cluster or a distributed system, and can also provide cloud services, cloud databases, cloud computing, cloud functions, cloud storage Cloud servers for basic cloud computing services such as network services, cloud communications, middleware services, domain name services, security services, or big data and artificial intelligence platforms are not limited in this disclosure.
以下结合相关附图对本公开实施例提供的深度学习架构进行简要描述。The deep learning architecture provided by the embodiments of the present disclosure will be briefly described below in conjunction with related drawings.
请参见图2,图2为本公开实施例提供的一种深度学习架构的示意图,如图2所示,该深度学习架构至少可以包括特征提取器202和神经网络。,Please refer to FIG. 2 . FIG. 2 is a schematic diagram of a deep learning architecture provided by an embodiment of the present disclosure. As shown in FIG. 2 , the deep learning architecture may at least include a feature extractor 202 and a neural network. ,
在一些实施例中,神经网络可以是二维归一化流(FastFlow)204,该二维归一化流204也可以称为二维卷积流,包括至少2个可逆转换块f,并且相邻的可逆转换模块中的卷积核尺寸不同。其中,特征提取器202,被配置为对输入的输入图像201进行特征提取,得到宽度为W、高度为H和通道数为C的特征图203;二维归一化流204,被配置为采用至少两个可逆转换块f对特征提取器202输出的特征图203进行处理,得到输入图像201的特征的概率密度估计205。In some embodiments, the neural network can be a two-dimensional normalized flow (FastFlow) 204, the two-dimensional normalized flow 204 can also be called a two-dimensional convolution flow, including at least two reversible transformation blocks f, and the corresponding The convolution kernel sizes in adjacent reversible transformation modules are different. Among them, the feature extractor 202 is configured to perform feature extraction on the input image 201 to obtain a feature map 203 with a width of W, a height of H, and a number of channels of C; the two-dimensional normalization flow 204 is configured to use At least two reversible transformation blocks f process the feature map 203 output by the feature extractor 202 to obtain a probability density estimate 205 of the features of the input image 201 .
示例性的,至少两个可逆转换块f可以采用3*3卷积和1*1卷积交替处理的方式(简称为大小卷积交替处理的方式),以保留原始图像的特征空间信息。其中,每个可逆转换块f中使用仿射耦合层对输入的特征进行映射。基于二维归一化流204输出的概率密度估计205,可将该概率密度估计205进行后处理以得到异常热力图206,将异常热力图206中的异常评分与预设值进行比较,将图像中该异常评分无限趋近于预设值的区域确定为正常区域,将该异常评分远离于预设值的区域确定为异常区域。Exemplarily, the at least two reversible transformation blocks f may adopt a method of alternating 3*3 convolution and 1*1 convolution (referred to as the method of alternating large and small convolutions), so as to preserve the feature space information of the original image. Among them, an affine coupling layer is used in each reversible transformation block f to map the input features. Based on the probability density estimate 205 output by the two-dimensional normalized flow 204, the probability density estimate 205 can be post-processed to obtain the abnormal heat map 206, and the abnormal score in the abnormal heat map 206 is compared with the preset value, and the image The region where the abnormality score is infinitely close to the preset value is determined as a normal region, and the region where the abnormality score is far from the preset value is determined as an abnormal region.
可以看出,在本公开实施例提供的深度学习架构中,特征提取器202能更好地捕获输入图像201的局部信息和全局信息的关系,而二维归一化流204采用大小卷积交替处理的方式有利于保留输入图像201的特征空间信息,从而能够得到更准确的概率密度估计205,进而有利于提升图像异常检测的精度。It can be seen that in the deep learning framework provided by the disclosed embodiment, the feature extractor 202 can better capture the relationship between the local information and the global information of the input image 201, and the two-dimensional normalization flow 204 adopts alternating large and small convolutions The processing method is conducive to retaining the feature space information of the input image 201, so that a more accurate probability density estimation 205 can be obtained, which in turn is conducive to improving the accuracy of image anomaly detection.
以下结合相关附图对本公开实施例提供的异常检测方法进行详细阐述。The anomaly detection method provided by the embodiments of the present disclosure will be described in detail below in conjunction with related drawings.
请参见图3,图3为本公开实施例提供的一种异常检测方法的流程示意图,该方法可基于图1所示的应用环境实施,且应用于电子设备,如图3所示,包括S301至S304:Please refer to FIG. 3. FIG. 3 is a schematic flowchart of an anomaly detection method provided by an embodiment of the present disclosure. The method can be implemented based on the application environment shown in FIG. 1 and applied to electronic equipment, as shown in FIG. 3, including S301 to S304:
S301、对原始图像进行特征提取,得到第一特征图。S301. Perform feature extraction on the original image to obtain a first feature map.
在一些实施例中,原始图像是指医疗、工业等实际场景中采集的图像,应理解,在异常检测的特征提取方面,相关技术中通常采用滑动窗口方法对特征图逐块(Patch)建模并利用位置编码加以区分,逐块建模需要大量的图像块进行模型训练和测试,计算复杂度相对较高,且由于是针对局部进行建模,容易丢失图像的全局信息,在后续的推理中难以充分利用到全局信息与局部信息的相关性。In some embodiments, the original image refers to an image collected in actual scenes such as medical care and industry. It should be understood that, in terms of feature extraction for anomaly detection, the sliding window method is usually used in the related art to model the feature map block by block (Patch) And use position coding to distinguish, block-by-block modeling requires a large number of image blocks for model training and testing, the computational complexity is relatively high, and because it is modeled for the local area, it is easy to lose the global information of the image, in the subsequent reasoning It is difficult to make full use of the correlation between global information and local information.
本公开实施例中,采用残差网络(Residual Network,ResNet)或带有蒸馏令牌(Token)的视觉转换器(Vision Transformers,ViT)作为特征提取器,比如,残差网络可以是resnet18网络、wide_resnet50_2网络等,视觉转换器可以是数据高效的图像转换器(Data-efficient image Transformers,DeiT)、更深的图像转换器(Going deeper with Image Transformers,CaiT)等。特征提取器还可以采用其他预训练分类网络、目标检测网络、分割网络、重构网络、图像修复网络和超分辨网络等各类任务网络,可扩展性强。特征提取器还可以是多种视觉转换器的组合。In the embodiment of the present disclosure, a residual network (Residual Network, ResNet) or a visual converter (Vision Transformers, ViT) with a distillation token (Token) is used as a feature extractor. For example, the residual network can be a resnet18 network, wide_resnet50_2 network, etc., the visual converter can be a data-efficient image converter (Data-efficient image Transformers, DeiT), a deeper image converter (Going deeper with Image Transformers, CaiT), etc. The feature extractor can also use other pre-trained classification networks, target detection networks, segmentation networks, reconstruction networks, image repair networks and super-resolution networks and other task networks, which are highly scalable. A feature extractor can also be a combination of multiple vision transformers.
需要说明的是,特征提取器可以是预先训练好的,其所采用的数据集不限于常见视觉任务数据集和公开数据集,还可以是某些私有数据集。It should be noted that the feature extractor can be pre-trained, and the datasets it uses are not limited to common vision task datasets and public datasets, and can also be some private datasets.
示例性的,由于视觉转换器具有全局的感受野,因此其拥有更强的捕获局部与全局关系的能力,在采用视觉转换器作为特征提取器的情况下,第一特征图可以是视觉转换器中某一隐藏层输出的特征图,即单层级的特征图。Exemplarily, since the visual converter has a global receptive field, it has a stronger ability to capture the relationship between the local and the global. In the case of using the visual converter as a feature extractor, the first feature map can be a visual converter The feature map output by a hidden layer in , that is, the feature map of a single level.
示例性的,残差网络在捕获局部与全局关系方面的能力相对低于视觉转换器,在采用视觉转换器作为特征提取器的情况下,为了能够更好地捕获原始图像局部与全局的关系,第一特征图可以是残差网络中多个残差块输出的特征图,即多层级的特征图,比如,可以选取残差网络第1个残差块输出的特征图、第2个残差块输出的特征图和第3个残差块输出的特征图作为后续神经网络模型的输入,即二维归一化流模型的输入。Exemplarily, the ability of the residual network to capture the local and global relationship is relatively lower than that of the visual converter. In the case of using the visual converter as a feature extractor, in order to better capture the local and global relationship of the original image, The first feature map can be the feature map output by multiple residual blocks in the residual network, that is, a multi-level feature map. For example, you can select the feature map output by the first residual block of the residual network, the second residual The feature map output by the block and the feature map output by the third residual block are used as the input of the subsequent neural network model, that is, the input of the two-dimensional normalized flow model.
S302、将第一特征图映射为第二特征图。S302. Map the first feature map to a second feature map.
在一些实施例中,将第一特征图映射为第二特征图实际上是对第一特征图进行可逆转换处理,以得到原始图像的特征的概率密度估计,即第二特征图中的特征表示原始图像中对应位置的特征的概率密度估计。例如,可逆转换处理可以通过二维归一化流模型完成,第一特征图中的特征经过至少两次可逆转换处理,即可得到对应的隐变量,该隐变量可作为对应特征的概率密度估计。In some embodiments, mapping the first feature map to the second feature map is actually performing a reversible conversion process on the first feature map to obtain the probability density estimation of the features of the original image, that is, the feature representation in the second feature map The probability density estimate of the feature at the corresponding location in the original image. For example, the reversible transformation process can be completed through a two-dimensional normalized flow model. The features in the first feature map undergo at least two reversible transformation processes to obtain the corresponding hidden variable, which can be used as the probability density estimation of the corresponding feature .
请参见图4,图4为本公开实施例提供的另一种异常检测方法的流程示意图,基于图3,S302可以通过S401实现,将结合图4示出的步骤进行说明。Please refer to FIG. 4 . FIG. 4 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. Based on FIG. 3 , S302 can be implemented through S401 , which will be described in conjunction with the steps shown in FIG. 4 .
S401、通过至少两次可逆转换处理,将第一特征图映射为第二特征图。S401. Map the first feature map to the second feature map through at least two reversible transformation processes.
本公开实施例中,请继续参见图2,将第一特征图输入二维归一化流模型204的第1个可逆转换块f1进行第1次可逆转换处理,输出为第1次可逆转换处理得到的概率密度估计,将第1次可逆转换处理得到的概率密度估计输入二维归一化流模型204的第2个可逆转换块f2进行第2次可逆转换处理,输出为第2次可逆转换处理得到的概率密度估计,……,将第r次可逆转换处理得到的概率密度估计输入二维归一化流模型204的第(r+1)个可逆转换块fr+1进行第(r+1)次可逆转换处理,输出为第(r+1)次可逆转换处理得到的概率密度估计,经过至少两次可逆转换处理,得到第二特征图。比如,可将第2次可逆转换处理输出的特征图或第2次可逆转换处理之后的任意一次可逆转换处理输出的特征图作为该第二特征图,具体视二维归一化流模型204中可逆转换块f的数量而定。应理解,归一化流(Normalizing Flows,NF)主要用于学习数据分布之间的转换,其特殊性质是它们的转换过程是双向的,流模型可以在两个方向上使用。基于此,本公开实施例对第一特征图的映射也应该是双向可逆的,假设第一特征图为X1、概率密度估计为Z,则将X1映射为Z应满足公式(1)和公式(2):In the embodiment of the present disclosure, please continue to refer to FIG. 2 , the first feature map is input into the first reversible conversion block f1 of the two-dimensional normalized flow model 204 to perform the first reversible conversion process, and the output is the first reversible conversion process The obtained probability density estimate, the probability density estimate obtained by the first reversible transformation process is input into the second reversible transformation block f2 of the two-dimensional normalized flow model 204 for the second reversible transformation process, and the output is the second reversible transformation The probability density estimate obtained by processing, ..., the probability density estimate obtained by the r-th reversible transformation process is input into the (r+1)th reversible transformation block fr+1 of the two-dimensional normalized flow model 204 for the (r+ 1) The reversible transformation process, the output is the probability density estimate obtained by the (r+1)th reversible transformation process, after at least two reversible transformation processes, the second feature map is obtained. For example, the feature map output by the second reversible transformation process or the feature map output by any reversible transformation process after the second reversible transformation process can be used as the second feature map, specifically see the two-dimensional normalized flow model 204 Depends on the number of reversible transformation blocks f. It should be understood that normalizing flows (Normalizing Flows, NF) are mainly used to learn the transformation between data distributions, and their special property is that their transformation process is bidirectional, and the flow model can be used in both directions. Based on this, the mapping of the first feature map in the embodiment of the present disclosure should also be bidirectionally reversible. Assuming that the first feature map is X1 and the probability density estimate is Z, then the mapping of X1 to Z should satisfy formula (1) and formula ( 2):
Figure PCTCN2022092205-appb-000001
Figure PCTCN2022092205-appb-000001
and
Figure PCTCN2022092205-appb-000002
Figure PCTCN2022092205-appb-000002
其中,H表示可逆转换后的特征图,K表示可逆转换块f的数量。where H denotes the reversibly transformed feature map and K denotes the number of reversibly transformed blocks f.
示例性的,至少两次可逆转换处理中的第一次可逆转换处理所采用的二维卷积核的尺寸与第二次可逆转换处理所采用的二维卷积核的尺寸不同,所述第一次可逆转换处理为所述第二次可逆转换处理的上一次可逆转换处理。如图2所示,至少两个可逆转换块f所采用的二维卷积核的尺寸可以是3*3卷积和1*1卷积交替出现的方式。需要说明的是,交替出现旨在强调大小卷积核的交替出现,并不局限于3*3卷积和1*1卷积交替出现。Exemplarily, the size of the two-dimensional convolution kernel used in the first invertible transformation process in at least two invertible transformation processes is different from the size of the two-dimensional convolution kernel used in the second invertible transformation process, and the second The first reversible conversion process is the previous reversible conversion process of the second reversible conversion process. As shown in FIG. 2 , the size of the two-dimensional convolution kernels used by at least two reversible transformation blocks f may be in a manner of alternating 3*3 convolutions and 1*1 convolutions. It should be noted that the alternating appearance is intended to emphasize the alternating appearance of large and small convolution kernels, and is not limited to the alternating appearance of 3*3 convolution and 1*1 convolution.
该实施方式中,对于特征提取器提取出的第一特征图,通过二维归一化流模型对其进行映射,模型内采用大小卷积核交替处理的方式,有利于保留原始图像的特征空间信息,从而有利于后续得到准确度更高的第一概率密度估计。In this embodiment, for the first feature map extracted by the feature extractor, it is mapped through the two-dimensional normalized flow model, and the method of alternating large and small convolution kernels is used in the model, which is conducive to retaining the feature space of the original image information, which is conducive to the subsequent obtaining of the first probability density estimation with higher accuracy.
示例性的,在第一特征图为单层级的特征图的情况下,第二特征图为对单层级的特征图进行映射得到的特征图。例如,请参见图5,图5为本公开实施例提供的一种获取异常热力图的示意图,如图5所示,对于3*256*256的原始图像,假设在特征提取阶段产生256*64*64的第一特征图,第一特征图经过二维归一化流模型中至少两个可逆转换块f的映射得到256*64*64的第二特征图。该实施方式中,在第一特征图为单层级的特征图的情况下,由于视觉转换器本身就具有优异的全局捕获能力,将其输出作为二维归一化流模型的输入,能够充分利用到原始图像的特征的局部与全局关系,从而有利于提升第一概率密度估计的准确度。Exemplarily, when the first feature map is a single-level feature map, the second feature map is a feature map obtained by mapping the single-level feature map. For example, please refer to Figure 5. Figure 5 is a schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure. As shown in Figure 5, for an original image of 3*256*256, it is assumed that 256*64 The first feature map of *64, the first feature map is mapped by at least two reversible transformation blocks f in the two-dimensional normalized flow model to obtain the second feature map of 256*64*64. In this embodiment, when the first feature map is a single-level feature map, since the visual converter itself has excellent global capture capabilities, its output is used as the input of the two-dimensional normalized flow model, which can fully The local-global relationship between the features of the original image is used, which is beneficial to improving the accuracy of the first probability density estimation.
请参见图6,图6为本公开实施例提供的另一种异常检测方法的流程示意图,在图3的基础上,在第一特征图包括多层级的特征图的情况下,S302可以通过S601实现,将结合图6示出的步骤进行说明。Please refer to FIG. 6. FIG. 6 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. Implementation will be described in conjunction with the steps shown in FIG. 6 .
S601、对于多层级的特征图,通过至少两次可逆转换处理,得到多个第二特征图,多个第二特征图与多层级的特征图一一对应,多个第二特征图中的特征表示原始图像中对应位置的特征的概率密度估计。S601. For a multi-level feature map, through at least two reversible conversion processes, multiple second feature maps are obtained. The multiple second feature maps correspond to the multi-level feature maps one-to-one. The features in the multiple second feature maps Represents the probability density estimate of the feature at the corresponding location in the original image.
例如,请参见图7,图7为本公开实施例提供的另一种获取异常热力图的示意图,如图7所示,对于3*256*256的原始图像,假设在特征提取阶段产生三个层级的第一特征图,尺度分别为256*64*64、512*32*32和1024*16*16,三个层级的第一特征图分别经过二维归一化流模型中至少两个可逆转换块f的映射得到尺度对应的多个第二特征图。该实施方式中,在第一特征图为多层级的特征图的情况下,多个二维归一化流模型并行对每个层级的特征图进行可逆转换处理,有利于提升推理速度。For example, please refer to FIG. 7. FIG. 7 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure. As shown in FIG. 7, for an original image of 3*256*256, it is assumed that three The first feature map of the level, the scales are 256*64*64, 512*32*32 and 1024*16*16 respectively, the first feature maps of the three levels are respectively passed through at least two reversible two-dimensional normalized flow models The mapping of the transformation block f results in a plurality of second feature maps corresponding to the scales. In this embodiment, when the first feature map is a multi-level feature map, multiple two-dimensional normalized flow models perform reversible conversion processing on the feature maps of each level in parallel, which is beneficial to improve the inference speed.
请参见图8,图8为本公开实施例提供的另一种异常检测方法的流程示意图,在图3的基础上,在第一特征图包括多层级的特征图的情况下,S302可以通过S801至S803实现,将结合图8示出的步骤进行说明。Please refer to FIG. 8. FIG. 8 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. The implementation to S803 will be described in conjunction with the steps shown in FIG. 8 .
S801、对多层级的特征图进行尺度归一化,得到多个第一待拼接特征图,多个第一待拼接特征图与多层级的特征图一一对应;S801. Perform scale normalization on the multi-level feature maps to obtain a plurality of first feature maps to be stitched, and the plurality of first feature maps to be stitched are in one-to-one correspondence with the multi-level feature maps;
S802、将多个第一待拼接特征图拼接为第三特征图;S802. Stitch a plurality of first feature maps to be spliced into a third feature map;
S803、对于第三特征图,通过至少两次可逆转换处理,得到第二特征图。S803. For the third feature map, obtain a second feature map through at least two reversible transformation processes.
例如,请参见图9,图9为本公开实施例提供的另一种获取异常热力图的示意图,如图9所示,对于3*256*256的原始图像,经过四个残差块的处理,产生三个层级的第一特征图,尺度分别为512*32*32、1024*16*16和2048*8*8,从三个第一特征图的尺度中确定出参考尺度,比如可以将16*16作为参考尺度,即1024*16*16的第一特征图可以保持不动,对512*32*32的第一特征图进行下采样,得到2048*16*16的第一待拼接特征图,对2048*8*8的第一特征图进行上采样,得到512*16*16的第一待拼接特征图,以及,将1024*16*16的目标第二特征图也作为第一待拼接特征图,然后将三个第一待拼接特征图拼接为(2048+1024+512)*16*16的第三特征图。该第三特征图经过二维归一化流模型中至少两个可逆转换块f的映射得到尺度对应的第二特征图。该实施方式中,在二维归一化流模型处理之前,对多层级的特征图进行归一化和拼接,有利于减少二维归一化流模型的数量,降低部署多个二维归一化流模型进行推理所带来的开销。For example, please refer to FIG. 9. FIG. 9 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure. As shown in FIG. 9, for an original image of 3*256*256, four residual blocks are processed , to generate the first feature map of three levels, the scales are 512*32*32, 1024*16*16 and 2048*8*8 respectively, the reference scale can be determined from the scales of the three first feature maps, for example, 16*16 as the reference scale, that is, the first feature map of 1024*16*16 can be kept unchanged, and the first feature map of 512*32*32 is down-sampled to obtain the first feature to be stitched of 2048*16*16 In the figure, the first feature map of 2048*8*8 is up-sampled to obtain the first feature map to be stitched of 512*16*16, and the target second feature map of 1024*16*16 is also used as the first feature map to be stitched The feature map is spliced, and then the three first feature maps to be spliced are spliced into a third feature map of (2048+1024+512)*16*16. The third feature map is mapped by at least two reversible transformation blocks f in the two-dimensional normalized flow model to obtain a second feature map corresponding to the scale. In this embodiment, before the two-dimensional normalized flow model is processed, the multi-level feature maps are normalized and concatenated, which is beneficial to reduce the number of two-dimensional normalized flow models and reduce the need to deploy multiple two-dimensional normalized flow models. The overhead brought by the inference of the streaming model.
请参见图10,图10为本公开实施例提供的另一种异常检测方法的流程示意图,在图3的基础上,在第一特征图包括多层级的特征图的情况下,S302还可以通过S1001至S1004实现,将结合图10示出的步骤进行说明。Please refer to FIG. 10. FIG. 10 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. 3, when the first feature map includes multi-level feature maps, S302 can also pass The implementation of S1001 to S1004 will be described in conjunction with the steps shown in FIG. 10 .
S1001、对于多层级的特征图,通过至少两次可逆转换处理,得到多个第四特征图,多个第四特征图与多层级的特征图一一对应;S1001. For multi-level feature maps, through at least two reversible conversion processes, multiple fourth feature maps are obtained, and the multiple fourth feature maps are in one-to-one correspondence with the multi-level feature maps;
S1002、对多个第四特征图进行尺度归一化,得到多个第二待拼接特征图,多个第二待拼接特征图与多个第四特征图一一对应;S1002. Perform scale normalization on multiple fourth feature maps to obtain multiple second feature maps to be stitched, and the multiple second feature maps to be stitched are in one-to-one correspondence with the multiple fourth feature maps;
S1003、将多个第二待拼接特征图拼接为第五特征图;S1003. Stitch a plurality of second feature maps to be spliced into a fifth feature map;
S1004、对于第五特征图,通过至少两次可逆转换处理,得到第二特征图。S1004. For the fifth feature map, obtain a second feature map through at least two reversible transformation processes.
例如,请参见图11,图11为本公开实施例提供的另一种获取异常热力图的示意图,如图11所示,对于3*256*256的原始图像,经过四个残差块的处理,产生三个层级的第一特征图,尺度分别为512*32*32、1024*16*16和2048*8*8,三个层级的第一特征图分别经过二维归一化流模型中至少两个可逆转换块f的映射得到尺度对应的三个第四特征图。从三个第四特征图的尺度中确定出参考尺度,比如可以将16*16作为参考尺度,即1024*16*16的第四特征图可以保持不动,对512*32*32的第四特征图进行下采样,得到2048*16*16的第二待拼接特征图,对2048*8*8的第四特征图进行上采样,得到512*16*16的第二待拼接特征图,以及,将1024*16*16的第四特征图也作为第二待拼接特征图,然后将三个第二待拼接特征图拼接为(2048+1024+512)*16*16的第五特征图。第五特征图经过二维归一化流模型中至少两个可逆转换块f的映射得到尺度对应的第二特征图。For example, please refer to FIG. 11. FIG. 11 is another schematic diagram of obtaining an abnormal heat map provided by an embodiment of the present disclosure. As shown in FIG. 11, for an original image of 3*256*256, four residual blocks are processed , to generate the first feature maps of three levels, the scales are 512*32*32, 1024*16*16 and 2048*8*8 respectively, the first feature maps of the three levels are respectively passed through the two-dimensional normalized flow model The mapping of at least two reversible transformation blocks f results in three fourth feature maps corresponding to the scales. Determine the reference scale from the scales of the three fourth feature maps. For example, 16*16 can be used as the reference scale, that is, the fourth feature map of 1024*16*16 can remain unchanged, and the fourth feature map of 512*32*32 The feature map is down-sampled to obtain the second feature map to be stitched of 2048*16*16, and the fourth feature map of 2048*8*8 is up-sampled to obtain the second feature map to be stitched of 512*16*16, and , the fourth feature map of 1024*16*16 is also used as the second feature map to be stitched, and then the three second feature maps to be stitched are stitched into a fifth feature map of (2048+1024+512)*16*16. The fifth feature map is mapped by at least two reversible transformation blocks f in the two-dimensional normalized flow model to obtain the second feature map corresponding to the scale.
该实施方式中,在第一特征图为多层级的特征图的情况下,多个二维归一化流模型并行对每个层级的特征图进行可逆转换处理,有利于提升推理速度。另外,在二维归一化流模型内对多尺度特征图进行归一化和拼接,有利于充分利用多层级的特征进行概率密度的估计,在对多尺度特征图进行归一化和拼接后,还可再利用二维归一化流模型对特征图进行处理,模型设置的灵活性高,不仅适用于多输入多输出,还适用于多输入单输出。In this embodiment, when the first feature map is a multi-level feature map, multiple two-dimensional normalized flow models perform reversible conversion processing on the feature maps of each level in parallel, which is beneficial to improve the inference speed. In addition, normalizing and splicing multi-scale feature maps in the two-dimensional normalized flow model is conducive to making full use of multi-level features for probability density estimation. After normalizing and splicing multi-scale feature maps , the two-dimensional normalized flow model can also be used to process the feature map. The flexibility of the model setting is high, not only for multiple inputs and multiple outputs, but also for multiple inputs and single outputs.
需要说明的是,由于二维归一化流模型从输入到输出的“流”具有可逆性,因此,对目标第二特征图进行下采样和上采样也应具有可逆性。It should be noted that since the "flow" of the two-dimensional normalized flow model from input to output is reversible, the downsampling and upsampling of the target second feature map should also be reversible.
请参见图12,图12为本公开实施例提供的另一种异常检测方法的流程示意图,如图12所示,S401中的至少两次可逆转换处理中的任意一次可逆转换处理可以通过S1201至S1203实现,将结合图12示出的步骤进行说明。Please refer to FIG. 12. FIG. 12 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. As shown in FIG. 12, any one of the at least two reversible conversion processes in S401 can pass through The implementation of S1203 will be described in conjunction with the steps shown in FIG. 12 .
S1201、对于待执行可逆转换处理的目标特征图,将目标特征图分裂为第一子目标特征图和第二子目标特征图;第一子目标特征图和第二子目标特征图的通道数相等;S1201. For the target feature map to be subjected to reversible conversion processing, split the target feature map into a first sub-target feature map and a second sub-target feature map; the number of channels of the first sub-target feature map and the second sub-target feature map are equal ;
S1202、对于所述第一子目标特征图和所述第二子目标特征图,通过至少一次仿射耦合操作,得到第一待连接特征图;S1202. For the first sub-object feature map and the second sub-object feature map, obtain a first to-be-connected feature map through at least one affine coupling operation;
S1203、将所述第一待连接特征图与第二待连接特征图连接,得到可逆转换后的特征图;S1203. Connect the first feature map to be connected with the second feature map to be connected to obtain a reversibly transformed feature map;
其中,所述至少一次仿射耦合操作中的首次仿射耦合操作的第二待连接特征图为所述第一子目标特征图或所述第二子目标特征图;所述至少一次仿射耦合操作中的非首次仿射耦合操作的第二待连接特征图为所述非首次仿射耦合操作的上一次仿射耦合操作得到的特征图。Wherein, the second to-be-connected feature map of the first affine coupling operation in the at least one affine coupling operation is the first sub-target feature map or the second sub-target feature map; the at least one affine coupling The second to-be-connected feature map of the non-first affine coupling operation in operation is the feature map obtained by the last affine coupling operation of the non-first affine coupling operation.
例如,请参见图13,图13为本公开实施例提供的一种可逆转换的示意图,图13示出了每一个可逆转换块f中的处理流程,仿射耦合层中对于输入的目标特征图y1301,比如:目标特征图y1301可以是第一特征图、第三特征图或第五特征图,先通过具有数据依赖初始化的缩放和偏置层(Actnorm)进行零初始化,再进行通道变换(Channel Permute),然后将其分裂(Split)为通道数均为C/2的第一子目标特征图y a1302和第二子目标特征图y b1303,其公式表示为公式(3): For example, please refer to FIG. 13. FIG. 13 is a schematic diagram of a reversible transformation provided by an embodiment of the present disclosure. FIG. 13 shows the processing flow in each reversible transformation block f, and the input target feature map in the affine coupling layer y1301, for example: the target feature map y1301 can be the first feature map, the third feature map or the fifth feature map, first perform zero initialization through the scaling and bias layer (Actnorm) with data-dependent initialization, and then perform channel transformation (Channel Permute), and then split it into the first sub-target feature map y a 1302 and the second sub-target feature map y b 1303 with the number of channels C/2, and its formula is expressed as formula (3):
y a,y b=Split(y)          公式(3); y a , y b =Split(y) formula (3);
对于输入y a和y b,通过至少一次仿射耦合操作进行处理,将最后一次仿射耦合操作的输出作为第一待连接特征图,当仅采用一次仿射耦合操作时,将其输出的第一待连接特征图与y a或y b连接(Concat),得到可逆转换后的特征图1304,即完成一次可逆转换处理。比如:当仿射耦合操作中是对y a进行二维卷积处理,则将第一待连接特征图与y a连接,此时第二待连接特征图为y a;当仿射耦合操作中是对y b进行二维卷积处理,则将第一待连接特征图与y b连接,此时第二待连接特征图为y b。在采用至少一次仿射耦合操作的情况下,将其中一次仿射耦合操作输出的第一待连接特征图与这一次仿射耦合操作的上一次仿射耦合操作输出的特征图连接,得到可逆转换后的特征图1304,即完成一次可逆转换处理,此时,第二待连接特征图为其中一次仿射耦合操作得到的特征图。 For the input y a and y b , it is processed by at least one affine coupling operation, and the output of the last affine coupling operation is used as the first feature map to be connected. When only one affine coupling operation is used, the output of the first Once the feature map to be connected is connected (Concat) with y a or y b to obtain the feature map 1304 after reversible transformation, that is, a reversible transformation process is completed. For example: when y a is subjected to two-dimensional convolution processing in the affine coupling operation, the first feature map to be connected is connected to y a , and the second feature map to be connected is y a at this time; when the affine coupling operation is to perform two-dimensional convolution processing on y b , then connect the first feature map to be connected with y b , and at this time the second feature map to be connected is y b . In the case of using at least one affine coupling operation, the first feature map to be connected output by one of the affine coupling operations is connected with the feature map output by the previous affine coupling operation of this affine coupling operation to obtain a reversible transformation The final feature map 1304 is to complete a reversible transformation process. At this time, the second feature map to be connected is the feature map obtained by one of the affine coupling operations.
示例性的,将第一待连接特征图与第二待连接特征图连接可以是基于通道进行特征图的拼接。Exemplarily, connecting the first feature map to be connected with the second feature map to be connected may be splicing feature maps based on channels.
请参见图14,图14为本公开实施例提供的另一种异常检测方法的流程示意图,如图14所示,S1202中的至少一次仿射耦合操作中的任意一次仿射耦合操作可以通过S1401至S1404实现,将结合图14示出的步骤进行说明。Please refer to FIG. 14. FIG. 14 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. As shown in FIG. 14, any one of the at least one affine coupling operation in S1202 can pass S1401 The implementation to S1404 will be described in conjunction with the steps shown in FIG. 14 .
S1401、在任意一次仿射耦合操作为首次仿射耦合操作的情况下,对第一子目标特征图或第二子目标特征图进行二维卷积处理,得到第一缩放系数和第一平移系数;S1401. When any affine coupling operation is the first affine coupling operation, perform two-dimensional convolution processing on the first sub-object feature map or the second sub-object feature map to obtain the first scaling coefficient and the first translation coefficient ;
S1402、采用第一缩放系数和第一平移系数,将未进行二维卷积处理的第二子目标特征图或第一子目标特征图,与首次仿射耦合操作中的二维卷积处理的输入进行线性组合,得到首次仿射耦合操作的输出;S1402. Using the first scaling coefficient and the first translation coefficient, combine the second sub-object feature map or the first sub-object feature map that has not been subjected to two-dimensional convolution processing with the two-dimensional convolution processing in the first affine coupling operation The input is linearly combined to obtain the output of the first affine coupling operation;
S1403、在任意一次仿射耦合操作为非首次仿射耦合操作的情况下,对非首次仿射耦合操作的上一次仿射耦合操作的输出进行二维卷积处理,得到第二缩放系数和第二平移系数;S1403. In the case that any affine coupling operation is a non-first affine coupling operation, perform two-dimensional convolution processing on the output of the last affine coupling operation that is not the first affine coupling operation to obtain the second scaling factor and the second scaling factor. Two translation coefficients;
S1404、采用第二缩放系数和第二平移系数,将非首次仿射耦合操作的上一次仿射耦合操作的输出与上一次仿射耦合操作中二维卷积处理的输入进行线性组合,得到非首次仿射耦合操作的输出。S1404. Using the second scaling coefficient and the second translation coefficient, linearly combine the output of the last affine coupling operation that is not the first affine coupling operation with the input of the two-dimensional convolution processing in the last affine coupling operation to obtain a non-first affine coupling operation. The output of the first affine coupling operation.
例如,假设通过两个子网s(·)和b(·)对y a进行二维卷积得到第一缩放系数s1,以及第一平移系数b(y a),即图中的b1,对s1进行以自然对数底数e为底数的指数运算exp得到s(y a),y b为未经过二维卷积处理的特征图,利用s(y a)和b(y a)求取y a和y b的线性组合,其公式表示为公式(4): For example, suppose two-dimensional convolution of y a by two subnetworks s(·) and b(·) results in the first scaling coefficient s1, and the first translation coefficient b(y a ), that is, b1 in the figure, for s1 Perform the exponential operation exp with the natural logarithm base e as the base to get s(y a ), y b is the feature map that has not been processed by two-dimensional convolution, use s(y a ) and b(y a ) to find y a and y b linear combination, its formula is expressed as formula (4):
y′ b=s(y a)⊙y b+b(y a),            公式(4); y′ b =s(y a )⊙y b +b(y a ), formula (4);
其中,y′ b表示第1次仿射耦合操作的输出,在仅采用1次仿射耦合操作的情况下,该y′ b即可作为第一待连接特征图,将其与y a连接,即可得到可逆转换后的特征图,其公式表示为公式(5): Among them, y′ b represents the output of the first affine coupling operation. In the case of only one affine coupling operation, this y′ b can be used as the first feature map to be connected, and it can be connected with y a , The feature map after reversible transformation can be obtained, and its formula is expressed as formula (5):
y′=concat(y′ b,y′ a),            公式(5); y'=concat(y' b ,y' a ), formula (5);
其中,y′表示可逆转换后的特征图,y′ a表示y a的恒等映射,concat(·)表示连接。 where y′ represents the reversibly transformed feature map, y′ a represents the identity map of y a , and concat( ) represents the concatenation.
示例性的,当任意一次仿射耦合操作为第m次仿射耦合操作时,比如第2次仿射耦合操作,通过两个子网s(·)和b(·)对第1次仿射耦合操作的输出y′ b进行二维卷积得到第二缩放系数s2和第二平移系数b2,对s2进行以自然对数底数e为底数的指数运算exp得到s(y′ b),利用s(y′ b)和b2求取y′ b和第1次仿射耦合操作中二维卷积处理的输入y a的线性组合,得到第2次仿射耦合操作的输出。类似的,若存在更多的仿射耦合操作,则可参照第2次仿射耦合操作中的描述。 Exemplarily, when any affine coupling operation is the mth affine coupling operation, such as the second affine coupling operation, the first affine coupling operation is performed through two subnetworks s(·) and b(·) The output y′ b of the operation is subjected to two-dimensional convolution to obtain the second scaling coefficient s2 and the second translation coefficient b2, and the exponent operation exp with the natural logarithm base e as the base number is performed on s2 to obtain s(y′ b ), using s( y′ b ) and b2 calculate the linear combination of y′ b and the input y a of the two-dimensional convolution processing in the first affine coupling operation, and obtain the output of the second affine coupling operation. Similarly, if there are more affine coupling operations, refer to the description in the second affine coupling operation.
该实施方式中,由于现有归一化流在可逆转换处理中通常采用的是全连接网络,需要将特征从二维压缩到一维,这一定程度上破坏了输入特征图的空间位置关系,本公开实施例在两个子网s(·)和b(·)中采用二维卷积层进行二维卷积,有利于保留原始图像的特征的空间位置信息。另外,本公开实施例在二维归一化流模型中采用二维卷积层,使得模型支持以张量为输入,能够端到端实现张量概率密度的估计。In this embodiment, since the existing normalized flow usually uses a fully connected network in the reversible transformation process, the features need to be compressed from two dimensions to one dimension, which destroys the spatial position relationship of the input feature map to a certain extent. In the embodiment of the present disclosure, the two-dimensional convolution layer is used in the two subnets s(·) and b(·) to perform two-dimensional convolution, which is beneficial to retain the spatial position information of the features of the original image. In addition, the embodiment of the present disclosure adopts a two-dimensional convolutional layer in the two-dimensional normalized flow model, so that the model supports tensor as input, and can realize the estimation of the tensor probability density end-to-end.
S303、根据第二特征图,得到原始图像的异常热力图。S303. Obtain an abnormal heat map of the original image according to the second feature map.
示例性的,在第一特征图为单层级的特征图的情况下,对应于图5所示的实施例,对所有64*64的第二特征图中位置对应的概率密度估计求平方和,计算每个位置上的平方和的均值得到1*64*64的异常热力图,对该异常热力图进行缩放得到目标尺度的异常热力图,比如1*256*256的异常热力图,其中,缩放可以是上采样,例如可以是线性插值。其中,1*256*256的异常热力图中的特征用于表示原始图像中对应位置的异常评分。Exemplarily, in the case where the first feature map is a single-level feature map, corresponding to the embodiment shown in FIG. 5 , the probability density estimates corresponding to positions in all 64*64 second feature maps are summed by squares , calculate the mean value of the sum of squares at each position to obtain a 1*64*64 abnormal heat map, and scale the abnormal heat map to obtain an abnormal heat map of the target scale, such as a 1*256*256 abnormal heat map, where, Scaling can be upsampling, eg linear interpolation. Among them, the features in the abnormal heat map of 1*256*256 are used to represent the abnormal score of the corresponding position in the original image.
请继续参见图6,图6为本公开实施例提供的另一种异常检测方法的流程示意图,在图3的基础上,在第一特征图包括多层级的特征图的情况下,对应于图7所示的实施例,S303可以通过S602至S603实现,将继续结合图6示出的步骤进行说明。Please continue to refer to FIG. 6. FIG. 6 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. 3, when the first feature map includes multi-level feature maps, corresponding to In the embodiment shown in FIG. 7 , S303 can be implemented through S602 to S603 , which will continue to be described in conjunction with the steps shown in FIG. 6 .
S602、对于多个第二特征图中的每个第二特征图,在通道维度,对每个第二特征图中位置对应的概率密度估计求平方和;S602. For each second feature map in the plurality of second feature maps, in the channel dimension, calculate the sum of the squares of the probability density estimates corresponding to the positions in each second feature map;
S603、根据平方和,得到异常热力图。S603. Obtain an abnormal heat map according to the sum of squares.
请参见图15,图15为本公开实施例提供的另一种异常检测方法的流程示意图,在图6的基础上,S603可以通过S1501至S1502实现,将结合图15示出的步骤进行说明。Please refer to FIG. 15 , which is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. 6 , S603 can be implemented through S1501 to S1502 , which will be described in conjunction with the steps shown in FIG. 15 .
S1501、基于平方和的均值,得到每个第二特征图对应的待归一化特征图;S1501. Obtain the feature map to be normalized corresponding to each second feature map based on the mean value of the sum of squares;
S1502、对待归一化特征图进行尺度归一化,以及对尺度归一化后的特征图进行融合,得到异常热力 图。S1502. Perform scale normalization on the feature map to be normalized, and fuse the scale-normalized feature maps to obtain an abnormal heat map.
例如,对所有64*64的第二特征图中位置对应的概率密度估计求平方和,计算每个位置上的平方和的均值得到1*64*64的异常热力图;对所有32*32的第二特征图中位置对应的概率密度估计求平方和,计算每个位置上的平方和的均值得到1*32*32的异常热力图;对所有16*16的第二特征图中位置对应的概率密度估计求平方和,计算每个位置上的平方和的均值得到1*16*16的异常热力图。For example, calculate the sum of the squares of the probability density estimates corresponding to the positions in the second feature map of all 64*64, and calculate the mean value of the sum of squares at each position to obtain an abnormal heat map of 1*64*64; for all 32*32 Calculate the sum of the squares of the probability density estimates corresponding to the positions in the second feature map, and calculate the mean value of the sum of squares at each position to obtain a 1*32*32 abnormal heat map; for all 16*16 positions corresponding to the second feature map The probability density is estimated to calculate the sum of squares, and the mean value of the sum of squares at each position is calculated to obtain a 1*16*16 abnormal heat map.
其中,1*64*64的异常热力图、1*32*32的异常热力图和1*16*16的异常热力图即待归一化特征图,将待归一化特征图缩放至目标尺度,得到尺度归一化后的特征图,将其进行融合即可得到最终的异常热力图。其中,缩放可以是上采样,具体可以是线性插值,其中,目标尺度可以是原始图像的尺度(256*256),或者还可以是待归一化特征图的尺度,此处不作限定。Among them, the abnormal heat map of 1*64*64, the abnormal heat map of 1*32*32 and the abnormal heat map of 1*16*16 are the feature maps to be normalized, and the feature maps to be normalized are scaled to the target scale , get the feature map after scale normalization, and fuse it to get the final anomaly heat map. The scaling can be upsampling, specifically linear interpolation, where the target scale can be the scale of the original image (256*256), or the scale of the feature map to be normalized, which is not limited here.
该实施方式中,对每个二维归一化流模型输出的多尺度的第二特征图进行缩放和融合,有利于充分利用多层级的特征进行概率密度的估计。In this embodiment, the multi-scale second feature map output by each two-dimensional normalized flow model is scaled and fused, which is conducive to fully utilizing multi-level features to estimate the probability density.
请参见图16,图16为本公开实施例提供的另一种异常检测方法的流程示意图,基于图8,在第一特征图包括多层级的特征图的情况下,对应于图9或图11所示的实施例,S303可以通过S1601至S1603实现,将结合图16示出的步骤进行说明。Please refer to FIG. 16. FIG. 16 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. Based on FIG. 8, in the case where the first feature map includes multi-level feature maps, it corresponds to FIG. 9 or FIG. 11 In the illustrated embodiment, S303 may be implemented through S1601 to S1603, which will be described in conjunction with the steps shown in FIG. 16 .
S1601、在通道维度,对所述第二特征图中位置对应的概率密度估计求平方和;S1601. In the channel dimension, calculate the sum of the squares of the probability density estimates corresponding to the positions in the second feature map;
S1602、基于所述平方和的均值,得到待缩放特征图;S1602. Obtain the feature map to be scaled based on the mean value of the sum of squares;
S1603、对所述待缩放特征图进行缩放,得到所述异常热力图。S1603. Scale the to-be-scaled feature map to obtain the abnormal heat map.
如图9或图11所示,经过二维归一化流模型的至少两次可逆转换处理,得到(2048+1024+512)*16*16的第二特征图,对所有16*16的第二特征图中位置对应的概率密度估计求平方和,计算每个位置上的平方和的均值得到1*16*16的异常热力图(即待缩放特征图),对该待缩放特征图进行缩放得到目标尺度的异常评分图,比如1*256*256的异常热力图,该1*256*256的异常热力图中的特征用于表示原始图像中对应位置的异常评分。其中,缩放可以是上采样,例如,可以是线性插值。As shown in Figure 9 or Figure 11, after at least two reversible conversion processes of the two-dimensional normalized flow model, the second feature map of (2048+1024+512)*16*16 is obtained, and for all 16*16 Calculate the sum of the squares of the probability density corresponding to the position in the two feature maps, calculate the mean value of the sum of squares at each position to obtain a 1*16*16 abnormal heat map (that is, the feature map to be scaled), and scale the feature map to be scaled Obtain an abnormal score map of the target scale, such as a 1*256*256 abnormal heat map, and the features in the 1*256*256 abnormal heat map are used to represent the abnormal score of the corresponding position in the original image. Wherein, scaling may be upsampling, for example, may be linear interpolation.
应理解,本公开实施例中求平方和的均值的操作有利于消除通道数对计算第一概率密度估计的影响。It should be understood that the operation of calculating the mean of the sum of squares in the embodiment of the present disclosure is beneficial to eliminate the influence of the number of channels on the calculation of the first probability density estimate.
S304、根据异常热力图,得到原始图像的异常检测结果。S304. Obtain an abnormality detection result of the original image according to the abnormality heat map.
请参见图17,图17为本公开实施例提供的另一种异常检测方法的流程示意图,在图3的基础上,S304可以通过S1701至S1702实现,将结合图17示出的步骤进行说明。Please refer to FIG. 17 . FIG. 17 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. 3 , S304 can be implemented through S1701 to S1702 , which will be described in conjunction with the steps shown in FIG. 17 .
S1701、获取异常评分与预设值的差值,预设值基于正常图像的分布参数确定,即将异常热力图中的异常评分与预设值进行比较,以获取二者的差值;S1701. Obtain the difference between the abnormality score and the preset value, the preset value is determined based on the distribution parameters of the normal image, that is, compare the abnormality score in the abnormality heat map with the preset value to obtain the difference between the two;
S1702、根据异常评分与预设值的差值确定原始图像中的异常区域,得到异常检测结果。S1702. Determine the abnormal region in the original image according to the difference between the abnormality score and the preset value, and obtain an abnormality detection result.
其中,预设值是基于正常图像的分布参数确定的,比如:预设值可以是正常图像的正态分布的中心0,通过求取异常评分与0的差值,可将原始图像中异常评分趋近于0的区域确定为正常区域,将异常评分远大于0或远小于0的区域确定为异常区域。Among them, the preset value is determined based on the distribution parameters of the normal image. For example, the preset value can be the center 0 of the normal distribution of the normal image. By calculating the difference between the abnormal score and 0, the abnormal score in the original image can be calculated The area close to 0 is determined as a normal area, and the area with an abnormal score much greater than 0 or far less than 0 is determined as an abnormal area.
可以看出,本公开实施例通过对原始图像进行特征提取,得到第一特征图;将第一特征图映射为第二特征图;根据第二特征图,得到原始图像的异常热力图;根据异常热力图,得到原始图像的异常检测结果。由于第一特征图有利于更好地捕获原始图像局部与全局的关系,同时,对第一特征图进行映射得到的第二特征图保留了原始图像的特征空间信息,这样基于原始图像局部与全局的关系、特征空间信息及对第二特征图进行后处理,得到的异常热力图能够更准确地表示出原始图像中的异常区域,从而有利于提升图像异常检测的精度。It can be seen that the embodiment of the present disclosure obtains the first feature map by performing feature extraction on the original image; maps the first feature map to the second feature map; obtains the abnormal heat map of the original image according to the second feature map; Heat map to get the anomaly detection results of the original image. Since the first feature map is beneficial to better capture the relationship between the local and the global image of the original image, at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the local and global features of the original image relationship, feature space information, and post-processing the second feature map, the obtained anomaly heat map can more accurately represent the abnormal area in the original image, which is conducive to improving the accuracy of image anomaly detection.
请参见图18,图18为本公开实施例提供的另一种异常检测方法的流程示意图,同样可基于图1所示的应用环境实施,如图18所示,包括S1801至S1804:Please refer to FIG. 18. FIG. 18 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure, which can also be implemented based on the application environment shown in FIG. 1, as shown in FIG. 18, including S1801 to S1804:
S1801、对原始图像进行特征提取,得到第一特征图;S1801. Perform feature extraction on the original image to obtain a first feature map;
S1802、通过至少两次可逆转换处理,将第一特征图映射为第二特征图;S1802. Map the first feature map to the second feature map through at least two reversible transformation processes;
其中,至少两次可逆转换处理中的第一次可逆转换处理所采用的二维卷积核的尺寸与第二次可逆转换处理所采用的二维卷积核的尺寸不同,第一次可逆转换处理为第二次可逆转换处理的上一次可逆转换处理。Among them, the size of the two-dimensional convolution kernel used in the first reversible transformation process in the at least two reversible transformation processes is different from the size of the two-dimensional convolution kernel used in the second reversible transformation process, and the first reversible transformation process The last reversible conversion process that is processed as the second reversible conversion process.
SS1803、根据第二特征图,得到原始图像的异常热力图;SS1803. According to the second feature map, an abnormal heat map of the original image is obtained;
SS1804、根据异常热力图,得到原始图像的异常检测结果。SS1804. Obtain the abnormality detection result of the original image according to the abnormality heat map.
其中,S1801至S1804的具体实施方式在图3所示的实施例中已有相关说明。Wherein, specific implementation manners of S1801 to S1804 have been described in the embodiment shown in FIG. 3 .
请参见图19,图19为本公开实施例提供的另一种异常检测方法的流程示意图,如图19所示,在对原始图像进行特征提取,得到第一特征图之前,该方法还包括S1901至S1904,将结合图19示出的步骤进行说明。Please refer to FIG. 19. FIG. 19 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. As shown in FIG. 19, before performing feature extraction on the original image to obtain the first feature map, the method also includes S1901 Steps to S1904 will be described in conjunction with the steps shown in FIG. 19 .
S1901、对正样本图像进行特征提取,得到第六特征图;S1901. Perform feature extraction on the positive sample image to obtain a sixth feature map;
S1902、通过神经网络将第六特征图映射为第七特征图,第七特征图中的特征表示正样本图像中对应位置的特征的概率密度估计;S1902. Map the sixth feature map to a seventh feature map through a neural network, and the features in the seventh feature map represent probability density estimates of features at corresponding positions in the positive sample image;
S1903、根据第七特征图中的概率密度估计确定目标损失;S1903. Determine the target loss according to the probability density estimation in the seventh feature map;
S1904、基于目标损失对神经网络的参数进行调整,得到神经网络模型。S1904. Adjust the parameters of the neural network based on the target loss to obtain a neural network model.
其中,正样本图像可以是异常检测或定位数据集MVTec AD、BTAD BeanTech或CIFAR-10中的图像,可通过图2所示的特征提取器对正样本图像进行特征提取,应理解,特征提取器可以是残差网络或视觉转换器,第六特征图可以是单层级的特征图,也可以是多层级的特征图。Among them, the positive sample image can be an image in the anomaly detection or positioning data set MVTec AD, BTAD BeanTech or CIFAR-10, and the feature extractor shown in Figure 2 can be used to perform feature extraction on the positive sample image. It should be understood that the feature extractor It can be a residual network or a visual converter, and the sixth feature map can be a single-level feature map or a multi-level feature map.
其中,神经网络是指包括至少两个可逆转换块f的二维归一化流,将第六特征图输入二维归一化流进行至少两次可逆转换处理,得到第七特征图,即通过至少两个可逆转换块f将第六特征图X2中的特征x映射到均值为0、方差为1的正态分布Q,以得到正样本图像的特征的概率密度估计q,其目的在于让模型学习正样本图像(即正常图像)的分布。Wherein, the neural network refers to a two-dimensional normalized flow including at least two reversible transformation blocks f, and the sixth feature map is input into the two-dimensional normalized flow for at least two reversible transformation processes to obtain the seventh feature map, that is, by At least two reversible conversion blocks f map the feature x in the sixth feature map X2 to a normal distribution Q with a mean of 0 and a variance of 1 to obtain a probability density estimate q of the features of the positive sample image. The purpose is to make the model Learn the distribution of positive sample images (i.e. normal images).
请参见图20,图20为本公开实施例提供的另一种异常检测方法的流程示意图,在图19的基础上,如图20所示,S1903可以通过S2001至S2002实现,将结合图20示出的步骤进行说明。Please refer to FIG. 20. FIG. 20 is a schematic flowchart of another anomaly detection method provided by an embodiment of the present disclosure. On the basis of FIG. 19, as shown in FIG. Outlined steps are described.
S2001、根据第七特征图中的概率密度估计确定第六特征图中的特征的对数似然估计;S2001. Determine the log likelihood estimation of the features in the sixth feature map according to the probability density estimation in the seventh feature map;
S2002、将第六特征图中的特征的负对数似然估计作为目标损失。S2002. Taking the negative log likelihood estimation of the features in the sixth feature map as the target loss.
应理解,若第六特征图X2中的特征x满足分布p x,第七特征图中的概率密度估计q满足已知分布p z,将x映射为q,表示为公式(6): It should be understood that if the feature x in the sixth feature map X2 satisfies the distribution p x , the probability density estimate q in the seventh feature map satisfies the known distribution p z , and mapping x to q is expressed as formula (6):
f(x)=q,               公式(6);f(x)=q, formula (6);
根据变量替换法则有公式(7):According to the variable substitution rule, there is formula (7):
Figure PCTCN2022092205-appb-000003
Figure PCTCN2022092205-appb-000003
两边同时取log有公式(8):Taking log on both sides at the same time has the formula (8):
Figure PCTCN2022092205-appb-000004
Figure PCTCN2022092205-appb-000004
其中,x∈p X2(x),q∈p Q(q),
Figure PCTCN2022092205-appb-000005
表示将x映射为q的情况下,二维归一化流的雅可比行列式,log p X2(x)表示x的对数似然估计,log p Q(q)表示q的对数似然估计。最大化x的对数似然估计,即最小化其负数,将x的负对数似然估计作为目标损失L(x),其公式表示为公式)9:
where x∈p X2 (x), q∈p Q (q),
Figure PCTCN2022092205-appb-000005
Represents the Jacobian determinant of the two-dimensional normalized flow when x is mapped to q, log p X2 (x) represents the log likelihood estimate of x, and log p Q (q) represents the log likelihood of q estimate. Maximize the log-likelihood of x, that is, minimize its negative number, and use the negative log-likelihood of x as the target loss L(x), whose formula is expressed as Equation)9:
Figure PCTCN2022092205-appb-000006
Figure PCTCN2022092205-appb-000006
其中,
Figure PCTCN2022092205-appb-000007
表示q的L2范数的平方,根据L(x)调整二维归一化流的参数θ,不断迭代正样本图像,以最小化q的负对数似然估计,得到训练好的神经网络模型,即二维归一化流模型。
in,
Figure PCTCN2022092205-appb-000007
Represents the square of the L2 norm of q, adjusts the parameter θ of the two-dimensional normalized flow according to L(x), and iterates the positive sample image continuously to minimize the negative log likelihood estimate of q, and obtains the trained neural network model , that is, the two-dimensional normalized flow model.
其中,二维归一化流对第六特征图X2的映射,即对第六特征图X2进行可逆转换处理的过程,可参见图3所示的实施例中对第一特征图进行可逆转换处理的描述。Among them, the mapping of the two-dimensional normalized flow to the sixth feature map X2, that is, the process of performing reversible conversion processing on the sixth feature map X2, can refer to the reversible conversion processing of the first feature map in the embodiment shown in Figure 3 description of.
参见图21,图21为本公开实施例提供的通过本公开实施提供的异常检测方法对图像中的缺陷进行检测的缺陷预测结果示图。如图21所示的,图21中示出了对四种物品的图像进行缺陷预测的结果示图,其中,每种物品包括三张原始图像。采用本公开实施例提供的异常检测方法,首先输入原始图像2101,经过特征提取,得到第一特征图,再将第一特征图映射为第二特征图,然后根据第二特征图得到原始图像2101的异常热力图,最后根据异常热力图,可得到缺陷预测结果,即得到与原始图像2101对应的缺陷预测结果示意图2102。从缺陷预测结果示意图2102中可以看出与原始图像2101中的缺陷部分对应的异常区域的定位结果。Referring to FIG. 21 , FIG. 21 is a diagram of defect prediction results of defects in an image detected by the anomaly detection method provided by the implementation of the present disclosure provided by the embodiment of the present disclosure. As shown in FIG. 21 , FIG. 21 shows a diagram of defect prediction results for images of four items, where each item includes three original images. Using the anomaly detection method provided by the embodiment of the present disclosure, the original image 2101 is first input, the first feature map is obtained through feature extraction, and then the first feature map is mapped to the second feature map, and the original image 2101 is obtained according to the second feature map Finally, according to the abnormal heat map, the defect prediction result can be obtained, that is, the defect prediction result schematic diagram 2102 corresponding to the original image 2101 is obtained. From the defect prediction result diagram 2102 , it can be seen that the abnormal region location result corresponding to the defect part in the original image 2101 is obtained.
可以看出,本公开实施例通过对原始图像进行特征提取,得到第一特征图;将第一特征图映射为第二特征图;根据第二特征图,得到原始图像的异常热力图;根据异常热力图,得到原始图像的异常检测结果。由于第一特征图有利于更好地捕获原始图像局部与全局的关系,同时,对第一特征图进行映射得到的第二特征图保留了原始图像的特征空间信息,这样基于原始图像局部与全局的关系、特征空间信息及对第二特征图进行后处理,得到的异常热力图能够更准确地表示出原始图像中的异常区域,从而有利于提升图像异常检测的精度。It can be seen that the embodiment of the present disclosure obtains the first feature map by performing feature extraction on the original image; maps the first feature map to the second feature map; obtains the abnormal heat map of the original image according to the second feature map; Heat map to get the anomaly detection results of the original image. Since the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the obtained anomaly heat map can more accurately represent the abnormal area in the original image, which is conducive to improving the accuracy of image anomaly detection.
基于上述方法实施例的描述,本公开实施例还提供一种异常检测装置2200,请参见图22,图22为本公开实施例提供的一种异常检测装置2200的结构示意图,如图22所示,该装置包括特征提取部分2201和处理部分2202;其中,特征提取部分2201,被配置为对原始图像进行特征提取,得到第一特征图;特征提取部分2201,还被配置为将第一特征图映射为第二特征图;处理部分2202,被配置为根据第二特征图,得到原始图像的异常热力图;处理部分2202,还被配置为根据异常热力图,得到原始图像的异常检测结果。Based on the description of the above-mentioned method embodiment, the embodiment of the present disclosure also provides an anomaly detection device 2200, please refer to FIG. 22. FIG. 22 is a schematic structural diagram of an anomaly detection device 2200 provided by the embodiment of the present disclosure, as shown in FIG. 22 , the device includes a feature extraction part 2201 and a processing part 2202; wherein, the feature extraction part 2201 is configured to perform feature extraction on the original image to obtain a first feature map; the feature extraction part 2201 is also configured to convert the first feature map The mapping is the second feature map; the processing part 2202 is configured to obtain the abnormal heat map of the original image according to the second feature map; the processing part 2202 is also configured to obtain the abnormal detection result of the original image according to the abnormal heat map.
可以看出,在图22所示的装置中,通过对原始图像进行特征提取,得到第一特征图;将第一特征图映射为第二特征图;根据第二特征图,得到原始图像的异常热力图;根据异常热力图,得到原始图像的异常检测结果。由于第一特征图有利于更好地捕获原始图像局部与全局的关系,同时,对第一特征图进行映射得到的第二特征图保留了原始图像的特征空间信息,这样基于原始图像局部与全局的关系、特征空间信 息及对第二特征图进行后处理,得到的异常热力图能够更准确地表示出原始图像中的异常区域,从而有利于提升图像异常检测的精度。It can be seen that in the device shown in Figure 22, the first feature map is obtained by performing feature extraction on the original image; the first feature map is mapped to the second feature map; according to the second feature map, the abnormality of the original image is obtained Heat map: According to the abnormal heat map, the abnormal detection results of the original image are obtained. Since the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the obtained anomaly heat map can more accurately represent the abnormal area in the original image, which is conducive to improving the accuracy of image anomaly detection.
在一些实施方式中,在将第一特征图映射为第二特征图方面,特征提取部分2201还被配置为:通过至少两次可逆转换处理,将第一特征图映射为第二特征图;其中,至少两次可逆转换处理中的第一次可逆转换处理所采用的二维卷积核的尺寸与第二次可逆转换处理所采用的二维卷积核的尺寸不同,第一次可逆转换处理为第二次可逆转换处理的上一次可逆转换处理。In some implementations, in terms of mapping the first feature map to the second feature map, the feature extraction part 2201 is further configured to: map the first feature map to the second feature map through at least two reversible transformation processes; wherein , the size of the two-dimensional convolution kernel used in the first reversible transformation process in at least two reversible transformation processes is different from the size of the two-dimensional convolution kernel used in the second reversible transformation process, the first reversible transformation process The last reversible transformation processed for the second reversible transformation.
在一些实施方式中,在第一特征图包括多层级的特征图的情况下,在将第一特征图映射为第二特征图方面,特征提取部分2201还被配置为:对多层级的特征图进行尺度归一化,得到多个第一待拼接特征图,多个第一待拼接特征图与多层级的特征图一一对应;将多个第一待拼接特征图拼接为第三特征图;对于第三特征图,通过至少两次可逆转换处理,得到第二特征图。In some implementations, when the first feature map includes multi-level feature maps, in terms of mapping the first feature map to the second feature map, the feature extraction part 2201 is further configured to: for multi-level feature maps Scale normalization is performed to obtain a plurality of first feature maps to be stitched, and the plurality of first feature maps to be stitched are in one-to-one correspondence with multi-level feature maps; the plurality of first feature maps to be stitched is stitched into a third feature map; For the third feature map, the second feature map is obtained through at least two reversible transformation processes.
在一些实施方式中,在第一特征图包括多层级的特征图的情况下,在将第一特征图映射为第二特征图方面,特征提取部分2201还被配置为:对于多层级的特征图,通过至少两次可逆转换处理,得到多个第四特征图,多个第四特征图与多层级的特征图一一对应;对多个第四特征图进行尺度归一化,得到多个第二待拼接特征图,多个第二待拼接特征图与多个第四特征图一一对应;将多个第二待拼接特征图拼接为第五特征图;对于第五特征图,通过至少两次可逆转换处理,得到第二特征图。In some implementations, when the first feature map includes multi-level feature maps, in terms of mapping the first feature map to the second feature map, the feature extraction part 2201 is further configured to: for the multi-level feature map , through at least two reversible transformation processes, multiple fourth feature maps are obtained, and multiple fourth feature maps are in one-to-one correspondence with multi-level feature maps; scale normalization is performed on multiple fourth feature maps to obtain multiple fourth feature maps Two feature maps to be spliced, a plurality of second feature maps to be spliced are in one-to-one correspondence with a plurality of fourth feature maps; multiple second feature maps to be spliced are spliced into a fifth feature map; for the fifth feature map, through at least two The second reversible transformation process is performed to obtain the second feature map.
在一些实施方式中,第二特征图中的特征表示原始图像中对应位置的特征的概率密度估计;在根据第二特征图,得到原始图像的异常热力图方面,处理部分2202还被配置为:在通道维度,对第二特征图中位置对应的概率密度估计求平方和;基于平方和的均值,得到待缩放特征图;对待缩放特征图进行缩放,得到异常热力图。In some implementations, the features in the second feature map represent the probability density estimates of the features at corresponding positions in the original image; in terms of obtaining the abnormal heat map of the original image according to the second feature map, the processing part 2202 is further configured to: In the channel dimension, the sum of the squares of the probability density estimates corresponding to the positions in the second feature map is calculated; based on the mean value of the sum of squares, the feature map to be scaled is obtained; the feature map to be scaled is scaled to obtain an abnormal heat map.
在一些实施方式中,在第一特征图包括多层级的特征图的情况下,在将第一特征图映射为第二特征图方面,特征提取部分2201还被配置为:对于多层级的特征图,通过至少两次可逆转换处理,得到多个第二特征图,多个第二特征图与多层级的特征图一一对应,多个第二特征图中的特征表示原始图像中对应位置的特征的概率密度估计;在根据第二特征图,得到原始图像的异常热力图方面,处理部分2202还被配置为:对于多个第二特征图中的每个第二特征图,在通道维度,对每个第二特征图中位置对应的概率密度估计求平方和;根据平方和,得到异常热力图。In some implementations, when the first feature map includes multi-level feature maps, in terms of mapping the first feature map to the second feature map, the feature extraction part 2201 is further configured to: for the multi-level feature map , through at least two reversible transformation processes, a plurality of second feature maps are obtained, and the plurality of second feature maps correspond to the multi-level feature maps one by one, and the features in the plurality of second feature maps represent the features of the corresponding positions in the original image Probability density estimation of ; in terms of obtaining the abnormal heat map of the original image according to the second feature map, the processing part 2202 is also configured to: for each second feature map in a plurality of second feature maps, in the channel dimension, for Calculate the sum of squares of the probability density estimates corresponding to the positions in each second feature map; and obtain an abnormal heat map according to the sum of squares.
在一些实施方式中,在根据平方和,得到异常热力图方面,处理部分2202还被配置为:计算平方和的均值,得到每个第二特征图对应的待归一化特征图;对待归一化特征图进行尺度归一化,以及对尺度归一化后的特征图进行融合,得到异常热力图。In some implementations, in terms of obtaining the abnormal heat map according to the sum of squares, the processing part 2202 is further configured to: calculate the mean value of the sum of squares to obtain the feature map to be normalized corresponding to each second feature map; Scale normalization is performed on the scale-normalized feature maps, and the scale-normalized feature maps are fused to obtain an abnormal heat map.
在一些实施方式中,在执行至少两次可逆转换处理中的任意一次可逆转换处理方面,特征提取部分2101还被配置为:对于待执行可逆转换处理的目标特征图,将目标特征图分裂为第一子目标特征图和第二子目标特征图;第一子目标特征图和第二子目标特征图的通道数相等;对于所述第一子目标特征图和所述第二子目标特征图,通过至少一次仿射耦合操作,得到第一待连接特征图;将所述第一待连接特征图与第二待连接特征图连接,得到可逆转换后的特征图;其中,所述至少一次仿射耦合操作中的首次仿射耦合操作的第二待连接特征图为所述第一子目标特征图或所述第二子目标特征图;所述至少一次仿射耦合操作中的非首次仿射耦合操作的第二待连接特征图为所述非首次仿射耦合操作的上一次仿射耦合操作得到的特征图。In some implementations, in performing any one of the at least two reversible transformation processes, the feature extraction part 2101 is further configured to: for the target feature map to be subjected to the reversible transformation process, split the target feature map into the first A sub-target feature map and a second sub-target feature map; the number of channels of the first sub-target feature map and the second sub-target feature map are equal; for the first sub-target feature map and the second sub-target feature map, Through at least one affine coupling operation, the first feature map to be connected is obtained; the first feature map to be connected is connected to the second feature map to be connected to obtain a reversibly transformed feature map; wherein, the at least one affine The second feature map to be connected in the first affine coupling operation in the coupling operation is the first sub-target feature map or the second sub-target feature map; the non-first affine coupling in the at least one affine coupling operation The second to-be-connected feature map of the operation is the feature map obtained by the last affine coupling operation that is not the first affine coupling operation.
在一些实施方式中,在执行至少一次仿射耦合操作中的任意一次仿射耦合操作方面,特征提取部分2201还被配置为:在任意一次仿射耦合操作为首次仿射耦合操作的情况下,对第一子目标特征图或第二子目标特征图进行二维卷积处理,得到第一缩放系数和第一平移系数;采用第一缩放系数和第一平移系数,将未进行二维卷积处理的第二子目标特征图或第一子目标特征图,与首次仿射耦合操作中的二维卷积处理的输入进行线性组合,得到首次仿射耦合操作的输出;在任意一次仿射耦合操作为非首次仿射耦合操作的情况下,对所述非首次仿射耦合操作的上一次仿射耦合操作的输出进行二维卷积处理,得到第二缩放系数和第二平移系数;采用第二缩放系数和第二平移系数,将对非首次仿射耦合操作的上一次仿射耦合操作的输出与上一次仿射耦合操作中二维卷积处理的输入进行线性组合,得到非首次仿射耦合操作的输出。In some implementations, in terms of performing any one of the at least one affine coupling operation, the feature extraction part 2201 is further configured to: when any one of the affine coupling operations is the first affine coupling operation, Perform two-dimensional convolution processing on the first sub-target feature map or the second sub-target feature map to obtain the first scaling coefficient and the first translation coefficient; using the first scaling coefficient and the first translation coefficient, the two-dimensional convolution will not be performed The processed second sub-target feature map or the first sub-target feature map is linearly combined with the input of the two-dimensional convolution processing in the first affine coupling operation to obtain the output of the first affine coupling operation; in any affine coupling When the operation is a non-first affine coupling operation, two-dimensional convolution processing is performed on the output of the last affine coupling operation of the non-first affine coupling operation to obtain a second scaling coefficient and a second translation coefficient; using the first The second scaling coefficient and the second translation coefficient linearly combine the output of the last affine coupling operation of the non-first affine coupling operation with the input of the two-dimensional convolution processing in the last affine coupling operation to obtain the non-first affine The output of the coupling operation.
在一些实施方式中,在第一特征图为单层级的特征图的情况下,第二特征图为对单层级的特征图进行映射得到的特征图,第二特征图中的特征表示原始图像中对应位置的特征的概率密度估计;在根据第二特征图,得到原始图像的异常热力图方面,处理部分2202还被配置为:在通道维度,对第二特征图中位置对应的概率密度估计求平方和;基于平方和的均值,得到待缩放特征图;对待缩放特征图进行缩放,得到异常热力图。In some implementations, when the first feature map is a single-level feature map, the second feature map is a feature map obtained by mapping a single-level feature map, and the features in the second feature map represent the original Probability density estimation of features corresponding to positions in the image; in terms of obtaining the abnormal heat map of the original image according to the second feature map, the processing part 2202 is also configured to: in the channel dimension, the probability density corresponding to the position in the second feature map Estimate the sum of squares; based on the mean of the sum of squares, obtain the feature map to be scaled; scale the feature map to be scaled to obtain an abnormal heat map.
在一些实施方式中,异常热力图中的特征用于表示原始图像中对应位置的异常评分,在根据异常热力图,得到原始图像的异常检测结果方面,处理部分2202还被配置为:获取异常评分与预设值的差值,预设值基于正常图像的分布参数确定;根据异常评分与预设值的差值确定原始图像中的异常区域,得到异常检测结果。In some implementations, the features in the abnormal heat map are used to represent the abnormal score of the corresponding position in the original image. In terms of obtaining the abnormal detection result of the original image according to the abnormal heat map, the processing part 2202 is further configured to: obtain the abnormal score The difference with the preset value, the preset value is determined based on the distribution parameters of the normal image; the abnormal region in the original image is determined according to the difference between the abnormality score and the preset value, and the abnormality detection result is obtained.
在一些实施方式中,对第一特征图进行特征提取,得到第二特征图是通过神经网络模型执行的,处理部分2202还被配置为:对正样本图像进行特征提取,得到第六特征图;通过神经网络将第六特征图映射为第七特征图,第七特征图中的特征表示正样本图像中对应位置的特征的概率密度估计;根据第七特征图中的概率密度估计确定目标损失;基于目标损失对神经网络的参数进行调整,得到神经网络模型。In some embodiments, performing feature extraction on the first feature map to obtain the second feature map is performed through a neural network model, and the processing part 2202 is further configured to: perform feature extraction on the positive sample image to obtain the sixth feature map; Mapping the sixth feature map to a seventh feature map through a neural network, the features in the seventh feature map represent the probability density estimates of the features in the corresponding positions in the positive sample image; determine the target loss according to the probability density estimation in the seventh feature map; Adjust the parameters of the neural network based on the target loss to obtain the neural network model.
在一些实施方式中,在根据第七特征图中的概率密度估计确定目标损失方面,处理部分2202还被配置为:根据第七特征图中的概率密度估计确定第六特征图中的特征的对数似然估计;将第六特征图中的特征的负对数似然估计作为目标损失。In some implementations, in determining the target loss from the probability density estimate in the seventh feature map, the processing part 2202 is further configured to: determine the pair of features in the sixth feature map from the probability density estimate in the seventh feature map Log-likelihood estimation; The negative log-likelihood estimation of the features in the sixth feature map is used as the target loss.
根据本公开的一个实施例,图22所示的异常检测装置2200中的各个部分可以分别或全部合并为一个或若干个另外的部分来构成,或者其中的某个(些)部分还可以再拆分为功能上更小的多个部分来构成,这可以实现同样的操作,而不影响本公开的实施例的技术效果的实现。上述部分是基于逻辑功能划分的,在实际应用中,一个部分的功能也可以由多个部分来实现,或者多个部分的功能由一个部分实现。在本公开的其它实施例中,基于异常检测装置2200也可以包括其它部分,在实际应用中,这些功能也可以由其它部分协助实现,并且可以由多个部分协作实现。According to an embodiment of the present disclosure, various parts in the abnormality detection device 2200 shown in FIG. Divided into multiple functionally smaller parts, this can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present disclosure. The above parts are divided based on logical functions. In practical applications, the functions of one part can also be realized by multiple parts, or the functions of multiple parts can be realized by one part. In other embodiments of the present disclosure, the anomaly detection device 2200 may also include other parts. In practical applications, these functions may also be implemented with the assistance of other parts, and may be implemented by cooperation of multiple parts.
根据本公开的另一个实施例,可以通过在包括中央处理单元(或称CPU(Central Processing Unit,中央处理器))、随机存取存储介质(RAM,Random Access Memory)、只读存储介质(ROM,Read-Only Memory)等处理元件和存储元件的例如计算机的通用计算设备上运行能够执行如图3或图18中所示的相应方法所涉及的各步骤的计算机程序(包括程序代码),来构造如图22中所示的异常检测装置设备,以及来实现本公开实施例的异常检测方法。所述计算机程序可以记载于例如计算机可读记录介质上,并通过计算机可读记录介质装载于上述计算设备中,并在其中运行。According to another embodiment of the present disclosure, it may be implemented by including a central processing unit (or called CPU (Central Processing Unit, central processing unit)), a random access storage medium (RAM, Random Access Memory), a read-only storage medium (ROM) , Read-Only Memory) and other processing elements and storage elements such as computer general-purpose computing devices run computer programs (including program codes) that can execute the steps involved in the corresponding methods as shown in Figure 3 or Figure 18, to An anomaly detection device as shown in FIG. 22 is constructed to implement the anomaly detection method of the embodiment of the present disclosure. The computer program can be recorded in, for example, a computer-readable recording medium, loaded into the above-mentioned computing device through the computer-readable recording medium, and executed therein.
基于上述方法实施例和装置实施例的描述,本公开实施例还提供一种电子设备2300。请参见图23,该电子设备至少包括处理器2310、输入设备2320、输出设备2330以及计算机存储介质2340。其中,电子设备2300内的处理器2310、输入设备2320、输出设备2330以及计算机存储介质2340可通过总线或其他方式连接。Based on the descriptions of the foregoing method embodiment and device embodiment, an embodiment of the present disclosure further provides an electronic device 2300 . Referring to FIG. 23 , the electronic device at least includes a processor 2310 , an input device 2320 , an output device 2330 and a computer storage medium 2340 . Wherein, the processor 2310, the input device 2320, the output device 2330 and the computer storage medium 2340 in the electronic device 2300 may be connected through a bus or other means.
计算机存储介质2340可以存储在电子设备2300的存储器中,所述计算机存储介质2340用于存储计算机程序,所述计算机程序包括程序指令,所述处理器2310用于执行所述计算机存储介质2340存储的程序指令。处理器2310是电子设备的计算核心以及控制核心,其适于实现一条或多条指令,具体适于加载并执行一条或多条指令从而实现相应方法流程或相应功能。The computer storage medium 2340 may be stored in the memory of the electronic device 2300, the computer storage medium 2340 is used to store a computer program, the computer program includes program instructions, and the processor 2310 is used to execute the program stored in the computer storage medium 2340. Program instructions. The processor 2310 is the computing core and control core of the electronic device, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to realize corresponding method procedures or corresponding functions.
在一些实施例中,本公开实施例提供的电子设备2300的处理器2310可以被配置为进行一系列异常检测处理:对原始图像进行特征提取,得到第一特征图;将第一特征图映射为第二特征图;根据第二特征图,得到原始图像的异常热力图;根据异常热力图,得到原始图像的异常检测结果。In some embodiments, the processor 2310 of the electronic device 2300 provided by the embodiments of the present disclosure may be configured to perform a series of anomaly detection processes: perform feature extraction on the original image to obtain a first feature map; map the first feature map to The second feature map; according to the second feature map, an abnormal heat map of the original image is obtained; according to the abnormal heat map, an abnormal detection result of the original image is obtained.
可以看出,在图23所示的电子设备2300中,通过对原始图像进行特征提取,得到第一特征图;将第一特征图映射为第二特征图;根据第二特征图,得到原始图像的异常热力图;根据异常热力图,得到原始图像的异常检测结果。由于第一特征图有利于更好地捕获原始图像局部与全局的关系,同时,对第一特征图进行映射得到的第二特征图保留了原始图像的特征空间信息,这样基于原始图像局部与全局的关系、特征空间信息及对第二特征图进行后处理,得到的异常热力图能够更准确地表示出原始图像中的异常区域,从而有利于提升图像异常检测的精度。It can be seen that in the electronic device 2300 shown in FIG. 23, the first feature map is obtained by performing feature extraction on the original image; the first feature map is mapped to the second feature map; and the original image is obtained according to the second feature map The anomaly heat map; according to the anomaly heat map, the abnormal detection result of the original image is obtained. Since the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the obtained anomaly heat map can more accurately represent the abnormal area in the original image, which is conducive to improving the accuracy of image anomaly detection.
在一些实施例中,处理器2310执行将第一特征图映射为第二特征图,包括:通过至少两次可逆转换处理,将第一特征图映射为第二特征图;其中,所述至少两次可逆转换处理中的第一次可逆转换处理所采用的二维卷积核的尺寸与第二次可逆转换处理所采用的二维卷积核的尺寸不同,所述第一次可逆转换处理为所述第二次可逆转换处理的上一次可逆转换处理。In some embodiments, the processor 2310 performing the mapping of the first feature map to the second feature map includes: mapping the first feature map to the second feature map through at least two reversible conversion processes; wherein the at least two The size of the two-dimensional convolution kernel used in the first reversible conversion process in the second reversible conversion process is different from the size of the two-dimensional convolution kernel used in the second reversible conversion process, and the first reversible conversion process is The previous reversible conversion process of the second reversible conversion process.
在一些实施例中,在第一特征图包括多层级的特征图的情况下,处理器2310执行将第一特征图映射为第二特征图,包括:对多层级的特征图进行尺度归一化,得到多个第一待拼接特征图,多个第一待拼接特征图与多层级的特征图一一对应;将多个第一待拼接特征图拼接为第三特征图;对于第三特征图,通过至少两次可逆转换处理,得到第二特征图。In some embodiments, when the first feature map includes multi-level feature maps, the processor 2310 executes mapping the first feature map to the second feature map, including: performing scale normalization on the multi-level feature maps , to obtain a plurality of first feature maps to be spliced, and a plurality of first feature maps to be spliced are in one-to-one correspondence with multi-level feature maps; a plurality of first feature maps to be spliced are spliced into a third feature map; for the third feature map , through at least two reversible transformation processes to obtain the second feature map.
在一些实施例中,在第一特征图包括多层级的特征图的情况下,处理器2310执行将第一特征图映射为第二特征图,包括:对于多层级的特征图,通过至少两次可逆转换处理,得到多个第四特征图,多个第四特征图与多层级的特征图一一对应;对多个第四特征图进行尺度归一化,得到多个第二待拼接特征图,多个第二待拼接特征图与多个第四特征图一一对应;将多个第二待拼接特征图拼接为第五特征图;对于第五特征图,通过至少两次可逆转换处理,得到第二特征图。In some embodiments, when the first feature map includes a multi-level feature map, the processor 2310 executes mapping the first feature map to the second feature map, including: for a multi-level feature map, pass at least twice Reversible conversion processing to obtain multiple fourth feature maps, which correspond to multi-level feature maps one by one; scale normalization for multiple fourth feature maps to obtain multiple second feature maps to be stitched , multiple second feature maps to be spliced correspond to multiple fourth feature maps one-to-one; multiple second feature maps to be spliced are spliced into a fifth feature map; for the fifth feature map, through at least two reversible conversion processes, Get the second feature map.
在一些实施例中,第二特征图中的特征表示原始图像中对应位置的特征的概率密度估计;处理器2310执行根据第二特征图,得到原始图像的异常热力图,包括:在通道维度,对第二特征图中位置对应的概率密度估计求平方和;基于平方和的均值,得到待缩放特征图;对待缩放特征图进行缩放,得到异常热力图。In some embodiments, the features in the second feature map represent the probability density estimation of the features corresponding to the position in the original image; the processor 2310 executes to obtain the abnormal heat map of the original image according to the second feature map, including: in the channel dimension, Calculate the sum of the squares of the probability density estimates corresponding to the positions in the second feature map; obtain the feature map to be scaled based on the mean of the sum of squares; and scale the feature map to be scaled to obtain an abnormal heat map.
在一些实施例中,在第一特征图包括多层级的特征图的情况下,处理器2301执行将第一特征图映射 为第二特征图,包括:对于多层级的特征图,通过至少两次可逆转换处理,得到多个第二特征图,多个第二特征图与多层级的特征图一一对应,多个第二特征图中的特征表示原始图像中对应位置的特征的概率密度估计;处理器2310执行根据第二特征图,得到原始图像的异常热力图,包括:对于多个第二特征图中的每个第二特征图,在通道维度,对每个第二特征图中位置对应的概率密度估计求平方和;根据平方和,得到异常热力图。In some embodiments, when the first feature map includes a multi-level feature map, the processor 2301 executes mapping the first feature map to the second feature map, including: for a multi-level feature map, pass at least twice Reversible conversion processing to obtain a plurality of second feature maps, the plurality of second feature maps correspond to the multi-level feature maps one by one, and the features in the plurality of second feature maps represent probability density estimates of features at corresponding positions in the original image; The processor 2310 executes to obtain the abnormal heat map of the original image according to the second feature map, including: for each second feature map in multiple second feature maps, in the channel dimension, corresponding to the position in each second feature map Calculate the sum of the squares of the probability density estimate; according to the sum of squares, an abnormal heat map is obtained.
在一些实施例中,处理器2310执行根据平方和,得到异常热力图,包括:基于平方和的均值,得到每个第二特征图对应的待归一化特征图;对待归一化特征图进行尺度归一化,以及对尺度归一化后的特征图进行融合,得到异常热力图。In some embodiments, the processor 2310 executes obtaining the abnormal heat map according to the sum of squares, including: obtaining the feature map to be normalized corresponding to each second feature map based on the mean value of the sum of squares; Scale normalization and fusion of the scale-normalized feature maps to obtain an abnormal heat map.
在一些实施例中,处理器2201执行至少两次可逆转换处理中的任意一次可逆转换处理,包括:对于待执行可逆转换处理的目标特征图,将目标特征图分裂为第一子目标特征图和第二子目标特征图;第一子目标特征图和第二子目标特征图的通道数相等;对于所述第一子目标特征图和所述第二子目标特征图,通过至少一次仿射耦合操作,得到第一待连接特征图;将所述第一待连接特征图与第二待连接特征图连接,得到可逆转换后的特征图;其中,所述至少一次仿射耦合操作中的首次仿射耦合操作的第二待连接特征图为所述第一子目标特征图或所述第二子目标特征图;所述至少一次仿射耦合操作中的非首次仿射耦合操作的第二待连接特征图为所述非首次仿射耦合操作的上一次仿射耦合操作得到的特征图。In some embodiments, the processor 2201 performs any one of the at least two reversible transformation processes, including: for the target feature map to be subjected to the reversible transformation process, splitting the target feature map into a first sub-target feature map and The second sub-target feature map; the number of channels of the first sub-target feature map and the second sub-target feature map are equal; for the first sub-target feature map and the second sub-target feature map, through at least one affine coupling operation to obtain the first feature map to be connected; connect the first feature map to be connected with the second feature map to be connected to obtain a reversibly transformed feature map; wherein, the first affine in the at least one affine coupling operation The second to-be-connected feature map of the affine coupling operation is the first sub-target feature map or the second sub-target feature map; the second to-be-connected feature map of the non-first affine coupling operation in the at least one affine coupling operation The feature map is the feature map obtained by the last affine coupling operation that is not the first affine coupling operation.
在一些实施例中,处理器2310执行至少一次仿射耦合操作中的任意一次仿射耦合操作,包括:在任意一次仿射耦合操作为首次仿射耦合操作的情况下,对第一子目标特征图或第二子目标特征图进行二维卷积处理,得到第一缩放系数和第一平移系数;采用第一缩放系数和第一平移系数,将未进行二维卷积处理的第二子目标特征图或第一子目标特征图,与首次仿射耦合操作中的二维卷积处理的输入进行线性组合,得到首次仿射耦合操作的输出;在任意一次仿射耦合操作为非首次仿射耦合操作的情况下,对所述非首次仿射耦合操作的上一次仿射耦合操作的输出进行二维卷积处理,得到第二缩放系数和第二平移系数;采用第二缩放系数和第二平移系数,将非首次仿射耦合操作的上一次仿射耦合操作的输出与上一次仿射耦合操作中二维卷积处理的输入进行线性组合,得到非首次仿射耦合操作的输出。In some embodiments, the processor 2310 executes any one of the at least one affine coupling operation, including: when any one of the affine coupling operations is the first affine coupling operation, performing the first sub-target feature Two-dimensional convolution processing is performed on the map or the second sub-target feature map to obtain the first scaling coefficient and the first translation coefficient; the second sub-target that has not been subjected to two-dimensional convolution processing is obtained by using the first scaling coefficient and the first translation coefficient The feature map or the first sub-target feature map is linearly combined with the input of the two-dimensional convolution processing in the first affine coupling operation to obtain the output of the first affine coupling operation; any affine coupling operation is a non-first affine In the case of a coupling operation, two-dimensional convolution processing is performed on the output of the last affine coupling operation of the non-first affine coupling operation to obtain a second scaling coefficient and a second translation coefficient; the second scaling coefficient and the second The translation coefficient, the output of the last affine coupling operation of the non-first affine coupling operation is linearly combined with the input of the two-dimensional convolution processing in the last affine coupling operation to obtain the output of the non-first affine coupling operation.
在一些实施例中,在第一特征图为单层级的特征图的情况下,第二特征图为对单层级的特征图进行映射得到的特征图,第二特征图中的特征表示原始图像中对应位置的特征的概率密度估计;处理器2310执行根据第二特征图,得到原始图像的异常热力图,包括:在通道维度,对第二特征图中位置对应的概率密度估计求平方和;基于平方和的均值,得到待缩放特征图;对待缩放特征图进行缩放,得到异常热力图。In some embodiments, when the first feature map is a single-level feature map, the second feature map is a feature map obtained by mapping a single-level feature map, and the features in the second feature map represent the original The probability density estimation of the features corresponding to the position in the image; the processor 2310 executes according to the second feature map to obtain the abnormal heat map of the original image, including: in the channel dimension, calculate the sum of the squares of the probability density estimates corresponding to the positions in the second feature map ; Based on the mean value of the sum of squares, the feature map to be scaled is obtained; the feature map to be scaled is scaled to obtain an abnormal heat map.
在一些实施例中,异常热力图中的特征用于表示原始图像中对应位置的异常评分,处理器2310执行根据异常热力图,得到原始图像的异常检测结果,包括:获取异常评分与预设值的差值,预设值基于正常图像的分布参数确定;根据异常评分与预设值的差值确定原始图像中的异常区域,得到异常检测结果。In some embodiments, the features in the anomaly heat map are used to represent the anomaly score of the corresponding position in the original image, and the processor 2310 executes to obtain the abnormality detection result of the original image according to the anomaly heat map, including: obtaining the anomaly score and the preset value The default value is determined based on the distribution parameters of the normal image; the abnormal area in the original image is determined according to the difference between the abnormal score and the preset value, and the abnormal detection result is obtained.
在一些实施例中,对第一特征图进行特征提取,得到第二特征图是通过神经网络模型执行的,处理器2310执行神经网络模型的训练,包括:对正样本图像进行特征提取,得到第六特征图;通过神经网络将第六特征图映射为第七特征图,第七特征图中的特征表示正样本图像中对应位置的特征的概率密度估计;根据第七特征图中的概率密度估计确定目标损失;基于目标损失对神经网络的参数进行调整,得到神经网络模型。In some embodiments, performing feature extraction on the first feature map to obtain the second feature map is performed through a neural network model, and the processor 2310 executes the training of the neural network model, including: performing feature extraction on the positive sample image to obtain the second feature map Six feature maps; the sixth feature map is mapped to the seventh feature map through the neural network, and the features in the seventh feature map represent the probability density estimation of the features corresponding to the position in the positive sample image; according to the probability density estimation in the seventh feature map Determine the target loss; adjust the parameters of the neural network based on the target loss to obtain a neural network model.
在一些实施例中,处理器2310执行根据第七特征图中的概率密度估计确定目标损失,包括:根据第七特征图中的概率密度估计确定第六特征图中的特征的对数似然估计;将第六特征图中的特征的负对数似然估计作为目标损失。In some embodiments, the processor 2310 performing determining the target loss according to the probability density estimation in the seventh feature map includes: determining the log likelihood estimation of the features in the sixth feature map according to the probability density estimation in the seventh feature map ; Estimate the negative log-likelihood of the features in the sixth feature map as the target loss.
示例性的,电子设备2310可包括但不仅限于处理器2310、输入设备2320、输出设备2330、计算机存储介质2340、内存2350、电源2360和应用客户端部分2370,输入设备2320可以是键盘2321、触摸屏2322和射频接收器2323等,输出设备2330可以是扬声器2331、显示器2332和射频发送器2333等。本领域技术人员可以理解,所述示意图仅仅是电子设备2300的示例,并不构成对电子设备2300的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件。Exemplary, the electronic device 2310 may include but not limited to a processor 2310, an input device 2320, an output device 2330, a computer storage medium 2340, a memory 2350, a power supply 2360 and an application client part 2370, and the input device 2320 may be a keyboard 2321, a touch screen 2322, a radio frequency receiver 2323, etc., and the output device 2330 may be a speaker 2331, a display 2332, a radio frequency transmitter 2333, etc. Those skilled in the art can understand that the schematic diagram is only an example of the electronic device 2300, and does not constitute a limitation to the electronic device 2300. part.
需要说明的是,由于电子设备2300的处理器2310执行计算机程序时实现上述的异常检测方法中的步骤,因此上述异常检测方法的实施例均适用于该电子设备2300,且均能达到相同或相似的有益效果。It should be noted that since the processor 2310 of the electronic device 2300 executes the computer program to implement the steps in the above-mentioned anomaly detection method, the embodiments of the above-mentioned anomaly detection method are all applicable to the electronic device 2300, and can achieve the same or similar beneficial effect.
本公开实施例还提供了一种计算机存储介质(Memory),所述计算机存储介质可以是易失性存储介质或非易失性存储介质,是电子设备2200中的记忆设备,用于存放程序和数据。可以理解的是,此处的计算机存储介质既可以包括终端中的内置存储介质,当然也可以包括终端所支持的扩展存储介质。计算机存储介质提供存储空间,该存储空间存储了终端的操作系统。并且,在该存储空间中还存放了适于被处理器2310加载并执行的一条或多条的指令,这些指令可以是一个或一个以上的计算机程序(包括程序代码)。需要说明的是,此处的计算机存储介质可以是高速随机存取存储器(Random Access Memory,RAM)存储器,也可以是非不稳定的存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器;还可以是至少一个位于远离前述处理器2310的计算机可读存储介质。在一个实施例中,可由处理器2310加载并执行 计算机存储介质中存放的一条或多条指令,以实现上述有关异常检测方法的相应步骤。An embodiment of the present disclosure also provides a computer storage medium (Memory). The computer storage medium may be a volatile storage medium or a non-volatile storage medium, and is a memory device in the electronic device 2200 for storing programs and data. It can be understood that the computer storage medium here may include a built-in storage medium in the terminal, and of course may also include an extended storage medium supported by the terminal. The computer storage medium provides storage space, and the storage space stores the operating system of the terminal. Moreover, one or more instructions suitable for being loaded and executed by the processor 2310 are also stored in the storage space, and these instructions may be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed random access memory (Random Access Memory, RAM) memory, or a non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory; It may be at least one computer-readable storage medium located away from the aforementioned processor 2310. In one embodiment, the processor 2310 can load and execute one or more instructions stored in the computer storage medium, so as to realize the corresponding steps of the above-mentioned anomaly detection method.
示例性的,计算机存储介质的计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。所述计算机可读介质可以包括:能够携带所述计算机程序代码的任何实体或装置、记录介质、U盘、移动硬盘、磁碟、光盘、计算机存储器、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、电载波信号、电信信号以及软件分发介质等。Exemplarily, the computer program on the computer storage medium includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a removable hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (Read-Only Memory, ROM) , random access memory (Random Access Memory, RAM), electric carrier signal, telecommunication signal and software distribution medium, etc.
需要说明的是,由于计算机存储介质的计算机程序被处理器执行时实现上述的异常检测方法中的步骤,因此上述异常检测方法的所有实施例均适用于该计算机存储介质,且均能达到相同或相似的有益效果。It should be noted that, since the computer program of the computer storage medium is executed by the processor to implement the steps in the above-mentioned anomaly detection method, all embodiments of the above-mentioned anomaly detection method are applicable to the computer storage medium, and can achieve the same or similar beneficial effects.
本公开实施例还提供了一种计算机程序产品,其中,上述计算机程序产品包括计算机程序,上述计算机程序可操作来使计算机执行如上述异常检测方法中的步骤。该计算机程序产品可以为一个软件安装包。An embodiment of the present disclosure further provides a computer program product, wherein the above computer program product includes a computer program, and the above computer program is operable to cause a computer to execute the steps in the above anomaly detection method. The computer program product may be a software installation package.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本公开并不受所描述的动作顺序的限制,因为依据本公开,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及的动作和模块并不一定是本公开所必须的。It should be noted that for the foregoing method embodiments, for the sake of simple description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present disclosure is not limited by the described action sequence. Because of this disclosure, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present disclosure.
在上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the foregoing embodiments, the descriptions of each embodiment have their own emphases, and for parts not described in detail in a certain embodiment, reference may be made to relevant descriptions of other embodiments.
在本公开所提供的几个实施例中,应该理解到,所揭露的装置,可通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如所述部分的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个部分或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或部分的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in the present disclosure, it should be understood that the disclosed device may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the parts is only a logical function division. In actual implementation, there may be other division methods. For example, multiple parts or components can be combined or can be Integrate into another system, or some features may be ignored, or not implemented. In another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or parts may be in electrical or other forms.
所述作为分离部件说明的部分可以是或者也可以不是物理上分开的,作为“部分”显示的部件可以是或者也可以不是物理部分,即可以位于一个地方,或者也可以分布到多个网络部分上。可以根据实际的需要选择其中的部分或者全部部分来实现本实施例方案的目的。The parts described as separate components may or may not be physically separated, and the components displayed as "parts" may or may not be physical parts, that is, they may be located in one place, or may be distributed to multiple network parts superior. Some or all of them can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本公开各个实施例中的各功能“部分”可以集成在一个处理部分中,也可以是各个部分单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件程序模块的形式实现。In addition, each functional "part" in each embodiment of the present disclosure may be integrated into one processing part, each part may exist separately physically, or two or more units may be integrated into one unit. The above-mentioned integrated units can be implemented not only in the form of hardware, but also in the form of software program modules.
所述集成的部分如果以软件程序模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储器中。基于这样的理解,本公开的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储器中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本公开各个实施例所述方法的全部或部分步骤。The integrated parts may be stored in a computer-readable memory if implemented in the form of software program modules and sold or used as independent products. Based on such an understanding, the essence of the technical solution disclosed in this disclosure 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, and the computer software product is stored in a memory. Several instructions are included to make a computer device (which may be a personal computer, server or network device, etc.) execute all or part of the steps of the methods described in the various embodiments of the present disclosure.
以上对本公开实施例进行了详细介绍,本文中应用了具体实施例对本公开的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本公开的方法及其核心思想;同时,对于本领域的一般技术人员,依据本公开的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本公开的限制。The embodiments of the present disclosure have been introduced in detail above, and the principles and implementation methods of the present disclosure have been explained by using specific embodiments in this paper. The descriptions of the above embodiments are only used to help understand the methods and core ideas of the present disclosure; at the same time, for Those skilled in the art may have changes in specific implementation methods and application scopes based on the idea of the present disclosure. In summary, the contents of this specification should not be construed as limiting the present disclosure.
工业实用性Industrial Applicability
本公开实施例,通过对原始图像进行特征提取,得到第一特征图;将第一特征图映射为第二特征图;根据第二特征图,得到原始图像的异常热力图;根据异常热力图,得到原始图像的异常检测结果。由于第一特征图有利于更好地捕获原始图像局部与全局的关系,同时,对第一特征图进行映射得到的第二特征图保留了原始图像的特征空间信息,这样基于原始图像局部与全局的关系、特征空间信息及对第二特征图进行后处理,得到的异常热力图能够更准确地表示出原始图像中的异常分布(或异常区域),从而有利于提升图像异常检测的精度。In the embodiment of the present disclosure, the first feature map is obtained by extracting features from the original image; the first feature map is mapped to the second feature map; according to the second feature map, the abnormal heat map of the original image is obtained; according to the abnormal heat map, Get the anomaly detection results of the original image. Since the first feature map is beneficial to better capture the relationship between the local and the global of the original image, and at the same time, the second feature map obtained by mapping the first feature map retains the feature space information of the original image, so based on the original image local and global relationship, feature space information, and post-processing the second feature map, the abnormal heat map obtained can more accurately represent the abnormal distribution (or abnormal region) in the original image, which is conducive to improving the accuracy of image anomaly detection.

Claims (17)

  1. 一种异常检测方法,所述方法由电子设备执行,所述方法包括:An anomaly detection method, the method is performed by an electronic device, and the method includes:
    对原始图像进行特征提取,得到第一特征图;performing feature extraction on the original image to obtain a first feature map;
    将所述第一特征图映射为第二特征图;mapping the first feature map to a second feature map;
    根据所述第二特征图,得到所述原始图像的异常热力图;Obtaining an abnormal heat map of the original image according to the second feature map;
    根据所述异常热力图,得到所述原始图像的异常检测结果。According to the abnormal heat map, an abnormal detection result of the original image is obtained.
  2. 根据权利要求1所述的方法,其中,所述将所述第一特征图映射为第二特征图,包括:The method according to claim 1, wherein said mapping the first feature map to a second feature map comprises:
    通过至少两次可逆转换处理,将所述第一特征图映射为所述第二特征图;mapping the first feature map to the second feature map through at least two reversible transformation processes;
    其中,所述至少两次可逆转换处理中的第一次可逆转换处理所采用的二维卷积核的尺寸与第二次可逆转换处理所采用的二维卷积核的尺寸不同,所述第一次可逆转换处理为所述第二次可逆转换处理的上一次可逆转换处理。Wherein, the size of the two-dimensional convolution kernel used in the first reversible conversion process in the at least two reversible conversion processes is different from the size of the two-dimensional convolution kernel used in the second reversible conversion process, and the second The first reversible conversion process is the previous reversible conversion process of the second reversible conversion process.
  3. 根据权利要求1或2所述的方法,其中,在所述第一特征图包括多层级的特征图的情况下,所述将所述第一特征图映射为第二特征图,包括:The method according to claim 1 or 2, wherein, in the case where the first feature map includes a multi-level feature map, mapping the first feature map to a second feature map comprises:
    对所述多层级的特征图进行尺度归一化,得到多个第一待拼接特征图,所述多个第一待拼接特征图与所述多层级的特征图一一对应;performing scale normalization on the multi-level feature maps to obtain a plurality of first feature maps to be stitched, wherein the plurality of first feature maps to be stitched are in one-to-one correspondence with the multi-level feature maps;
    将所述多个第一待拼接特征图拼接为第三特征图;splicing the plurality of first feature maps to be spliced into a third feature map;
    对于所述第三特征图,通过至少两次可逆转换处理,得到所述第二特征图。For the third feature map, the second feature map is obtained through at least two reversible transformation processes.
  4. 根据权利要求1或2所述的方法,其中,在所述第一特征图包括多层级的特征图的情况下,所述将所述第一特征图映射为第二特征图,包括:The method according to claim 1 or 2, wherein, in the case where the first feature map includes a multi-level feature map, mapping the first feature map to a second feature map comprises:
    对于所述多层级的特征图,通过至少两次可逆转换处理,得到多个第四特征图,所述多个第四特征图与所述多层级的特征图一一对应;For the multi-level feature map, a plurality of fourth feature maps are obtained through at least two reversible conversion processes, and the plurality of fourth feature maps correspond to the multi-level feature map one-to-one;
    对所述多个第四特征图进行尺度归一化,得到多个第二待拼接特征图,所述多个第二待拼接特征图与所述多个第四特征图一一对应;performing scale normalization on the plurality of fourth feature maps to obtain a plurality of second feature maps to be stitched, wherein the plurality of second feature maps to be stitched correspond one-to-one to the plurality of fourth feature maps;
    将所述多个第二待拼接特征图拼接为第五特征图;splicing the plurality of second feature maps to be spliced into a fifth feature map;
    对于所述第五特征图,通过至少两次可逆转换处理,得到所述第二特征图。For the fifth feature map, the second feature map is obtained through at least two reversible transformation processes.
  5. 根据权利要求3或4所述的方法,其中,所述第二特征图中的特征表示所述原始图像中对应位置的特征的概率密度估计;The method according to claim 3 or 4, wherein the features in the second feature map represent probability density estimates of features at corresponding positions in the original image;
    所述根据所述第二特征图,得到所述原始图像的异常热力图,包括:According to the second feature map, the abnormal heat map of the original image is obtained, including:
    在通道维度,对所述第二特征图中位置对应的概率密度估计求平方和;In the channel dimension, summing the squares of the probability density estimates corresponding to the positions in the second feature map;
    基于所述平方和的均值,得到待缩放特征图;Obtain the feature map to be scaled based on the mean value of the sum of squares;
    对所述待缩放特征图进行缩放,得到所述异常热力图。Scaling the feature map to be scaled to obtain the abnormal heat map.
  6. 根据权利要求1或2所述的方法,其中,在所述第一特征图包括多层级的特征图的情况下,所述将所述第一特征图映射为第二特征图,包括:The method according to claim 1 or 2, wherein, in the case where the first feature map includes a multi-level feature map, mapping the first feature map to a second feature map comprises:
    对于所述多层级的特征图,通过至少两次可逆转换处理,得到多个第二特征图,所述多个第二特征图与所述多层级的特征图一一对应,所述多个第二特征图中的特征表示所述原始图像中对应位置的特征的概率密度估计;For the multi-level feature map, through at least two reversible conversion processes, a plurality of second feature maps are obtained, the plurality of second feature maps correspond to the multi-level feature map one-to-one, and the plurality of first feature maps The features in the two feature maps represent the probability density estimates of the features in the corresponding positions in the original image;
    所述根据所述第二特征图,得到所述原始图像的异常热力图,包括:According to the second feature map, the abnormal heat map of the original image is obtained, including:
    对于所述多个第二特征图中的每个第二特征图,在通道维度,对所述每个第二特征图中位置对应的概率密度估计求平方和;For each second feature map in the plurality of second feature maps, in the channel dimension, summing the squares of probability density estimates corresponding to positions in each second feature map;
    根据所述平方和,得到所述异常热力图。According to the sum of squares, the abnormal heat map is obtained.
  7. 根据权利要求6所述的方法,其中,所述根据所述平方和,得到所述异常热力图,包括:The method according to claim 6, wherein said obtaining said abnormal heat map according to said sum of squares comprises:
    基于所述平方和的均值,得到所述每个第二特征图对应的待归一化特征图;Obtaining a feature map to be normalized corresponding to each second feature map based on the mean value of the sum of squares;
    对所述待归一化特征图进行尺度归一化,以及对尺度归一化后的特征图进行融合,得到所述异常热力图。Scale normalization is performed on the feature map to be normalized, and the scale normalized feature map is fused to obtain the abnormal heat map.
  8. 根据权利要求2至4或6中任一项所述的方法,其中,所述至少两次可逆转换处理中的任意一次可逆转换处理,包括:The method according to any one of claims 2 to 4 or 6, wherein any one of the at least two reversible conversion processes includes:
    对于待执行可逆转换处理的目标特征图,将所述目标特征图分裂为第一子目标特征图和第二子目标特征图;所述第一子目标特征图和所述第二子目标特征图的通道数相等;For the target feature map to be reversibly converted, split the target feature map into a first sub-target feature map and a second sub-target feature map; the first sub-target feature map and the second sub-target feature map The number of channels is equal;
    对于所述第一子目标特征图和所述第二子目标特征图,通过至少一次仿射耦合操作,得到第一待连接特征图;For the first sub-object feature map and the second sub-object feature map, obtain a first feature map to be connected through at least one affine coupling operation;
    将所述第一待连接特征图与第二待连接特征图连接,得到可逆转换后的特征图;connecting the first feature map to be connected with the second feature map to be connected to obtain a reversibly transformed feature map;
    其中,所述至少一次仿射耦合操作中的首次仿射耦合操作的第二待连接特征图为所述第一子目标特征图或所述第二子目标特征图;所述至少一次仿射耦合操作中的非首次仿射耦合操作的第二待连接特征图为所述非首次仿射耦合操作的上一次仿射耦合操作得到的特征图。Wherein, the second to-be-connected feature map of the first affine coupling operation in the at least one affine coupling operation is the first sub-target feature map or the second sub-target feature map; the at least one affine coupling The second to-be-connected feature map of the non-first affine coupling operation in operation is the feature map obtained by the last affine coupling operation of the non-first affine coupling operation.
  9. 根据权利要求8所述的方法,其中,所述至少一次仿射耦合操作中的任意一次仿射耦合操作,包括:The method according to claim 8, wherein any one of the at least one affine coupling operation comprises:
    在所述任意一次仿射耦合操作为首次仿射耦合操作的情况下,对所述第一子目标特征图或所述第二子目标特征图进行二维卷积处理,得到第一缩放系数和第一平移系数;In the case that any one of the affine coupling operations is the first affine coupling operation, two-dimensional convolution processing is performed on the first sub-target feature map or the second sub-target feature map to obtain the first scaling factor and first translation factor;
    采用所述第一缩放系数和所述第一平移系数,将未进行二维卷积处理的所述第二子目标特征图或所述第一子目标特征图,与所述首次仿射耦合操作中的二维卷积处理的输入进行线性组合,得到所述首次仿射耦合操作的输出;Using the first scaling coefficient and the first translation coefficient, the second sub-object feature map or the first sub-object feature map that has not been subjected to two-dimensional convolution processing, and the first affine coupling operation The input of the two-dimensional convolution processing in is linearly combined to obtain the output of the first affine coupling operation;
    在所述任意一次仿射耦合操作为非首次仿射耦合操作的情况下,对所述非首次仿射耦合操作的上一次仿射耦合操作的输出进行二维卷积处理,得到第二缩放系数和第二平移系数;In the case that any one of the affine coupling operations is a non-first affine coupling operation, two-dimensional convolution processing is performed on the output of the last affine coupling operation of the non-first affine coupling operation to obtain a second scaling factor and the second translation coefficient;
    采用所述第二缩放系数和所述第二平移系数,将所述上一次仿射耦合操作的输出与所述上一次仿射耦合操作中二维卷积处理的输入进行线性组合,得到所述非首次仿射耦合操作的输出。Using the second scaling coefficient and the second translation coefficient, linearly combine the output of the last affine coupling operation with the input of the two-dimensional convolution processing in the last affine coupling operation to obtain the The output of the non-first affine coupling operation.
  10. 根据权利要求1或2所述的方法,其中,在所述第一特征图为单层级的特征图的情况下,所述第二特征图为对所述单层级的特征图进行映射得到的特征图,所述第二特征图中的特征表示所述原始图像中对应位置的特征的概率密度估计;The method according to claim 1 or 2, wherein, when the first feature map is a single-level feature map, the second feature map is obtained by mapping the single-level feature map The feature map of the second feature map represents the probability density estimation of the feature of the corresponding position in the original image;
    所述根据所述第二特征图,得到所述原始图像的异常热力图,包括:According to the second feature map, the abnormal heat map of the original image is obtained, including:
    在通道维度,对所述第二特征图中位置对应的概率密度估计求平方和;In the channel dimension, summing the squares of the probability density estimates corresponding to the positions in the second feature map;
    基于所述平方和的均值,得到待缩放特征图;Obtain the feature map to be scaled based on the mean value of the sum of squares;
    对所述待缩放特征图进行缩放,得到所述异常热力图。Scaling the feature map to be scaled to obtain the abnormal heat map.
  11. 根据权利要求1至10任一项所述的方法,其中,所述异常热力图中的特征用于表示所述原始图像中对应位置的异常评分,所述根据所述异常热力图,得到所述原始图像的异常检测结果,包括:The method according to any one of claims 1 to 10, wherein the features in the abnormal heat map are used to represent the abnormal score of the corresponding position in the original image, and according to the abnormal heat map, the Anomaly detection results for raw images, including:
    获取所述异常评分与预设值的差值,所述预设值基于正常图像的分布参数确定;Acquiring the difference between the abnormal score and a preset value, the preset value is determined based on the distribution parameters of the normal image;
    根据所述异常评分与所述预设值的差值确定所述原始图像中的异常区域,得到所述异常检测结果。The abnormal region in the original image is determined according to the difference between the abnormality score and the preset value, and the abnormality detection result is obtained.
  12. 根据权利要求1至11任一项所述的方法,其中,所述将所述第一特征图映射为第二特征图是通过神经网络模型执行的,所述神经网络模型采用以下步骤训练得到:The method according to any one of claims 1 to 11, wherein the mapping of the first feature map to the second feature map is performed through a neural network model, and the neural network model is obtained by training through the following steps:
    对正样本图像进行特征提取,得到第六特征图;Perform feature extraction on the positive sample image to obtain the sixth feature map;
    通过神经网络将所述第六特征图映射为第七特征图,所述第七特征图中的特征表示所述正样本图像中对应位置的特征的概率密度估计;Mapping the sixth feature map to a seventh feature map through a neural network, where the features in the seventh feature map represent probability density estimates of features at corresponding positions in the positive sample image;
    根据所述第七特征图中的概率密度估计确定目标损失;determining a target loss based on a probability density estimate in the seventh feature map;
    基于所述目标损失对所述神经网络的参数进行调整,得到所述神经网络模型。The parameters of the neural network are adjusted based on the target loss to obtain the neural network model.
  13. 根据权利要求12所述的方法,其中,所述根据所述第七特征图中的概率密度估计确定目标损失,包括:The method according to claim 12, wherein said determining a target loss based on a probability density estimate in said seventh feature map comprises:
    根据所述第七特征图中的概率密度估计确定所述第六特征图中的特征的对数似然估计;determining log-likelihood estimates for features in the sixth feature map based on probability density estimates in the seventh feature map;
    将所述第六特征图中的特征的负对数似然估计作为所述目标损失。The negative log likelihood estimation of the features in the sixth feature map is used as the target loss.
  14. 一种异常检测装置,所述装置包括特征提取单元和处理单元,其中,An anomaly detection device, the device includes a feature extraction unit and a processing unit, wherein,
    所述特征提取部分,被配置为对原始图像进行特征提取,得到第一特征图;The feature extraction part is configured to perform feature extraction on the original image to obtain a first feature map;
    所述特征提取部分,还被配置为将所述第一特征图映射为第二特征图;The feature extraction part is further configured to map the first feature map to a second feature map;
    所述处理部分,被配置为根据所述第二特征图,得到所述原始图像的异常热力图;The processing part is configured to obtain an abnormal heat map of the original image according to the second feature map;
    所述处理部分,还被配置为根据所述异常热力图,得到所述原始图像的异常检测结果。The processing part is further configured to obtain an abnormality detection result of the original image according to the abnormality heat map.
  15. 一种电子设备,包括输入设备和输出设备,还包括处理器和计算机存储介质;An electronic device, including input devices and output devices, including a processor and computer storage media;
    所述处理器,被配置为实现一条或多条指令;以及,the processor configured to implement one or more instructions; and,
    所述计算机存储介质,存储有一条或多条指令,所述一条或多条指令被所述处理器加载并执行如权利要求1至13任意一项所述的方法。The computer storage medium stores one or more instructions, and the one or more instructions are loaded by the processor to execute the method according to any one of claims 1 to 13.
  16. 一种计算机存储介质,所述计算机存储介质存储有一条或多条指令,所述一条或多条指令被处理器加载并执行如权利要求1至13任意一项所述的方法。A computer storage medium, the computer storage medium stores one or more instructions, and the one or more instructions are loaded by a processor to execute the method according to any one of claims 1 to 13.
  17. 一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机存储介质,所述计算机程序被计算机读取并执行如权利要求1至13任意一项所述的方法。A computer program product, the computer program product comprising a non-transitory computer storage medium storing a computer program, the computer program being read by a computer and executing the method according to any one of claims 1 to 13.
PCT/CN2022/092205 2021-11-16 2022-05-11 Anomaly detection method and apparatus, and electronic device, storage medium and computer program product WO2023087636A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111359576.3 2021-11-16
CN202111359576.3A CN114049332A (en) 2021-11-16 2021-11-16 Abnormality detection method and apparatus, electronic device, and storage medium

Publications (1)

Publication Number Publication Date
WO2023087636A1 true WO2023087636A1 (en) 2023-05-25

Family

ID=80209529

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/092205 WO2023087636A1 (en) 2021-11-16 2022-05-11 Anomaly detection method and apparatus, and electronic device, storage medium and computer program product

Country Status (2)

Country Link
CN (1) CN114049332A (en)
WO (1) WO2023087636A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117218457A (en) * 2023-11-07 2023-12-12 成都理工大学 Self-supervision industrial anomaly detection method based on double-layer two-dimensional normalized flow

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114049332A (en) * 2021-11-16 2022-02-15 上海商汤智能科技有限公司 Abnormality detection method and apparatus, electronic device, and storage medium
CN114820541A (en) * 2022-05-07 2022-07-29 武汉象点科技有限公司 Defect detection method based on reconstructed network
CN114782694B (en) * 2022-06-21 2022-09-30 中国科学技术大学 Unsupervised anomaly detection method, system, device and storage medium
CN115147669B (en) * 2022-06-24 2023-04-18 北京百度网讯科技有限公司 Image processing method, training method and equipment based on visual converter model
CN115147418B (en) * 2022-09-05 2022-12-27 东声(苏州)智能科技有限公司 Compression training method and device for defect detection model
CN118014922A (en) * 2022-11-09 2024-05-10 华为技术有限公司 Image anomaly detection method, device, equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090279772A1 (en) * 2008-05-12 2009-11-12 General Electric Company Method and System for Identifying Defects in NDT Image Data
CN112907589A (en) * 2021-04-02 2021-06-04 联通(上海)产业互联网有限公司 Deep learning algorithm for detecting abnormality and segmenting abnormal region in image
CN114049332A (en) * 2021-11-16 2022-02-15 上海商汤智能科技有限公司 Abnormality detection method and apparatus, electronic device, and storage medium

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090279772A1 (en) * 2008-05-12 2009-11-12 General Electric Company Method and System for Identifying Defects in NDT Image Data
CN112907589A (en) * 2021-04-02 2021-06-04 联通(上海)产业互联网有限公司 Deep learning algorithm for detecting abnormality and segmenting abnormal region in image
CN114049332A (en) * 2021-11-16 2022-02-15 上海商汤智能科技有限公司 Abnormality detection method and apparatus, electronic device, and storage medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
DENIS GUDOVSKIY; SHUN ISHIZAKA; KAZUKI KOZUKA: "CFLOW-AD: Real-Time Unsupervised Anomaly Detection with Localization via Conditional Normalizing Flows", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 27 July 2021 (2021-07-27), 201 Olin Library Cornell University Ithaca, NY 14853, XP091017053 *
JIAWEI YU1; YE ZHENG; XIANG WANG; WEI LI; YUSHUANG WU; RUI ZHAO; LIWEI WU1: "FastFlow: Unsupervised Anomaly Detection and Localization via 2D Normalizing Flows", ARXIV.ORG, CORNELL UNIVERSITY LIBRARY, 201 OLIN LIBRARY CORNELL UNIVERSITY ITHACA, NY 14853, 15 November 2021 (2021-11-15), 201 Olin Library Cornell University Ithaca, NY 14853, XP091099647 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117218457A (en) * 2023-11-07 2023-12-12 成都理工大学 Self-supervision industrial anomaly detection method based on double-layer two-dimensional normalized flow
CN117218457B (en) * 2023-11-07 2024-01-26 成都理工大学 Self-supervision industrial anomaly detection method based on double-layer two-dimensional normalized flow

Also Published As

Publication number Publication date
CN114049332A (en) 2022-02-15

Similar Documents

Publication Publication Date Title
WO2023087636A1 (en) Anomaly detection method and apparatus, and electronic device, storage medium and computer program product
CN109508681B (en) Method and device for generating human body key point detection model
US10467756B2 (en) Systems and methods for determining a camera pose of an image
WO2020006961A1 (en) Image extraction method and device
US9858472B2 (en) Three-dimensional facial recognition method and system
CN108256479B (en) Face tracking method and device
CN108197618B (en) Method and device for generating human face detection model
CN109858333B (en) Image processing method, image processing device, electronic equipment and computer readable medium
WO2016023264A1 (en) Fingerprint identification method and fingerprint identification device
US9626552B2 (en) Calculating facial image similarity
CN108960114A (en) Human body recognition method and device, computer readable storage medium and electronic equipment
JP2016508652A (en) Determining object occlusion in image sequences
WO2018082308A1 (en) Image processing method and terminal
CN112446322B (en) Eyeball characteristic detection method, device, equipment and computer readable storage medium
CN108197584A (en) A kind of recognition methods again of the pedestrian based on triple deep neural network
CN113362314B (en) Medical image recognition method, recognition model training method and device
CN114140623A (en) Image feature point extraction method and system
CN114298997A (en) Method and device for detecting forged picture and storage medium
CN113793370A (en) Three-dimensional point cloud registration method and device, electronic equipment and readable medium
Liu et al. Iris recognition in visible spectrum based on multi-layer analogous convolution and collaborative representation
CN113761995A (en) Cross-mode pedestrian re-identification method based on double-transformation alignment and blocking
US20200357137A1 (en) Determining a Pose of an Object in the Surroundings of the Object by Means of Multi-Task Learning
CN117765363A (en) Image anomaly detection method and system based on lightweight memory bank
Gao et al. Occluded person re-identification based on feature fusion and sparse reconstruction
Kelenyi et al. SAM-Net: self-attention based feature matching with spatial transformers and knowledge distillation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22894181

Country of ref document: EP

Kind code of ref document: A1