UltralyticsAssistant 4 months ago
parent 612dd26a0e
commit 28dc673547
  1. 4
      examples/YOLOv8-Action-Recognition/action_recognition.py
  2. 8
      ultralytics/solutions/action_recognition.py

@ -212,7 +212,9 @@ class HuggingFaceVideoClassifier:
[ [
v2.ToDtype(torch.float32, scale=True), v2.ToDtype(torch.float32, scale=True),
v2.Resize(input_size, antialias=True), v2.Resize(input_size, antialias=True),
v2.Normalize(mean=self.processor.image_processor.image_mean, std=self.processor.image_processor.image_std), v2.Normalize(
mean=self.processor.image_processor.image_mean, std=self.processor.image_processor.image_std
),
] ]
) )
else: else:

@ -207,9 +207,7 @@ class TorchVisionVideoClassifier:
supports_r3d = check_requirements("torchvision>=0.8.1", install=False) supports_r3d = check_requirements("torchvision>=0.8.1", install=False)
supports_transforms_v2 = check_requirements("torchvision>=0.16.0", install=False) supports_transforms_v2 = check_requirements("torchvision>=0.16.0", install=False)
supports_mvitv1b = supports_s3d = check_requirements("torchvision>=0.14.0", install=False) supports_mvitv1b = supports_s3d = check_requirements("torchvision>=0.14.0", install=False)
supports_mvitv2s = supports_swin3dt = supports_swin3db = check_requirements( supports_mvitv2s = supports_swin3dt = supports_swin3db = check_requirements("torchvision>=0.15.0", install=False)
"torchvision>=0.15.0", install=False
)
model_name_to_model_and_weights = {} model_name_to_model_and_weights = {}
if supports_r3d: if supports_r3d:
@ -396,7 +394,9 @@ class HuggingFaceVideoClassifier:
[ [
v2.ToDtype(torch.float32, scale=True), v2.ToDtype(torch.float32, scale=True),
v2.Resize(input_size, antialias=True), v2.Resize(input_size, antialias=True),
v2.Normalize(mean=self.processor.image_processor.image_mean, std=self.processor.image_processor.image_std), v2.Normalize(
mean=self.processor.image_processor.image_mean, std=self.processor.image_processor.image_std
),
] ]
) )
else: else:

Loading…
Cancel
Save