Skip to content

Commit

Permalink
Fix Action Recognition Example with torch>=2.0 (ultralytics#14232)
Browse files Browse the repository at this point in the history
  • Loading branch information
fcakyon authored Jul 5, 2024
1 parent 5d479c7 commit 2b1b263
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions examples/YOLOv8-Action-Recognition/action_recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ def preprocess_crops_for_video_cls(self, crops: List[np.ndarray], input_size: li
"""
if input_size is None:
input_size = [224, 224]
from torchvision.transforms import v2
from torchvision import transforms

transform = v2.Compose(
transform = transforms.Compose(
[
v2.ToDtype(torch.float32, scale=True),
v2.Resize(input_size, antialias=True),
v2.Normalize(
transforms.Lambda(lambda x: x.float() / 255.0),
transforms.Resize(input_size),
transforms.Normalize(
mean=self.processor.image_processor.image_mean, std=self.processor.image_processor.image_std
),
]
Expand Down

0 comments on commit 2b1b263

Please sign in to comment.