Skip to content

Latest commit

 

History

History
113 lines (96 loc) · 3.33 KB

File metadata and controls

113 lines (96 loc) · 3.33 KB

Installation

Requirements

  • Linux or macOS with Python ≥ 3.8
  • CUDA>=11.7, lower CUDA versions may result in not successfully built on detectron2
  • pip install -r requirements.txt

Example virtualenv environment setup for kMaX-DeepLab

pip3 install virtualenv
python3 -m virtualenv kmax_deeplab --python=python3
source kmax_deeplab/bin/activate

pip install torch==2.0.1 torchvision==0.15.2 torchaudio==2.0.2
pip install -r requirements.txt
unzip detectron2.zip
cd detectron2
pip install -e .

Example test model checkpoint of kMaX-DeepLab

  1. Download the checkpoint.

  2. Dataset preperation and structure for evaluation as below. You need to download 'relabeled_COCO_val' and json file and download the images from COCO dataset.

  3. Convert the downloaded panoptic segmentations to instances by using the following script.

pip install git+https://github.com/cocodataset/panopticapi.git
python prepare_coco_panoptic_semseg.py

This script will automatically detect your DETECTRON2_DATASETS path, the default is "./datasets/coco".

If you want to change your folder path, please export your dataset path using the script as below.

export DETECTRON2_DATASETS=YOUR_DATA_PATH
  1. Prepare the dataset structure.
datasets
└── coco
    ├── panoptic_semseg_val2017  # converted semantic segmentation masks
    ├── val2017 # original COCO dataset val set images
  1. Use the script below to evaluate the model.
export DETECTRON2_DATASETS=YOUR_DATA_PATH
python3 train_net.py --num-gpus 8 --dist-url tcp://127.0.0.1:9999 \
--config-file configs/coco/instance_segmentation/kmax_convnext_large.yaml \
--eval-only MODEL.WEIGHTS YOUR_MODEL_PATH

Distributed training

Need to set up your environment variables to run the training script below.

export DETECTRON2_DATASETS=YOUR_DATASET_PATH
python3 train_net.py --num-gpus 8 --num-machines $WORKER_NUM \
--machine-rank $WORKER_ID --dist-url tcp://$WORKER_0_HOST:$port \
--config-file configs/coco/instance_segmentation/kmax_convnext_large.yaml 

Model zoo

COCO-val relabeled COCO-val COCONut-val
backbone training set mIoU mIoU mIoU model
Swin-L COCO 67.1 70.9 68.1 download
COCONut-S 66.1 71.9 69.9 download
COCONut-B 67.4 72.4 71.3 download