From ce55c049e5a0da8a19ac5c9de7e32710c681ccba Mon Sep 17 00:00:00 2001 From: Jackson Hamburger Date: Fri, 16 Feb 2024 19:06:42 -0500 Subject: [PATCH] Correct README results parameters and configs --- README.md | 57 +++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index d219789..b5141df 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # V-JEPA: Video Joint Embedding Predictive Architecture -Official PyTorch codebase for the *video joint-embedding predictive architecture*, V-JEPA, a method for self-supervised learning of visual representations from video. +Official PyTorch codebase for the _video joint-embedding predictive architecture_, V-JEPA, a method for self-supervised learning of visual representations from video. **[Meta AI Research, FAIR](https://ai.facebook.com/research/)** @@ -12,18 +12,17 @@ Adrien Bardes, Quentin Garrido, Jean Ponce, Xinlei Chen, Michael Rabbat, Yann Le V-JEPA models are trained by passively watching video pixels from the VideoMix2M dataset, and produce versatile visual representations that perform well on downstream video and image tasks, without adaption of the model’s parameters; e.g., using a frozen backbone and only a light-weight task-specific attentive probe. ## Method -V-JEPA pretraining is based solely on an unsupervised feature prediction objective, and does not utilize pretrained image encoders, text, negative examples, human annotations, or pixel-level reconstruction. +V-JEPA pretraining is based solely on an unsupervised feature prediction objective, and does not utilize pretrained image encoders, text, negative examples, human annotations, or pixel-level reconstruction.       - - ## Visualizations + As opposed to generative methods that have a pixel decoder, V-JEPA has a predictor that makes predictions in latent space. -We train a conditional diffusion model to decode the V-JEPA feature-space predictions to interpretable pixels; the pretrained V-JEPA encoder and predictor networks are kept frozen in this process. +We train a conditional diffusion model to decode the V-JEPA feature-space predictions to interpretable pixels; the pretrained V-JEPA encoder and predictor networks are kept frozen in this process. The decoder is only fed the representations predicted for the missing regions of the video, and does not have access to the unmasked regions of the video. The V-JEPA feature predictions are indeed grounded, and exhibit spatio-temporal consistency with the unmasked regions of the video. @@ -96,7 +95,7 @@ The V-JEPA feature predictions are indeed grounded, and exhibit spatio-temporal 224x224 80.8 attentive probe checkpoint - configs + configs ViT-H/16 @@ -107,10 +106,10 @@ The V-JEPA feature predictions are indeed grounded, and exhibit spatio-temporal ViT-H/16 - 224x224 + 384x384 81.9 attentive probe checkpoint - configs + configs @@ -171,7 +170,7 @@ The V-JEPA feature predictions are indeed grounded, and exhibit spatio-temporal ViT-H/16 - 224x224 + 384x384 77.4 attentive probe checkpoint configs @@ -203,7 +202,7 @@ The V-JEPA feature predictions are indeed grounded, and exhibit spatio-temporal ViT-H/16 - 224x224 + 384x384 62.8 attentive probe checkpoint configs @@ -235,7 +234,7 @@ The V-JEPA feature predictions are indeed grounded, and exhibit spatio-temporal ViT-H/16 - 224x224 + 384x384 72.6 attentive probe checkpoint configs @@ -247,7 +246,6 @@ The V-JEPA feature predictions are indeed grounded, and exhibit spatio-temporal **Config files:** All experiment parameters are specified in config files (as opposed to command-line-arguments). See the [configs/](configs/) directory for example config files. Note, before launching an experiment, you must update the paths in the config file to point to your own directories: indicating where to save the logs and checkpoints, and where to find the training data. - ``` . ├── app # the only place where training loops are allowed @@ -273,24 +271,29 @@ All experiment parameters are specified in config files (as opposed to command-l ## Data preparation ### Video Datasets + V-JEPA pretraining and evaluations works with many standard video formats. -To make a video dataset compatible with the V-JEPA codebase, you simply need to create a ```.csv``` file with the following format, and then specify the path to this csv file in your config. +To make a video dataset compatible with the V-JEPA codebase, you simply need to create a `.csv` file with the following format, and then specify the path to this csv file in your config. + ``` /absolute_file_path.[mp4, webvid, etc.] $integer_class_label /absolute_file_path.[mp4, webvid, etc.] $integer_class_label /absolute_file_path.[mp4, webvid, etc.] $integer_class_label ... ``` -Since V-JEPA is entirely unsupervised, the pretraining code will disregard the ```$integer_class_label``` in the csv file. + +Since V-JEPA is entirely unsupervised, the pretraining code will disregard the `$integer_class_label` in the csv file. Thus, feel free to put a random value in this column. -However, if you wish to run a supervised video classification evaluation on your video dataset, you must replace ```$integer_class_label``` with the ground truth label for each video. +However, if you wish to run a supervised video classification evaluation on your video dataset, you must replace `$integer_class_label` with the ground truth label for each video. ### Image Datasets -We use the standard PyTorch ```ImageFolder``` class in our image classification evals. -Thus, to setup an image dataset for the image classification evaluation, first create a directory to store your image datasets ```$your_directory_containing_image_datasets```. + +We use the standard PyTorch `ImageFolder` class in our image classification evals. +Thus, to setup an image dataset for the image classification evaluation, first create a directory to store your image datasets `$your_directory_containing_image_datasets`. Next, download your image datasets into this directory in a format compatible with [PyTorch ImageFolder](https://pytorch.org/vision/main/generated/torchvision.datasets.ImageFolder.html). -For example, suppose we have a directory called ``my_image_datasets``. We would then download our image datasets into this directory so that we end up with the following file tree +For example, suppose we have a directory called `my_image_datasets`. We would then download our image datasets into this directory so that we end up with the following file tree + ``` . └── /my_image_datasets/ # where we store image datasets @@ -323,14 +326,15 @@ For example, suppose we have a directory called ``my_image_datasets``. We would └── abz.[png, jpeg, etc.] ``` - ## Launching V-JEPA pretraining ### Local training + If you wish to debug your code or setup before launching a distributed training run, we provide the functionality to do so by running the pretraining script locally on a multi-GPU (or single-GPU) machine, however, reproducing our results requires launching distributed training. The single machine implementation starts from the [app/main.py](appmain.py), which parses the experiment config file and runs the pretraining locally on a multi-GPU (or single-GPU) machine. For example, to run V-JEPA pretraining on GPUs "0","1", and "2" on a local machine using the config [configs/pretrain/vitl16.yaml](configs/pretrain/vitl16.yaml), type the command: + ``` python -m app.main \ --fname configs/pretrain/vitl16.yaml \ @@ -338,9 +342,11 @@ python -m app.main \ ``` ### Distributed training + To launch a distributed training run, the implementation starts from [app/main_distributed.py](app/main_distributed.py), which, in addition to parsing the config file, also allows for specifying details about distributed training. For distributed training, we use the popular open-source [submitit](https://github.com/facebookincubator/submitit) tool and provide examples for a SLURM cluster. For example, to launch a distributed pre-training experiment using the config [configs/pretrain/vitl16.yaml](configs/pretrain/vitl16.yaml), type the command: + ``` python -m app.main_distributed \ --fname configs/pretrain/vitl16.yaml \ @@ -351,21 +357,24 @@ python -m app.main_distributed \ ## Launching Evaluations ### Local training + If you wish to debug your eval code or setup before launching a distributed training run, we provide the functionality to do so by running the pretraining script locally on a multi-GPU (or single-GPU) machine, however, reproducing the full eval would require launching distributed training. The single machine implementation starts from the [eval/main.py](eval/main.py), which parses the experiment config file and runs the eval locally on a multi-GPU (or single-GPU) machine. For example, to run ImageNet image classification on GPUs "0","1", and "2" on a local machine using the config [configs/eval/vitl16_in1k.yaml](configs/eval/vitl16_in1k.yaml), type the command: + ``` python -m eval.main \ --fname configs/eval/vitl16_in1k.yaml \ --devices cuda:0 cuda:1 cuda:2 ``` - ### Distributed training + To launch a distributed evaluation run, the implementation starts from [eval/main_distributed.py](eval/main_distributed.py), which, in addition to parsing the config file, also allows for specifying details about distributed training. For distributed training, we use the popular open-source [submitit](https://github.com/facebookincubator/submitit) tool and provide examples for a SLURM cluster. For example, to launch a distributed ImageNet image classification experiment using the config [configs/eval/vitl16_in1k.yaml](configs/eval/vitl16_in1k.yaml), type the command: + ``` python -m eval.main_distributed \ --fname configs/eval/vitl16_in1k.yaml \ @@ -374,6 +383,7 @@ python -m eval.main_distributed \ ``` Similarly, to launch a distributed K400 video classificaiton experiment using the config [configs/eval/vitl16_k400.yaml](configs/eval/vitl16_k400.yaml), type the command: + ``` python -m eval.main_distributed \ --fname configs/eval/vitl16_k400.yaml \ @@ -384,13 +394,17 @@ python -m eval.main_distributed \ --- ### Setup -Create a new anaconda environment, activate it, and run the [setup.py](setup.py) script. + +Create a new anaconda environment, activate it, and run the [setup.py](setup.py) script. ## License + See the [LICENSE](./LICENSE) file for details about the license under which this code is made available. ## Citation + If you find this repository useful in your research, please consider giving a star :star: and a citation + ``` @article{bardes2024revisiting, title={Revisiting Feature Prediction for Learning Visual Representations from Video}, @@ -398,3 +412,4 @@ If you find this repository useful in your research, please consider giving a st journal={arXiv preprint}, year={2024} } +``` -- 2.39.2 (Apple Git-143)