Skip to content

Latest commit

 

History

History
125 lines (89 loc) · 3.39 KB

INSTALL.md

File metadata and controls

125 lines (89 loc) · 3.39 KB

Installation

In our experiments, we used the following setup:

  • Ubuntu 20.04.2 LTS
  • Python 3.6.11
  • CUDA 10.2
  • Pytorch 1.5.1

In order to reimplement our development environment, pelase, follow the below-mentioned instructions.


I. Setup Code Environment

NOTE: In case you have multiple CUDA versions installed, please, make sure to initialise the appropriate system CUDA version before running any command.

# <xx.x> - CUDA version number
module load cuda-xx.x 
  1. Setup a conda environment:

    • With Conda [Recommended]:
    # Create a conda environment with dependencies from the environment.yml file
    conda env create --name smvit -f environment.yml
    # Activate the environment
    conda activate smvit
    • With PIP [Not Tested]:
    # Create a conda environment
    conda create -n smvit python=3.6.11
    # Activate the environment
    conda activate smvit
    # Install dependencies from the requirements.txt file
    pip install -r requirements.txt
    
  2. Install the Apex library for mixed-precision training:

    • With conda [Our choice]:
    ## Both commands are necessary
    # May throw warnings, but it is okay
    conda install -c conda-forge nvidia-apex
    # Answer 'Yes' when numpy package upgrade is inquired
    conda install -c conda-forge nvidia-apex=0.1 
    • From source [Recommended]:
    git clone https://github.com/NVIDIA/apex
    cd apex
    # May throw unexpected system-specific errors
    pip install -v --disable-pip-version-check --no-cache-dir --global-option="--cpp_ext" --global-option="--cuda_ext" ./
  3. [Additional] In case of runtime errors related to numpy or scikit-learn packages, force downgrade numpy to the '1.15.4' version:

    pip install numpy==1.15.4

II. Download Pre-trained Models

U2-Net:

NOTE: This model is required for every experiment (training from scratch, fine-tuning, inference).

Download the pre-trained model from the U2-Net author's Google Drive link ("u2net.pth" - 176.3 MB).
P.S. Original shared link was taken from here.

Place the model in the following path:

sm-vit/
|–– U2Net/
|   |–– model/
|   |   |–– pre_trained/
|   |   |   |–– u2net.pth

SM-ViT (ours):

NOTE: This model is required for fine-tuning and inference.

Download a pre-trained model for the dataset of interest from our moodel zoo.

Place the model in the following path:

sm-vit/
|–– models/
|   |–– pre_trained/
|   |   |–– <model_name>.bin

Vanilla ViT-B/16:

NOTE: This model is required for training from scratch only.

Download the pre-trained model from the ViT author's Google Cloud link ("ViT-B_16.npz" - 393.7 MB).
P.S. Original shared link was taken from here.

wget https://storage.googleapis.com/vit_models/imagenet21k/ViT-B_16.npz

Place the model in the following path:

sm-vit/
|–– models/
|   |–– pre_trained/
|   |   |–– ViT-B_16.npz