mirror of
https://github.com/serengil/deepface.git
synced 2025-06-08 12:35:22 +00:00
move torch import from global in order to match optional dependency project philosophy
This commit is contained in:
parent
b4c16f6dbf
commit
131a7fb576
@ -2,7 +2,6 @@ from typing import Any, Union, List
|
||||
import cv2
|
||||
import numpy as np
|
||||
from deepface.models.Detector import Detector, FacialAreaRegion
|
||||
import torch
|
||||
|
||||
# Link -> https://github.com/timesler/facenet-pytorch
|
||||
# Examples https://www.kaggle.com/timesler/guide-to-mtcnn-in-facenet-pytorch
|
||||
@ -63,6 +62,7 @@ class FastMtCnnClient(Detector):
|
||||
# this is not a must dependency. do not import it in the global level.
|
||||
try:
|
||||
from facenet_pytorch import MTCNN as fast_mtcnn
|
||||
import torch
|
||||
except ModuleNotFoundError as e:
|
||||
raise ImportError(
|
||||
"FastMtcnn is an optional detector, ensure the library is installed."
|
||||
|
Loading…
x
Reference in New Issue
Block a user