From c8e3c5db4bc737cd9ed8e63ae71dc4949cb6553f Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Tue, 10 Jan 2023 13:31:43 +0100 Subject: [PATCH] Cleanup (#197) Co-authored-by: Onuralp Sezer Co-authored-by: Ayush Chaurasia --- README.md | 2 +- ultralytics/__init__.py | 2 +- ultralytics/models/README.md | 44 ++++++++++++++-------- ultralytics/yolo/utils/callbacks/base.py | 3 +- ultralytics/yolo/utils/callbacks/wb.py | 48 ------------------------ 5 files changed, 31 insertions(+), 68 deletions(-) delete mode 100644 ultralytics/yolo/utils/callbacks/wb.py diff --git a/README.md b/README.md index 416cef9..358e377 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@
Ultralytics CI YOLOv8 Citation - Docker Pulls + Docker Pulls
Run on Gradient Open In Colab diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 1e38860..1b84830 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, GPL-3.0 license -__version__ = "8.0.0" +__version__ = "8.0.2" from ultralytics.hub import checks from ultralytics.yolo.engine.model import YOLO diff --git a/ultralytics/models/README.md b/ultralytics/models/README.md index f81008e..7d72657 100644 --- a/ultralytics/models/README.md +++ b/ultralytics/models/README.md @@ -1,24 +1,36 @@ -## Models HUB +## Models -Here are the models that are supported out-of-the-box with Ultralytics. For a detailed view and navigation, visit [model hub](<>) section of the docs. +Welcome to the Ultralytics Models directory! Here you will find a wide variety of pre-configured model configuration +files (`*.yaml`s) that can be used to create custom YOLO models. The models in this directory have been expertly crafted +and fine-tuned by the Ultralytics team to provide the best performance for a wide range of object detection and image +segmentation tasks. + +These model configurations cover a wide range of scenarios, from simple object detection to more complex tasks like +instance segmentation and object tracking. They are also designed to run efficiently on a variety of hardware platforms, +from CPUs to GPUs. Whether you are a seasoned machine learning practitioner or just getting started with YOLO, this +directory provides a great starting point for your custom model development needs. + +To get started, simply browse through the models in this directory and find one that best suits your needs. Once you've +selected a model, you can use the provided `*.yaml` file to train and deploy your custom YOLO model with ease. See full +details at the Ultralytics [Docs](https://docs.ultralytics.com), and if you need help or have any questions, feel free +to reach out to the Ultralytics team for support. So, don't wait, start creating your custom YOLO model now! ### Usage -You can simply set the `model` parameter to any available yaml config or pretained weights +Model `*.yaml` files may be used directly in the Command Line Interface (CLI) with a `yolo` command: ```bash -yolo task=... mode=... model=yolov5n.yaml +yolo task=detect mode=train model=yolov8n.yaml data=coco128.yaml epochs=100 ``` -| Model | Version/ | size (pixels) | mAPval 50-95 | Speed CPU b1 (ms) | params (M) | FLOPs @640 (B) | model file | Pretrained Weights | -| ------------------ | -------- | ------------- | ------------ | ----------------- | ---------- | -------------- | ------------- | ------------------ | -| YOLOv5n | v6.3 | 640 | 28.0 | 45 | 1.9 | 4.5 | yolov5n.yaml | - | -| YOLOv5s | - | 640 | 37.4 | 98 | 7.2 | 16.5 | yolov5s.yaml | - | -| YOLOv5m | - | 640 | 45.4 | 224 | 21.2 | 49.0 | yolov5m.yaml | - | -| YOLOv5l | - | 640 | 49.0 | 430 | 46.5 | 109.1 | yolov5l.yaml | - | -| YOLOv5x | - | 640 | 50.7 | 766 | 86.7 | 205.7 | yolov5x.yaml | - | -| YOLOv5n6 | - | 1280 | 36.0 | 153 | 3.2 | 4.6 | yolov5n6.yaml | - | -| YOLOv5s6 | - | 1280 | 44.8 | 385 | 12.6 | 16.8 | yolov5s6.yaml | - | -| YOLOv5m6 | - | 1280 | 51.3 | 887 | 35.7 | 50.0 | yolov5m6.yaml | - | -| YOLOv5l6 | - | 1280 | 53.7 | 1784 | 76.8 | 111.4 | yolov5l6.yaml | - | -| YOLOv5x6 + \[TTA\] | - | 1280 1536 | 55.0 55.8 | 3136 - | 140.7 - | 209.8 - | yolov5x6.yaml | - | +They may also be used directly in a Python environment, and accepts the same +[arguments](https://docs.ultralytics.com/config/) as in the CLI example above: + +```python +from ultralytics import YOLO + +model = YOLO("yolov8n.yaml") # build a YOLOv8n model from scratch + +model.info() # display model information +model.train(data="coco128.yaml", epochs=100) # train the model +``` diff --git a/ultralytics/yolo/utils/callbacks/base.py b/ultralytics/yolo/utils/callbacks/base.py index fedf0ea..689bf15 100644 --- a/ultralytics/yolo/utils/callbacks/base.py +++ b/ultralytics/yolo/utils/callbacks/base.py @@ -143,8 +143,7 @@ def add_integration_callbacks(instance): from .comet import callbacks as comet_callbacks from .hub import callbacks as hub_callbacks from .tensorboard import callbacks as tb_callbacks - from .wb import callbacks as wb_callbacks - for x in clearml_callbacks, comet_callbacks, hub_callbacks, tb_callbacks, wb_callbacks: + for x in clearml_callbacks, comet_callbacks, hub_callbacks, tb_callbacks: for k, v in x.items(): instance.callbacks[k].append(v) # callback[name].append(func) diff --git a/ultralytics/yolo/utils/callbacks/wb.py b/ultralytics/yolo/utils/callbacks/wb.py deleted file mode 100644 index ce4db81..0000000 --- a/ultralytics/yolo/utils/callbacks/wb.py +++ /dev/null @@ -1,48 +0,0 @@ -# Ultralytics YOLO 🚀, GPL-3.0 license - -from ultralytics.yolo.utils.torch_utils import get_flops, get_num_params - -try: - import wandb - - assert hasattr(wandb, '__version__') -except (ImportError, AssertionError): - wandb = None - - -def on_pretrain_routine_start(trainer): - wandb.init(project=trainer.args.project or "YOLOv8", name=trainer.args.name, config=dict( - trainer.args)) if not wandb.run else wandb.run - - -def on_fit_epoch_end(trainer): - wandb.run.log(trainer.metrics, step=trainer.epoch + 1) - if trainer.epoch == 0: - model_info = { - "model/parameters": get_num_params(trainer.model), - "model/GFLOPs": round(get_flops(trainer.model), 3), - "model/speed(ms)": round(trainer.validator.speed[1], 3)} - wandb.run.log(model_info, step=trainer.epoch + 1) - - -def on_train_epoch_end(trainer): - wandb.run.log(trainer.label_loss_items(trainer.tloss, prefix="train"), step=trainer.epoch + 1) - wandb.run.log(trainer.lr, step=trainer.epoch + 1) - if trainer.epoch == 1: - wandb.run.log({f.stem: wandb.Image(str(f)) - for f in trainer.save_dir.glob('train_batch*.jpg')}, - step=trainer.epoch + 1) - - -def on_train_end(trainer): - art = wandb.Artifact(type="model", name=f"run_{wandb.run.id}_model") - if trainer.best.exists(): - art.add_file(trainer.best) - wandb.run.log_artifact(art) - - -callbacks = { - "on_pretrain_routine_start": on_pretrain_routine_start, - "on_train_epoch_end": on_train_epoch_end, - "on_fit_epoch_end": on_fit_epoch_end, - "on_train_end": on_train_end} if wandb else {}