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
Efficient Sparse Attacks on Videos using Reinforcement Learning

EARL This repository provides a simple implementation of the work "Efficient Sparse Attacks on Videos using Reinforcement Learning" Example: Demo: Her

12 Dec 05, 2021
Reinfore learning tool box, contains trpo, a3c algorithm for continous action space

RL_toolbox all the algorithm is running on pycharm IDE, or the package loss error may exist. implemented algorithm: trpo a3c a3c:for continous action

yupei.wu 44 Oct 10, 2022
Pure python implementations of popular ML algorithms.

Minimal ML algorithms This repo includes minimal implementations of popular ML algorithms using pure python and numpy. The purpose of these notebooks

Alexis Gidiotis 3 Jan 10, 2022
This repo includes our code for evaluating and improving transferability in domain generalization (NeurIPS 2021)

Transferability for domain generalization This repo is for evaluating and improving transferability in domain generalization (NeurIPS 2021), based on

gordon 9 Nov 29, 2022
Source code for "OmniPhotos: Casual 360° VR Photography"

OmniPhotos: Casual 360° VR Photography Project Page | Video | Paper | Demo | Data This repository contains the source code for creating and viewing Om

Christian Richardt 144 Dec 30, 2022
A very tiny, very simple, and very secure file encryption tool.

Picocrypt is a very tiny (hence "Pico"), very simple, yet very secure file encryption tool. It uses the modern ChaCha20-Poly1305 cipher suite as well

Evan Su 1k Dec 30, 2022
Official git repo for the CHIRP project

CHIRP Project This is the official git repository for the CHIRP project. Pull requests are accepted here, but for the moment, the main repository is s

Dan Smith 77 Jan 08, 2023
The Simplest DCGAN Implementation

DCGAN in TensorLayer This is the TensorLayer implementation of Deep Convolutional Generative Adversarial Networks. Looking for Text to Image Synthesis

TensorLayer Community 310 Dec 13, 2022
a reccurrent neural netowrk that when trained on a peice of text and fed a starting prompt will write its on 250 character text using LSTM layers

RNN-Playwrite a reccurrent neural netowrk that when trained on a peice of text and fed a starting prompt will write its on 250 character text using LS

Arno Barton 1 Oct 29, 2021
Single/multi view image(s) to voxel reconstruction using a recurrent neural network

3D-R2N2: 3D Recurrent Reconstruction Neural Network This repository contains the source codes for the paper Choy et al., 3D-R2N2: A Unified Approach f

Chris Choy 1.2k Dec 27, 2022
Workshop Materials Delivered on 28/02/2022

intro-to-cnn-p1 Repo for hosting workshop materials delivered on 28/02/2022 Questions you will answer in this workshop Learning Objectives What are co

Beginners Machine Learning 5 Feb 28, 2022
Single Image Deraining Using Bilateral Recurrent Network (TIP 2020)

Single Image Deraining Using Bilateral Recurrent Network Introduction Single image deraining has received considerable progress based on deep convolut

23 Aug 10, 2022
An official PyTorch Implementation of Boundary-aware Self-supervised Learning for Video Scene Segmentation (BaSSL)

An official PyTorch Implementation of Boundary-aware Self-supervised Learning for Video Scene Segmentation (BaSSL)

Kakao Brain 72 Dec 28, 2022
Source code of AAAI 2022 paper "Towards End-to-End Image Compression and Analysis with Transformers".

Towards End-to-End Image Compression and Analysis with Transformers Source code of our AAAI 2022 paper "Towards End-to-End Image Compression and Analy

37 Dec 21, 2022
Pytorch implementation of Implicit Behavior Cloning.

Implicit Behavior Cloning - PyTorch (wip) Pytorch implementation of Implicit Behavior Cloning. Install conda create -n ibc python=3.8 pip install -r r

Kevin Zakka 49 Dec 25, 2022
scAR (single-cell Ambient Remover) is a package for data denoising in single-cell omics.

scAR scAR (single cell Ambient Remover) is a package for denoising multiple single cell omics data. It can be used for multiple tasks, such as, sgRNA

19 Nov 28, 2022
This is the offical website for paper ''Category-consistent deep network learning for accurate vehicle logo recognition''

The Pytorch Implementation of Category-consistent deep network learning for accurate vehicle logo recognition This is the offical website for paper ''

Wanglong Lu 28 Oct 29, 2022
Face Recognition & AI Based Smart Attendance Monitoring System.

In today’s generation, authentication is one of the biggest problems in our society. So, one of the most known techniques used for authentication is h

Sagar Saha 1 Jan 14, 2022
HashNeRF-pytorch - Pure PyTorch Implementation of NVIDIA paper on Instant Training of Neural Graphics primitives

HashNeRF-pytorch Instant-NGP recently introduced a Multi-resolution Hash Encodin

Yash Sanjay Bhalgat 616 Jan 06, 2023