### Run SimVP Single GPU Testing Example (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/docs/en/get_started.md Provides an example command for testing a trained SimVP+gSTA model on the Moving MNIST dataset using the `non_dist_test.py` script. It requires specifying the dataset, method, configuration file, and the experiment name corresponding to the trained model. ```python python tools/non_dist_test.py -d mmnist -m SimVP -c configs/mmnist/simvp/SimVP_gSTA.py --ex_name mmnist_simvp_gsta ``` -------------------------------- ### Run SimVP Single GPU Training Example (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/docs/en/get_started.md Demonstrates a specific example of training SimVP+gSTA on the Moving MNIST dataset using the `non_dist_train.py` script. It specifies the dataset, method, model type, learning rate, and experiment name. ```python python tools/non_dist_train.py -d mmnist -m SimVP --model_type gsta --lr 1e-3 --ex_name mmnist_simvp_gsta ``` -------------------------------- ### Clone Repository and Install Dependencies (Shell) Source: https://github.com/westlake-ai/moganet/blob/main/INSTALL.md These commands clone the MogaNet repository from GitHub and then install additional required Python packages (timm and fvcore) using pip within the active environment. ```Shell git clone https://github.com/Westlake-AI/MogaNet pip install timm fvcore ``` -------------------------------- ### Download Moving MNIST Data (Shell) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/docs/en/get_started.md Executes a shell script to download the Moving MNIST dataset. This is a prerequisite step before running the training or testing examples that use this dataset. ```shell bash tools/prepare_data/download_mmnist.sh ``` -------------------------------- ### Run SimVP Single GPU Training (Bash) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/docs/en/get_started.md Provides the general command structure for performing single GPU training using the `non_dist_train.py` script. It includes placeholders for essential arguments like dataset name, method, config file, experiment name, batch size, and learning rate, along with an option for automatic resume. ```bash python tools/non_dist_train.py \ --dataname ${DATASET_NAME} \ --method ${METHOD_NAME} \ --config_file ${CONFIG_FILE} \ --ex_name ${EXP_NAME} \ --auto_resume \ --batch_size ${BATCH_SIZE} \ --lr ${LEARNING_RATE} ``` -------------------------------- ### Install Project Dependencies (Shell) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/docs/en/install.md This script clones the project repository, navigates into the directory, creates a conda environment from the provided YAML file, activates the environment, and installs the project in development mode. ```shell git clone https://github.com/chengtan9907/SimVPv2 cd SimVPv2 conda env create -f environment.yml conda activate SimVP python setup.py develop ``` -------------------------------- ### Install PyTorch and Torchvision (Shell) Source: https://github.com/westlake-ai/moganet/blob/main/INSTALL.md This command installs specific versions of PyTorch, Torchvision, and Torchaudio compatible with CUDA 11.1 from the official PyTorch stable channel. Ensure your CUDA version matches or adjust the command accordingly. ```Shell pip install torch==1.10.0+cu111 torchvision==0.11.0+cu111 torchaudio==0.10.0 -f https://download.pytorch.org/whl/torch_stable.html ``` -------------------------------- ### Create and Activate Conda Environment (Shell) Source: https://github.com/westlake-ai/moganet/blob/main/INSTALL.md These commands create a new conda virtual environment named 'moganet' with Python 3.8 and then activate it. This isolates the project's dependencies from the system Python environment. ```Shell conda create -n moganet python=3.8 -y conda activate moganet ``` -------------------------------- ### Install SimVPv2 in Development Mode Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/README.md Installs the SimVPv2 project from the current directory in development mode using setup.py. This allows for easy modification of the installed code. ```Shell python setup.py develop ``` -------------------------------- ### Install Apex (Optional) Source: https://github.com/westlake-ai/moganet/blob/main/detection/README.md Clones the Apex repository and installs it from source with C++ and CUDA extensions. This is optional for PyTorch <= 1.6.0. ```Shell git clone https://github.com/NVIDIA/apex cd apex python setup.py install --cpp_ext --cuda_ext --user ``` -------------------------------- ### Install MMPose Dependencies with pip Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/README.md Installs the necessary dependencies for MMPose, including openmim and mmcv-full, using the pip package manager. This is part of the environment setup process required before running the pose estimation code. ```bash pip install openmim mim install mmcv-full pip install mmpose ``` -------------------------------- ### Install pytorch_sphinx_theme from Git (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Installs the 'pytorch_sphinx_theme' package directly from a Git repository URL in editable mode ('-e'). ```Python -e git+https://github.com/Westlake-AI/pytorch_sphinx_theme.git#egg=pytorch_sphinx_theme ``` -------------------------------- ### Install MMDetection Dependencies Source: https://github.com/westlake-ai/moganet/blob/main/detection/README.md Installs the necessary dependencies for MMDetection using pip and mim, including openmim, mmcv-full, and mmdet. ```Shell pip install openmim mim install mmcv-full pip install mmdet ``` -------------------------------- ### Installing MMSegmentation Dependencies via pip Source: https://github.com/westlake-ai/moganet/blob/main/segmentation/README.md Installs necessary libraries for MMSegmentation, including openmim, mmcv-full, and mmseg, using pip and mim package managers. These are prerequisites for running the segmentation code. ```bash pip install openmim mim install mmcv-full pip install mmseg ``` -------------------------------- ### Train MogaNet UperNet Model Bash Source: https://github.com/westlake-ai/moganet/blob/main/segmentation/README.md Start distributed training for the MogaNet UperNet model on a single node using multiple GPUs. The command requires specifying the port, the path to the configuration file, and the number of GPUs. ```bash PORT=29001 bash dist_train.sh /path/to/config 8 ``` -------------------------------- ### Performing MogaNet Pose Inference and Visualization - Python Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/demo/inference_demo.ipynb Loads the COCO validation dataset annotations and initializes the MogaNet pose model. It then loads an example image, extracts person bounding boxes from annotations, performs top-down pose estimation inference using `inference_top_down_pose_model`, and visualizes the results on the image using `vis_pose_result` and `matplotlib`. ```python coco = COCO("../data/coco/annotations/person_keypoints_val2017.json") # build the pose model from a config file and a checkpoint file pose_model = init_pose_model(config_file, checkpoint_file, device='cuda:0') dataset = pose_model.cfg.data['test']['type'] dataset_info = pose_model.cfg.data['test'].get('dataset_info', None) if dataset_info is None: print('Please set `dataset_info` in the config. Check https://github.com/open-mmlab/mmpose/pull/663 for details.') else: dataset_info = DatasetInfo(dataset_info) # test a single image img_root = 'coco2017_val' img_keys = os.listdir(img_root) img_keys = [img.split('000000')[-1].split('.')[0] for img in img_keys] # optional return_heatmap = False # e.g. use ('backbone', ) to return backbone feature output_layer_names = None # get bounding box annotations image_id = int(img_keys[0]) image = coco.loadImgs(image_id)[0] image_name = os.path.join(img_root, image['file_name']) ann_ids = coco.getAnnIds(image_id) # make person bounding boxes person_results = [] for ann_id in ann_ids: person = {} ann = coco.anns[ann_id] # bbox format is 'xywh' person['bbox'] = ann['bbox'] person_results.append(person) # test a single image, with a list of bboxes pose_results, returned_outputs = inference_top_down_pose_model( pose_model, image_name, person_results, bbox_thr=None, format='xywh', dataset=dataset, dataset_info=dataset_info, return_heatmap=return_heatmap, outputs=output_layer_names) out_file = None img = vis_pose_result( pose_model, image_name, pose_results, dataset=dataset, dataset_info=dataset_info, kpt_score_thr=0.3, radius=4, thickness=1, show=False, out_file=out_file) img = cv2.cvtColor(img, cv2.COLOR_RGB2BGR) plt.imshow(img) ``` -------------------------------- ### Python Project Dependencies Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/runtime.txt Lists the necessary Python packages required for the project to function correctly. These are typically installed using pip. ```Requirements File future fvcore matplotlib nni numpy hickle packaging scikit-image six scikit-learn timm tqdm xarray ``` -------------------------------- ### Specify recommonmark Dependency (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Includes the 'recommonmark' dependency without specifying a version constraint, allowing the latest compatible version to be installed. ```Python recommonmark ``` -------------------------------- ### Validating MogaNet-Tiny on ImageNet-1K (8 GPUs) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to validate the MogaNet-Tiny model on ImageNet-1K using 8 GPUs. Specifies image size, crop percentage, number of GPUs, data directory, and checkpoint path. This example does not use EMA evaluation. ```Python python validate.py \ --model moganet_tiny --img_size 224 --crop_pct 0.9 --num_gpu 8 \ --data_dir /path/to/imagenet-1k \ --checkpoint /path/to/checkpoint.tar.gz ``` -------------------------------- ### Validating MogaNet-Tiny on ImageNet-1K (Single GPU) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to validate the MogaNet-Tiny model on the ImageNet-1K validation set using a single GPU. Specifies image size, crop percentage, data directory, and checkpoint path. This example does not use EMA evaluation. ```Python python validate.py \ --model moganet_tiny --img_size 224 --crop_pct 0.9 \ --data_dir /path/to/imagenet-1k \ --checkpoint /path/to/checkpoint.tar.gz ``` -------------------------------- ### Validating MogaNet-XTiny on ImageNet-1K (8 GPUs) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to validate the MogaNet-XTiny model on ImageNet-1K using 8 GPUs. Specifies image size, crop percentage, number of GPUs, data directory, and checkpoint path. This example does not use EMA evaluation. ```Python python validate.py \ --model moganet_xtiny --img_size 224 --crop_pct 0.9 --num_gpu 8 \ --data_dir /path/to/imagenet-1k \ --checkpoint /path/to/checkpoint.tar.gz ``` -------------------------------- ### Specify sphinx-copybutton Dependency (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Includes the 'sphinx-copybutton' dependency without specifying a version constraint, allowing the latest compatible version to be installed. ```Python sphinx-copybutton ``` -------------------------------- ### Specify myst_parser Dependency (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Includes the 'myst_parser' dependency without specifying a version constraint, allowing the latest compatible version to be installed. ```Python myst_parser ``` -------------------------------- ### Run MMDetection Image Demo with MogaNet Source: https://github.com/westlake-ai/moganet/blob/main/detection/README.md Navigates to the demo directory and runs the image demonstration script using a specified configuration file and checkpoint, saving the output to a file. ```Bash cd demo python image_demo.py demo.png ../configs/moganet/mask_rcnn_moganet_small_fpn_1x_coco.py ../../work_dirs/checkpoints/mask_rcnn_moganet_small_fpn_1x_coco.pth --out-file pred.png ``` -------------------------------- ### Configuring and Downloading MogaNet Checkpoint - Python Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/demo/inference_demo.ipynb Defines the configuration file path and the checkpoint file path for the MogaNet model. It includes a shell command (`!wget`) to download the pre-trained weights from a GitHub release URL and saves it to the specified directory. ```python # demo MogaNet config_file = '../configs/body/2d_kpt_sview_rgb_img/topdown_heatmap/coco/moganet_s_coco_384x288.py' # download the checkpoint from model zoo and put it in `checkpoints/` !wget https://github.com/Westlake-AI/MogaNet/releases/download/moganet-pose-weights/moganet_s_coco_384x288.pth -P ../../work_dirs/checkpoints checkpoint_file = '../../work_dirs/checkpoints/moganet_s_coco_384x288.pth' ``` -------------------------------- ### Run MogaNet Pose Estimation Demo Script Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/README.md Provides the bash command to navigate to the demo directory and execute the Python top-down image demo script. It requires specifying the configuration file, model checkpoint, image root directory, and a JSON file containing annotations, with an option to display results. ```Bash cd demo python top_down_img_demo.py path/to/config path/to/checkpoint --img-root coco2017_val --json-file ../data/coco/annotations/person_keypoints_val2017.json --show ``` -------------------------------- ### Visualize Grad-CAM activation maps - Shell Source: https://github.com/westlake-ai/moganet/blob/main/README.md Runs the `cam_image.py` script to generate and visualize Grad-CAM activation maps for an image using a specified MogaNet model. Requires the `cam_image.py` script, a CUDA-enabled environment (if `--use_cuda` is used), and an image file. ```Shell python cam_image.py --use_cuda --image_path /path/to/image.JPEG --model moganet_tiny --method gradcam ``` -------------------------------- ### Train MogaNet Model with Distributed Training Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/README.md Provides the bash command to initiate distributed training for a MogaNet model. It sets the communication port and executes the distributed training script with the specified configuration file and the number of GPUs (8 in this case). ```Bash PORT=29001 bash dist_train.sh /path/to/config 8 ``` -------------------------------- ### BibTeX entry for SmoothNet (arXiv'2021) Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/configs/_base_/filters/smoothnet_h36m.md Provides the BibTeX citation information for the SmoothNet paper, 'SmoothNet: A Plug-and-Play Network for Refining Human Poses in Videos', published on arXiv in 2021. This entry is useful for citing the work in research papers. ```bibtex @article{zeng2021smoothnet, title={SmoothNet: A Plug-and-Play Network for Refining Human Poses in Videos}, author={Zeng, Ailing and Yang, Lei and Ju, Xuan and Li, Jiefeng and Wang, Jianyi and Xu, Qiang}, journal={arXiv preprint arXiv:2112.13715}, year={2021} } ``` -------------------------------- ### BibTeX Citation for MogaNet Paper Source: https://github.com/westlake-ai/moganet/blob/main/detection/README.md Provides the BibTeX entry for citing the 'Efficient Multi-order Gated Aggregation Network' paper presented at ICLR 2024. ```BibTeX @inproceedings{iclr2024MogaNet, title={Efficient Multi-order Gated Aggregation Network}, author={Siyuan Li and Zedong Wang and Zicheng Liu and Cheng Tan and Haitao Lin and Di Wu and Zhiyuan Chen and Jiangbin Zheng and Stan Z. Li}, booktitle={International Conference on Learning Representations}, year={2024} } ``` -------------------------------- ### Evaluate Trained MogaNet Model with MMDetection Source: https://github.com/westlake-ai/moganet/blob/main/detection/README.md Runs distributed evaluation of a trained model using the specified configuration and checkpoint files on a single node with a given number of GPUs. Saves results to a pickle file and specifies evaluation metrics (bbox or bbox segm). ```Bash bash dist_test.sh /path/to/config /path/to/checkpoint 8 --out results.pkl --eval bbox # or `bbox segm` ``` -------------------------------- ### Evaluate MogaNet Model with Distributed Testing Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/README.md Provides the bash command to perform distributed evaluation on a trained MogaNet model. It executes the distributed test script using the specified configuration and checkpoint, outputs results to a pickle file, and evaluates the model using the mAP metric. ```Bash bash dist_test.sh /path/to/config /path/to/checkpoint 8 --out results.pkl --eval mAP ``` -------------------------------- ### Run Image Segmentation Demo with MogaNet UperNet Bash Source: https://github.com/westlake-ai/moganet/blob/main/segmentation/README.md Execute the image segmentation demo script using a specified image, configuration file, and model checkpoint. The output prediction mask will be saved to a file. ```bash cd demo python image_demo.py ADE_val_00000001.png ../configs/upernet/moganet/upernet_moganet_small_512x512_160k_ade20k.py ../work_dirs/checkpoints/upernet_moganet_small_512x512_160k_ade20k.pth --out-file pred.png ``` -------------------------------- ### Evaluate MogaNet UperNet Model Bash Source: https://github.com/westlake-ai/moganet/blob/main/segmentation/README.md Evaluate a trained MogaNet UperNet model on a single node with multiple GPUs. Provide the paths to the configuration and checkpoint files, the number of GPUs, the output file for results, and the evaluation metric (e.g., mIoU). ```bash bash dist_test.sh /path/to/config /path/to/checkpoint 8 --out results.pkl --eval mIoU ``` -------------------------------- ### Importing Libraries for MogaNet Pose Estimation - Python Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/demo/inference_demo.ipynb Imports necessary libraries for image processing (cv2), file operations (os), plotting (matplotlib), COCO dataset handling (xtcocotools), and MMPose model initialization and inference (mmpose). It also adds the parent directory to the system path to import custom models. ```python import cv2 import os import matplotlib.pyplot as plt from xtcocotools.coco import COCO from mmpose.apis import (inference_top_down_pose_model, init_pose_model, vis_pose_result) from mmpose.datasets import DatasetInfo import sys sys.path.append('../../') import models # register_model for MogaNet ``` -------------------------------- ### Configuration to Disable fp16/Apex Source: https://github.com/westlake-ai/moganet/blob/main/detection/README.md Configuration block to comment out in MMDetection config files to disable fp16 training and the DistOptimizerHook when not using Apex or fp16. ```Configuration fp16 = None optimizer_config = dict( type="DistOptimizerHook", update_interval=1, grad_clip=None, coalesce=True, bucket_size_mb=-1, use_fp16=True, ) ``` -------------------------------- ### Calculate Model FLOPs Source: https://github.com/westlake-ai/moganet/blob/main/detection/README.md Runs the `get_flops.py` script to calculate the floating-point operations (FLOPs) for a given model configuration at a specified input shape (1280x800). ```Shell python get_flops.py /path/to/config --shape 1280 800 ``` -------------------------------- ### Cite MogaNet Paper (BibTeX Format) Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/README.md Provides the BibTeX entry for citing the Efficient Multi-order Gated Aggregation Network (MogaNet) paper presented at ICLR 2024. It includes standard fields such as title, authors, booktitle, and year. ```BibTeX @inproceedings{iclr2024MogaNet, title={Efficient Multi-order Gated Aggregation Network}, author={Siyuan Li and Zedong Wang and Zicheng Liu and Cheng Tan and Haitao Lin and Di Wu and Zhiyuan Chen and Jiangbin Zheng and Stan Z. Li}, booktitle={International Conference on Learning Representations}, year={2024} } ``` -------------------------------- ### Train MogaNet Model (Single GPU) - Bash Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/README.md Executes the training script for the MogaNet model on a single GPU using the specified configuration and dataset. Sets the learning rate and experiment name. ```bash python tools/non_dist_train.py -d mmnist -m SimVP --model_type moga -c configs/mmnist/simvp/SimVP_MogaNet.py --lr 1e-3 --ex_name mmnist_simvp_moga ``` -------------------------------- ### BibTeX entry for Human3.6M (TPAMI'2014) Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/configs/_base_/filters/smoothnet_h36m.md Provides the BibTeX citation information for the Human3.6M dataset paper, 'Human3.6M: Large Scale Datasets and Predictive Methods for 3D Human Sensing in Natural Environments', published in IEEE TPAMI in 2014. This entry is useful for citing the dataset in research papers. ```bibtex @article{h36m_pami, author = {Ionescu, Catalin and Papava, Dragos and Olaru, Vlad and Sminchisescu, Cristian}, title = {Human3.6M: Large Scale Datasets and Predictive Methods for 3D Human Sensing in Natural Environments}, journal = {IEEE Transactions on Pattern Analysis and Machine Intelligence}, publisher = {IEEE Computer Society}, volume = {36}, number = {7}, pages = {1325-1339}, month = {jul}, year = {2014} } ``` -------------------------------- ### Calculating Model FLOPs and Params Source: https://github.com/westlake-ai/moganet/blob/main/segmentation/README.md Executes the `get_flops.py` script to measure the FLOPs (Floating Point Operations) and parameters of a specified model configuration file at a given input resolution (2048x512). This is used for performance analysis. ```bash python get_flops.py /path/to/config --shape 2048 512 ``` -------------------------------- ### Calculate Model FLOPs using get_flops.py Source: https://github.com/westlake-ai/moganet/blob/main/pose_estimation/README.md Executes the `get_flops.py` script to calculate the floating-point operations (FLOPs) for a specified model configuration file at a given input shape (256x192). This command is used to evaluate the computational efficiency of the model. ```bash python get_flops.py /path/to/config --shape 256 192 ``` -------------------------------- ### Evaluate Trained MogaNet Model (Single GPU) - Bash Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/README.md Runs the evaluation script for a trained MogaNet model on a single GPU. Requires specifying the path to the experiment name containing the trained model. ```bash python tools/non_dist_test.py -d mmnist -m SimVP --model_type moga -c configs/mmnist/simvp/SimVP_MogaNet.py --ex_name /path/to/exp_name ``` -------------------------------- ### Train MogaNet-Tiny on ImageNet-1K (224x224, 8 GPUs) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to train the MogaNet-Tiny model on ImageNet-1K using 8 GPUs with 224x224 input size. Includes standard hyperparameters for this variant. ```Shell python -m torch.distributed.launch --nproc_per_node=8 train.py \ --model moganet_tiny --img_size 224 --drop_path 0.1 \ --epochs 300 --batch_size 128 --lr 1e-3 --weight_decay 0.04 \ --aa rand-m7-mstd0.5-inc1 --crop_pct 0.9 --mixup 0.1 \ --amp --native_amp \ --data_dir /path/to/imagenet-1k \ --experiment /path/to/save_results ``` -------------------------------- ### Validating MogaNet-Small on ImageNet-1K (8 GPUs, EMA) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to validate the MogaNet-Small model on ImageNet-1K using 8 GPUs and enabling EMA evaluation. Specifies image size, crop percentage, number of GPUs, EMA flag, data directory, and checkpoint path. ```Python python validate.py \ --model moganet_small --img_size 224 --crop_pct 0.9 --num_gpu 8 --use_ema \ --data_dir /path/to/imagenet-1k \ --checkpoint /path/to/checkpoint.tar.gz ``` -------------------------------- ### Validating MogaNet-Base on ImageNet-1K (8 GPUs, EMA) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to validate the MogaNet-Base model on ImageNet-1K using 8 GPUs and enabling EMA evaluation. Specifies image size, crop percentage, number of GPUs, EMA flag, data directory, and checkpoint path. ```Python python validate.py \ --model moganet_base --img_size 224 --crop_pct 0.9 --num_gpu 8 --use_ema \ --data_dir /path/to/imagenet-1k \ --checkpoint /path/to/checkpoint.tar.gz ``` -------------------------------- ### Training MogaNet-XLarge on ImageNet-1K (Distributed) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to train the MogaNet-XLarge model on ImageNet-1K using distributed training with 8 GPUs. Specifies hyperparameters like epochs, batch size, learning rate, weight decay, crop percentage, minimum learning rate, and EMA settings. Requires a PyTorch distributed environment and the ImageNet-1K dataset. ```Python python -m torch.distributed.launch --nproc_per_node=8 train.py \ --model moganet_xlarge --img_size 224 --drop_path 0.4 \ --epochs 300 --batch_size 64 --lr 1e-3 --weight_decay 0.05 \ --crop_pct 0.9 --min_lr 1e-5 \ --model_ema --model_ema_decay 0.9999 \ --data_dir /path/to/imagenet-1k \ --experiment /path/to/save_results ``` -------------------------------- ### Train MogaNet-Tiny on ImageNet-1K (224x224, 8 GPUs) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to train the MogaNet-Tiny model on the ImageNet-1K dataset using 8 GPUs on a single machine. Specifies hyperparameters like image size, drop path rate, epochs, batch size, learning rate, weight decay, augmentation, mixed precision, and data/output directories. ```Shell python -m torch.distributed.launch --nproc_per_node=8 train.py \ --model moganet_tiny --img_size 224 --drop_path 0.1 \ --epochs 300 --batch_size 128 --lr 1e-3 --weight_decay 0.04 \ --aa rand-m7-mstd0.5-inc1 --crop_pct 0.9 --mixup 0.1 \ --amp --native_amp \ --data_dir /path/to/imagenet-1k \ --experiment /path/to/save_results ``` -------------------------------- ### Train MogaNet-Base on ImageNet-1K (224x224, 8 GPUs) with EMA Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to train the MogaNet-Base model on ImageNet-1K using 8 GPUs with 224x224 input size and EMA. Configured with drop path 0.2, weight decay 0.05, min learning rate 1e-5, and EMA decay 0.9999. ```Shell python -m torch.distributed.launch --nproc_per_node=8 train.py \ --model moganet_base --img_size 224 --drop_path 0.2 \ --epochs 300 --batch_size 128 --lr 1e-3 --weight_decay 0.05 \ --crop_pct 0.9 --min_lr 1e-5 \ --model_ema --model_ema_decay 0.9999 \ --data_dir /path/to/imagenet-1k \ --experiment /path/to/save_results ``` -------------------------------- ### Validating MogaNet-XLarge on ImageNet-1K (8 GPUs, EMA) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to validate the MogaNet-XLarge model on ImageNet-1K using 8 GPUs and enabling EMA evaluation. Specifies image size, crop percentage, number of GPUs, EMA flag, data directory, and checkpoint path. ```Python python validate.py \ --model moganet_xlarge --img_size 224 --crop_pct 0.9 --num_gpu 8 --use_ema \ --data_dir /path/to/imagenet-1k \ --checkpoint /path/to/checkpoint.tar.gz ``` -------------------------------- ### BibTeX Citation for MogaNet Paper Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/README.md Provides the BibTeX entry for citing the Efficient Multi-order Gated Aggregation Network (MogaNet) paper presented at ICLR 2024. ```BibTeX @inproceedings{iclr2024MogaNet, title={Efficient Multi-order Gated Aggregation Network}, author={Siyuan Li and Zedong Wang and Zicheng Liu and Cheng Tan and Haitao Lin and Di Wu and Zhiyuan Chen and Jiangbin Zheng and Stan Z. Li}, booktitle={International Conference on Learning Representations}, year={2024} } ``` -------------------------------- ### Python Development and Testing Dependencies Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/tests.txt A list of Python packages used for development, testing (pytest, xdoctest), code coverage (codecov, pytest-cov), code formatting/linting (flake8, isort, yapf), asynchronous testing (asynctest), and specific utilities (kwarray). ```Python asynctest codecov flake8 isort pytest pytest-cov pytest-runner xdoctest >= 0.10.0 yapf kwarray ``` -------------------------------- ### Train MogaNet-Tiny on ImageNet-1K (256x256, 8 GPUs) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to train the MogaNet-Tiny model on ImageNet-1K using 8 GPUs with a larger input size of 256x256. Uses similar hyperparameters as the 224x224 training but adjusts for the increased image resolution. ```Shell python -m torch.distributed.launch --nproc_per_node=8 train.py \ --model moganet_tiny --img_size 256 --drop_path 0.1 \ --epochs 300 --batch_size 128 --lr 1e-3 --weight_decay 0.04 \ --aa rand-m7-mstd0.5-inc1 --crop_pct 0.9 --mixup 0.1 \ --amp --native_amp \ --data_dir /path/to/imagenet-1k \ --experiment /path/to/save_results ``` -------------------------------- ### Train MogaNet-XTiny on ImageNet-1K (224x224, 8 GPUs) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to train the MogaNet-XTiny model on ImageNet-1K using 8 GPUs. Configured with specific hyperparameters including image size 224, drop path 0.05, 300 epochs, batch size 128, learning rate 1e-3, and weight decay 0.03. ```Shell python -m torch.distributed.launch --nproc_per_node=8 train.py \ --model moganet_xtiny --img_size 224 --drop_path 0.05 \ --epochs 300 --batch_size 128 --lr 1e-3 --weight_decay 0.03 \ --aa rand-m7-mstd0.5-inc1 --crop_pct 0.9 --mixup 0.1 \ --amp --native_amp \ --data_dir /path/to/imagenet-1k \ --experiment /path/to/save_results ``` -------------------------------- ### Validating MogaNet-Large on ImageNet-1K (8 GPUs, EMA) Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to validate the MogaNet-Large model on ImageNet-1K using 8 GPUs and enabling EMA evaluation. Specifies image size, crop percentage, number of GPUs, EMA flag, data directory, and checkpoint path. ```Python python validate.py \ --model moganet_large --img_size 224 --crop_pct 0.9 --num_gpu 8 --use_ema \ --data_dir /path/to/imagenet-1k \ --checkpoint /path/to/checkpoint.tar.gz ``` -------------------------------- ### Citing MogaNet in BibTeX Source: https://github.com/westlake-ai/moganet/blob/main/README.md This code snippet provides the standard BibTeX entry required to cite the MogaNet paper in academic publications and bibliographies. ```BibTeX @inproceedings{iclr2024MogaNet, title={MogaNet: Multi-order Gated Aggregation Network}, author={Siyuan Li and Zedong Wang and Zicheng Liu and Cheng Tan and Haitao Lin and Di Wu and Zhiyuan Chen and Jiangbin Zheng and Stan Z. Li}, booktitle={International Conference on Learning Representations}, year={2024} } ``` -------------------------------- ### Specify sphinx_rtd_theme Version (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Specifies the exact required version (0.5.2) for the 'sphinx_rtd_theme' dependency using the '==' operator. ```Python sphinx_rtd_theme==0.5.2 ``` -------------------------------- ### Specify sphinx_markdown_tables Version Range (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Specifies a minimum required version (0.0.16) for the 'sphinx_markdown_tables' dependency using the '>=' operator. ```Python sphinx_markdown_tables>=0.0.16 ``` -------------------------------- ### Train MogaNet-Small on ImageNet-1K (224x224, 8 GPUs) with EMA Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to train the MogaNet-Small model on ImageNet-1K using 8 GPUs with 224x224 input size and Exponential Moving Average (EMA) enabled. Includes specific hyperparameters like drop path 0.1, weight decay 0.05, min learning rate 1e-5, and EMA decay 0.9999. ```Shell python -m torch.distributed.launch --nproc_per_node=8 train.py \ --model moganet_small --img_size 224 --drop_path 0.1 \ --epochs 300 --batch_size 128 --lr 1e-3 --weight_decay 0.05 \ --crop_pct 0.9 --min_lr 1e-5 \ --model_ema --model_ema_decay 0.9999 \ --data_dir /path/to/imagenet-1k \ --experiment /path/to/save_results ``` -------------------------------- ### Specify sphinx Version (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Specifies the exact required version (4.0.2) for the 'sphinx' dependency using the '==' operator. ```Python sphinx==4.0.2 ``` -------------------------------- ### Specify docutils Version (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Specifies the exact required version (0.16.0) for the 'docutils' dependency using the '==' operator. ```Python docutils==0.16.0 ``` -------------------------------- ### Train MogaNet-Large on ImageNet-1K (224x224, 8 GPUs) with EMA Source: https://github.com/westlake-ai/moganet/blob/main/TRAINING.md Command to train the MogaNet-Large model on ImageNet-1K using 8 GPUs with 224x224 input size and EMA. Uses drop path 0.3, weight decay 0.05, min learning rate 1e-5, and EMA decay 0.9999. ```Shell python -m torch.distributed.launch --nproc_per_node=8 train.py \ --model moganet_large --img_size 224 --drop_path 0.3 \ --epochs 300 --batch_size 128 --lr 1e-3 --weight_decay 0.05 \ --crop_pct 0.9 --min_lr 1e-5 \ --model_ema --model_ema_decay 0.9999 \ --data_dir /path/to/imagenet-1k \ --experiment /path/to/save_results ``` -------------------------------- ### Count MACs of MogaNet variants - Shell Source: https://github.com/westlake-ai/moganet/blob/main/README.md Executes the `get_flops.py` script to calculate the Multiply-Accumulate Operations (MACs) for a specified MogaNet model variant. Requires the `get_flops.py` script and a Python environment with necessary dependencies. ```Shell python get_flops.py --model moganet_tiny ``` -------------------------------- ### Specify markdown Version Range (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements/docs.txt Specifies a minimum required version (3.4.0) for the 'markdown' dependency using the '>=' operator. ```Python markdown>=3.4.0 ``` -------------------------------- ### Include Other Requirements Files (Python) Source: https://github.com/westlake-ai/moganet/blob/main/video_prediction/requirements.txt Uses the `-r` flag within a requirements file to recursively process the specified file's dependencies. This allows for modular organization of project dependencies. ```Python -r requirements/optional.txt -r requirements/runtime.txt -r requirements/tests.txt ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.