importing all modules at the beginning is ~40% faster

This commit is contained in:
dmig 2018-12-12 14:45:23 +07:00
parent 4f11da686f
commit 7aac419bd7

View file

@ -10,12 +10,14 @@ timings = {
} }
# Import required modules # Import required modules
import cv2
import sys import sys
import os import os
import json import json
import configparser import configparser
from threading import Thread from threading import Thread
import cv2
import dlib
import numpy as np
# Get the absolute path to the current directory # Get the absolute path to the current directory
PATH = os.path.abspath(__file__ + '/..') PATH = os.path.abspath(__file__ + '/..')
@ -90,10 +92,6 @@ timings['ic'] = time.time() - timings['ic']
timings['ll'] = time.time() timings['ll'] = time.time()
# Import face recognition, takes some time
import dlib
import numpy as np
face_detector = None face_detector = None
pose_predictor = None pose_predictor = None
face_encoder = None face_encoder = None