Instructions to use danil-ml-2026/YOLOv3-VOC with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- timm
How to use danil-ml-2026/YOLOv3-VOC with timm:
import timm model = timm.create_model("hf-hub:danil-ml-2026/YOLOv3-VOC", pretrained=True) - Notebooks
- Google Colab
- Kaggle
🇷🇺 Русская версия
📖 О модели
Веса модели YOLOv3, обученной на Pascal VOC. В качестве backbone использована предобученная модель из библиотеки timm. Сама модель, функция потерь, NMS, метрики и работа с данными находятся в библиотеке Detection_library.
📈 Результаты
| Модель | Датасет | Backbone | mAP@0.5 |
|---|---|---|---|
| YOLOv3 | Pascal VOC (валидация) | предобученный, из timm |
0.5468 |
📦 Файлы
| Файл | Размер | Описание |
|---|---|---|
best_model.pth |
549 MB | Чекпоинт лучшей модели (веса + состояние обучения) |
🗃️ Содержимое чекпоинта
best_model.pth — это словарь, а не просто state_dict. Он сохранялся так, что позволяет как делать инференс, так и продолжить обучение:
| Ключ | Что внутри |
|---|---|
epoch |
Номер эпохи, на которой сохранён чекпоинт |
model_state_dict |
Веса модели |
optimizer_state_dict |
Состояние оптимизатора |
scheduler_state_dict |
Состояние планировщика learning rate |
train_loss |
Значение train loss (лучшее на момент сохранения) |
train_loss_history |
История train loss по эпохам |
mAP_50_history |
История mAP@0.5 на валидации по эпохам |
patience |
Счётчик терпения для early stopping |
anchors |
Якоря (anchors), с которыми обучалась модель |
Из-за
optimizer_state_dictиscheduler_state_dictфайл весит заметно больше, чем одни веса модели.
🚀 Как использовать
git clone https://github.com/fffffopas/Detection_library.git
cd Detection_library
pip install torch timm huggingface_hub
Запускать из корня репозитория:
import torch
from huggingface_hub import hf_hub_download
from Education_localization.models.yolov3 import YOLOv3
from Education_localization.utils.nms import nms_yolov3_vectorized
# 1. Скачиваем чекпоинт
path = hf_hub_download(repo_id="danil-ml-2026/YOLOv3-VOC", filename="best_model.pth")
# 2. Загружаем (в чекпоинте есть не только тензоры, поэтому weights_only=False;
# загружайте только файлы, которым доверяете)
checkpoint = torch.load(path, map_location="cpu", weights_only=False)
anchors = checkpoint["anchors"]
print("Эпоха:", checkpoint["epoch"])
print("Лучший mAP@0.5 в истории:", max(checkpoint["mAP_50_history"]))
# 3. Собираем модель с теми же параметрами, что и при обучении
# (аргументы конструктора — как в Kaggle-ноутбуке) и загружаем веса
model = YOLOv3(...)
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()
Полный пример инференса с визуализацией на изображениях, а также код обучения и валидации — в Kaggle-ноутбуке.
🔗 Ссылки
- 💻 Код библиотеки: fffffopas/Detection_library
- 📓 Обучение, валидация и примеры на изображениях: Kaggle
🇬🇧 English version
📖 About
Weights of a YOLOv3 model trained on Pascal VOC. The backbone is a pretrained model from the timm library. The model itself, the loss, NMS, metrics and data handling live in the Detection_library repository.
📈 Results
| Model | Dataset | Backbone | mAP@0.5 |
|---|---|---|---|
| YOLOv3 | Pascal VOC (validation) | pretrained, from timm |
0.5468 |
📦 Files
| File | Size | Description |
|---|---|---|
best_model.pth |
549 MB | Best-model checkpoint (weights + training state) |
🗃️ Checkpoint contents
best_model.pth is a dictionary, not a bare state_dict. It supports both inference and resuming training:
| Key | Contents |
|---|---|
epoch |
Epoch at which the checkpoint was saved |
model_state_dict |
Model weights |
optimizer_state_dict |
Optimizer state |
scheduler_state_dict |
Learning-rate scheduler state |
train_loss |
Train loss value (best at the time of saving) |
train_loss_history |
Train loss history per epoch |
mAP_50_history |
Validation mAP@0.5 history per epoch |
patience |
Early-stopping patience counter |
anchors |
Anchors the model was trained with |
Because of
optimizer_state_dictandscheduler_state_dict, the file is considerably larger than the model weights alone.
🚀 Usage
git clone https://github.com/fffffopas/Detection_library.git
cd Detection_library
pip install torch timm huggingface_hub
Run from the repository root:
import torch
from huggingface_hub import hf_hub_download
from Education_localization.models.yolov3 import YOLOv3
from Education_localization.utils.nms import nms_yolov3_vectorized
# 1. Download the checkpoint
path = hf_hub_download(repo_id="danil-ml-2026/YOLOv3-VOC", filename="best_model.pth")
# 2. Load it (the checkpoint holds more than tensors, hence weights_only=False;
# only load files you trust)
checkpoint = torch.load(path, map_location="cpu", weights_only=False)
anchors = checkpoint["anchors"]
print("Epoch:", checkpoint["epoch"])
print("Best mAP@0.5 in history:", max(checkpoint["mAP_50_history"]))
# 3. Build the model with the same arguments as during training
# (constructor arguments as in the Kaggle notebook) and load the weights
model = YOLOv3(...)
model.load_state_dict(checkpoint["model_state_dict"])
model.eval()
A full inference example with visualizations on images, as well as the training and validation code, is in the Kaggle notebook.
🔗 Links
- 💻 Library code: fffffopas/Detection_library
- 📓 Training, validation and image examples: Kaggle