YAML Metadata Warning: empty or missing yaml metadata in repo card (https://huggingface.co/docs/hub/model-cards#model-card-metadata)

SPFormer-V1: Semantic Segmentation Repository

This repository is currently under construction and hosts an unofficial implementation of Superpixel Transformers for Efficient Semantic Segmentation (SPFormer-V1). SPFormer-V1 project provides an efficient implementation of the semantic segmentation model.

Prerequisites

  • mmsegmentation 1.0.0
  • pytorch 1.8.1

Installation

Step 0. Install MMCV using MIM.

pip install -U openmim
mim install mmengine
mim install "mmcv>=2.0.0"

Step 1. Clone the Repository

To get started, clone the repository to your local machine with the following command:

git clonehttps://github.com/yunfeixie233/SpformerV1.git
cd SpformerV1
pip install -v -e .
pip install -r requirements.txt
# '-v' means verbose, or more output
# '-e' means installing a project in editable mode,
# thus any local modifications made to the code will take effect without reinstallation.
cd mmpretrain
pip install -v -e .
# mmpretrain library for data augmentation

Dataset Preparation

The ADE20K dataset is used for training and validation, which can be downloaded here. The file structure of ADE20K is as follows:

    β”œβ”€β”€ data                                               
    β”‚   β”œβ”€β”€ ade/ADEChallengeData2016                                   
    β”‚   β”‚   β”œβ”€β”€ annotations                                     
    β”‚   β”‚   β”‚   β”œβ”€β”€ training                                                                               
    β”‚   β”‚   β”‚   β”œβ”€β”€ validation                                    
    β”‚   β”‚   β”œβ”€β”€  images                                
    β”‚   β”‚   β”‚   β”œβ”€β”€ training                                                                          
    β”‚   β”‚   β”‚   β”œβ”€β”€ validation                                                              
    

Training

To train the model, use the following command:

python ./tools/train.py ./configs/superformer/superformer_reshape_1stage.py

For the specific meaning in config setting, you can refer to https://mmsegmentation.readthedocs.io/en/latest/user_guides/1_config.html

Testing

To test the model, use the following command. Replace ${CHECKPOINT_FILE} with the path to your saved model weights.

python ./tools/test.py ./configs/superformer/superformer_reshape_1stage.py  ${CHECKPOINT_FILE}

For additional details on training and testing, please refer to the official mmsegmentation documentation.

Model Path

The model is added and registered in MMSegmentation.

  • Backbone: Resnet-50 with feature fusion from different stage.
  • Head: SuperformerBottleNeck to finish Superpixel Tokenization, Classification and Superpixel Association

You can find the implementation of the model in the following directory:

SpformerV1
|__mmseg
   |__models
      |__backbones
         |__resnet.py
      |__decode_heads
         |__SuperformerBottleNeck.py

The original Superformer modules and ops have been put under the following directory:

mmseg/superformer
β”œβ”€β”€ superpixel
β”‚   β”œβ”€β”€ dual_path_transformer_ops.py
β”‚   β”œβ”€β”€ superpixel_cross_attention_new_ops.py
β”‚   β”œβ”€β”€ superpixel_cross_attention_ops.py
β”‚   β”œβ”€β”€ superpixel_ops.py
β”‚   β”œβ”€β”€ superpixel_transformer.py
β”‚   └── test_superpixel_transformer_ops.py
Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The model has no library tag.