def __init__(self, threshold=0.5): args = utils.get_arguments() self.weight_path = args.weight_path self.cfg_path = args.config_path self.labels = utils.get_labels(args.classes_path) self.threshold = threshold # Load model self.model = cv2.dnn.readNet(model=self.weight_path, config=self.cfg_path)
def __init__(self, threshold=0.5): args = utils.get_arguments() self.weight_path = args.weight_path self.cfg_path = args.config_path self.labels = utils.get_labels(args.classes_path) self.threshold = threshold # Tải mô hình YOLOv3 Tiny cho phát hiện vùng biển số self.model = cv2.dnn.readNet(model=self.weight_path, config=self.cfg_path)
import data_utils as utils from imutils.video import FileVideoStream, VideoStream from imutils.video import FPS from mtcnn import MTCNN import time import cv2 import model import tensorflow as tf if __name__ == '__main__': arguments = utils.get_arguments() image_path = None video_path = None session = tf.compat.v1.Session() # load model multitask learning multitask_model = model.Model(session=session, trainable=False, prediction=True) # load model detect faces detect_model = MTCNN() if arguments.image_path is not None: image_path = arguments.image_path else: video_path = arguments.video_path if image_path is not None: # case 1: detect image img = cv2.imread(image_path) # detect faces result = detect_model.detect_faces(img)