From 7aac419bd7066e979fb6a9adc341e0655a756c5c Mon Sep 17 00:00:00 2001 From: dmig Date: Wed, 12 Dec 2018 14:45:23 +0700 Subject: [PATCH] importing all modules at the beginning is ~40% faster --- src/compare.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/compare.py b/src/compare.py index 4ac8cb6..53ba3d4 100644 --- a/src/compare.py +++ b/src/compare.py @@ -10,12 +10,14 @@ timings = { } # Import required modules -import cv2 import sys import os import json import configparser from threading import Thread +import cv2 +import dlib +import numpy as np # Get the absolute path to the current directory PATH = os.path.abspath(__file__ + '/..') @@ -90,10 +92,6 @@ timings['ic'] = time.time() - timings['ic'] timings['ll'] = time.time() -# Import face recognition, takes some time -import dlib -import numpy as np - face_detector = None pose_predictor = None face_encoder = None