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
Code for reproducible experiments presented in KSD Aggregated Goodness-of-fit Test.

Code for KSDAgg: a KSD aggregated goodness-of-fit test This GitHub repository contains the code for the reproducible experiments presented in our pape

Antonin Schrab 5 Dec 15, 2022
A collection of 100 Deep Learning images and visualizations

A collection of Deep Learning images and visualizations. The project has been developed by the AI Summer team and currently contains almost 100 images.

AI Summer 65 Sep 12, 2022
A novel pipeline framework for multi-hop complex KGQA task. About the paper title: Improving Multi-hop Embedded Knowledge Graph Question Answering by Introducing Relational Chain Reasoning

Rce-KGQA A novel pipeline framework for multi-hop complex KGQA task. This framework mainly contains two modules, answering_filtering_module and relati

金伟强 -上海大学人工智能小渣渣~ 16 Nov 18, 2022
DeceFL: A Principled Decentralized Federated Learning Framework

DeceFL: A Principled Decentralized Federated Learning Framework This repository comprises codes that reproduce experiments in Ye, et al (2021), which

Huazhong Artificial Intelligence Lab (HAIL) 10 May 31, 2022
A PyTorch implementation of "Graph Classification Using Structural Attention" (KDD 2018).

GAM ⠀⠀ A PyTorch implementation of Graph Classification Using Structural Attention (KDD 2018). Abstract Graph classification is a problem with practic

Benedek Rozemberczki 259 Dec 05, 2022
Official codebase for ICLR oral paper Unsupervised Vision-Language Grammar Induction with Shared Structure Modeling

CLIORA This is the official codebase for ICLR oral paper: Unsupervised Vision-Language Grammar Induction with Shared Structure Modeling. We introduce

Bo Wan 32 Dec 23, 2022
Using knowledge-informed machine learning on the PRONOSTIA (FEMTO) and IMS bearing data sets. Predict remaining-useful-life (RUL).

Knowledge Informed Machine Learning using a Weibull-based Loss Function Exploring the concept of knowledge-informed machine learning with the use of a

Tim 43 Dec 14, 2022
Experimenting with computer vision techniques to generate annotated image datasets from gameplay recordings automatically.

Experimenting with computer vision techniques to generate annotated image datasets from gameplay recordings automatically. The collected data will then be used to train a deep neural network that can

Martin Valchev 3 Apr 24, 2022
A High-Level Fusion Scheme for Circular Quantities published at the 20th International Conference on Advanced Robotics

Monte Carlo Simulation to the Paper A High-Level Fusion Scheme for Circular Quantities published at the 20th International Conference on Advanced Robotics

Sören Kohnert 0 Dec 06, 2021
Python code for loading the Aschaffenburg Pose Dataset.

Aschaffenburg Pose Dataset (APD) This repository contains Python code for loading and filtering the Aschaffenburg Pose Dataset. The dataset itself and

1 Nov 26, 2021
A higher performance pytorch implementation of DeepLab V3 Plus(DeepLab v3+)

A Higher Performance Pytorch Implementation of DeepLab V3 Plus Introduction This repo is an (re-)implementation of Encoder-Decoder with Atrous Separab

linhua 326 Nov 22, 2022
Official repository for "PAIR: Planning and Iterative Refinement in Pre-trained Transformers for Long Text Generation"

pair-emnlp2020 Official repository for the paper: Xinyu Hua and Lu Wang: PAIR: Planning and Iterative Refinement in Pre-trained Transformers for Long

Xinyu Hua 31 Oct 13, 2022
Reimplementation of NeurIPS'19: "Meta-Weight-Net: Learning an Explicit Mapping For Sample Weighting" by Shu et al.

[Re] Meta-Weight-Net: Learning an Explicit Mapping For Sample Weighting Reimplementation of NeurIPS'19: "Meta-Weight-Net: Learning an Explicit Mapping

Robert Cedergren 1 Mar 13, 2020
Evolutionary Scale Modeling (esm): Pretrained language models for proteins

Evolutionary Scale Modeling This repository contains code and pre-trained weights for Transformer protein language models from Facebook AI Research, i

Meta Research 1.6k Jan 09, 2023
Time-stretch audio clips quickly with PyTorch (CUDA supported)! Additional utilities for searching efficient transformations are included.

Time-stretch audio clips quickly with PyTorch (CUDA supported)! Additional utilities for searching efficient transformations are included.

Kento Nishi 22 Jul 07, 2022
CvT2DistilGPT2 is an encoder-to-decoder model that was developed for chest X-ray report generation.

CvT2DistilGPT2 Improving Chest X-Ray Report Generation by Leveraging Warm-Starting This repository houses the implementation of CvT2DistilGPT2 from [1

The Australian e-Health Research Centre 21 Dec 28, 2022
This repository contains all code and data for the Inside Out Visual Place Recognition task

Inside Out Visual Place Recognition This repository contains code and instructions to reproduce the results for the Inside Out Visual Place Recognitio

15 May 21, 2022
RuleBERT: Teaching Soft Rules to Pre-Trained Language Models

RuleBERT: Teaching Soft Rules to Pre-Trained Language Models (Paper) (Slides) (Video) RuleBERT is a pre-trained language model that has been fine-tune

16 Aug 24, 2022
The repository offers the official implementation of our paper in PyTorch.

Cloth Interactive Transformer (CIT) Cloth Interactive Transformer for Virtual Try-On Bin Ren1, Hao Tang1, Fanyang Meng2, Runwei Ding3, Ling Shao4, Phi

Bingoren 49 Dec 01, 2022