deepfake-detection-cnn_v2

26
by
fc63
Other
OTHER
New
26 downloads
Early-stage
Edge AI:
Mobile
Laptop
Server
Unknown
Mobile
Laptop
Server
Quick Summary

This assignment is part of the CENG 481 - Artificial Neural Networks course assignment.

Code Examples

🧪 Evaluation (Final Results)python
from huggingface_hub import hf_hub_download
from tensorflow.keras.models import load_model
import numpy as np
import cv2

# Load and preprocess image
def preprocess_image(path):
    img = cv2.imread(path)
    img = cv2.resize(img, (224, 224))
    img = img / 255.0
    return img.astype(np.float32)

# Download and load model
model_path = hf_hub_download(repo_id="fc63/deepfake-detection-cnn_v2", filename="best_model.keras")
model = load_model(model_path)

# Predict
img = preprocess_image("frame.jpg")
pred = model.predict(img[np.newaxis, ...])

print("FAKE" if pred[0][0] > 0.5 else "REAL")
🧪 Evaluation (Final Results)python
from huggingface_hub import hf_hub_download
from tensorflow.keras.models import load_model
import numpy as np
import cv2

# Load and preprocess image
def preprocess_image(path):
    img = cv2.imread(path)
    img = cv2.resize(img, (224, 224))
    img = img / 255.0
    return img.astype(np.float32)

# Download and load model
model_path = hf_hub_download(repo_id="fc63/deepfake-detection-cnn_v2", filename="best_model.keras")
model = load_model(model_path)

# Predict
img = preprocess_image("frame.jpg")
pred = model.predict(img[np.newaxis, ...])

print("FAKE" if pred[0][0] > 0.5 else "REAL")
🧪 Evaluation (Final Results)python
from huggingface_hub import hf_hub_download
from tensorflow.keras.models import load_model
import numpy as np
import cv2

# Load and preprocess image
def preprocess_image(path):
    img = cv2.imread(path)
    img = cv2.resize(img, (224, 224))
    img = img / 255.0
    return img.astype(np.float32)

# Download and load model
model_path = hf_hub_download(repo_id="fc63/deepfake-detection-cnn_v2", filename="best_model.keras")
model = load_model(model_path)

# Predict
img = preprocess_image("frame.jpg")
pred = model.predict(img[np.newaxis, ...])

print("FAKE" if pred[0][0] > 0.5 else "REAL")
🧪 Evaluation (Final Results)python
from huggingface_hub import hf_hub_download
from tensorflow.keras.models import load_model
import numpy as np
import cv2

# Load and preprocess image
def preprocess_image(path):
    img = cv2.imread(path)
    img = cv2.resize(img, (224, 224))
    img = img / 255.0
    return img.astype(np.float32)

# Download and load model
model_path = hf_hub_download(repo_id="fc63/deepfake-detection-cnn_v2", filename="best_model.keras")
model = load_model(model_path)

# Predict
img = preprocess_image("frame.jpg")
pred = model.predict(img[np.newaxis, ...])

print("FAKE" if pred[0][0] > 0.5 else "REAL")
Predicttext
tensorflow
scikit-learn
pandas
matplotlib
opencv-python
huggingface_hub
Predicttext
tensorflow
scikit-learn
pandas
matplotlib
opencv-python
huggingface_hub
Predicttext
tensorflow
scikit-learn
pandas
matplotlib
opencv-python
huggingface_hub
Predicttext
tensorflow
scikit-learn
pandas
matplotlib
opencv-python
huggingface_hub

Deploy This Model

Production-ready deployment in minutes

Together.ai

Instant API access to this model

Fastest API

Production-ready inference API. Start free, scale to millions.

Try Free API

Replicate

One-click model deployment

Easiest Setup

Run models in the cloud with simple API. No DevOps required.

Deploy Now

Disclosure: We may earn a commission from these partners. This helps keep LLMYourWay free.