Semantic-Segmentation | I will upload many semantic segmentation models | Machine Learning library
kandi X-RAY | Semantic-Segmentation Summary
kandi X-RAY | Semantic-Segmentation Summary
I will upload many semantic segmentation models to this repository for you to learn
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Deeplabv3
- Separated convolution layer
- 2D Conv2D convolutional layer
- Xception flow
- Creates a phonenet model
- Pool a block of Tensors
- Construct a PSP network
- Return a convolutional encoder
- Depth - wise convolution block
- Layer convolutional block
- Get resnet50 encoder
- Computes the identity block
- 2D convolution block
- Resolutional network
- Divide value into divisible by divisor
- Inverse convolution block
- Generate a Universal Classification model
- Unet encoder
- Create a convolutional network model
- Segmentation model
- Get random data
- Generates numpy arrays from file
- Returns a list of class colors
- Make a letterbox image
- Creates a Resnet50 model
- Construct a convnet model
Semantic-Segmentation Key Features
Semantic-Segmentation Examples and Code Snippets
Community Discussions
Trending Discussions on Semantic-Segmentation
QUESTION
While performing semantic-segmentation task by following this tutorial ,
I noticed that the final predicted output from the model is not 0 and 1,
it consists of decimal values from 0.0000xxxx to 1.0.
Since the model took in the label of 0 and 1 only,
what is the meaning of the the decimal values range in the output?
(The possibility of the pixels belonging to a certain class?)
ANSWER
Answered 2021-May-01 at 11:08I have found about this from the same youtube tutorial in a different video (19.20 ~ 20.04).
The values in the prediction indeed reflecting the probability of a pixel to it's corresponding class.
In this case, it is referring the probability of the current pixel to be the membrane.
QUESTION
I am using the Image segmentation guide by fchollet to perform semantic segmentation. I have attempted modifying the guide to suit my dataset by labelling the 8-bit img mask values into 1 and 2 like in the Oxford Pets dataset which will be subtracted to 0 and 1 in class Generator(keras.utils.Sequence)
.The input image is an RGB-image.
I am not sure why but my dice coefficient isn't increasing at all. I have tried to reduce the learning rate as well as changing the optimizer to SGD/RMSProp, normalizing the data, taking the imbalanced labels into account but the result is very strange. The accuracy/IoU of the model is decreasing as the no. of epochs increases.
If it helps, I previously asked a question about the metrics that I should be using for an imbalanced dataset here. The visualization of the predictions are okay but the metric is not.
What I can do next to debug this problem? Is there anything wrong with my code? Will appreciate any advice.
Here are the results
...ANSWER
Answered 2021-Apr-13 at 17:31The model output was wrong. It was supposed to be a sigmoid activation function with 1 output channel. Changing output_layer = Conv2D(nclasses, 3, activation="softmax", padding="same")(output_layer)
to output_layer = Conv2D(1, 1, activation="sigmoid", padding="same")(output_layer)
solved my problem.
Also, I decided to use True Positive Rate (TPR) also commonly known as recall/sensitivity/probability of detection as my main metric after reading this post.
QUESTION
I'm trying to follow this introduction to how to use VGG-16 to do some Semantic Segmentation. However, there are a few aspect of the tutorial that were unclear to me:
Here is the detailed of their implementation:
We’ll implement FCN-8, as detailed step-by-step below:
- Encoder: A pre-trained VGG16 is used as an encoder. The decoder starts from Layer 7 of VGG16.
- FCN Layer-8: The last fully connected layer of VGG16 is replaced by a 1x1 convolution.
...
What I don't understand is what is layer 7 or 8? Could someone offer me some explanation?
...ANSWER
Answered 2020-Nov-01 at 05:36Layer 7 is just the last convolutional layer of VGG16.
Layer 8 would be a fully connected/dense layer, but instead is replaced with a 1x1 convolution which, if input to this layer would be of size 1x1, is the same thing. Otherwise its as if you mapped each pixel through the same dense layer.
If your input size is such that input to layer 8 is of size 1x1, then there is no difference. If its bigger, this still potentially allows the network to work in a meaningful way.
QUESTION
I have a semantic-segmentation model created using Keras.
Now I want to use it in production where I need to execute the model on a large folder with 10k-100k images a few times a day. This takes several hours, so every improvement is helpful.
I'm wondering what is the correct way to use it in production. I currently just use model.predict()
on a created Sequence
. But everywhere I look I see all kinds of different libraries or technologies that seem relevant.
Tensorflow-serving
, converting to C, different libraries by intel and others.
I'm wondering what is the bottom-line recommended way to execute a model as production-grade and as efficiently as possible.
...ANSWER
Answered 2020-Aug-29 at 16:42I'm not sure this has a canonical answer — as with many things there are lots of tradeoffs between different choices — but I'll attempt to give an answer.
I've been pretty happy using TensorFlow Serving to do model deployment, with separate services doing the business logic calling those models and doing something with the predictions. That provides a small boost because there won't be as much resource contention — the TensorFlow Serving instances do nothing but run the models. We have them deployed via Kubernetes, and that makes grouping a cluster of TensorFlow Serving instances very easy if you want to scale horizontally as well for more throughput.
You're unlikely to get meaningful improvements by messing around the edges with things like making sure the TensorFlow Serving deployment is compiled with the right flags to use all of Intel's vector instructions. The big boost is running everything in fast C++ code. The one (probably very obvious) way to boost performance is to run the inference on a GPU rather than a CPU. That's going to scale more or less the way you'd expect: the more powerful the GPU, the faster the inference is going to be.
There are probably more involved things you could do to eke our more single percentage point gains. But this strikes a pretty good balance of speed with flexibility. It's definitely a little bit more finicky to have this separate service architecture: if you're not doing something too complicated, it might be easier (if quite a bit slower) to use your models "as-is" in a Python script rather than going to the trouble of setting up TensorFlow serving. On the other hand, the speedup is pretty significant, and it's pretty easy to manage. On the other end of the spectrum, I have no idea what crazy things you could do to eke out more marginal performance gains, but instinct tells me that they're going to be pretty exotic, and therefore pretty difficult to maintain.
QUESTION
When an image is given as input to a semantic-segmentation model its output is a 2D array of values. Each value in that array represents an object that model thinks is present at that position in the original image. The array looks something like this:
...ANSWER
Answered 2020-Apr-30 at 03:38Got it!
I used matrix multiplication along with np.expand_dims:
QUESTION
This is the original image:
...ANSWER
Answered 2020-Apr-30 at 08:05bitwise_and takes 3 arguments. cv2.bitwise_and(src1, src2, mask)
QUESTION
I am trying to segment 4 lesions with semantic segmentation. I follow this this great post
My training folder has only 2 subfolders with patches: masks and images. Inside the folder with masks, ALL the classes are mixed. The other folder has the corresponding images. So, when I train the model ,it appears: ONE CLASS FOUND, just following the abovementioned post. The results are disappointing and I am wondering if I have to split the classes in the folders, and thus the model recognizes 4 classes instead of the one.
...ANSWER
Answered 2020-Apr-30 at 07:19What your really need to be attentive at is the way in which the masks are created.
It is possible that by default the ImageDataGenerator
in Keras to output the number of folders, regardless of how you manually build and adapt the ImageDataGenerator
for image segmentation instead of image classification.
My suggestion is to follow the entire post along and change nothing in the first instance. If you pay attention the final results obtained are quite good; this means that the dataset preparation process (mask creation) is correct.
QUESTION
Similar to the issue of The trained model can be deployed on the other platform without dependency of sagemaker or aws service?.
I have trained a model on AWS SageMaker by using the built-in algorithm Semantic Segmentation. This trained model named as model.tar.gz
is stored on S3. So I want to download this file from S3 and then use it to make inference on my local PC without using AWS SageMaker anymore. Since the built-in algorithm Semantic Segmentation is built using the MXNet Gluon framework and the Gluon CV toolkit, so I try to refer the documentation of mxnet and gluon-cv to make inference on local PC.
It's easy to download this file from S3, and then I unzip this file to get three files:
- hyperparams.json: includes the parameters for network architecture, data inputs, and training. Refer to Semantic Segmentation Hyperparameters.
- model_algo-1
- model_best.params
Both model_algo-1 and model_best.params are the trained models, and I think it's the output from net.save_parameters
(Refer to Train the neural network). I can also load them with the function mxnet.ndarray.load
.
Refer to Predict with a pre-trained model. I found there are two necessary things:
- Reconstruct the network for making inference.
- Load the trained parameters.
As for reconstructing the network for making inference, since I have used PSPNet from training, so I can use the class gluoncv.model_zoo.PSPNet
to reconstruct the network. And I know how to use some services of AWS SageMaker, for example batch transform jobs, to make inference. I want to reproduce it on my local PC. If I use the class gluoncv.model_zoo.PSPNet
to reconstruct the network, I can't make sure whether the parameters for this network are same those used on AWS SageMaker while making inference. Because I can't see the image 501404015308.dkr.ecr.ap-northeast-1.amazonaws.com/semantic-segmentation:latest
in detail.
As for loading the trained parameters, I can use the load_parameters
. But as for model_algo-1 and model_best.params, I don't know which one I should use.
ANSWER
Answered 2020-Mar-02 at 05:15The following code works well for me.
QUESTION
I am trying to use machine learning for semantic segmentation and I managed to find a way to get the proper one hot encoding (using this : https://www.jeremyjordan.me/semantic-segmentation/) however the code that I obtain is quite bad and I am certain that numpy has functionalities that could provide a more elegant solution.
The idea is the following: from a label array (88,240,240) creating a new array (88,240,240,3) with the proper values in each channel.
I came up with this:
...ANSWER
Answered 2019-Dec-23 at 01:30train_label_list
has values 0,1,2 and you want to expand it to 3 channels. Is that right?
QUESTION
Suppose I have one or multiple tiles consisting of a single pattern (e.g. materials like: wood, concrete, gravel...) that I would like to train my classifier on, and then I'll use the trained classifier to determine to which class each pixel in another image belong.
Below are example of two tiles I would like to train the classifier on:
And let's say I want to segment the image below to identify the pixels belonging to the door and those belonging to the wall. It's just an example, I know this image isn't made of exactly the same patterns as the tiles above:
For this specific problem, is it necessary to use convolutional neural networks? Or is there a way to achieve my goal with a shallow neural network or any other classifier, combined with texture features for example?
I've already implemented a classifier with Scikit-learn which works on tile pixels individually (see code below where training_data
is a vector of singletons), but I want instead to train the classifier on texture patterns.
ANSWER
Answered 2019-Nov-02 at 19:13You can use U-Net
or SegNet
for image segmentation. In fact you add residual layers to your CNN to get this result:
About U-Net:
Arxiv: U-Net: Convolutional Networks for Biomedical Image Segmentation
Seg-Net:
Arxiv: SegNet: A Deep Convolutional Encoder-Decoder Architecture for Image Segmentation
Here are Simple Examples of Codes: keras==1.1.0
U-Net:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install Semantic-Segmentation
You can use Semantic-Segmentation like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page