Skip to content

Commit

Permalink
Update inference.py
Browse files Browse the repository at this point in the history
Face detection for CPU and GPU
  • Loading branch information
magicse authored Sep 11, 2024
1 parent b725d4f commit d9c9717
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions inference.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,9 +294,13 @@ def do_load(checkpoint_path):
model = load_model(checkpoint_path)

# SFDDetector.load_model(device)
detector = RetinaFace(gpu_id=0, model_path="checkpoints/mobilenet.pth", network="mobilenet")
# detector = RetinaFace(gpu_id=0, model_path="checkpoints/mobilenet.pth", network="mobilenet")
# detector = RetinaFace(gpu_id=0, model_path="checkpoints/resnet50.pth", network="resnet50")

if torch.cuda.is_available():
detector = RetinaFace(gpu_id=0, model_path="checkpoints/mobilenet.pth", network="mobilenet")
else:
detector = RetinaFace( model_path="checkpoints/mobilenet.pth", network="mobilenet")

detector_model = detector.model

print("Models loaded")
Expand Down

0 comments on commit d9c9717

Please sign in to comment.