Cyber1090 nielsr HF Staff commited on
Commit
850db97
·
0 Parent(s):

Duplicate from MCG-NJU/videomae-base

Browse files

Co-authored-by: Niels Rogge <nielsr@users.noreply.huggingface.co>

Files changed (6) hide show
  1. .gitattributes +32 -0
  2. README.md +84 -0
  3. config.json +29 -0
  4. model.safetensors +3 -0
  5. preprocessor_config.json +18 -0
  6. pytorch_model.bin +3 -0
.gitattributes ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
5
+ *.ftz filter=lfs diff=lfs merge=lfs -text
6
+ *.gz filter=lfs diff=lfs merge=lfs -text
7
+ *.h5 filter=lfs diff=lfs merge=lfs -text
8
+ *.joblib filter=lfs diff=lfs merge=lfs -text
9
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
10
+ *.model filter=lfs diff=lfs merge=lfs -text
11
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
12
+ *.npy filter=lfs diff=lfs merge=lfs -text
13
+ *.npz filter=lfs diff=lfs merge=lfs -text
14
+ *.onnx filter=lfs diff=lfs merge=lfs -text
15
+ *.ot filter=lfs diff=lfs merge=lfs -text
16
+ *.parquet filter=lfs diff=lfs merge=lfs -text
17
+ *.pb filter=lfs diff=lfs merge=lfs -text
18
+ *.pickle filter=lfs diff=lfs merge=lfs -text
19
+ *.pkl filter=lfs diff=lfs merge=lfs -text
20
+ *.pt filter=lfs diff=lfs merge=lfs -text
21
+ *.pth filter=lfs diff=lfs merge=lfs -text
22
+ *.rar filter=lfs diff=lfs merge=lfs -text
23
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
24
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
25
+ *.tflite filter=lfs diff=lfs merge=lfs -text
26
+ *.tgz filter=lfs diff=lfs merge=lfs -text
27
+ *.wasm filter=lfs diff=lfs merge=lfs -text
28
+ *.xz filter=lfs diff=lfs merge=lfs -text
29
+ *.zip filter=lfs diff=lfs merge=lfs -text
30
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
31
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
32
+ model.safetensors filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: "cc-by-nc-4.0"
3
+ tags:
4
+ - vision
5
+ - video-classification
6
+ ---
7
+
8
+ # VideoMAE (base-sized model, pre-trained only)
9
+
10
+ VideoMAE model pre-trained on Kinetics-400 for 1600 epochs in a self-supervised way. It was introduced in the paper [VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training](https://arxiv.org/abs/2203.12602) by Tong et al. and first released in [this repository](https://github.com/MCG-NJU/VideoMAE).
11
+
12
+ Disclaimer: The team releasing VideoMAE did not write a model card for this model so this model card has been written by the Hugging Face team.
13
+
14
+ ## Model description
15
+
16
+ VideoMAE is an extension of [Masked Autoencoders (MAE)](https://arxiv.org/abs/2111.06377) to video. The architecture of the model is very similar to that of a standard Vision Transformer (ViT), with a decoder on top for predicting pixel values for masked patches.
17
+
18
+ Videos are presented to the model as a sequence of fixed-size patches (resolution 16x16), which are linearly embedded. One also adds a [CLS] token to the beginning of a sequence to use it for classification tasks. One also adds fixed sinus/cosinus position embeddings before feeding the sequence to the layers of the Transformer encoder.
19
+
20
+ By pre-training the model, it learns an inner representation of videos that can then be used to extract features useful for downstream tasks: if you have a dataset of labeled videos for instance, you can train a standard classifier by placing a linear layer on top of the pre-trained encoder. One typically places a linear layer on top of the [CLS] token, as the last hidden state of this token can be seen as a representation of an entire video.
21
+
22
+ ## Intended uses & limitations
23
+
24
+ You can use the raw model for predicting pixel values for masked patches of a video, but it's mostly intended to be fine-tuned on a downstream task. See the [model hub](https://huggingface.co/models?filter=videomae) to look for fine-tuned versions on a task that interests you.
25
+
26
+ ### How to use
27
+
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-base")
39
+ model = VideoMAEForPreTraining.from_pretrained("MCG-NJU/videomae-base")
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
45
+ bool_masked_pos = torch.randint(0, 2, (1, seq_length)).bool()
46
+
47
+ outputs = model(pixel_values, bool_masked_pos=bool_masked_pos)
48
+ loss = outputs.loss
49
+ ```
50
+
51
+ For more code examples, we refer to the [documentation](https://huggingface.co/transformers/main/model_doc/videomae.html#).
52
+
53
+ ## Training data
54
+
55
+ (to do, feel free to open a PR)
56
+
57
+ ## Training procedure
58
+
59
+ ### Preprocessing
60
+
61
+ (to do, feel free to open a PR)
62
+
63
+ ### Pretraining
64
+
65
+ (to do, feel free to open a PR)
66
+
67
+ ## Evaluation results
68
+
69
+ (to do, feel free to open a PR)
70
+
71
+ ### BibTeX entry and citation info
72
+
73
+ ```bibtex
74
+ misc{https://doi.org/10.48550/arxiv.2203.12602,
75
+ doi = {10.48550/ARXIV.2203.12602},
76
+ url = {https://arxiv.org/abs/2203.12602},
77
+ author = {Tong, Zhan and Song, Yibing and Wang, Jue and Wang, Limin},
78
+ keywords = {Computer Vision and Pattern Recognition (cs.CV), FOS: Computer and information sciences, FOS: Computer and information sciences},
79
+ title = {VideoMAE: Masked Autoencoders are Data-Efficient Learners for Self-Supervised Video Pre-Training},
80
+ publisher = {arXiv},
81
+ year = {2022},
82
+ copyright = {Creative Commons Attribution 4.0 International}
83
+ }
84
+ ```
config.json ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "VideoMAEForPreTraining"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.0,
6
+ "decoder_hidden_size": 384,
7
+ "decoder_intermediate_size": 1536,
8
+ "decoder_num_attention_heads": 6,
9
+ "decoder_num_hidden_layers": 4,
10
+ "hidden_act": "gelu",
11
+ "hidden_dropout_prob": 0.0,
12
+ "hidden_size": 768,
13
+ "image_size": 224,
14
+ "initializer_range": 0.02,
15
+ "intermediate_size": 3072,
16
+ "layer_norm_eps": 1e-12,
17
+ "model_type": "videomae",
18
+ "norm_pix_loss": true,
19
+ "num_attention_heads": 12,
20
+ "num_channels": 3,
21
+ "num_frames": 16,
22
+ "num_hidden_layers": 12,
23
+ "patch_size": 16,
24
+ "qkv_bias": true,
25
+ "torch_dtype": "float32",
26
+ "transformers_version": "4.22.0.dev0",
27
+ "tubelet_size": 2,
28
+ "use_mean_pooling": false
29
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bc053ca2840a038b1068269a4eec06ca569689e9a1ed9376a5b2b8a111be5290
3
+ size 376873760
preprocessor_config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_center_crop": true,
3
+ "do_normalize": true,
4
+ "do_resize": true,
5
+ "feature_extractor_type": "VideoMAEFeatureExtractor",
6
+ "image_mean": [
7
+ 0.485,
8
+ 0.456,
9
+ 0.406
10
+ ],
11
+ "image_std": [
12
+ 0.229,
13
+ 0.224,
14
+ 0.225
15
+ ],
16
+ "resample": 2,
17
+ "size": 224
18
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2e0c3f4bc73c6d287b96c30975b43d60c9fc004c548150f252278f1becd89a7d
3
+ size 376924301