# SPANet **Repository Path**: scu-cabbage/spanet ## Basic Information - **Project Name**: SPANet - **Description**: No description available - **Primary Language**: Python - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-07-01 - **Last Updated**: 2024-10-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Dynamic Dual Gating Neural Networks This repository contains the PyTorch implementation for > **Dynamic Dual Gating Neural Networks** > Fanrong Li, Gang Li, Xiangyu He, Jian Cheng > ICCV 2021 Oral  ## Getting Started ### Requirements The main requirements of this work are: - Python 3.7 - PyTorch == 1.5.0 - Torchvision == 0.6.0 - CUDA 10.2 We recommand using conda env to setup the experimental environments. ```shell script # Create environment conda create -n DGNet python=3.7 conda activate DGNet # Install PyTorch & Torchvision pip install torch==1.5.0 torchvision==0.6.0 # Clone repo git clone https://github.com/anonymous-9800/DGNet.git ./DGNet cd ./DGNet # Install other requirements pip install -r requirements.txt ``` ### Trained models Our trained models can be found here: [Google Drive](https://drive.google.com/file/d/1_-G5eHm3PUrrorjzp8w17W7ogZZoTElk/view?usp=sharing). And the pretrained cifar10 models can be found here: [Google Drive](https://drive.google.com/file/d/15sM2W2ADqtq5Gr8RTdaFalPK7qIw0VXF/view?usp=sharing). Unzip and place them into the DGNet folder. ### Evaluate a trained DGNet ```shell script # CIFAR-10 sh ./scripts/cifar_e.sh [ARCH] [PATH-TO-DATASET] [GPU-IDs] [PATH-TO-SAVE] [PATH-TO-TRAINED-MODEL] # ResNet on ImageNet sh ./scripts/imagenet_e.sh [ARCH] [PATH-TO-DATASET] [GPU-IDs] [PATH-TO-SAVE] [PATH-TO-TRAINED-MODEL] # Example sh ./scripts/imagenet_e.sh resdg34 [PATH-TO-DATASET] 0 imagenet/resdg34-04-e ./trained_models_cls/imagenet_results/resdg34/sparse06/resdg34_04.pth.tar ``` ### Train a DGNet ```shell script # CIFAR-10 sh ./scripts/cifar_t.sh [ARCH] [PATH-TO-DATASET] [TARGET-DENSITY] [GPU-IDs] [PATH-TO-SAVE] [PATH-TO-PRETRAINED-MODEL] # ResNet on ImageNet sh ./scripts/imagenet_t.sh [ARCH] [PATH-TO-DATASET] [TARGET-DENSITY] [GPU-IDs] [PATH-TO-SAVE] # Example sh ./scripts/imagenet_t.sh resdg34 [PATH-TO-DATASET] 0.4 0,1 imagent/resdg34-04 ``` ## Main results
| Model | Method | Top-1 (%) | Top-5 (%) | FLOPs | Google Drive |
| ResNet-18 | DGNet (50%) | 70.12 | 89.22 | 9.54E8 | Link |
| DGNet (60%) | 69.38 | 88.94 | 7.88E8 | Link | |
| ResNet-34 | DGNet (60%) | 73.01 | 90.99 | 1.50E9 | Link |
| DGNet (70%) | 71.95 | 90.46 | 1.21E9 | Link | |
| ResNet-50 | DGNet (60%) | 76.41 | 93.05 | 1.65E9 | Link |
| DGNet (70%) | 75.12 | 92.34 | 1.31E9 | Link | |
| MobileNet-V2 | DGNet (50%) | 71.62 | 90.05 | 1.60E8 | Link |