From 90be5f72660b7b989aab59b3cdaf00dc78332081 Mon Sep 17 00:00:00 2001 From: Muhammad Rizwan Munawar Date: Thu, 22 Aug 2024 22:51:37 +0500 Subject: [PATCH 1/5] Add https://youtu.be/WwXnljc7ZUM to docs (#15751) --- docs/en/guides/parking-management.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/en/guides/parking-management.md b/docs/en/guides/parking-management.md index 1532938db..cc42fb9b4 100644 --- a/docs/en/guides/parking-management.md +++ b/docs/en/guides/parking-management.md @@ -10,6 +10,17 @@ keywords: parking management, YOLOv8, Ultralytics, vehicle detection, real-time Parking management with [Ultralytics YOLOv8](https://github.com/ultralytics/ultralytics/) ensures efficient and safe parking by organizing spaces and monitoring availability. YOLOv8 can improve parking lot management through real-time vehicle detection, and insights into parking occupancy. +

+
+ +
+ Watch: How to Implement Parking Management Using Ultralytics YOLOv8 🚀 +

+ ## Advantages of Parking Management System? - **Efficiency**: Parking lot management optimizes the use of parking spaces and reduces congestion. From 62094bd03fc6d14726a8362ccb7e2872fe6b7909 Mon Sep 17 00:00:00 2001 From: Jan Knobloch <116908874+jk4e@users.noreply.github.com> Date: Thu, 22 Aug 2024 19:56:12 +0200 Subject: [PATCH 2/5] Improve Docs dataset layout issues (#15696) Co-authored-by: Francesco Mattioli Co-authored-by: Glenn Jocher --- docs/en/datasets/classify/cifar10.md | 20 +++++++++------- docs/en/datasets/classify/imagewoof.md | 29 +++++++++++++++------- docs/en/datasets/detect/roboflow-100.md | 2 +- docs/en/datasets/detect/visdrone.md | 29 ++++++++++++---------- docs/en/datasets/segment/crack-seg.md | 32 ++++++++++++++----------- docs/en/datasets/segment/package-seg.md | 30 +++++++++++++---------- 6 files changed, 84 insertions(+), 58 deletions(-) diff --git a/docs/en/datasets/classify/cifar10.md b/docs/en/datasets/classify/cifar10.md index b4742cbcb..54f9e9c2d 100644 --- a/docs/en/datasets/classify/cifar10.md +++ b/docs/en/datasets/classify/cifar10.md @@ -153,14 +153,18 @@ Each subset comprises images categorized into 10 classes, with their annotations If you use the CIFAR-10 dataset in your research or development projects, make sure to cite the following paper: -```bibtex -@TECHREPORT{Krizhevsky09learningmultiple, - author={Alex Krizhevsky}, - title={Learning multiple layers of features from tiny images}, - institution={}, - year={2009} -} -``` +!!! Quote "" + + === "BibTeX" + + ```bibtex + @TECHREPORT{Krizhevsky09learningmultiple, + author={Alex Krizhevsky}, + title={Learning multiple layers of features from tiny images}, + institution={}, + year={2009} + } + ``` Acknowledging the dataset's creators helps support continued research and development in the field. For more details, see the [citations and acknowledgments](#citations-and-acknowledgments) section. diff --git a/docs/en/datasets/classify/imagewoof.md b/docs/en/datasets/classify/imagewoof.md index 5a76d97fc..e6668dfcb 100644 --- a/docs/en/datasets/classify/imagewoof.md +++ b/docs/en/datasets/classify/imagewoof.md @@ -59,18 +59,29 @@ ImageWoof dataset comes in three different sizes to accommodate various research To use these variants in your training, simply replace 'imagewoof' in the dataset argument with 'imagewoof320' or 'imagewoof160'. For example: -```python -from ultralytics import YOLO +!!! Example "Example" -# Load a model -model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training) + === "Python" + + ```python + from ultralytics import YOLO + + # Load a model + model = YOLO("yolov8n-cls.pt") # load a pretrained model (recommended for training) -# For medium-sized dataset -model.train(data="imagewoof320", epochs=100, imgsz=224) + # For medium-sized dataset + model.train(data="imagewoof320", epochs=100, imgsz=224) -# For small-sized dataset -model.train(data="imagewoof160", epochs=100, imgsz=224) -``` + # For small-sized dataset + model.train(data="imagewoof160", epochs=100, imgsz=224) + ``` + + === "CLI" + + ```bash + # Load a pretrained model and train on the small-sized dataset + yolo classify train model=yolov8n-cls.pt data=imagewoof320 epochs=100 imgsz=224 + ``` It's important to note that using smaller images will likely yield lower performance in terms of classification accuracy. However, it's an excellent way to iterate quickly in the early stages of model development and prototyping. diff --git a/docs/en/datasets/detect/roboflow-100.md b/docs/en/datasets/detect/roboflow-100.md index d8c61c37c..541f8e8e5 100644 --- a/docs/en/datasets/detect/roboflow-100.md +++ b/docs/en/datasets/detect/roboflow-100.md @@ -203,7 +203,7 @@ The **Roboflow 100** dataset is accessible on [GitHub](https://github.com/robofl When using the Roboflow 100 dataset in your research, ensure to properly cite it. Here is the recommended citation: -!!! Quote +!!! Quote "" === "BibTeX" diff --git a/docs/en/datasets/detect/visdrone.md b/docs/en/datasets/detect/visdrone.md index 00d84b10e..fab2fe80f 100644 --- a/docs/en/datasets/detect/visdrone.md +++ b/docs/en/datasets/detect/visdrone.md @@ -159,16 +159,19 @@ The configuration file for the VisDrone dataset, `VisDrone.yaml`, can be found i If you use the VisDrone dataset in your research or development work, please cite the following paper: -!!! Quote "BibTeX" - - ```bibtex - @ARTICLE{9573394, - author={Zhu, Pengfei and Wen, Longyin and Du, Dawei and Bian, Xiao and Fan, Heng and Hu, Qinghua and Ling, Haibin}, - journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, - title={Detection and Tracking Meet Drones Challenge}, - year={2021}, - volume={}, - number={}, - pages={1-1}, - doi={10.1109/TPAMI.2021.3119563}} - ``` +!!! Quote "" + + === "BibTeX" + + ```bibtex + @ARTICLE{9573394, + author={Zhu, Pengfei and Wen, Longyin and Du, Dawei and Bian, Xiao and Fan, Heng and Hu, Qinghua and Ling, Haibin}, + journal={IEEE Transactions on Pattern Analysis and Machine Intelligence}, + title={Detection and Tracking Meet Drones Challenge}, + year={2021}, + volume={}, + number={}, + pages={1-1}, + doi={10.1109/TPAMI.2021.3119563} + } + ``` diff --git a/docs/en/datasets/segment/crack-seg.md b/docs/en/datasets/segment/crack-seg.md index 2dd897263..83f019871 100644 --- a/docs/en/datasets/segment/crack-seg.md +++ b/docs/en/datasets/segment/crack-seg.md @@ -135,19 +135,23 @@ Ultralytics YOLO offers advanced real-time object detection, segmentation, and c If you incorporate the Crack Segmentation Dataset into your research, please use the following BibTeX reference: -```bibtex -@misc{ crack-bphdr_dataset, - title = { crack Dataset }, - type = { Open Source Dataset }, - author = { University }, - howpublished = { \url{ https://universe.roboflow.com/university-bswxt/crack-bphdr } }, - url = { https://universe.roboflow.com/university-bswxt/crack-bphdr }, - journal = { Roboflow Universe }, - publisher = { Roboflow }, - year = { 2022 }, - month = { dec }, - note = { visited on 2024-01-23 }, -} -``` +!!! Quote "" + + === "BibTeX" + + ```bibtex + @misc{ crack-bphdr_dataset, + title = { crack Dataset }, + type = { Open Source Dataset }, + author = { University }, + howpublished = { \url{ https://universe.roboflow.com/university-bswxt/crack-bphdr } }, + url = { https://universe.roboflow.com/university-bswxt/crack-bphdr }, + journal = { Roboflow Universe }, + publisher = { Roboflow }, + year = { 2022 }, + month = { dec }, + note = { visited on 2024-01-23 }, + } + ``` This citation format ensures proper accreditation to the creators of the dataset and acknowledges its use in your research. diff --git a/docs/en/datasets/segment/package-seg.md b/docs/en/datasets/segment/package-seg.md index af4f90a51..86fad9e9b 100644 --- a/docs/en/datasets/segment/package-seg.md +++ b/docs/en/datasets/segment/package-seg.md @@ -99,24 +99,28 @@ The [Roboflow Package Segmentation Dataset](https://universe.roboflow.com/factor ### How do I train an Ultralytics YOLOv8 model on the Package Segmentation Dataset? -You can train an Ultralytics YOLOv8n model using both Python and CLI methods. For Python, use the snippet below: +You can train an Ultralytics YOLOv8n model using both Python and CLI methods. Use the snippets below: -```python -from ultralytics import YOLO +!!! Example "Train Example" -# Load a model -model = YOLO("yolov8n-seg.pt") # load a pretrained model + === "Python" + + ```python + from ultralytics import YOLO -# Train the model -results = model.train(data="package-seg.yaml", epochs=100, imgsz=640) -``` + # Load a model + model = YOLO("yolov8n-seg.pt") # load a pretrained model -For CLI: + # Train the model + results = model.train(data="package-seg.yaml", epochs=100, imgsz=640) + ``` -```bash -# Start training from a pretrained *.pt model -yolo segment train data=package-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640 -``` + === "CLI" + + ```bash + # Start training from a pretrained *.pt model + yolo segment train data=package-seg.yaml model=yolov8n-seg.pt epochs=100 imgsz=640 + ``` Refer to the model [Training](../../modes/train.md) page for more details. From 8bb776fbc3007846d0058111daab949d9adba8a4 Mon Sep 17 00:00:00 2001 From: Laughing <61612323+Laughing-q@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:42:46 +0800 Subject: [PATCH 3/5] Fix `xywh` docstring (#15765) --- ultralytics/engine/results.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ultralytics/engine/results.py b/ultralytics/engine/results.py index 34a5d3e08..3c57d73af 100644 --- a/ultralytics/engine/results.py +++ b/ultralytics/engine/results.py @@ -992,8 +992,8 @@ class Boxes(BaseTensor): Convert bounding boxes from [x1, y1, x2, y2] format to [x, y, width, height] format. Returns: - (torch.Tensor | numpy.ndarray): Boxes in [x, y, width, height] format, where x, y are the coordinates of - the top-left corner of the bounding box, width, height are the dimensions of the bounding box and the + (torch.Tensor | numpy.ndarray): Boxes in [x_center, y_center, width, height] format, where x_center, y_center are the coordinates of + the center point of the bounding box, width, height are the dimensions of the bounding box and the shape of the returned tensor is (N, 4), where N is the number of boxes. Examples: From a89b316f276bd73c0aaee746c40752e9404f3fc6 Mon Sep 17 00:00:00 2001 From: Robert Schroll Date: Thu, 22 Aug 2024 20:48:41 -0700 Subject: [PATCH 4/5] Ensure matplotlib backend gets reset with plt_settings (#15759) Co-authored-by: UltralyticsAssistant Co-authored-by: Glenn Jocher --- ultralytics/utils/__init__.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/ultralytics/utils/__init__.py b/ultralytics/utils/__init__.py index f614eea20..9a2209725 100644 --- a/ultralytics/utils/__init__.py +++ b/ultralytics/utils/__init__.py @@ -219,16 +219,19 @@ def plt_settings(rcparams=None, backend="Agg"): def wrapper(*args, **kwargs): """Sets rc parameters and backend, calls the original function, and restores the settings.""" original_backend = plt.get_backend() - if backend.lower() != original_backend.lower(): + switch = backend.lower() != original_backend.lower() + if switch: plt.close("all") # auto-close()ing of figures upon backend switching is deprecated since 3.8 plt.switch_backend(backend) - with plt.rc_context(rcparams): - result = func(*args, **kwargs) - - if backend != original_backend: - plt.close("all") - plt.switch_backend(original_backend) + # Plot with backend and always revert to original backend + try: + with plt.rc_context(rcparams): + result = func(*args, **kwargs) + finally: + if switch: + plt.close("all") + plt.switch_backend(original_backend) return result return wrapper From 2b7fac4db483aa89542c361ad4384e9119f0573d Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 23 Aug 2024 11:50:52 +0800 Subject: [PATCH 5/5] `ultralytics 8.2.81` fix HUB missing 'best.pt' resumed checkpoint upload (#15754) --- ultralytics/__init__.py | 2 +- ultralytics/hub/session.py | 46 ++++++++++++++++++++++++-------------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index a03cb559e..5d7906d07 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = "8.2.80" +__version__ = "8.2.81" import os diff --git a/ultralytics/hub/session.py b/ultralytics/hub/session.py index 1423f5f46..9ce9a299e 100644 --- a/ultralytics/hub/session.py +++ b/ultralytics/hub/session.py @@ -1,5 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license +import shutil import threading import time from http import HTTPStatus @@ -344,23 +345,34 @@ class HUBTrainingSession: map (float): Mean average precision of the model. final (bool): Indicates if the model is the final model after training. """ - if Path(weights).is_file(): - progress_total = Path(weights).stat().st_size if final else None # Only show progress if final - self.request_queue( - self.model.upload_model, - epoch=epoch, - weights=weights, - is_best=is_best, - map=map, - final=final, - retry=10, - timeout=3600, - thread=not final, - progress_total=progress_total, - stream_response=True, - ) - else: - LOGGER.warning(f"{PREFIX}WARNING ⚠️ Model upload issue. Missing model {weights}.") + weights = Path(weights) + if not weights.is_file(): + last = weights.with_name("last" + weights.suffix) + if final and last.is_file(): + LOGGER.warning( + f"{PREFIX} ARNING ⚠️ Model 'best.pt' not found, copying 'last.pt' to 'best.pt' and uploading. " + "This often happens when resuming training in transient environments like Google Colab. " + "For more reliable training, consider using Ultralytics HUB Cloud. " + "Learn more at https://docs.ultralytics.com/hub/cloud-training/." + ) + shutil.copy(last, weights) # copy last.pt to best.pt + else: + LOGGER.warning(f"{PREFIX} WARNING ⚠️ Model upload issue. Missing model {weights}.") + return + + self.request_queue( + self.model.upload_model, + epoch=epoch, + weights=str(weights), + is_best=is_best, + map=map, + final=final, + retry=10, + timeout=3600, + thread=not final, + progress_total=weights.stat().st_size if final else None, # only show progress if final + stream_response=True, + ) @staticmethod def _show_upload_progress(content_length: int, response: requests.Response) -> None: