Skip to content

A reproduction of Exploring Cross-Image Pixel Contrast for Semantic Segmentation in PaddlePaddle

Notifications You must be signed in to change notification settings

justld/contrast_seg_paddle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

contrast_seg_paddle

English | 简体中文

1 Introduction

images
This project reproduces HRNet_W48_Contrast based on paddlepaddle framework. The core idea of pixel-wise contrastive algorithm is to force pixel embeddings belonging to a same semantic class to be more similar than embeddings from different classes. It has two advantages. Firstly, pixel-wise contrastive algorithm can address the categorization ability of individual pixel embeddings. Secondly, pixel embeddings be well structured to addrress intra-class compactness and inter-class dispersion.

Paper:

Reference project:

2 Accuracy

This index is test in the val set of CityScapes. HRNet_W48 was pretrained in ImageNet.

steps opt image_size batch_size dataset memory card mIou config
HRNet_W48_contrast 60k sgd 1024x512 2 CityScapes 32G 4 0.8266 HRNet_W48_cityscapes_1024x512_60k.yml

3 Dataset

CityScapes dataset

  • Dataset size:
    • train: 2975
    • val: 500

4 Environment

  • Hardware: Tesla V100 * 4

  • Framework:

    • PaddlePaddle == 2.1.2

5 Quick start

step1: clone

# clone this repo
git clone https://github.com/justld/contrast_seg_paddle.git
cd contrast_seg_paddle

Install packages

pip install -r requirements.txt

step2: train

python train.py --config configs/HRNet_W48_cityscapes_1024x512_60k.yml  --do_eval --use_vdl --log_iter 100 --save_interval 1000 --save_dir output

If you want to train distributed and use multicards:

python -m paddle.distributed.launch train.py --config configs/HRNet_W48_cityscapes_1024x512_60k.yml  --do_eval --use_vdl --log_iter 100 --save_interval 1000 --save_dir output

step3: test

You can download the pretrained model in BaiduYun. (Extraction code: hwq7)

python val.py --config configs/HRNet_W48_cityscapes_1024x512_60k.yml --model_path output/best_model/model.pdparams

6 Code structure

Structure

├─configs                          
├─images                         
├─output                           
├─paddleseg                                                   
│  export.py                     
│  predict.py                        
│  README.md                        
│  README_CN.md                     
│  requirements.txt                      
│  setup.py                   
│  train.py                
│  val.py                       

7 Model information

For other information about the model, please refer to the following table:

information description
Author du lang
Date 2021.09
Framework version Paddle 2.1.2
Application scenarios Semantic Segmentation
Support hardware GPU、CPU
Online operation notebook, Script

About

A reproduction of Exploring Cross-Image Pixel Contrast for Semantic Segmentation in PaddlePaddle

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages