diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 3e8f07ef..e3542660 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -225,7 +225,7 @@ jobs: run: shell: bash -el {0} steps: - - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v3 with: python-version: ${{ matrix.python-version }} mamba-version: "*" diff --git a/README.md b/README.md index 4914bef6..f14a0c31 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Ultralytics Code Coverage YOLOv8 Citation Docker Pulls + Discord
Run on Gradient Open In Colab diff --git a/README.zh-CN.md b/README.zh-CN.md index 7f25522d..cc581c98 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -12,6 +12,7 @@ Ultralytics Code Coverage YOLOv8 Citation Docker Pulls + Discord
Run on Gradient Open In Colab diff --git a/docs/ar/index.md b/docs/ar/index.md index 211f6673..ab95a6ab 100644 --- a/docs/ar/index.md +++ b/docs/ar/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics، YOLOv8، كشف الكائنات، تجزئة الصور Ultralytics Code Coverage YOLOv8 Citation Docker Pulls + Discord
Run on Gradient Open In Colab diff --git a/docs/de/index.md b/docs/de/index.md index 1216d92e..a008082e 100644 --- a/docs/de/index.md +++ b/docs/de/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, Objekterkennung, Bildsegmentierung, maschinelles Ultralytics Code Coverage YOLOv8 Zitation Docker Ziehungen + Discord
Auf Gradient ausführen In Colab öffnen diff --git a/docs/en/guides/isolating-segmentation-objects.md b/docs/en/guides/isolating-segmentation-objects.md index 676b11f5..a0436f43 100644 --- a/docs/en/guides/isolating-segmentation-objects.md +++ b/docs/en/guides/isolating-segmentation-objects.md @@ -24,7 +24,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab from ultralytics import YOLO ``` - ???+ tip "Ultralytics Install" + ???+ tip "Ultralytics Install" See the Ultralytics [Quickstart](../quickstart.md/#install-ultralytics) Installation section for a quick walkthrough on installing the required libraries. @@ -42,7 +42,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab result = model.predict() ``` - ??? question "No Prediction Arguments?" + ??? question "No Prediction Arguments?" Without specifying a source, the example images from the library will be used: @@ -53,7 +53,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab This is helpful for rapid testing with the `predict()` method. - For additional information about Segmentation Models, visit the [Segment Task](../tasks/segment.md#models) page. To learn more about `predict()` method, see [Predict Mode](../modes/predict.md) section of the Documentation. + For additional information about Segmentation Models, visit the [Segment Task](../tasks/segment.md#models) page. To learn more about `predict()` method, see [Predict Mode](../modes/predict.md) section of the Documentation. --- @@ -75,7 +75,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab 1. To learn more about working with detection results, see [Boxes Section for Predict Mode](../modes/predict.md#boxes). 2. To learn more about `predict()` results see [Working with Results for Predict Mode](../modes/predict.md#working-with-results) - ??? info "For-Loop" + ??? info "For-Loop" A single image will only iterate the first loop once. A single image with only a single detection will iterate each loop _only_ once. @@ -83,7 +83,8 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab 4. Start with generating a binary mask from the source image and then draw a filled contour onto the mask. This will allow the object to be isolated from the other parts of the image. An example from `bus.jpg` for one of the detected `person` class objects is shown on the right. - ![Binary Mask Image](https://github.com/ultralytics/ultralytics/assets/62214284/59bce684-fdda-4b17-8104-0b4b51149aca){ width="240", align="right" } + ![Binary Mask Image](https://github.com/ultralytics/ultralytics/assets/62214284/59bce684-fdda-4b17-8104-0b4b51149aca){ width="240", align="right" } + ``` { .py .annotate } # Create binary mask b_mask = np.zeros(img.shape[:2], np.uint8) @@ -146,9 +147,9 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab 5. Next the there are 2 options for how to move forward with the image from this point and a subsequent option for each. - ### Object Isolation Options + ### Object Isolation Options - !!! Example "" + !!! example "" === "Black Background Pixels" @@ -251,7 +252,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab - Finally the image region for the bounding box is cropped using index slicing, where the bounds are set using the `[ymin:ymax, xmin:xmax]` coordinates of the detection bounding box. - ??? question "What if I want the cropped object **including** the background?" + ??? question "What if I want the cropped object **including** the background?" This is a built in feature for the Ultralytics library. See the `save_crop` argument for [Predict Mode Inference Arguments](../modes/predict.md/#inference-arguments) for details. @@ -261,7 +262,7 @@ After performing the [Segment Task](../tasks/segment.md), it's sometimes desirab - **NOTE:** this step is optional and can be skipped if not required for your specific use case. - ??? example "Example Final Step" + ??? example "Example Final Step" ```py # Save isolated object to file diff --git a/docs/en/index.md b/docs/en/index.md index c69388b9..4f4b0d63 100644 --- a/docs/en/index.md +++ b/docs/en/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, object detection, image segmentation, machine lea Ultralytics Code Coverage YOLOv8 Citation Docker Pulls + Discord
Run on Gradient Open In Colab diff --git a/docs/en/models/yolov8.md b/docs/en/models/yolov8.md index 027b3996..fd701302 100644 --- a/docs/en/models/yolov8.md +++ b/docs/en/models/yolov8.md @@ -12,6 +12,17 @@ YOLOv8 is the latest iteration in the YOLO series of real-time object detectors, ![Ultralytics YOLOv8](https://raw.githubusercontent.com/ultralytics/assets/main/yolov8/yolo-comparison-plots.png) +

+
+ +
+ Watch: Ultralytics YOLOv8 Model Overview +

+ ## Key Features - **Advanced Backbone and Neck Architectures:** YOLOv8 employs state-of-the-art backbone and neck architectures, resulting in improved feature extraction and object detection performance. diff --git a/docs/es/index.md b/docs/es/index.md index 163f4c7d..df844586 100644 --- a/docs/es/index.md +++ b/docs/es/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, detección de objetos, segmentación de imágenes Cobertura de código de Ultralytics Cita de YOLOv8 Descargas de Docker + Discord
Ejecutar en Gradient Abrir en Colab diff --git a/docs/fr/index.md b/docs/fr/index.md index be3e9477..dd8dcc17 100644 --- a/docs/fr/index.md +++ b/docs/fr/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, détection d'objets, segmentation d'images, appre Couverture de code Ultralytics Citation YOLOv8 Téléchargements Docker + Discord
Exécuter sur Gradient Ouvrir dans Colab diff --git a/docs/hi/index.md b/docs/hi/index.md index f06b6b8e..89f296d0 100644 --- a/docs/hi/index.md +++ b/docs/hi/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, वस्तु पता लगाना, छव Ultralytics Code Coverage YOLOv8 Citation Docker Pulls + Discord
Run on Gradient Open In Colab diff --git a/docs/ja/index.md b/docs/ja/index.md index 97f5ec6e..c66c3f96 100644 --- a/docs/ja/index.md +++ b/docs/ja/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, オブジェクト検出, 画像セグメンテ Ultralytics コードカバレッジ YOLOv8 引用情報 Docker プル + Discord
Gradient上で実行 Colabで開く diff --git a/docs/ko/index.md b/docs/ko/index.md index cf6acbe7..67d82a7b 100644 --- a/docs/ko/index.md +++ b/docs/ko/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, 객체 탐지, 이미지 분할, 기계 학습, Ultralytics 코드 커버리지 YOLOv8 인용 Docker 당기기 + Discord
Run on Gradient Open In Colab diff --git a/docs/pt/index.md b/docs/pt/index.md index cc87e6ee..3c9296ff 100644 --- a/docs/pt/index.md +++ b/docs/pt/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, detecção de objetos, segmentação de imagens, Cobertura de Código da Ultralytics Citação do YOLOv8 Contagem de Pulls no Docker + Discord
Executar no Gradient Abrir no Colab diff --git a/docs/ru/index.md b/docs/ru/index.md index aac44064..a4ccca11 100644 --- a/docs/ru/index.md +++ b/docs/ru/index.md @@ -28,6 +28,7 @@ keywords: Ultralytics, YOLOv8, обнаружение объектов, сегм Покрытие кода Ultralytics Цитирование YOLOv8 Загрузки Docker + Discord
Запустить на Gradient Открыть в Colab diff --git a/docs/zh/index.md b/docs/zh/index.md index b8c3ea80..d7d58ded 100644 --- a/docs/zh/index.md +++ b/docs/zh/index.md @@ -30,6 +30,7 @@ keywords: Ultralytics, YOLOv8, 目标检测, 图像分割, 机器学习, 深度 Ultralytics Code Coverage YOLOv8 Citation Docker Pulls + Discord
Run on Gradient Open In Colab diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py index 1609c3ab..e1e4eed8 100644 --- a/ultralytics/__init__.py +++ b/ultralytics/__init__.py @@ -1,6 +1,6 @@ # Ultralytics YOLO 🚀, AGPL-3.0 license -__version__ = '8.0.222' +__version__ = '8.0.223' from ultralytics.models import RTDETR, SAM, YOLO from ultralytics.models.fastsam import FastSAM diff --git a/ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml b/ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml new file mode 100644 index 00000000..2295f122 --- /dev/null +++ b/ultralytics/cfg/models/v8/yolov8-ghost-p2.yaml @@ -0,0 +1,54 @@ +# Ultralytics YOLO 🚀, AGPL-3.0 license +# YOLOv8 object detection model with P2-P5 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect + +# Parameters +nc: 80 # number of classes +scales: # model compound scaling constants, i.e. 'model=yolov8n.yaml' will call yolov8.yaml with scale 'n' + # [depth, width, max_channels] + n: [0.33, 0.25, 1024] # YOLOv8n-ghost-p2 summary: 491 layers, 2033944 parameters, 2033928 gradients, 13.8 GFLOPs + s: [0.33, 0.50, 1024] # YOLOv8s-ghost-p2 summary: 491 layers, 5562080 parameters, 5562064 gradients, 25.1 GFLOPs + m: [0.67, 0.75, 768] # YOLOv8m-ghost-p2 summary: 731 layers, 9031728 parameters, 9031712 gradients, 42.8 GFLOPs + l: [1.00, 1.00, 512] # YOLOv8l-ghost-p2 summary: 971 layers, 12214448 parameters, 12214432 gradients, 69.1 GFLOPs + x: [1.00, 1.25, 512] # YOLOv8x-ghost-p2 summary: 971 layers, 18664776 parameters, 18664760 gradients, 103.3 GFLOPs + +# YOLOv8.0-ghost backbone +backbone: + # [from, repeats, module, args] + - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 + - [-1, 1, GhostConv, [128, 3, 2]] # 1-P2/4 + - [-1, 3, C3Ghost, [128, True]] + - [-1, 1, GhostConv, [256, 3, 2]] # 3-P3/8 + - [-1, 6, C3Ghost, [256, True]] + - [-1, 1, GhostConv, [512, 3, 2]] # 5-P4/16 + - [-1, 6, C3Ghost, [512, True]] + - [-1, 1, GhostConv, [1024, 3, 2]] # 7-P5/32 + - [-1, 3, C3Ghost, [1024, True]] + - [-1, 1, SPPF, [1024, 5]] # 9 + +# YOLOv8.0-ghost-p2 head +head: + - [-1, 1, nn.Upsample, [None, 2, 'nearest']] + - [[-1, 6], 1, Concat, [1]] # cat backbone P4 + - [-1, 3, C3Ghost, [512]] # 12 + + - [-1, 1, nn.Upsample, [None, 2, 'nearest']] + - [[-1, 4], 1, Concat, [1]] # cat backbone P3 + - [-1, 3, C3Ghost, [256]] # 15 (P3/8-small) + + - [-1, 1, nn.Upsample, [None, 2, 'nearest']] + - [[-1, 2], 1, Concat, [1]] # cat backbone P2 + - [-1, 3, C3Ghost, [128]] # 18 (P2/4-xsmall) + + - [-1, 1, GhostConv, [128, 3, 2]] + - [[-1, 15], 1, Concat, [1]] # cat head P3 + - [-1, 3, C3Ghost, [256]] # 21 (P3/8-small) + + - [-1, 1, GhostConv, [256, 3, 2]] + - [[-1, 12], 1, Concat, [1]] # cat head P4 + - [-1, 3, C3Ghost, [512]] # 24 (P4/16-medium) + + - [-1, 1, GhostConv, [512, 3, 2]] + - [[-1, 9], 1, Concat, [1]] # cat head P5 + - [-1, 3, C3Ghost, [1024]] # 27 (P5/32-large) + + - [[18, 21, 24, 27], 1, Detect, [nc]] # Detect(P2, P3, P4, P5) diff --git a/ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml b/ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml new file mode 100644 index 00000000..21f5b820 --- /dev/null +++ b/ultralytics/cfg/models/v8/yolov8-ghost-p6.yaml @@ -0,0 +1,56 @@ +# Ultralytics YOLO 🚀, AGPL-3.0 license +# YOLOv8 object detection model with P3-P6 outputs. For Usage examples see https://docs.ultralytics.com/tasks/detect + +# Parameters +nc: 80 # number of classes +scales: # model compound scaling constants, i.e. 'model=yolov8n-p6.yaml' will call yolov8-p6.yaml with scale 'n' + # [depth, width, max_channels] + n: [0.33, 0.25, 1024] # YOLOv8n-ghost-p6 summary: 529 layers, 2901100 parameters, 2901084 gradients, 5.8 GFLOPs + s: [0.33, 0.50, 1024] # YOLOv8s-ghost-p6 summary: 529 layers, 9520008 parameters, 9519992 gradients, 16.4 GFLOPs + m: [0.67, 0.75, 768] # YOLOv8m-ghost-p6 summary: 789 layers, 18002904 parameters, 18002888 gradients, 34.4 GFLOPs + l: [1.00, 1.00, 512] # YOLOv8l-ghost-p6 summary: 1049 layers, 21227584 parameters, 21227568 gradients, 55.3 GFLOPs + x: [1.00, 1.25, 512] # YOLOv8x-ghost-p6 summary: 1049 layers, 33057852 parameters, 33057836 gradients, 85.7 GFLOPs + +# YOLOv8.0-ghost backbone +backbone: + # [from, repeats, module, args] + - [-1, 1, Conv, [64, 3, 2]] # 0-P1/2 + - [-1, 1, GhostConv, [128, 3, 2]] # 1-P2/4 + - [-1, 3, C3Ghost, [128, True]] + - [-1, 1, GhostConv, [256, 3, 2]] # 3-P3/8 + - [-1, 6, C3Ghost, [256, True]] + - [-1, 1, GhostConv, [512, 3, 2]] # 5-P4/16 + - [-1, 6, C3Ghost, [512, True]] + - [-1, 1, GhostConv, [768, 3, 2]] # 7-P5/32 + - [-1, 3, C3Ghost, [768, True]] + - [-1, 1, GhostConv, [1024, 3, 2]] # 9-P6/64 + - [-1, 3, C3Ghost, [1024, True]] + - [-1, 1, SPPF, [1024, 5]] # 11 + +# YOLOv8.0-ghost-p6 head +head: + - [-1, 1, nn.Upsample, [None, 2, 'nearest']] + - [[-1, 8], 1, Concat, [1]] # cat backbone P5 + - [-1, 3, C3Ghost, [768]] # 14 + + - [-1, 1, nn.Upsample, [None, 2, 'nearest']] + - [[-1, 6], 1, Concat, [1]] # cat backbone P4 + - [-1, 3, C3Ghost, [512]] # 17 + + - [-1, 1, nn.Upsample, [None, 2, 'nearest']] + - [[-1, 4], 1, Concat, [1]] # cat backbone P3 + - [-1, 3, C3Ghost, [256]] # 20 (P3/8-small) + + - [-1, 1, GhostConv, [256, 3, 2]] + - [[-1, 17], 1, Concat, [1]] # cat head P4 + - [-1, 3, C3Ghost, [512]] # 23 (P4/16-medium) + + - [-1, 1, GhostConv, [512, 3, 2]] + - [[-1, 14], 1, Concat, [1]] # cat head P5 + - [-1, 3, C3Ghost, [768]] # 26 (P5/32-large) + + - [-1, 1, GhostConv, [768, 3, 2]] + - [[-1, 11], 1, Concat, [1]] # cat head P6 + - [-1, 3, C3Ghost, [1024]] # 29 (P6/64-xlarge) + + - [[20, 23, 26, 29], 1, Detect, [nc]] # Detect(P3, P4, P5, P6) diff --git a/ultralytics/engine/predictor.py b/ultralytics/engine/predictor.py index 3df7bdb5..83abbd2a 100644 --- a/ultralytics/engine/predictor.py +++ b/ultralytics/engine/predictor.py @@ -345,9 +345,10 @@ class BasePredictor: else: # 'video' or 'stream' frames_path = f'{save_path.split(".", 1)[0]}_frames/' if self.vid_path[idx] != save_path: # new video - Path(frames_path).mkdir(parents=True, exist_ok=True) - self.vid_path[idx] = save_path - self.vid_frame[idx] = 0 + if self.args.save_frames: + Path(frames_path).mkdir(parents=True, exist_ok=True) + self.vid_path[idx] = save_path + self.vid_frame[idx] = 0 if isinstance(self.vid_writer[idx], cv2.VideoWriter): self.vid_writer[idx].release() # release previous video writer if vid_cap: # video @@ -363,8 +364,9 @@ class BasePredictor: self.vid_writer[idx].write(im0) # Write frame - cv2.imwrite(f'{frames_path}{self.vid_frame[idx]}.jpg', im0) - self.vid_frame[idx] += 1 + if self.args.save_frames: + cv2.imwrite(f'{frames_path}{self.vid_frame[idx]}.jpg', im0) + self.vid_frame[idx] += 1 def run_callbacks(self, event: str): """Runs all registered callbacks for a specific event."""