<jupyter_start><jupyter_text>TESTING<jupyter_code>import tensorflow as tf
import mtcnn
import cv2
import os
import numpy as np
from mtcnn import MTCNN
from PIL import Image, ImageChops, ImageEnhance
from tensorflow.keras.models import load_model
from tensorflow.keras.preprocessing.image import img_to_array, load_img
model = load_model('/content/drive/MyDrive/deepfake-detection-model.hdf5')
input_shape = (128, 128, 3)
pr_data = []
detector = MTCNN()
#cap = cv2.VideoCapture('/content/drive/MyDrive/test_videos/aassnaulhq.mp4')
cap=cv2.VideoCapture('/content/drive/MyDrive/train_sample_videos/aagfhgtpmv.mp4')
frameRate = cap.get(5)
while cap.isOpened():
  frameId = cap.get(1)
  ret, frame = cap.read()
  if ret != True:
    break
  if frameId % ((int(frameRate)+1)*1) == 0:
    face_rects=detector.detect_faces(frame)
    for i, d in enumerate(face_rects):
      x, y, width, height = face_rects[0]['box']
      x1,y1,x2,y2 = x-10,y+10,x-10 +width + 20,y+10+height
      crop_img = frame[y1:y2, x1:x2]
      data = img_to_array(cv2.resize(crop_img, (128, 128))).flatten() / 255.0
      data = data.reshape(-1, 128, 128, 3)
      print(model.predict(data))<jupyter_output>[[0.6297813  0.37021872]]
[[0.6769913  0.32300872]]
[[0.27756765 0.7224323 ]]
[[0.71699625 0.28300372]]
[[0.6691242 0.3308758]]
[[0.5326348 0.4673652]]
[[0.0876537 0.9123463]]
[[0.67959785 0.32040215]]
[[0.55352384 0.4464762 ]]
[[0.38096157 0.6190384 ]]
[[0.38096157 0.6190384 ]]
{'fraction_non_alphanumeric': 0.15680880330123798, 'fraction_numerical': 0.16643741403026135, 'mean_word_length': 4.705882352941177, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '333763', 'license': 'MIT', 'n_tokens_mistral': 754, 'n_tokens_neox': 616, 'n_words': 112, 'path': 'Deepfake_face_detection.ipynb', 'repo_name': 'PRITH-S07/Detection-of-Deepfakes', 'size': '1454'}