MCPcopy Index your code
hub / github.com/XPixelGroup/DiffBIR / init_dlib

Method init_dlib

diffbir/utils/face.py:144–154  ·  view source on GitHub ↗

Initialize the dlib detectors and predictors.

(self, detection_path, landmark5_path)

Source from the content-addressed store, hash-verified

142 self.input_img = cv2.resize(self.input_img, (0,0), fx=f, fy=f, interpolation=cv2.INTER_LINEAR)
143
144 def init_dlib(self, detection_path, landmark5_path):
145 """Initialize the dlib detectors and predictors."""
146 try:
147 import dlib
148 except ImportError:
149 print('Please install dlib by running:' 'conda install -c conda-forge dlib')
150 detection_path = load_file_from_url(url=detection_path, model_dir='weights/dlib', progress=True, file_name=None)
151 landmark5_path = load_file_from_url(url=landmark5_path, model_dir='weights/dlib', progress=True, file_name=None)
152 face_detector = dlib.cnn_face_detection_model_v1(detection_path)
153 shape_predictor_5 = dlib.shape_predictor(landmark5_path)
154 return face_detector, shape_predictor_5
155
156 def get_face_landmarks_5_dlib(self,
157 only_keep_largest=False,

Callers

nothing calls this directly

Calls 1

load_file_from_urlFunction · 0.85

Tested by

no test coverage detected