Instructions to use mayanktak15/yolo8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ultralytics
How to use mayanktak15/yolo8 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("mayanktak15/yolo8", "<weights>.pt") model = YOLO(weights) source = 'http://images.cocodataset.org/val2017/000000039769.jpg' model.predict(source=source, save=True) - Notebooks
- Google Colab
- Kaggle
Download src/analytics/statistics.py from mayanktak15/yolo8: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/mayanktak15/yolo8/resolve/main/src/analytics/statistics.py
- Command line
-
hf download hf://mayanktak15/yolo8/src/analytics/statistics.py
-
curl -L -o statistics.py https://huggingface.co/mayanktak15/yolo8/resolve/main/src/analytics/statistics.py
1.35 kB
| """Plotting helpers for tracking statistics.""" | |
| from __future__ import annotations | |
| from pathlib import Path | |
| import matplotlib.pyplot as plt | |
| import pandas as pd | |
| def plot_object_counts(frame_df: pd.DataFrame, output_path: str | Path) -> None: | |
| """Save a line chart of active tracked objects per frame.""" | |
| if frame_df.empty: | |
| return | |
| output_path = Path(output_path) | |
| output_path.parent.mkdir(parents=True, exist_ok=True) | |
| plt.figure(figsize=(10, 4)) | |
| plt.plot(frame_df["frame"], frame_df["active_tracks"], color="#2364aa", linewidth=2) | |
| plt.title("Tracked Object Count Over Time") | |
| plt.xlabel("Frame") | |
| plt.ylabel("Active Tracks") | |
| plt.grid(alpha=0.25) | |
| plt.tight_layout() | |
| plt.savefig(output_path, dpi=160) | |
| plt.close() | |
| def confidence_histogram(track_df: pd.DataFrame, output_path: str | Path) -> None: | |
| """Save a histogram of detection confidence scores.""" | |
| if track_df.empty: | |
| return | |
| output_path = Path(output_path) | |
| output_path.parent.mkdir(parents=True, exist_ok=True) | |
| plt.figure(figsize=(8, 4)) | |
| plt.hist(track_df["confidence"], bins=20, color="#3da35d", edgecolor="white") | |
| plt.title("Detection Confidence Distribution") | |
| plt.xlabel("Confidence") | |
| plt.ylabel("Count") | |
| plt.tight_layout() | |
| plt.savefig(output_path, dpi=160) | |
| plt.close() | |