mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 20:15:21 +00:00
throw meaningful error if yolo weights failed while downloading
This commit is contained in:
parent
af73d3dfe4
commit
ab38a1fcf7
@ -43,8 +43,15 @@ class YoloClient(Detector):
|
|||||||
|
|
||||||
# Download the model's weights if they don't exist
|
# Download the model's weights if they don't exist
|
||||||
if not os.path.isfile(weight_path):
|
if not os.path.isfile(weight_path):
|
||||||
gdown.download(WEIGHT_URL, weight_path, quiet=False)
|
logger.info(f"Downloading Yolo weights from {WEIGHT_URL} to {weight_path}...")
|
||||||
logger.info(f"Downloaded YOLO model {os.path.basename(weight_path)}")
|
try:
|
||||||
|
gdown.download(WEIGHT_URL, weight_path, quiet=False)
|
||||||
|
except Exception as err:
|
||||||
|
raise ValueError(
|
||||||
|
f"Exception while downloading Yolo weights from {WEIGHT_URL}."
|
||||||
|
f"You may consider to download it to {weight_path} manually."
|
||||||
|
) from err
|
||||||
|
logger.info(f"Yolo model is just downloaded to {os.path.basename(weight_path)}")
|
||||||
|
|
||||||
# Return face_detector
|
# Return face_detector
|
||||||
return YOLO(weight_path)
|
return YOLO(weight_path)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user