提交 4be6c483 编写于 作者: Eric.Lee2021's avatar Eric.Lee2021 🚴🏻

update

上级 b2c87e4f
...@@ -22,10 +22,10 @@ import time ...@@ -22,10 +22,10 @@ import time
from multiprocessing import Process from multiprocessing import Process
from multiprocessing import Manager from multiprocessing import Manager
import cv2
import numpy as np import numpy as np
import random import random
import time import time
import shutil
# 加载模型组件库 # 加载模型组件库
from face_detect.yolo_v3_face import yolo_v3_face_model from face_detect.yolo_v3_face import yolo_v3_face_model
...@@ -41,15 +41,28 @@ from utils.show_videos_thread import run_show ...@@ -41,15 +41,28 @@ from utils.show_videos_thread import run_show
from moviepy.editor import * from moviepy.editor import *
def main_wyw2s(cfg_file,video_path = None): def main_wyw2s(video_path,cfg_file):
config = parse_data_cfg(cfg_file) config = parse_data_cfg(cfg_file)
face_detect_model = yolo_v3_face_model(conf_thres = 0.43) print("\n/---------------------- main_wyw2s config ------------------------/\n")
face_verify_model = insight_face_model(threshold = 1.2) for k_ in config.keys():
face_multitask_model = FaceMuitiTask_Model() print("{} : {}".format(k_,config[k_]))
face_euler_model = FaceAngle_Model() print("\n/------------------------------------------------------------------------/\n")
print("\n loading who you want 2 see local demo ...\n")
face_detect_model = yolo_v3_face_model(conf_thres=float(config["detect_conf_thres"]),nms_thres=float(config["detect_nms_thres"]),
model_arch = config["detect_model_arch"],model_path = config["detect_model_path"],yolo_anchor_scale = float(config["yolo_anchor_scale"]),
img_size = float(config["detect_input_size"]),
)
face_verify_model = insight_face_model(backbone_model_path =config["face_verify_backbone_path"] ,
facebank_path = config["facebank_path"],
threshold = float(config["face_verify_threshold"]))
face_multitask_model = FaceMuitiTask_Model(model_path = config["face_multitask_model_path"])
face_euler_model = FaceAngle_Model(model_path = config["face_euler_model_path"])
print("\n/------------------------------------------------------------------------/\n") print("\n/------------------------------------------------------------------------/\n")
YouWantToSee = config["YouWantToSee"] YouWantToSee = config["YouWantToSee"]
...@@ -74,7 +87,6 @@ def main_wyw2s(cfg_file,video_path = None): ...@@ -74,7 +87,6 @@ def main_wyw2s(cfg_file,video_path = None):
else: else:
p_colors.append((random.randint(60,255),random.randint(70,255),random.randint(130,255))) p_colors.append((random.randint(60,255),random.randint(70,255),random.randint(130,255)))
cap = cv2.VideoCapture(video_path) cap = cv2.VideoCapture(video_path)
frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT)) frame_count = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
...@@ -88,7 +100,6 @@ def main_wyw2s(cfg_file,video_path = None): ...@@ -88,7 +100,6 @@ def main_wyw2s(cfg_file,video_path = None):
frame_idx = 0 frame_idx = 0
Flag_Last,Flag_Now = False,False Flag_Last,Flag_Now = False,False
start_time = 0. start_time = 0.
end_time = 0.
YouWantToSee_time_list = [] YouWantToSee_time_list = []
while cap.isOpened(): while cap.isOpened():
...@@ -124,7 +135,6 @@ def main_wyw2s(cfg_file,video_path = None): ...@@ -124,7 +135,6 @@ def main_wyw2s(cfg_file,video_path = None):
print(" ------ ") print(" ------ ")
Flag_Now = False Flag_Now = False
else: else:
face_map = np.zeros([112*3,112*3,3]).astype(np.uint8) face_map = np.zeros([112*3,112*3,3]).astype(np.uint8)
face_map[:,:,0].fill(205) face_map[:,:,0].fill(205)
...@@ -180,6 +190,10 @@ def main_wyw2s(cfg_file,video_path = None): ...@@ -180,6 +190,10 @@ def main_wyw2s(cfg_file,video_path = None):
print("\n ----->>> YouWantToSee_Time_list : \n") print("\n ----->>> YouWantToSee_Time_list : \n")
movie = VideoFileClip(video_path) movie = VideoFileClip(video_path)
video_s = "./clip_wyw2s/" video_s = "./clip_wyw2s/"
if os.path.exists(video_s): #删除之前的文件夹
shutil.rmtree(video_s)
if not os.path.exists(video_s): # 如果文件夹不存在 if not os.path.exists(video_s): # 如果文件夹不存在
os.mkdir(video_s) # 生成文件夹 os.mkdir(video_s) # 生成文件夹
......
...@@ -10,9 +10,9 @@ import time ...@@ -10,9 +10,9 @@ import time
import torch import torch
from hand_detect.yolov3 import Yolov3, Yolov3Tiny from face_detect.yolov3 import Yolov3, Yolov3Tiny
from hand_detect.utils.torch_utils import select_device from face_detect.utils.torch_utils import select_device
from hand_detect.acc_model import acc_model from face_detect.acc_model import acc_model
import torch.backends.cudnn as cudnn import torch.backends.cudnn as cudnn
import torch.nn.functional as F import torch.nn.functional as F
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册