Instructions to use MCG-NJU/videomae-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use MCG-NJU/videomae-large with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("video-classification", model="MCG-NJU/videomae-large")# Load model directly from transformers import AutoImageProcessor, AutoModelForPreTraining processor = AutoImageProcessor.from_pretrained("MCG-NJU/videomae-large") model = AutoModelForPreTraining.from_pretrained("MCG-NJU/videomae-large") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -28,17 +28,17 @@ You can use the raw model for predicting pixel values for masked patches of a vi
|
|
| 28 |
Here is how to use this model to predict pixel values for randomly masked patches:
|
| 29 |
|
| 30 |
```python
|
| 31 |
-
from transformers import
|
| 32 |
import numpy as np
|
| 33 |
import torch
|
| 34 |
|
| 35 |
num_frames = 16
|
| 36 |
video = list(np.random.randn(16, 3, 224, 224))
|
| 37 |
|
| 38 |
-
|
| 39 |
model = VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-large")
|
| 40 |
|
| 41 |
-
pixel_values =
|
| 42 |
|
| 43 |
num_patches_per_frame = (model.config.image_size // model.config.patch_size) ** 2
|
| 44 |
seq_length = (num_frames // model.config.tubelet_size) * num_patches_per_frame
|
|
|
|
| 28 |
Here is how to use this model to predict pixel values for randomly masked patches:
|
| 29 |
|
| 30 |
```python
|
| 31 |
+
from transformers import VideoMAEImageProcessor, VideoMAEForPreTraining
|
| 32 |
import numpy as np
|
| 33 |
import torch
|
| 34 |
|
| 35 |
num_frames = 16
|
| 36 |
video = list(np.random.randn(16, 3, 224, 224))
|
| 37 |
|
| 38 |
+
processor = VideoMAEImageProcessor.from_pretrained("MCG-NJU/videomae-large")
|
| 39 |
model = VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-large")
|
| 40 |
|
| 41 |
+
pixel_values = processor(video, return_tensors="pt").pixel_values
|
| 42 |
|
| 43 |
num_patches_per_frame = (model.config.image_size // model.config.patch_size) ** 2
|
| 44 |
seq_length = (num_frames // model.config.tubelet_size) * num_patches_per_frame
|