Fix Action Recognition Example with torch>=2.0 (#14232)
This commit is contained in:
parent
5d479c73c2
commit
2b1b26333b
1 changed files with 5 additions and 5 deletions
|
|
@ -171,13 +171,13 @@ class HuggingFaceVideoClassifier:
|
||||||
"""
|
"""
|
||||||
if input_size is None:
|
if input_size is None:
|
||||||
input_size = [224, 224]
|
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),
|
transforms.Lambda(lambda x: x.float() / 255.0),
|
||||||
v2.Resize(input_size, antialias=True),
|
transforms.Resize(input_size),
|
||||||
v2.Normalize(
|
transforms.Normalize(
|
||||||
mean=self.processor.image_processor.image_mean, std=self.processor.image_processor.image_std
|
mean=self.processor.image_processor.image_mean, std=self.processor.image_processor.image_std
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue