Generalized anomaly detection
Described are methods and systems for training a system for detecting anomalies in images of documents in a class of documents. A plurality of training document images of training documents in a class of documents are obtained. For each training document image, the training document image is segmented into a plurality of region of interest (ROI) images, each ROI image corresponding to a respective ROI of the training document. For each ROI image, a plurality of transformations are applied to the ROI image to generate respective transform-specific features for the ROI image and respective transform-specific anomaly scores from the transform-specific features. Based on the respective anomaly scores of the plurality of training document images, a transform-specific threshold is computed for each transformation to separate document images containing an anomaly from document images not containing an anomaly.
1 . A computer-implemented method of sourcing training images for a system for detecting anomalies in images of documents in a class of documents, the method comprising:
(a) obtaining one or more document images of a fraudulent document;
(b) for each document image:
(i) segmenting the document image into one or more region of interest (ROI) images, each ROI image corresponding to a respective ROI of the fraudulent document;
(ii) generating a vector representation of each ROI image in an embedding space, the embedding space comprising vector representations of one or more other ROI images from a plurality of sample document images;
(iii) determining a similarity between each ROI image from the fraudulent document and one or more other ROI images from sample document images using the vector representations in the embedding space; and
(iv) selecting a plurality of sample document images that have ROI images similar to the ROI images from the fraudulent document and generating a training data set using the selected sample document images; and
(c) in response to a determination that a size of the training data set exceeds a predetermined size threshold, training a supervised anomaly detection machine learning model using the training data set.
2 . The method of claim 1 , wherein the vector representation of each ROI image is generated using a vision transformer (ViT) model.
3 . The method of claim 1 , wherein the similarity is determined using a distance metric.
4 . The method of claim 1 , wherein the one or more document images of the fraudulent document are obtained from an external application programming interface (API) or a user interface of a production anomaly detection system.
5 . The method of claim 1 , wherein at least one of the one or more ROI images comprises an image of the entire fraudulent document.
6 . The method of claim 1 , wherein at least one of the one or more ROI images comprises an image of a portion of the fraudulent document.
7 . The method of claim 1 , wherein generating a vector representation of each ROI image in an embedding space comprises projecting the vector representation into the embedding space.
8 . The method of claim 1 , wherein training a supervised anomaly detection machine learning model using the training data set comprises:
training a plurality of supervised anomaly detection machine learning models using the training data set, each supervised anomaly detection machine learning model corresponding to a respective ROI of the fraudulent document.
9 . A system for sourcing training images for a system for detecting anomalies in images of documents in a class of documents, the system comprising a computing device having a memory for storing computer-executable instructions and a processor that executes the computer-executable instructions to:
(a) obtain one or more document images of a fraudulent document;
(b) for each document image:
(i) segment the document image into one or more region of interest (ROI) images, each ROI image corresponding to a respective ROI of the fraudulent document;
(ii) generate a vector representation of each ROI image in an embedding space, the embedding space comprising vector representations of one or more other ROI images from a plurality of sample document images;
(iii) determine a similarity between each ROI image from the fraudulent document and one or more other ROI images from sample document images using the vector representations in the embedding space; and
(iv) select a plurality of sample document images that have ROI images similar to the ROI images from the fraudulent document and generating a training data set using the selected sample document images;
(c) determine whether a size of the training data set exceeds a predetermined size threshold; and
(d) in response to a determination that the size of the training data set exceeds the predetermined size threshold, train a supervised anomaly detection machine learning model using the training data set; or
(e) in response to a determination that the size of the training data set does not exceed the predetermined size threshold, train an unsupervised anomaly detection machine learning model using the training data set.
10 . The system of claim 9 , wherein the vector representation of each ROI image is generated using a vision transformer (ViT) model.
11 . The system of claim 9 , wherein the similarity is determined using a distance metric.
12 . The system of claim 9 , wherein the one or more document images of the fraudulent document are obtained from an external application programming interface (API) or a user interface of a production anomaly detection system.
13 . The system of claim 9 , wherein at least one of the one or more ROI images comprises an image of the entire fraudulent document.
14 . The system of claim 9 , wherein at least one of the one or more ROI images comprises an image of a portion of the fraudulent document.
15 . The system of claim 9 , wherein generating a vector representation of each ROI image in an embedding space comprises projecting the vector representation into the embedding space.
16 . The system of claim 9 , wherein training a supervised anomaly detection machine learning model using the training data set comprises:
training a plurality of supervised anomaly detection machine learning models using the training data set, each supervised anomaly detection machine learning model corresponding to a respective ROI of the fraudulent document.