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
A plug-and-play library for neural networks written in Python

A plug-and-play library for neural networks written in Python!

Dimos Michailidis 2 Jul 16, 2022
A toolkit for controlling Euro Truck Simulator 2 with python to develop self-driving algorithms.

europilot Overview Europilot is an open source project that leverages the popular Euro Truck Simulator(ETS2) to develop self-driving algorithms. A con

1.4k Jan 04, 2023
Research on Event Accumulator Settings for Event-Based SLAM

Research on Event Accumulator Settings for Event-Based SLAM This is the source code for paper "Research on Event Accumulator Settings for Event-Based

Robin Shaun 26 Dec 21, 2022
Repository for the electrical and ICT benchmark model developed in the ERIGrid 2.0 project.

Benchmark Model Electrical and ICT System This repository contains the documentation, code, and models for the electrical and ICT benchmark model deve

ERIGrid 2.0 1 Nov 29, 2021
DeepFaceEditing: Deep Face Generation and Editing with Disentangled Geometry and Appearance Control

DeepFaceEditing: Deep Face Generation and Editing with Disentangled Geometry and Appearance Control One version of our system is implemented using the

260 Nov 28, 2022
Code to train models from "Paraphrastic Representations at Scale".

Paraphrastic Representations at Scale Code to train models from "Paraphrastic Representations at Scale". The code is written in Python 3.7 and require

John Wieting 71 Dec 19, 2022
A Python type explainer!

typesplainer A Python typehint explainer! Available as a cli, as a website, as a vscode extension, as a vim extension Usage First, install the package

Typesplainer 79 Dec 01, 2022
Generative code template for PixelBeasts 10k NFT project.

generator-template Generative code template for combining transparent png attributes into 10,000 unique images. Used for the PixelBeasts 10k NFT proje

Yohei Nakajima 9 Aug 24, 2022
Doge-Prediction - Coding Club prediction ig

Doge-Prediction Coding Club prediction ig Basically: Create an application that

1 Jan 10, 2022
Face recognition. Redefined.

FaceFinder Use a powerful CNN to identify faces in images! TABLE OF CONTENTS About The Project Built With Getting Started Prerequisites Installation U

BleepLogger 20 Jun 16, 2021
MLP-Like Vision Permutator for Visual Recognition (PyTorch)

Vision Permutator: A Permutable MLP-Like Architecture for Visual Recognition (arxiv) This is a Pytorch implementation of our paper. We present Vision

Qibin (Andrew) Hou 162 Nov 28, 2022
YOLOv5 Series Multi-backbone, Pruning and quantization Compression Tool Box.

YOLOv5-Compression Update News Requirements 环境安装 pip install -r requirements.txt Evaluation metric Visdrone Model mAP ZhangYuan 719 Jan 02, 2023

PyTorch implementation of "Contrast to Divide: self-supervised pre-training for learning with noisy labels"

Contrast to Divide: self-supervised pre-training for learning with noisy labels This is an official implementation of "Contrast to Divide: self-superv

55 Nov 23, 2022
CyTran: Cycle-Consistent Transformers for Non-Contrast to Contrast CT Translation

CyTran: Cycle-Consistent Transformers for Non-Contrast to Contrast CT Translation We propose a novel approach to translate unpaired contrast computed

Nicolae Catalin Ristea 13 Jan 02, 2023
This repository accompanies the ACM TOIS paper "What can I cook with these ingredients?" - Understanding cooking-related information needs in conversational search

In this repository you find data that has been gathered when conducting in-situ experiments in a conversational cooking setting. These data include tr

6 Sep 22, 2022
Unofficial PyTorch implementation of MobileViT.

MobileViT Overview This is a PyTorch implementation of MobileViT specified in "MobileViT: Light-weight, General-purpose, and Mobile-friendly Vision Tr

Chin-Hsuan Wu 348 Dec 23, 2022
Depression Asisstant GDSC Challenge Solution

Depression Asisstant can help you give solution. Please using Python version 3.9.5 for contribute.

Ananda Rauf 1 Jan 30, 2022
PyTorch implementation of CDistNet: Perceiving Multi-Domain Character Distance for Robust Text Recognition

PyTorch implementation of CDistNet: Perceiving Multi-Domain Character Distance for Robust Text Recognition The unofficial code of CDistNet. Now, we ha

25 Jul 20, 2022
Save-restricted-v-3 - Save restricted content Bot For telegram

Save restricted content Bot Contact: Telegram A stable telegram bot to get restr

DEVANSH 11 Dec 21, 2022
General Virtual Sketching Framework for Vector Line Art (SIGGRAPH 2021)

General Virtual Sketching Framework for Vector Line Art - SIGGRAPH 2021 Paper | Project Page Outline Dependencies Testing with Trained Weights Trainin

Haoran MO 118 Dec 27, 2022