Instructions to use keffy/hvc_model with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use keffy/hvc_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("keffy/hvc_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 predict.py from keffy/hvc_model: direct link, hf CLI and curl.
- Browser
- Download file 647 Bytes
-
https://huggingface.co/keffy/hvc_model/resolve/main/predict.py
- Command line
-
hf download hf://keffy/hvc_model/predict.py
-
curl -L -o predict.py https://huggingface.co/keffy/hvc_model/resolve/main/predict.py
647 Bytes
| import torch | |
| from ultralytics import YOLO | |
| import cv2 | |
| import numpy as np | |
| # Load the model | |
| model = YOLO("best.pt") | |
| def predict(image_path): | |
| # Load image | |
| image = cv2.imread(image_path) | |
| # Inference | |
| results = model(image) | |
| # Parse results into CVAT format (adjust as needed) | |
| annotations = [] | |
| for box in results[0].boxes.data: | |
| x1, y1, x2, y2, confidence, class_id = box[:6] | |
| annotations.append({ | |
| "x1": int(x1), "y1": int(y1), | |
| "x2": int(x2), "y2": int(y2), | |
| "confidence": float(confidence), | |
| "class": int(class_id) | |
| }) | |
| return annotations | |