Tensorflow implementation of "Learning Deconvolution Network for Semantic Segmentation"

Overview

Tensorflow implementation of Learning Deconvolution Network for Semantic Segmentation.

Install Instructions

  1. Works with tensorflow 1.11.0 and uses the Keras API so use pip to install tensorflow-gpu in the latest version

  2. Run the following commands in your terminal

git clone https://github.com/fabianbormann/Tensorflow-DeconvNet-Segmentation.git
cd Tensorflow-DeconvNet-Segmentation
sudo pip3 install -r requirements.txt

python3
Python 3.5.2+ (default, Sep 22 2016, 12:18:14)
[GCC 6.2.0 20160927] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from DeconvNet import DeconvNet
>>> deconvNet = DeconvNet() # will start collecting the VOC2012 data
>>> deconvNet.train(epochs=20, steps_per_epoch=500, batch_size=64)
>>> deconvNet.save()
>>> prediction = deconvNet.predict(any_image)

Contributions welcome!

Comments
  • Training Speed

    Training Speed

    Hi Fabian, sorry this might not entirely constitute an "issue", but I was wondering if it is normal to have training times of 1-5 seconds per step? Meaning that 1000 steps of GD might take ~1 hour? This seems quite slow based on other networks I've trained (on my GTX 1080 GPU), particularly with a single image per batch, but perhaps this is entirely down to the significant number of parameters for this very deep model. Just wanted to make sure it seemed like everything was installed and running properly on my machine anyway as a sanity check! Thanks!

    opened by djl11 11
  • How to deal with images with various size in VOC

    How to deal with images with various size in VOC

    Hi, I have saw that in this code you use the placeholder with fixed shape? I really want to know how to deal with images with different size in semantic segmentation.

    question 
    opened by BingzheWu 9
  • Shape mismatch while unpooling

    Shape mismatch while unpooling

    The Error appears in line 147 respectively in line 234. Maybe there is some flooring or ceiling during the input size and or conv layers.

    Steps to reproduce:

    cd /your/path/to/Tensorflow-DeconvNet-Segmentation/
    python3 main.py
    

    Error: Caused by op 'concat_1', defined at: File "main.py", line 4, in deconvNet = DeconvNet(use_cpu=True) File "/home/fabian/workspace/Tensorflow-DeconvNet-Segmentation/DeconvNet.py", line 15, in init self.build(use_cpu=use_cpu) File "/home/fabian/workspace/Tensorflow-DeconvNet-Segmentation/DeconvNet.py", line 147, in build unpool_4 = self.unpool_layer2x2(deconv_5_1, self.unravel_argmax(pool_4_argmax, tf.to_int64(tf.shape(conv_4_3)))) File "/home/fabian/workspace/Tensorflow-DeconvNet-Segmentation/DeconvNet.py", line 234, in unpool_layer2x2 t = tf.concat(3, [t2, t1]) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/array_ops.py", line 872, in concat name=name) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/ops/gen_array_ops.py", line 436, in _concat values=values, name=name) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/op_def_library.py", line 749, in apply_op op_def=op_def) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 2380, in create_op original_op=self._default_original_op, op_def=op_def) File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/framework/ops.py", line 1298, in init self._traceback = _extract_stack()

    question contributions welcome 
    opened by fabianbormann 7
  • Using activation function only in conv layer?

    Using activation function only in conv layer?

    Thanks for sharing good stuff! Reviewing this code, and found that in file DeconvNet.py ReLU used only once in convolution layer, not in deconvolution layer. In ref paper they are using. Is this correct? (For me, looks like problem arrives from calc of output score values that don't need activation function, linear op, but deconv need relu..)

    opened by erko 5
  • Error in DeconvNet.py

    Error in DeconvNet.py

    There are some errors I've found recently when trying to reproduce the result.

    1. restore_session -> doesn't have 'self' as param
    2. in predict: feed_dict={image:[image]} -> {self.x:[image]}
    opened by hungnguyen0606 3
  • Tensorflow in Windows

    Tensorflow in Windows

    Can I compile and execute this code on windows? I tried like

    "pip install -r requirement.txt Then get error: Could not open requirements file: [Errno 2] No such file or directory: 'requirement.txt'"

    I think I may not using right command. I am very beginner at this.......:(

    opened by HosnaCSE 3
  • An error message while running the UnpoolLayerTest.ipynb

    An error message while running the UnpoolLayerTest.ipynb

    Hi Fabian,

    When experimenting with your code of UnpoolLayerTest.ipynb, I got the following error message. Would you like to take a look at it? I did not change your code. Thanks.

    Traceback (most recent call last): File "UnpoolLayerTest.py", line 56, in <module> unpool_1 = unpool_layer2x2(pool_1, unravel_argmax(argmax, tf.to_int64(tf.shape(x)))) File "UnpoolLayerTest.py", line 17, in unpool_layer2x2 output = tf.zeros([x_shape[1] * 2, x_shape[2] * 2, x_shape[3]]) File "/develop/tfw/lib/python3.4/site-packages/tensorflow/python/ops/array_ops.py", line 620, in zeros output = constant(0, shape=shape, dtype=dtype, name=name) File "/develop/tfw/lib/python3.4/site-packages/tensorflow/python/ops/constant_op.py", line 162, in constant tensor_util.make_tensor_proto(value, dtype=dtype, shape=shape)) File "/develop/tfw/lib/python3.4/site-packages/tensorflow/python/framework/tensor_util.py", line 363, in make_tensor_proto shape = [int(dim) for dim in shape] File "/develop/tfw/lib/python3.4/site-packages/tensorflow/python/framework/tensor_util.py", line 363, in <listcomp> shape = [int(dim) for dim in shape] TypeError: int() argument must be a string, a bytes-like object or a number, not 'Tensor'

    opened by wenouyang 3
  • Deconv_1_1

    Deconv_1_1

    Hello, I read the original paper and there was no deconv layer with 32 filters, but in the code I saw this:

    deconv_1_1 = self.deconv_layer(deconv_1_2, [3, 3, 32, 64], 32, 'deconv_1_1')

    I really appreciate if someone helps me with that.

    opened by hamidrezafazlali 2
  • logits' dimension

    logits' dimension

    Hi? I am currently working to make PR of DeconvNetPipeline.py with batch normalization. I wonder, however, why the logits' last dimension is 21 at the end of the network, while ? Does self.y has same 21 at final dimension?

    Thank you

    opened by hanna-kim 1
  • batch normalization, and input size

    batch normalization, and input size

    Hi! I wonder why batch normalization and activation function is not used in the code. Also, another thing that I am curious about is that filter size of 'fc_6' is 77 in this code. however , the filter width&height should be variable to make fc_7 11 vector.

    Thank you.

    opened by hanna-kim 1
  • bug

    bug

    Traceback (most recent call last): File "img_to_tfrecords.py", line 48, in iQ,imgLen,mQ,segLen=read_filelist(args.imgpath,args.segpath)
    File "img_to_tfrecords.py", line 20, in read_filelist imgFiles=tf.train.string_input_producer(imgList,shuffle=False) File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/training/input.py", line 217, in string_input_producer raise ValueError(not_null_err) ValueError: string_input_producer requires a non-null input tensor

    opened by nannanliuliuliu 1
  • About input's shape

    About input's shape

    I am wondering whether the shape of this input must be (224, 224, 3). If it is not this shape, I just need to change the kernel_size in fc6 in the code to the width and height of pool5, right?

    fc6 = Conv2D(512, 7, use_bias=False, padding='valid', name='fc6')(pool5) #4096
    fc6 = BatchNormalization(name='batchnorm_fc6')(fc6)
    fc6 = Activation('relu', name='relu_fc6')(fc6)
    
    opened by EricPengShuai 1
  • Logic behind MaxUnpoolWithArgmax

    Logic behind MaxUnpoolWithArgmax

    I have been reading thorugh the code for the function "MaxUnpoolWithArgmax" since I'm interested in the logic to extract the indexes [b,y,x,c] from the argmax tensor. I cannot understand the maths behind to extract the index "y" and "x". Could you elaborate a bit on how did you get these expressions? :

    • y = argmax // (output_shape[2] * output_shape[3])

    • x = argmax % (output_shape[2] * output_shape[3]) // output_shape[3]

    Thank you so much Pedro

    opened by pedrogalher 0
  • Want for the Well trained models~

    Want for the Well trained models~

    Hello everyone ! Do you have the Well trained models . I want to see the the effect of the network . As you all know, the network is training very slowly . . .Thanks ! !

    contributions welcome 
    opened by stridom 2
  • Requesting Documentation for unpool_layer2x2 in DeconvNet.py

    Requesting Documentation for unpool_layer2x2 in DeconvNet.py

    I know this question should not be an issue, but I would like to read some documentation on the unpool_layer2x2 method in DeconvNet.py code so as to understand what is going on in this code.

    Any help is much appreciated!!

    question in_progress 
    opened by ghost 0
  • i got enormous loss function

    i got enormous loss function

    hi i run the code DeconvNetPipeline.py and while the traning i got something like this: 2017-01-26 15:01:00.156146: step 85, loss = 39709622646341632.00 (3.6 examples/sec; 2.809 sec/batch) 2017-01-26 15:01:03.019399: step 86, loss = 34950307108618240.00 (3.5 examples/sec; 2.863 sec/batch) 2017-01-26 15:01:05.870122: step 87, loss = 37934860555255808.00 (3.5 examples/sec; 2.851 sec/batch) its error? Also he break in the middle and because the line: except tf.errors.OutOfRangeError: what its mean? thenk you

    opened by oneOfThePeople 7
Owner
Fabian Bormann
Fabian Bormann
TensorFlow Ranking is a library for Learning-to-Rank (LTR) techniques on the TensorFlow platform

TensorFlow Ranking is a library for Learning-to-Rank (LTR) techniques on the TensorFlow platform

null 2.6k Jan 4, 2023
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Peter Lin 6.5k Jan 4, 2023
Robust Video Matting in PyTorch, TensorFlow, TensorFlow.js, ONNX, CoreML!

Robust Video Matting (RVM) English | 中文 Official repository for the paper Robust High-Resolution Video Matting with Temporal Guidance. RVM is specific

flow-dev 2 Aug 21, 2022
Implementation of Restricted Boltzmann Machine (RBM) and its variants in Tensorflow

xRBM Library Implementation of Restricted Boltzmann Machine (RBM) and its variants in Tensorflow Installation Using pip: pip install xrbm Examples Tut

Omid Alemi 55 Dec 29, 2022
Functional TensorFlow Implementation of Singular Value Decomposition for paper Fast Graph Learning

tf-fsvd TensorFlow Implementation of Functional Singular Value Decomposition for paper Fast Graph Learning with Unique Optimal Solutions Cite If you f

Sami Abu-El-Haija 14 Nov 25, 2021
StyleGAN2 - Official TensorFlow Implementation

StyleGAN2 - Official TensorFlow Implementation

NVIDIA Research Projects 10.1k Dec 28, 2022
An efficient and effective learning to rank algorithm by mining information across ranking candidates. This repository contains the tensorflow implementation of SERank model. The code is developed based on TF-Ranking.

SERank An efficient and effective learning to rank algorithm by mining information across ranking candidates. This repository contains the tensorflow

Zhihu 44 Oct 20, 2022
Implementation of Perceiver, General Perception with Iterative Attention in TensorFlow

Perceiver This Python package implements Perceiver: General Perception with Iterative Attention by Andrew Jaegle in TensorFlow. This model builds on t

Rishit Dagli 84 Oct 15, 2022
Minimal implementation of Denoised Smoothing: A Provable Defense for Pretrained Classifiers in TensorFlow.

Denoised-Smoothing-TF Minimal implementation of Denoised Smoothing: A Provable Defense for Pretrained Classifiers in TensorFlow. Denoised Smoothing is

Sayak Paul 19 Dec 11, 2022
Unofficial Implementation of MLP-Mixer in TensorFlow

mlp-mixer-tf Unofficial Implementation of MLP-Mixer [abs, pdf] in TensorFlow. Note: This project may have some bugs in it. I'm still learning how to i

Rishabh Anand 24 Mar 23, 2022
Tensorflow implementation for Self-supervised Graph Learning for Recommendation

If the compilation is successful, the evaluator of cpp implementation will be called automatically. Otherwise, the evaluator of python implementation will be called.

null 152 Jan 7, 2023
Minimal implementation of PAWS (https://arxiv.org/abs/2104.13963) in TensorFlow.

PAWS-TF ?? Implementation of Semi-Supervised Learning of Visual Features by Non-Parametrically Predicting View Assignments with Support Samples (PAWS)

Sayak Paul 43 Jan 8, 2023
Unofficial TensorFlow implementation of the Keyword Spotting Transformer model

Keyword Spotting Transformer This is the unofficial TensorFlow implementation of the Keyword Spotting Transformer model. This model is used to train o

Intelligent Machines Limited 8 May 11, 2022
A tensorflow implementation of GCN-LPA

GCN-LPA This repository is the implementation of GCN-LPA (arXiv): Unifying Graph Convolutional Neural Networks and Label Propagation Hongwei Wang, Jur

Hongwei Wang 83 Nov 28, 2022
Official Tensorflow implementation of "M-LSD: Towards Light-weight and Real-time Line Segment Detection"

M-LSD: Towards Light-weight and Real-time Line Segment Detection Official Tensorflow implementation of "M-LSD: Towards Light-weight and Real-time Line

NAVER/LINE Vision 357 Jan 4, 2023
Unofficial TensorFlow implementation of Protein Interface Prediction using Graph Convolutional Networks.

[TensorFlow] Protein Interface Prediction using Graph Convolutional Networks Unofficial TensorFlow implementation of Protein Interface Prediction usin

YeongHyeon Park 9 Oct 25, 2022
Tensorflow implementation of MIRNet for Low-light image enhancement

MIRNet Tensorflow implementation of the MIRNet architecture as proposed by Learning Enriched Features for Real Image Restoration and Enhancement. Lanu

Soumik Rakshit 91 Jan 6, 2023
Tensorflow python implementation of "Learning High Fidelity Depths of Dressed Humans by Watching Social Media Dance Videos"

Learning High Fidelity Depths of Dressed Humans by Watching Social Media Dance Videos This repository is the official tensorflow python implementation

Yasamin Jafarian 287 Jan 6, 2023
Tensorflow implementation of Swin Transformer model.

Swin Transformer (Tensorflow) Tensorflow reimplementation of Swin Transformer model. Based on Official Pytorch implementation. Requirements tensorflow

null 167 Jan 8, 2023