Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Develop: rectify face_recognition.yaml & PP-ShiTuV2.yaml, del device=gpu. #2705

Open
wants to merge 13 commits into
base: develop
Choose a base branch
from
Open
1 change: 0 additions & 1 deletion paddlex/pipelines/PP-ShiTuV2.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Pipeline:
rec_model: PP-ShiTuV2_rec
det_batch_size: 1
rec_batch_size: 1
device: gpu
index: None
score_thres: 0.5
return_k: 5
1 change: 0 additions & 1 deletion paddlex/pipelines/face_recognition.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ Pipeline:
rec_model: "MobileFaceNet"
det_batch_size: 1
rec_batch_size: 1
device: gpu
index: None
score_thres: 0.4
return_k: 5
9 changes: 8 additions & 1 deletion paddlex/utils/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

import os
import GPUtil
import lazy_paddle as paddle

import lazy_paddle as paddle
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需确认下是否安装了pre-commit钩子

from . import logging
from .errors import raise_unsupported_device_error

Expand All @@ -32,6 +32,13 @@ def _constr_device(device_type, device_ids):

def get_default_device():
avail_gpus = GPUtil.getAvailable()
if not avail_gpus:
# maybe edge devices like Jetson
if os.path.exists("/etc/nv_tegra_release"):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这种方式看起来有点儿hack,建议加一句debug日志

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DONE。

avail_gpus = [0]
logging.info(
"Detected that the current device is a Jetson edge device. The default behavior will be to use GPU: 0"
)
if not avail_gpus:
return "cpu"
else:
Expand Down