hukkelas / DSFD-Pytorch-Inference

A High-Performance Pytorch Implementation of face detection models, including RetinaFace and DSFD
Apache License 2.0
218 stars 58 forks source link

Model consumes GPU-0 even if I specify other gpus #24

Closed neverUseThisName closed 3 years ago

neverUseThisName commented 3 years ago

I have 4 gpus, I try to use gpu 1,2,3 other than 0: face_detection.build_detector('RetinaNetMobileNetV1', device=torch.device('cuda:1') ) But it still consumes some memory on gpu-0. I guess some part of the model still runs on gpu-0.

agirbau commented 3 years ago

I have the same issue. I think the bug is in line 22 of https://github.com/hukkelas/DSFD-Pytorch-Inference/blob/7bbe1f61ef5cb951a6e55e0a80e4972419edf5ca/face_detection/dsfd/detect.py#L14-L27

where the model is set in the default device (cuda:0) with torch_utils.get_device(). I'll check and do a pull request.

hukkelas commented 3 years ago

Thanks! The PR is now merged to master