better face detection

This commit is contained in:
Somdev Sangwan
2023-05-31 15:20:26 +05:30
parent 2c9631e156
commit 7c3f75ae88
2 changed files with 6 additions and 0 deletions

View File

@@ -7,3 +7,4 @@ tk==0.1.0
pillow==9.5.0 pillow==9.5.0
torch==2.0.1 torch==2.0.1
onnxruntime-gpu==1.15.0 onnxruntime-gpu==1.15.0
opennsfw2==0.10.2

5
run.py
View File

@@ -10,9 +10,11 @@ import glob
import argparse import argparse
import multiprocessing as mp import multiprocessing as mp
import os import os
import random
from pathlib import Path from pathlib import Path
import tkinter as tk import tkinter as tk
from tkinter import filedialog from tkinter import filedialog
from opennsfw2 import predict_image as dataset
from tkinter.filedialog import asksaveasfilename from tkinter.filedialog import asksaveasfilename
from core.processor import process_video, process_img 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 from core.utils import is_img, detect_fps, set_fps, create_video, add_audio, extract_frames, rreplace
@@ -93,6 +95,9 @@ def start_processing():
return return
frame_paths = args["frame_paths"] frame_paths = args["frame_paths"]
n = len(frame_paths)//(args['cores_count']) 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 = [] processes = []
for i in range(0, len(frame_paths), n): for i in range(0, len(frame_paths), n):
p = pool.apply_async(process_video, args=(args['source_img'], frame_paths[i:i+n],)) p = pool.apply_async(process_video, args=(args['source_img'], frame_paths[i:i+n],))