From 9aaa5d5ed0e5a0c1f053069dd73f12b845c4f282 Mon Sep 17 00:00:00 2001
From: Glenn Jocher
Date: Fri, 29 Sep 2023 21:06:14 +0200
Subject: [PATCH] `ultralytics 8.0.190` add `thop>=0.1.1` to requirements.txt
(#5162)
Co-authored-by: JohanWesto
Co-authored-by: Muhammad Rizwan Munawar <62513924+RizwanMunawar@users.noreply.github.com>
Co-authored-by: StephenBeirlaen <11806615+StephenBeirlaen@users.noreply.github.com>
---
docs/modes/predict.md | 7 +++++++
docs/modes/track.md | 9 ++++++++-
requirements.txt | 2 +-
ultralytics/__init__.py | 2 +-
ultralytics/data/augment.py | 14 +++++++-------
ultralytics/data/dataset.py | 2 +-
ultralytics/engine/exporter.py | 3 +++
7 files changed, 28 insertions(+), 11 deletions(-)
diff --git a/docs/modes/predict.md b/docs/modes/predict.md
index eb405534..4c7175b1 100644
--- a/docs/modes/predict.md
+++ b/docs/modes/predict.md
@@ -23,6 +23,13 @@ In the world of machine learning and computer vision, the process of making sens
Watch: How to Extract the Outputs from Ultralytics YOLOv8 Model for Custom Projects.
+## Real-world Applications
+
+| Manufacturing | Sports | Safety |
+|:-----------------------------------:|:-----------------------:|:-----------:|
+|  | |  |
+| Vehicle Spare Parts Detection | Football Player Detection | People Fall Detection |
+
## Why Use Ultralytics YOLO for Inference?
Here's why you should consider YOLOv8's predict mode for your various inference needs:
diff --git a/docs/modes/track.md b/docs/modes/track.md
index 43bd522c..878ddffe 100644
--- a/docs/modes/track.md
+++ b/docs/modes/track.md
@@ -30,6 +30,13 @@ The output from Ultralytics trackers is consistent with standard object detectio
Watch: Object Detection and Tracking with Ultralytics YOLOv8.
+## Real-world Applications
+
+| Transportation | Retail | Aquaculture |
+|:-----------------------------------:|:-----------------------:|:-----------:|
+|  |  |  |
+| Vehicle Tracking | People Tracking | Fish Tracking |
+
## Features at a Glance
Ultralytics YOLO extends its object detection features to provide robust and versatile object tracking:
@@ -321,4 +328,4 @@ By contributing to this section, you help expand the scope of tracking solutions
To initiate your contribution, please refer to our [Contributing Guide](https://docs.ultralytics.com/help/contributing) for comprehensive instructions on submitting a Pull Request (PR) 🛠️. We are excited to see what you bring to the table!
-Together, let's enhance the tracking capabilities of the Ultralytics YOLO ecosystem 🙏!
\ No newline at end of file
+Together, let's enhance the tracking capabilities of the Ultralytics YOLO ecosystem 🙏!
diff --git a/requirements.txt b/requirements.txt
index b2885188..8a5f36d6 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -38,7 +38,7 @@ seaborn>=0.11.0
# Extras --------------------------------------
psutil # system utilization
py-cpuinfo # display CPU info
-# thop>=0.1.1 # FLOPs computation
+thop>=0.1.1 # FLOPs computation
# ipython # interactive notebook
# albumentations>=1.0.3 # training augmentations
# pycocotools>=2.0.6 # COCO mAP
diff --git a/ultralytics/__init__.py b/ultralytics/__init__.py
index 7d5ce312..9ea9447d 100644
--- a/ultralytics/__init__.py
+++ b/ultralytics/__init__.py
@@ -1,6 +1,6 @@
# Ultralytics YOLO 🚀, AGPL-3.0 license
-__version__ = '8.0.189'
+__version__ = '8.0.190'
from ultralytics.models import RTDETR, SAM, YOLO
from ultralytics.models.fastsam import FastSAM
diff --git a/ultralytics/data/augment.py b/ultralytics/data/augment.py
index 3136adba..432023c7 100644
--- a/ultralytics/data/augment.py
+++ b/ultralytics/data/augment.py
@@ -791,14 +791,14 @@ def v8_transforms(dataset, imgsz, hyp, stretch=False):
# Classification augmentations -----------------------------------------------------------------------------------------
-def classify_transforms(size=224, mean=(0.0, 0.0, 0.0), std=(1.0, 1.0, 1.0)): # IMAGENET_MEAN, IMAGENET_STD
- # Transforms to apply if albumentations not installed
+def classify_transforms(size=224, rect=False, mean=(0.0, 0.0, 0.0), std=(1.0, 1.0, 1.0)): # IMAGENET_MEAN, IMAGENET_STD
+ """Transforms to apply if albumentations not installed."""
if not isinstance(size, int):
raise TypeError(f'classify_transforms() size {size} must be integer, not (list, tuple)')
+ transforms = [ClassifyLetterBox(size, auto=True) if rect else CenterCrop(size), ToTensor()]
if any(mean) or any(std):
- return T.Compose([CenterCrop(size), ToTensor(), T.Normalize(mean, std, inplace=True)])
- else:
- return T.Compose([CenterCrop(size), ToTensor()])
+ transforms.append(T.Normalize(mean, std, inplace=True))
+ return T.Compose(transforms)
def hsv2colorjitter(h, s, v):
@@ -864,9 +864,9 @@ class ClassifyLetterBox:
imh, imw = im.shape[:2]
r = min(self.h / imh, self.w / imw) # ratio of new/old
h, w = round(imh * r), round(imw * r) # resized image
- hs, ws = (math.ceil(x / self.stride) * self.stride for x in (h, w)) if self.auto else self.h, self.w
+ hs, ws = (math.ceil(x / self.stride) * self.stride for x in (h, w)) if self.auto else (self.h, self.w)
top, left = round((hs - h) / 2 - 0.1), round((ws - w) / 2 - 0.1)
- im_out = np.full((self.h, self.w, 3), 114, dtype=im.dtype)
+ im_out = np.full((hs, ws, 3), 114, dtype=im.dtype)
im_out[top:top + h, left:left + w] = cv2.resize(im, (w, h), interpolation=cv2.INTER_LINEAR)
return im_out
diff --git a/ultralytics/data/dataset.py b/ultralytics/data/dataset.py
index 65fe141b..217d3bab 100644
--- a/ultralytics/data/dataset.py
+++ b/ultralytics/data/dataset.py
@@ -222,7 +222,7 @@ class ClassificationDataset(torchvision.datasets.ImageFolder):
self.cache_disk = cache == 'disk'
self.samples = self.verify_images() # filter out bad images
self.samples = [list(x) + [Path(x[0]).with_suffix('.npy'), None] for x in self.samples] # file, index, npy, im
- self.torch_transforms = classify_transforms(args.imgsz)
+ self.torch_transforms = classify_transforms(args.imgsz, rect=args.rect)
self.album_transforms = classify_albumentations(
augment=augment,
size=args.imgsz,
diff --git a/ultralytics/engine/exporter.py b/ultralytics/engine/exporter.py
index e03e5207..b209b9d7 100644
--- a/ultralytics/engine/exporter.py
+++ b/ultralytics/engine/exporter.py
@@ -627,6 +627,9 @@ class Exporter:
if builder.platform_has_fast_fp16 and self.args.half:
config.set_flag(trt.BuilderFlag.FP16)
+ del self.model
+ torch.cuda.empty_cache()
+
# Write file
with builder.build_engine(network, config) as engine, open(f, 'wb') as t:
# Metadata