Instructions to use Banaxi-Tech/face-model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use Banaxi-Tech/face-model with ultralytics:
from huggingface_hub import hf_hub_download from ultralytics import YOLO # pick the weights file from this repo's "Files and versions" tab weights = hf_hub_download("Banaxi-Tech/face-model", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Download code/eval_model.py from Banaxi-Tech/face-model: direct link, hf CLI and curl.
- Browser
- Download file 1.06 kB
-
https://huggingface.co/Banaxi-Tech/face-model/resolve/main/code/eval_model.py
- Command line
-
hf download hf://Banaxi-Tech/face-model/code/eval_model.py
-
curl -L -o eval_model.py https://huggingface.co/Banaxi-Tech/face-model/resolve/main/code/eval_model.py
1.06 kB
| #!/usr/bin/env python3 | |
| """Evaluate one or more face-detector weights (.pt / .onnx) on the converted WIDER FACE val split. | |
| Usage: python eval_model.py export/face_yolo11n.pt export/face_yolo11n_fp32.onnx export/face_yolo11n_fp16.onnx | |
| """ | |
| import argparse | |
| from ultralytics import YOLO | |
| def main(): | |
| ap = argparse.ArgumentParser() | |
| ap.add_argument("models", nargs="+") | |
| ap.add_argument("--data", default="dataset/data.yaml") | |
| ap.add_argument("--imgsz", type=int, default=640) | |
| ap.add_argument("--workers", type=int, default=4) | |
| a = ap.parse_args() | |
| for path in a.models: | |
| r = YOLO(path, task="detect").val(data=a.data, imgsz=a.imgsz, batch=1, device=0, | |
| workers=a.workers, plots=False, verbose=False) | |
| print(f"RES {path}: mAP50={r.box.map50:.4f} mAP50-95={r.box.map:.4f} P={r.box.mp:.3f} R={r.box.mr:.3f} " | |
| f"| {r.speed['preprocess']:.2f}+{r.speed['inference']:.2f}+{r.speed['postprocess']:.2f} ms/img", | |
| flush=True) | |
| if __name__ == "__main__": | |
| main() | |