Add metadata

This commit is contained in:
Niels 2024-06-02 11:43:29 +02:00
parent 84015ac9bc
commit 18eb5498ee
3 changed files with 16 additions and 4 deletions

View File

@ -104,6 +104,18 @@ model.train(data='coco.yaml', epochs=500, batch=256, imgsz=640)
# model.push_to_hub("reponame")
```
## Push to hub to 🤗
Optionally, you can push your fine-tuned model to the [Hugging Face hub](https://huggingface.co/) as a public or private model:
```python
# let's say you have fine-tuned a model for crop detection
model.push_to_hub("<your-hf-username-or-organization/yolov10-finetuned-crop-detection")
# you can also pass `private=True` if you don't want everyone to see your model
model.push_to_hub("<your-hf-username-or-organization/yolov10-finetuned-crop-detection", private=True)
```
## Prediction
Note that a smaller confidence threshold can be set to detect smaller objects or objects in the distance. Please refer to [here](https://github.com/THU-MIG/yolov10/issues/136) for details.
```

View File

@ -13,10 +13,8 @@ from ultralytics.hub.utils import HUB_WEB_ROOT
from ultralytics.nn.tasks import attempt_load_one_weight, guess_model_task, nn, yaml_model_load
from ultralytics.utils import ASSETS, DEFAULT_CFG_DICT, LOGGER, RANK, SETTINGS, callbacks, checks, emojis, yaml_load
from huggingface_hub import PyTorchModelHubMixin
class Model(nn.Module, PyTorchModelHubMixin):
class Model(nn.Module):
"""
A base class for implementing YOLO models, unifying APIs across different model types.

View File

@ -4,7 +4,9 @@ from .val import YOLOv10DetectionValidator
from .predict import YOLOv10DetectionPredictor
from .train import YOLOv10DetectionTrainer
class YOLOv10(Model):
from huggingface_hub import PyTorchModelHubMixin
class YOLOv10(Model, PyTorchModelHubMixin, library_name="ultralytics", repo_url="https://github.com/THU-MIG/yolov10", tags=["object-detection", "yolov10"]):
def __init__(self, model="yolov10n.pt", task=None, verbose=False):
super().__init__(model=model, task=task, verbose=verbose)