From 131a7fb576607fcef621cde96e1793abfab20475 Mon Sep 17 00:00:00 2001 From: aku-ato <111570992+aku-ato@users.noreply.github.com> Date: Fri, 5 Apr 2024 17:26:45 +0200 Subject: [PATCH] move torch import from global in order to match optional dependency project philosophy --- deepface/detectors/FastMtCnn.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deepface/detectors/FastMtCnn.py b/deepface/detectors/FastMtCnn.py index 89b7a38..ee8e69c 100644 --- a/deepface/detectors/FastMtCnn.py +++ b/deepface/detectors/FastMtCnn.py @@ -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."