I am working with face anti-spoofing. The database consists of a number of real face images and a number of fake images. After pre-processing and feature extraction, I have a feature vector for each image. For classification, the Euclidean distance measure is used. The test image vector is compared with all real image vectors stored in the database, and the minimum distance is chosen (min.1) . The same vector is compared with all fake image vectors and the minimum value is chosen (min. 2). The minimum rule is applied again to choose the minimum of both min.1 and min.2 to identify the correct class of the test image. My problem is in plotting the ROC curve. To draw a ROC curve, only the true positive rate (TPR) and false positive rate (FPR) are needed (as functions of some classifier parameter). The TPR defines how many correct positive results occur among all positive samples available during the test. FPR, on the other hand, defines how many incorrect positive results occur among all negative samples available during the test. I do not have a threshold which can be changed, how can I plot this curve?


I am not really sure what is meant by "fake face" but for the purposes of this response, let's consider that you have two classes "REAL" and "FAKE" and representative example data points from each class are positioned in some $n$ dimensional space, with $n$ denoting the number of features.

In the described situation, the Minimum Distance Classifier (MDC) is used to discover the decision boundary between the two classes (the MDC can work with more than two classes if required but let's just constrain it to two here).

The MDC discovers the decision boundary by first estimating the centroid of each class by averaging the feature values. Once this is done, the classifier is essentially "trained". The knowledge of what it means to belong to one or the other class is basically depending on the position of the centroids in multidimensional space.

The next step is to find the line that passes through the two centroids and its vertical that is further at the half-way point between the two centroids. This vertical line at the half-way point is the actual decision boundary. Anything landing to the right of this line is classified as belonging to one class and anything landing on the left of this line (or on the line itself) is classified as belonging to the the other class.

For the purposes of illustration, I will be re-using one of the figures from a previous link here, let's call the "O"s -> REAL and the "X"s -> FAKE:

Two dimensional feature space with MDC decision boundary

So, here is a simple "exercise". Forget about the vertical line being at the HALF-WAY point between the two classes and let's try and draw it a bit to the LEFT, that is, closer to the REAL class.

Obviously, this will classify some of the examples of Class REAL as Class REAL (True Positives), some of the examples of Class REAL as Class FAKE (False Negatives), some of the examples of Class FAKE as Class REAL (False Positives) and some of the examples of class FAKE as Class FAKE (True Negatives).

This "exercise" just gave us the 4 numbers we need to calculate the two metrics of False Positive Rate (FPR), True Positive Rate (TPR) that we need to derive one point of the ROC curve at some threshold value.

So, in the case of the MD classifier, your threshold is equivalent to the position of the decision boundary between the two classes. By "sweeping" that decision boundary all the way from the centroid of one class to the centroid of the other class and deriving FPR, TPR for each value, you will be able to derive the complete ROC curve.

Another way to "visualise" this process with respect to the textbook examples of 'sweeping the threshold value', is to imagine that you rotate your feature space clockwise, until the decision boundary is vertical to the x-axis. If you were to do this, you would be practically eliminating one of the features and you would be "back" to the one dimensional case that is depicted here (for example), with each "gaussian" curve representing the density of the points above that x-axis value. (This is suggested here just as an aid, in case it helps you to make the connection between the position of the decision boundary and the threshold. You don't have to actually rotate the feature space).

Hope this helps.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.