资源算法PSPNet-Keras-tensorflow

PSPNet-Keras-tensorflow

2020-01-17 | |  31 |   0 |   0

Keras implementation of PSPNet(caffe)

Implemented Architecture of Pyramid Scene Parsing Network in Keras.

For the best compability please use Python3.5

Setup

  1. Install dependencies:

    pip install -r requirements.txt --upgrade
    • Tensorflow (-gpu)

    • Keras

    • numpy

    • scipy

    • pycaffe(PSPNet)(optional for converting the weights)

  2. Converted trained weights are needed to run the network. Weights(in .h5 .json format) have to be downloaded and placed into directory weights/keras

Already converted weights can be downloaded here:

Convert weights by yourself(optional)

(Note: this is not required if you use .h5/.json weights)

Running this needs the compiled original PSPNet caffe code and pycaffe.

python weight_converter.py <path to .prototxt> <path to .caffemodel>

Usage:

python pspnet.py -m <model> -i <input_image>  -o <output_path>python pspnet.py -m pspnet101_cityscapes -i example_images/cityscapes.png -o example_results/cityscapes.jpg
python pspnet.py -m pspnet101_voc2012 -i example_images/pascal_voc.jpg -o example_results/pascal_voc.jpg

List of arguments:

 -m --model        - which model to use: 'pspnet50_ade20k', 'pspnet101_cityscapes', 'pspnet101_voc2012'
    --id           - (int) GPU Device id. Default 0
 -s --sliding      - Use sliding window
 -f --flip         - Additional prediction of flipped image
 -ms --multi_scale - Predict on multiscale images

Keras results:

图片.png

图片.png

图片.png

图片.png

图片.png

Implementation details

  • The interpolation layer is implemented as custom layer "Interp"

  • Forward step takes about ~1 sec on single image

  • Memory usage can be optimized with:

    config = tf.ConfigProto()
    config.gpu_options.per_process_gpu_memory_fraction = 0.3 sess = tf.Session(config=config)
  • ndimage.zoom can take a long time


上一篇:PSPNet-tensorflow

下一篇:PSPNet-TF-Reproduce

用户评价
全部评价

热门资源

  • seetafaceJNI

    项目介绍 基于中科院seetaface2进行封装的JAVA...

  • spark-corenlp

    This package wraps Stanford CoreNLP annotators ...

  • Keras-ResNeXt

    Keras ResNeXt Implementation of ResNeXt models...

  • capsnet-with-caps...

    CapsNet with capsule-wise convolution Project ...

  • inferno-boilerplate

    This is a very basic boilerplate example for pe...