PSPNet in Chainer

Overview

PSPNet

This is an unofficial implementation of Pyramid Scene Parsing Network (PSPNet) in Chainer.

Training

Requirement

  • Python 3.4.4+
    • Chainer 3.0.0b1+
    • ChainerMN master
    • CuPy 2.0.0b1+
    • ChainerCV 0.6.0+
    • NumPy 1.12.0+
    • tqdm 4.11.0+
pip install chainer --pre
pip install cupy --pre
pip install git+git://github.com/chainer/chainermn
pip install git+git://github.com/chainer/chainercv
pip install tqdm

Inference using converted weights

Requirement

  • Python 3.4.4+
    • Chainer 3.0.0b1+
    • ChainerCV 0.6.0+
    • Matplotlib 2.0.0+
    • CuPy 2.0.0b1+
    • tqdm 4.11.0+

1. Run demo.py

Cityscapes

$ python demo.py -g 0 -m cityscapes -f aachen_000000_000019_leftImg8bit.png

Pascal VOC2012

$ python demo.py -g 0 -m voc2012 -f 2008_000005.jpg

ADE20K

$ python demo.py -g 0 -m ade20k -f ADE_val_00000001.jpg

FAQ

If you get RuntimeError: Invalid DISPLAY variable, how about specifying the matplotlib's backend by an environment variable?

$ MPLBACKEND=Agg python demo.py -g 0 -m cityscapes -f aachen_000000_000019_leftImg8bit.png

Convert weights by yourself

Caffe is NOT needed to convert .caffemodel to Chainer model. Use caffe_pb2.py.

Requirement

  • Python 3.4.4+
    • protobuf 3.2.0+
    • Chainer 3.0.0b1+
    • NumPy 1.12.0+

1. Download the original weights

Please download the weights below from the author's repository:

and then put them into weights directory.

2. Convert weights

$ python convert.py

Reference

  • The original implementation by authors is: hszhao/PSPNet
  • The original paper is:
    • Hengshuang Zhao, Jianping Shi, Xiaojuan Qi, Xiaogang Wang, Jiaya Jia, "Pyramid Scene Parsing Network", Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR), 2017
You might also like...
Comments
  • Training failes with ModuleNotFoundError when using train_mn.py

    Training failes with ModuleNotFoundError when using train_mn.py

    Hi, I got following error when I tried to train PSP net with your train_mn.py How can I train my PSPNet model?

    [email protected]:/yendo/oss/chainer-pspnet# python3 train_mn.py --result_dir result configs/cityscapes/pspnet.yml
    Warning: using naive communicator because only naive supports CPU-only execution
    ==========================================
    Num process (COMM_WORLD): 1
    Using single_node communicator
    Chainer version: 3.4.0
    ChainerMN version: 1.2.0
    cuda: True, cudnn: True
    result_dir: result
    Traceback (most recent call last):
      File "train_mn.py", line 504, in <module>
        trainer = get_trainer(args)
      File "train_mn.py", line 374, in get_trainer
        model = get_model_from_config(config, comm)
      File "train_mn.py", line 239, in get_model_from_config
        loss.module, loss.name, loss.args, comm)
      File "train_mn.py", line 219, in get_model
        mod = import_module(loss_module)
      File "/root/.pyenv/versions/anaconda3-5.0.1/lib/python3.6/importlib/__init__.py", line 126, in import_module
        return _bootstrap._gcd_import(name[level:], package, level)
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 941, in _find_and_load_unlocked
      File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
      File "<frozen importlib._bootstrap>", line 994, in _gcd_import
      File "<frozen importlib._bootstrap>", line 971, in _find_and_load
      File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
    ModuleNotFoundError: No module named 'loss'
    
    opened by jo7ueb 0
  • Training Fails with IndexError when using train.py

    Training Fails with IndexError when using train.py

    Hi, I got following error when I tried to train PSP net with your train.py How can I train my PSPNet model?

    [email protected]:/yendo/oss/chainer-pspnet# python3 train.py --gpu --result_dir result configs/cityscapes/pspnet.yml
    ==========================================
    Chainer version: 3.4.0
    CuPy version: 2.4.0
    Traceback (most recent call last):
      File "train.py", line 483, in <module>
        trainer = get_trainer(args)
      File "train.py", line 339, in get_trainer
        chainer.cuda.available, chainer.cuda.cudnn_enabled, ))
    IndexError: tuple index out of range
    
    opened by jo7ueb 0
  • could you actually train a new model?

    could you actually train a new model?

    Hi, I am currently trying to train the cityscapes dataset with your code, but the result is miserable: still 0.5263158 (=1/19) class accuracy after 120 epochs. Apparently, the loss of training data is converged correctly, so it seems like a perfect over fitting. Since I used the same settings as yours, i am wondering how you managed to reproduce the results(maybe i need less learning rate?). thanks in advance!

    opened by suzukikbp 0
Owner
Shunta Saito
Ph.D in Engineering, Researcher at Preferred Networks, Inc.
Shunta Saito
This repository is for EMNLP 2021 paper: It is Not as Good as You Think! Evaluating Simultaneous Machine Translation on Interpretation Data

InterpretationData This repository is for our EMNLP 2021 paper: It is Not as Good as You Think! Evaluating Simultaneous Machine Translation on Interpr

4 Apr 21, 2022
Layer 7 DDoS Panel with Cloudflare Bypass ( UAM, CAPTCHA, BFM, etc.. )

Blood Deluxe DDoS DDoS Attack Panel includes CloudFlare Bypass (UAM, CAPTCHA, BFM, etc..)(It works intermittently. Working on it) Don't attack any web

272 Nov 01, 2022
Post-Training Quantization for Vision transformers.

PTQ4ViT Post-Training Quantization Framework for Vision Transformers. We use the twin uniform quantization method to reduce the quantization error on

Zhihang Yuan 61 Dec 28, 2022
Code for the ECIR'22 paper "Evaluating the Robustness of Retrieval Pipelines with Query Variation Generators"

Query Variation Generators This repository contains the code and annotation data for the ECIR'22 paper "Evaluating the Robustness of Retrieval Pipelin

Gustavo Penha 12 Nov 20, 2022
Python Auto-ML Package for Tabular Datasets

Tabular-AutoML AutoML Package for tabular datasets Tabular dataset tuning is now hassle free! Run one liner command and get best tuning and processed

Sagnik Roy 18 Nov 20, 2022
Run PowerShell command without invoking powershell.exe

PowerLessShell PowerLessShell rely on MSBuild.exe to remotely execute PowerShell scripts and commands without spawning powershell.exe. You can also ex

Mr.Un1k0d3r 1.2k Jan 03, 2023
Reinforcement Learning for Automated Trading

Reinforcement Learning for Automated Trading This thesis has been realized for the obtention of the Master's in Mathematical Engineering at the Polite

Pierpaolo Necchi 80 Jun 19, 2022
Training Very Deep Neural Networks Without Skip-Connections

DiracNets v2 update (January 2018): The code was updated for DiracNets-v2 in which we removed NCReLU by adding per-channel a and b multipliers without

Sergey Zagoruyko 585 Oct 12, 2022
Matplotlib Image labeller for classifying images

mpl-image-labeller Use Matplotlib to label images for classification. Works anywhere Matplotlib does - from the notebook to a standalone gui! For more

Ian Hunt-Isaak 5 Sep 24, 2022
Stereo Radiance Fields (SRF): Learning View Synthesis for Sparse Views of Novel Scenes

Stereo Radiance Fields (SRF): Learning View Synthesis for Sparse Views of Novel Scenes

111 Dec 29, 2022
LERP : Label-dependent and event-guided interpretable disease risk prediction using EHRs

LERP : Label-dependent and event-guided interpretable disease risk prediction using EHRs This is the code for the LERP. Dataset The dataset used is MI

5 Jun 18, 2022
Image-generation-baseline - MUGE Text To Image Generation Baseline

MUGE Text To Image Generation Baseline Requirements and Installation More detail

23 Oct 17, 2022
Gesture Volume Control Using OpenCV and MediaPipe

This Project Uses OpenCV and MediaPipe Hand solutions to identify hands and Change system volume by taking thumb and index finger positions

Pratham Bhatnagar 6 Sep 12, 2022
Code for Understanding Pooling in Graph Neural Networks

Select, Reduce, Connect This repository contains the code used for the experiments of: "Understanding Pooling in Graph Neural Networks" Setup Install

Daniele Grattarola 37 Dec 13, 2022
🔊 Audio and fastai v2

Fastaudio An audio module for fastai v2. We want to help you build audio machine learning applications while minimizing the need for audio domain expe

152 Dec 28, 2022
Python based Advanced AI Assistant

Knick is a virtual artificial intelligence project, fully developed in python. The objective of this project is to develop a virtual assistant that can handle our minor, intermediate as well as heavy

19 Nov 15, 2022
A really easy-to-use and powerful sudoku solver.

SodukuSolver This is a really useful sudoku solver with a Qt gui. USAGE Enter the numbers in and click "RUN"! If you don't want to wait, simply press

Ujhhgtg Teams 11 Jun 02, 2022
DECAF: Deep Extreme Classification with Label Features

DECAF DECAF: Deep Extreme Classification with Label Features @InProceedings{Mittal21, author = "Mittal, A. and Dahiya, K. and Agrawal, S. and Sain

46 Nov 06, 2022
CRISCE: Automatically Generating Critical Driving Scenarios From Car Accident Sketches

CRISCE: Automatically Generating Critical Driving Scenarios From Car Accident Sketches This document describes how to install and use CRISCE (CRItical

Chair of Software Engineering II, Uni Passau 2 Feb 09, 2022
For IBM Quantum Challenge Africa 2021, 9 September (07:00 UTC) - 20 September (23:00 UTC).

IBM Quantum Challenge Africa 2021 To ensure Africa is able to apply quantum computing to solve problems relevant to the continent, the IBM Research La

Qiskit Community 48 Dec 25, 2022