This projects aims in detection of video deepfakes using deep learning techniques like ResNeXt50 and LSTM. We have achived deepfake detection by using transfer learning where the pretrained ResNext CNN is used to obtain a feature vector, further the LSTM layer is trained using the features.
You can clone this flutter application using below command:
git clone https://github.com/AyeshaMalikAyesha/AppDeepfakeDetection.git
The features in our app is:
π‘ π¨πππππππ: We achieved an accuracy of 93% on training set and 75% on test set.
π‘ π¨π ππππππ π«ππππππππ: Utilizing cutting-edge AI and machine learning algorithms, our app can accurately identify deepfake videos and images.
π‘ πΉπππ-ππππ π¨πππππππ: Get instant results with our high-speed processing, ensuring you can verify content quickly and efficiently.
π‘ πΌπππ-ππππππ ππ π°ππππππππ: Our app is designed with ease of use in mind, making deepfake detection accessible to everyone, from tech experts to everyday users.
π‘ πͺππππππππππππ πΉππππππππ: Receive detailed reports on the detected deepfakes, providing insights into the authenticity of the media.
π‘ πͺππππππππ πππππ: Our forum is a dynamic, interactive space designed for users, experts, and enthusiasts of our deepfake detection app.
api.py file contains the API in which http request from flutter app is passed to server through api where preprocessing and prediction occur.To properly set up the model for the API, follow these steps:
- Train the Model: Begin by training your model.
- Save and Download the Model: Once the model is trained, save it and download the model file.
- Update Local Repository: Save the downloaded model file in your local repository.
- Modify Path in
api.py
: Update thepath_to_model
variable in theapi.py
file to reflect the new location of the model file. - Create Static Folder: Ensure that a
static
folder is created in your project directory. This folder will store user input files. - Update Filepath in
api.py
: Update thefilepath
variable in theapi.py
file to point to the newly createdstatic
folder here on line 207 in api.py filepath = 'D:\Hifza\fyp\API\' + 'static/' + filename Now here you should replace this 'D:\Hifza\fyp\API\' with the path where static folder present.
By completing these steps, you will ensure that the API is correctly configured to utilize the trained model and handle user inputs effectively.
For preprocessing of videos and model Training we used the code from this Github repo
To run the application on an emulator, please follow these steps:
- Navigate to the
scan_screen.dart
file located in thelib/screens
directory. - Go to line 73 in the file.
- Replace the following code:
var request = http.MultipartRequest(
'POST',
Uri.parse('https://sparrow-helpful-yearly.ngrok-free.app/predict_media'));
with this code:
var request = http.MultipartRequest(
'POST',
Uri.parse('http://10.0.2.2:5000/predict_media'));
This change will configure the app to use the appropriate API endpoint for the emulator.
To run the application on a real device, please follow these instructions:
-
Visit Ngrok Setup for Windows and sign in.
-
In the "Step 1: Connect" section, go to the download section and download Ngrok for Windows (64-bit or 32-bit) according to your system specifications.
-
After downloading, install Ngrok and add its installation path to the PATH variable under system variables.
-
Once Ngrok is installed, return to the Ngrok dashboard and go to the "Deploy Your App Online" section. Find the "Static Domain" section and copy the domain. For example, the domain might be:
ngrok http --domain=macaw-elegant-ghastly.ngrok-free.app 80
. In your case it is different. -
Replace
80
with5000
in the copied domain, resulting in:ngrok http --domain=macaw-elegant-ghastly.ngrok-free.app 5000
. -
Open Visual Studio Code, ensure the API is running, and paste the modified command (
ngrok http --domain=macaw-elegant-ghastly.ngrok-free.app 5000
) into the terminal. -
Now go to scan_screen.dart file, navigate to line 76 and replace this part (
https://sparrow-helpful-yearly.ngrok-free.app
) of the line with this (https://macaw-elegant-ghastly.ngrok-free.app
). In your case your static domain will be different.
This setup will allow you to run the application on a real device.
You can watch the video for demo:
- Ayesha
- Sania Batool
- Sana Anwar
For any queries you can ask it in issues section or feel free to email me at [email protected]