Icon

Nearest-Template

Object-classication using template matching
"Nearest-template search"# PrincipleThe idea is that each template represents a class and the goal is to find the closest template to the current image, using a template matching (pixel comparison)Ie each image will be classified as either containing an object corresponding to one of the template, or as an outlier. The template matching algorithm first finds the object in the image (in this implementation the localisation is not returned but could modified for so) NB : Currently this implementation is designed for image with a single object to classify per image# ComputationFor each template provided the workflow computes the correlation map with the current image and return the maxima of the correlation map (correlation score). This is interpreted as the probabilitythat the image corresponds to this template/category.# Parameters- Score Type : this is the formulation used for the computation of the correlation map (see opencv documentation for matchTemplate). With the difference score, a low score correspond to a high probability to belong to that class.With the correlation scores, a high score correspond to a high probability to belong to that class.- Score-threshold: minimum score for correlation-score (respectively maximum for difference-score) of an image with a given template to be classified into a template category.Ie for a given image :If all correlation-scores are below (respectively all difference-score above) the threshold then the image is classified as an outlier (not corresponding to any of the provided template/class)If several templates/categories pass the score threshold then the image is assigned the category that showed the highest correlation score. # ResultsFor each template, the correlation score and the found region are returned for the current image/row.The correlations score can be visualised as a histogram with one bar per template/class, a gray horizontal line depicts the score threshold.The column "Prediction" contains the name of the template that match best the image, or the name "Outlier".The column "Confidence" correspond to an index in the range 0-1 proportionnal to the confidence of the classification : the higher the better (see confidence below). The confidence is also represented as a color code (red = high confidence, blue = low confidence). ## AVG DifferenceFor images classified as outliers, the average difference is the average of the absolute differences between the score threshold and the predicted scores.For images succesfully classified, the average difference is the average of the absolute differences between the score of the predicted category and the score for the other categories (ie for 2categories it is just the difference of score between the 2)The higher the average difference, the more configent is the classification## RequirementsRequires a python3 environment with :- Multi-Template-Matching 1.6.1- Matplotlib List of model template Images to search for template(alternative of list file) Right clicselect the similarity measureand score-threshold for outlierview result+ histogram(pull on table cell to resize plot)Apply color LUTHigh Confidence: GreenLow: BlueImage Reader Image Reader Template Matching Image Viewer Color Manager "Nearest-template search"# PrincipleThe idea is that each template represents a class and the goal is to find the closest template to the current image, using a template matching (pixel comparison)Ie each image will be classified as either containing an object corresponding to one of the template, or as an outlier. The template matching algorithm first finds the object in the image (in this implementation the localisation is not returned but could modified for so) NB : Currently this implementation is designed for image with a single object to classify per image# ComputationFor each template provided the workflow computes the correlation map with the current image and return the maxima of the correlation map (correlation score). This is interpreted as the probabilitythat the image corresponds to this template/category.# Parameters- Score Type : this is the formulation used for the computation of the correlation map (see opencv documentation for matchTemplate). With the difference score, a low score correspond to a high probability to belong to that class.With the correlation scores, a high score correspond to a high probability to belong to that class.- Score-threshold: minimum score for correlation-score (respectively maximum for difference-score) of an image with a given template to be classified into a template category.Ie for a given image :If all correlation-scores are below (respectively all difference-score above) the threshold then the image is classified as an outlier (not corresponding to any of the provided template/class)If several templates/categories pass the score threshold then the image is assigned the category that showed the highest correlation score. # ResultsFor each template, the correlation score and the found region are returned for the current image/row.The correlations score can be visualised as a histogram with one bar per template/class, a gray horizontal line depicts the score threshold.The column "Prediction" contains the name of the template that match best the image, or the name "Outlier".The column "Confidence" correspond to an index in the range 0-1 proportionnal to the confidence of the classification : the higher the better (see confidence below). The confidence is also represented as a color code (red = high confidence, blue = low confidence). ## AVG DifferenceFor images classified as outliers, the average difference is the average of the absolute differences between the score threshold and the predicted scores.For images succesfully classified, the average difference is the average of the absolute differences between the score of the predicted category and the score for the other categories (ie for 2categories it is just the difference of score between the 2)The higher the average difference, the more configent is the classification## RequirementsRequires a python3 environment with :- Multi-Template-Matching 1.6.1- Matplotlib List of model template Images to search for template(alternative of list file)Right clicselect the similarity measureand score-threshold for outlierview result+ histogram(pull on table cell to resize plot)Apply color LUTHigh Confidence: GreenLow: BlueImage Reader Image Reader Template Matching Image Viewer Color Manager

Nodes

Extensions

Links