shathe / semantic-segmentation-tensorflow-eager Goto Github PK
View Code? Open in Web Editor NEWAn example of semantic segmentation using tensorflow in eager execution.
An example of semantic segmentation using tensorflow in eager execution.
Hi,
I change the example to use my dataset.
I have just one class (the mask has two colors, black and with).
The image has 140x140 pixels.
n_classes = 1
dataset_path = 'seg'
loader = Loader.Loader(dataFolderPath=dataset_path, n_classes=n_classes, problemType='segmentation', width=140,
height=140, ignore_label=n_classes)
model = MnasnetEager.MnasnetFC(num_classes=n_classes)
optimizer = tf.train.AdamOptimizer(0.001)
train(loader=loader, model=model, epochs=20, batch_size=8)
get_params(model)
The result generates an error:
Using TensorFlow backend.
Reading files...
Structuring test and train files...
Loaded 92 training samples
Loaded 10 testing samples
Dataset contains 1 classes
epoch: 0
Traceback (most recent call last):
File "train_eager_seg.py", line 109, in
train(loader=loader, model=model, epochs=20, batch_size=1)
File "train_eager_seg.py", line 44, in train
x, y, mask = loader.get_batch(size=batch_size, train=True, augmenter=augmenter)
File "/pylon5/ac3uump/rafaelmr/Semantic-Segmentation-Tensorflow-Eager/Loader.py", line 377, in get_batch
return self._get_batch_segmentation(size=size, train=train, augmenter=augmenter)
File "/pylon5/ac3uump/rafaelmr/Semantic-Segmentation-Tensorflow-Eager/Loader.py", line 296, in _get_batch_segmentation
y = to_categorical(y, num_classes=self.n_classes+1)
File "/home/rafaelmr/.conda/envs/seg1/lib/python2.7/site-packages/keras/utils/np_utils.py", line 32, in to_categorical
categorical[np.arange(n), y] = 1
IndexError: index 255 is out of bounds for axis 1 with size 2
Probably the error is associated with the number of the classes.
I put the correct number of the classes. I try others numbers, but the problem still the same.
Do I need to code another place?
Thank you for your sharing. Will the detection function be supported later?
Hello, thanks for your work with this code.
I found a lot of class of network in the Network.py. Can you tell me those networks built depending on the existing the network structure or designed by yourself?
Are the deconv (transpose conv) going to create artifacts in the decoder?
https://distill.pub/2016/deconv-checkerboard/ (there are many mentions to this 2016 paper)
Change the custom loader your are using for the Dataset API. Keep the same functionalities like data augmentation.
Change the rest of the code to integrate it.
https://www.tensorflow.org/tutorials/eager/eager_basics#datasets
https://www.tensorflow.org/performance/datasets_performance
https://colab.research.google.com/github/tensorflow/tensorflow/blob/master/tensorflow/contrib/eager/python/examples/generative_examples/image_captioning_with_attention.ipynb
Once the Dataset API is integrated, move into the TFrecords data format
http://warmspringwinds.github.io/tensorflow/tf-slim/2016/12/21/tfrecords-guide/
First of all, thank you for sharing. I use the original dataset to get the correct results, but the final predicted result image of the cityscapes dataset using RGB annotations is all black, and the output is black when I test with my own dataset. Do you know why? thank you very much!
Add to the Loaders get_batch function the possibility of loading it in another process.
If its the first time to call it, load a batch as normal and creates anew process to load next batch
it is not the first time to load it, creates a new process to load next batch and waits for the previous loaded batch in the queue.
compare both performances
Is available upstream now? keras-team/keras-contrib#264 (comment)
Hi,
I executed your code, but the results are strange:
epoch: 0
Train accuracy: None
Test accuracy: None
epoch: 1
Train accuracy: None
Test accuracy: None
......
epoch: 18
Train accuracy: None
Test accuracy: None
epoch: 19
Train accuracy: None
Test accuracy: None
Total parameters of the net: 6421507 == 6.421507M
Why are all accuracies with none result?
Tks
from imgaug import augmenters as iaa
ImportError: No module named imgaug
I have never used tensorflow eager, and I want to run the saved model on the mobile phone. May I ask you if the model saved by tensorflow eager can be saved as a file in tflite format and run on the mobile phone? Save the model without. What about the meta file? Thank you very much for your help!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.