do this with same sizes in each section "1.1 Background
1.1.1 Overview of Deep Fakes
Deep fakes are synthetic media in which a person in an existing image
or video is replaced with someone else’s likeness. This is achieved through
advanced techniques in artificial intelligence, particularly using deep learning
models. The advent of deep fakes has raised significant concerns due to
their potential misuse in spreading misinformation, committing fraud, and
undermining public trust in media.
1.1.2 Importance of Detecting Deep Fakes
Detecting deep fakes is crucial for maintaining the integrity of digital
content. As deep fake technology becomes more sophisticated, it becomes
increasingly challenging to distinguish between genuine and manipulated media. Effective detection methods are essential for preventing the malicious
use of deep fakes in areas such as politics, entertainment, and social media.
Reliable detection mechanisms are vital for protecting individuals’ reputations
and ensuring the authenticity of digital communications.
1
Tool Key Features Additional Information
Faceswap - Uses two encoder-decoder
pairs with shared parameters
- Incorporates adversarial loss
and perceptual loss
- Utilizes pre-trained face recognition models
- Supports multiple face extraction modes
- Implements DSSIM loss function for face reconstruction
FaceswapGAN
- Reconstructs 3D faces
from low-resolution images
- Supports few-shot face reenactment
Few-Shot
Face
Translation GAN
- Generates face images of
virtual people with independent latent variables
- Embeds 3D priors into adversarial learning
DeepFaceLab- Creates portrait images
with rig-like control over
StyleGAN via 3D morphable face models
- Self-supervised without manual
annotations
DFaker - Performs high-fidelity
face swapping
- Can be applied to any face
pairs without subject-specific
training
Reface.ai - Offers advanced face
swapping technology
- Provides seamless integration
with social media platforms
Remaker.ai - Enables easy creation of
deepfake videos
- Supports various editing features for enhancing videos
Table 1.1: Summary of Notable Deepfake Creation Tools
1.2 Objectives
1.2.1 Goals of the Report
The primary goal of this report is to explore the application of Convolutional
Neural Networks (CNNs) in the detection of deep fakes in both images and
videos. It aims to provide a comprehensive understanding of the current
state-of-the-art techniques and evaluate their effectiveness.
1.2.2 Specific Objectives Related to CNN-Based Detection
- To review the fundamental concepts of CNNs and their applicability in
image and video analysis. - To investigate various CNN architectures that
Department of Computer Science and Engineering 2
have been utilized for deep fake detection. - To analyze the performance of
CNN-based methods in terms of accuracy, efficiency, and robustness. - To
identify the challenges and limitations associated with CNN-based deep fake
detection.
1.3 Scope
1.3.1 What the Report Will Cover
This report will cover the theoretical background of deep fakes, the principles of CNNs, and their implementation in detecting deep fakes. It will include
a review of existing literature, a comparison of different CNN architectures,
and a discussion of experimental results from recent studies.
1.3.2 Limitations and Assumptions
The scope of this report is limited to the detection of deep fakes in digital
images and videos. It assumes a basic understanding of machine learning and
deep learning concepts. The report will not delve into the legal or ethical
implications of deep fakes, although their importance is acknowledged.
1.4 Structure
1.4.1 Brief Overview of the Chapters
-Chapter 2: Literature Review - This chapter provides a review of the
existing literature on deep fake detection techniques and the role of CNNs.
- Chapter 3: Methodology - This chapter details the methodologies used in
CNN-based deep fake detection, including data preprocessing, model training,
and evaluation.
- Chapter 4: Results and Discussion - This chapter presents the experimental results and discusses the performance of different CNN models. -
Chapter 5: Conclusion - This chapter summarizes the findings, discusses
the implications, and suggests future research directions."


but for my project this is the code of my project "from tkinter import messagebox
from tkinter import *
from tkinter import simpledialog
import tkinter
from tkinter import filedialog
from tkinter.filedialog import askopenfilename
import cv2 as cv
import numpy as np

import os
from keras.preprocessing.image import load_img
from keras.utils import to_categorical
from keras.preprocessing.image import img_to_array
# from sklearn.model_selection import train_test_split
import pickle
from keras.models import load_model
from keras.applications import VGG16
from keras.layers import Flatten
from keras.layers import Dropout
from keras.layers import Dense
from keras.layers import Input
from keras.models import Model
from keras.optimizers import Adam
from keras.models import model_from_json


main = tkinter.Tk()
main.title("SSLA Based Traffic Sign and Lane Detection for Autonomous cars")
main.geometry("1300x1200")

global filename
global model

old = None
class_labels = ['Speed limit (20km/h)','Speed limit (30km/h)','Speed limit (50km/h)','Speed limit (60km/h)','Speed limit (70km/h)',
                'Speed limit (80km/h)','End of speed limit (80km/h)','Speed limit (100km/h)','Speed limit (120km/h)','No passing','Stop','No Entry',
                'General caution','Traffic signals']

def cannyDetection(img):
    grayImg = cv.cvtColor(img, cv.COLOR_RGB2GRAY)
    blurImg = cv.GaussianBlur(grayImg, (5, 5), 0)
    cannyImg = cv.Canny(blurImg, 50, 150)
    return cannyImg

def segmentDetection(img):
    height = img.shape[0]
    polygons = np.array([[(0, height), (800, height), (380, 290)]])
    maskImg = np.zeros_like(img)
    cv.fillPoly(maskImg, polygons, 255)
    segmentImg = cv.bitwise_and(img, maskImg)
    return segmentImg

def calculateLines(frame, lines):
    left = []
    right = []
    for line in lines:
        x1, y1, x2, y2 = line.reshape(4)
        parameters = np.polyfit((x1, x2), (y1, y2), 1)
        slope = parameters[0]
        y_intercept = parameters[1]
        if slope < 0:
            left.append((slope, y_intercept))
        else:
            right.append((slope, y_intercept))
    left_avg = np.average(left, axis = 0)
    right_avg = np.average(right, axis = 0)
    left_line = calculateCoordinates(frame, left_avg)
    right_line = calculateCoordinates(frame, right_avg)
    return np.array([left_line, right_line])

def calculateCoordinates(frame, parameters):
    global old
    #print(str(parameters)+" "+str(type(parameters))+" "+str(np.isnan(parameters)))
    if old is None:
        old = parameters        
    if np.isnan(parameters.any()) == False:
        parameters = old
    slope, intercept = parameters
    y1 = frame.shape[0]
    y2 = int(y1 - 150)
    x1 = int((y1 - intercept) / slope)
    x2 = int((y2 - intercept) / slope)
    return np.array([x1, y1, x2, y2])

def visualizeLines(frame, lines):
    lines_visualize = np.zeros_like(frame)
    if lines is not None:
        for x1, y1, x2, y2 in lines:
            cv.line(lines_visualize, (x1, y1), (x2, y2), (0, 255, 0), 5)
    return lines_visualize


def loadModel():
    global model
    model = load_model('model/model.h5')
    pathlabel.config(text="Machine Learning Traffic Sign Detection Model Loaded")
    text.delete('1.0', END)
    text.insert(END,"Machine Learning Traffic Sign Detection Model Loaded\n\n");

def detectSignal():
    global model 
    filename = filedialog.askopenfilename(initialdir="Videos")
    pathlabel.config(text=filename)
    text.delete('1.0', END)
    text.insert(END,filename+" loaded\n\n")
    text.update_idletasks()
    cap = cv.VideoCapture(filename)
    while (cap.isOpened()):
        ret, frame = cap.read()
        if frame is not None:
            canny = cannyDetection(frame)
            cv.imshow("cannyImage", canny)
            segment = segmentDetection(canny)
            hough = cv.HoughLinesP(segment, 2, np.pi / 180, 100, np.array([]), minLineLength = 100, maxLineGap = 50)
            if hough is not None:
                lines = calculateLines(frame, hough)
                linesVisualize = visualizeLines(frame, lines)
                cv.imshow("hough", linesVisualize)
                output = cv.addWeighted(frame, 0.9, linesVisualize, 1, 1)
            cv.imwrite("test.jpg",output)
            temps = cv.imread("test.jpg")
            h, w, c = temps.shape
            image = load_img("test.jpg", target_size=(80, 80))
            image = img_to_array(image) / 255.0
            image = np.expand_dims(image, axis=0)
            (boxPreds, labelPreds) = model.predict(image)
            print(boxPreds)
            boxPreds = boxPreds[0]
            startX = int(boxPreds[0] * w)
            startY = int(boxPreds[1] * h)
            endX = int(boxPreds[2] * w)
            endY = int(boxPreds[3] * h)
            predict= np.argmax(labelPreds, axis=1)
            predict = predict[0]
            accuracy = np.amax(labelPreds, axis=1)
            print(str(class_labels[predict])+" "+str(accuracy))
            if accuracy > 0.97:
                cv.putText(output, "Recognized As "+str(class_labels[predict]), (startX, startY), cv.FONT_HERSHEY_SIMPLEX, 0.7, (0, 255, 0), 2)
                cv.rectangle(output, (startX, startY), (endX, endY), (0, 255, 0), 2)
            cv.imshow("output", output)
            if cv.waitKey(10) & 0xFF == ord('q'):
                break
    cap.release()
    cv.destroyAllWindows()

    

def close():
    main.destroy()
    
    
font = ('times', 16, 'bold')
title = Label(main, text='SSLA Based Traffic Sign and Lane Detection for Autonomous cars',anchor=W, justify=CENTER)
title.config(bg='yellow4', fg='white')  
title.config(font=font)           
title.config(height=3, width=120)       
title.place(x=0,y=5)


font1 = ('times', 14, 'bold')
upload = Button(main, text="Generate & Load Machine Learning Model", command=loadModel)
upload.place(x=50,y=100)
upload.config(font=font1)  

pathlabel = Label(main)
pathlabel.config(bg='yellow4', fg='white')  
pathlabel.config(font=font1)           
pathlabel.place(x=50,y=150)

markovButton = Button(main, text="Upload Video & Detect Hough Lane, Signal", command=detectSignal)
markovButton.place(x=50,y=200)
markovButton.config(font=font1)

predictButton = Button(main, text="Exit", command=close)
predictButton.place(x=50,y=250)
predictButton.config(font=font1)


font1 = ('times', 12, 'bold')
text=Text(main,height=15,width=78)
scroll=Scrollbar(text)
text.configure(yscrollcommand=scroll.set)
text.place(x=450,y=100)
text.config(font=font1)


main.config(bg='magenta3')
main.mainloop()"