GithubHelp home page GithubHelp logo

ndrplz / dilation-tensorflow Goto Github PK

View Code? Open in Web Editor NEW
138.0 7.0 61.0 3.06 MB

A native Tensorflow implementation of semantic segmentation according to Multi-Scale Context Aggregation by Dilated Convolutions (2016). Optionally uses the pretrained weights by the authors.

License: MIT License

Python 100.00%
deep-learning tensorflow segmentation semantic-segmentation dilation-tensorflow pretrained-weights

dilation-tensorflow's Introduction

dilation-tensorflow

A native Tensorflow implementation of semantic segmentation according to Multi-Scale Context Aggregation by Dilated Convolutions by Yu and Koltun.

Pretrained weights have been converted to TensorFlow from the original Caffe implementation.

Model pretrained either on CityScapes or on CamVid datasets is available.

You you're looking instead for a Keras+Theano implementation of this very same network you can find it here.

Examples

Cityscapes

input
Test image (input)

segmentation
Test image (prediction)

CamVid

input
Test image (input)

segmentation
Test image (prediction)

How-to

  1. Download pretrained weights from here:

    CityScapes weights

    CamVid weights

  2. Move weights file into data directory.

  3. Run the model on the test image by executing main_tf.py.

Configuration

This model has been tested with the following configuration:

  • Ubuntu 16.04
  • python 3.5.2
  • tensorflow 1.1.0
  • cv2 3.2.0

Acknowledgements

Thanks to DavideA which converted all weights from Caffe to Keras+Theano (here) making my effort of conversion towards TensorFlow much less painful than it could have been :-)

dilation-tensorflow's People

Contributors

ndrplz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

dilation-tensorflow's Issues

test image problem for "Cityscapes"

hi @ndrplz,

when i replaced the "cityscapes.png" file in the data directory by some other test image with smaller resolution (e.g. 1438 x 803), then I got following error:

File "main_tf.py", line 61, in <module>
    predicted_image = predict(input_image, input_tensor, model, dataset, sess)
  File "C:\Users\ininetynine\Desktop\dilation-tensorflow-master\utils.py", line 79, in predict
    color_image = CONFIG[ds]['palette'][prediction.ravel()].reshape(image_size)
ValueError: total size of new array must be unchanged

any idea on the reason behind this? and how should i fix it? thank you ~

Utils.py raises ValueError: cannot reshape array of size 50331648 into shape (3183,3183,3)

main_tf.py with pre-trained Cityscapes weights works with no problems when I run it on the dummy image under /data.
However when I ran it on my own image here, I encountered the following error:

Traceback (most recent call last):
  File "main_tf.py", line 60, in <module>
    predicted_image = predict(input_image, input_tensor, model, dataset, sess)
  File "dilation-tensorflow/utils.py", line 76, in predict
    color_image = CONFIG[ds]['palette'][prediction.ravel()].reshape(image_size)
ValueError: cannot reshape array of size 50331648 into shape (3183,3183,3)

50331648 corresponds to a shape of (4096,4096,3) which is not the image size. What might be the issue here?

ResourceExhaustedError - Jetson TX1

I ran into a ResourceExhaustedError errror on my Jetson TX1 with 4GB of RAM. How much RAM is needed/recommended to test the code???

Ubuntu 16.04
python 3.5
tensorflow 1.5.0
cv2 3.3.0
pretrained_dilation_cityscapes.pickle - 537MB


ResourceExhaustedError (see above for traceback): OOM when allocating tensor of shape [7,7,512,4096] and type float
[[Node: fc6/Variable/initial_value = Const[dtype=DT_FLOAT, value=Tensor<type: float shape: [7,7,512,4096] values: [[[-4.46356426e-05 0.000302301254 -0.00146040611]]]...>, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]

weight file

pretrained_dilation_camvid.pickle and pretrained_dilation_cityscapes.pickle,How does this come about?How to experiment with my own data set?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.