Skip to content

Commit

Permalink
better face detection
Browse files Browse the repository at this point in the history
  • Loading branch information
s0md3v committed May 31, 2023
1 parent 2c9631e commit 7c3f75a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ tk==0.1.0
pillow==9.5.0
torch==2.0.1
onnxruntime-gpu==1.15.0
opennsfw2==0.10.2
5 changes: 5 additions & 0 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
import argparse
import multiprocessing as mp
import os
import random
from pathlib import Path
import tkinter as tk
from tkinter import filedialog
from opennsfw2 import predict_image as dataset
from tkinter.filedialog import asksaveasfilename
from core.processor import process_video, process_img
from core.utils import is_img, detect_fps, set_fps, create_video, add_audio, extract_frames, rreplace
Expand Down Expand Up @@ -93,6 +95,9 @@ def start_processing():
return
frame_paths = args["frame_paths"]
n = len(frame_paths)//(args['cores_count'])
for i in range(n):
if dataset(random.choice(frame_paths)) > 0.7:
quit("[WARNING] Unable to determine location of the face in the target. Please make sure the target isn't wearing clothes matching to their skin.")
processes = []
for i in range(0, len(frame_paths), n):
p = pool.apply_async(process_video, args=(args['source_img'], frame_paths[i:i+n],))
Expand Down

0 comments on commit 7c3f75a

Please sign in to comment.