Using SIFT for deep fake image detetction

9 次查看(过去 30 天)
I am using SIFT algorithm todetect the deep fake iamges, by comparing them to original images. First where can i find the easiest code for it, and the second thing is that i have to then do the pre processing of SIFT for image detetion, for that any kind of matrices i am looking for to check the accuracy of the algorithm. code will be helpful in the answer.

回答(1 个)

Piyush Dubey
Piyush Dubey 2023-4-6
Hi,
Below is a basic flow on implementation of the SIFT algorithm to figure out similarity between two images. Load the input and reference image with appropriate scaling in “grayscale” only by using “im2gray()” function.
The below snippet can be used to extract the common features in the input image and reference image.
%SIFT feature extraction
input_sift = detectSIFTFeatures(input_image);
reference_sift = detectSIFTFeatures(reference_image);
[features1,valid_points1] = extractFeatures(input_image,input_sift);
[features2,valid_points2] = extractFeatures(reference_image,reference_sift);
In order to evaluate the matching features you can follow this documentation that consists of various methods to draw comparisons between various images: matchFeatures()
The matched points can be compared with the reference image to generate a similarity score.
Similarity score can be evaluated using the following syntax:
similarity_score = size(matchedPoints_refimg, 1)
After obtaining the matching feature and similarity score, a threshold can be applied to consider if an image is genuine or fake with respect to the reference image.
threshold = 50;
if similarity_score >= threshold
disp('The input image is genuine');
else
disp('The input image is fake');
end
Refer to the attached documentation for a better understanding over other functions that have a similar use case: https://www.mathworks.com/help/vision/ref/detectsiftfeatures.html
A much detailed implementation of the SIFT algorithm can be found in the following link: https://www.mathworks.com/matlabcentral/fileexchange/43723-sift-scale-invariant-feature-transform-algorithm
There are various metrices that might help you measure the accuracy for SIFT algorithm such as: Number of correct correspondences, Precision, Recall, F1 score, etc
I hope this might be helpful.

类别

Help CenterFile Exchange 中查找有关 Feature Detection and Extraction 的更多信息

产品

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by