MLP model in image segmentation - image-segmentation

I am working on the MLP mixer model which should be applied into transportation infrastructure image segmentation. Can anyone provide me with proper MLP mixer model which can be particularly used in transportation infrastructure image segmentation (road,sidewalk etc) ?

Related

CNN as a backbone of U-net using segmentation models library

I’ve a confusion regarding using CNN (VGG, ResNet) as a backbone of U-net. I’m using segmentation model library for using VGG and ResNet as a backbone. My input shape is 512x512x3. As far I’ve understood in U-net the skip connection is used in before every layer where a downsampling happes (example: maxpool for VGG or conv with 2x2 stride for ResNet).But, in the model summary for both VGG and ResNet based backbone I’m seeing the skip connection is there from the second downsampling (256x256x64) but there is no skip connection from the 512 resolution. Can someone explain the reasons? I’ve added the detailed model diagram for reference.
I was following this code, https://github.com/bnsreenu/python_for_microscopists/blob/master/214_multiclass_Unet_sandstone_segm_models_ensemble.py.
Thanks in advance.

CNN feed forward or back propagtion model

Is convolutional neural network (CNN) a feed forward model or back propagation model. I get this confusion by comparing the blog of DR.Yann and Wikipedia definition of CNN.
A convolutional neural net is a structured neural net where the first several layers are sparsely connected in order to process information (usually visual).
A feed forward network is defined as having no cycles contained within it. If it has cycles, it is a recurrent neural network. For example, imagine a three layer net where layer 1 is the input layer and layer 3 the output layer. A feed forward network would be structured by layer 1 taking inputs, feeding them to layer 2, layer 2 feeds to layer 3, and layer 3 outputs. A recurrent neural net would take inputs at layer 1, feed to layer 2, but then layer two might feed to both layer 1 and layer 3. Since the "lower" layer feeds its outputs into a "higher" layer, it creates a cycle inside the neural net.
Back propagation, however, is the method by which a neural net is trained. It doesn't have much to do with the structure of the net, but rather implies how input weights are updated.
When training a feed forward net, the info is passed into the net, and the resulting classification is compared to the known training sample. If the net's classification is incorrect, the weights are adjusted backward through the net in the direction that would give it the correct classification. This is the backward propagation portion of the training.
So a CNN is a feed-forward network, but is trained through back-propagation.
In short,
CNN is feed forward Neural Network.
Backward propagation is a technique that is used for training neural network.
Similar to tswei's answer but perhaps more concise.
A convolutional Neural Network is a feed forward nn architecture that uses multiple sets of weights (filters) that "slide" or convolve across the input-space to analyze distance-pixel relationship opposed to individual node activations.
Backward propagation is a method to train neural networks by "back propagating" the error from the output layer to the input layer (including hidden layers).

Make any keras network convolutional

The circumstances remaining an abstraction, I need to train a convolutional network and then run this convolutional network over a sliding window on an image. The goal will be to build a heatmap for making pixel perfect detection boundaries for certain objects.
I'm wondering if there is an easy way in keras to train a network and then turn it into a convolutional network without needing to run loops over an image, which is very slow?
I'm thinking I can just copy the trained convolutional filters into a larger convolutional network.
If not, I'll need to go directly to tensorflow.
This is easily done in Keras, as long as you use a fully convolutional net, i.e. replace any dense layers by a convolutional layer with kernel size 1.
The easiest way to get started is to use one of the pre-trained nets included in Keras, see https://keras.io/applications/ how this is done for custom input size. If you've trained your own fully convolutional net 'old_model', just do:
new_input = Input(new_size)
new_model = Model(new_input, old_model.output)
old_model.save_weights('w.h5')
new_model.get_weights('w.h5')

Caffe: Initializing two channels of siamese networks with the same pretrained weights , but without sharing weights during training

I was trying to implement the siamese network described in "Seeing the Forest from the Trees: A Holistic Approach to Near-infrared
Heterogeneous Face Recognition, CVPRW 2016". The approach involves initialising the two channels of siamese network with the same pretrained weights of a single channel model. This is pretty straigtforward in caffe when the weights are shared. But I'm looking to implement it in such a way that the weights are not shared (has to learn together without the same weights by employing the contrastive loss as mentioned in the above paper, but the initializations on both channels has to be the same). I couldn't find a way to implement it in caffe. Any of you have any suggestions for neat approaches or hacks to do this in caffe?
Thanks.
You can load source and siamese destination model in python using caffe :
netSrc = caffe.Net('deploySrc.prototxt',
'src.caffemodel',
caffe.TEST)
netDst = caffe.Net('deployDst.prototxt',
'dst.caffemodel',
caffe.TEST)
Then you can assign per layer weights from source to destination. Say you want to copy layer conv from source to convA and convB copies in siamese network:
netDst.params['convA'] = netSrc.params['conv']
netDst.params['convB'] = netSrc.params['conv']
Then save results to new caffemodel :
netDst.save('dstInitialized.caffemodel')

Tensorflow class balancing for training multi-class classification network

I am training a classification neural network for multiple classes. I have very imbalanced classes (80:10:5:5 ratio approximately). I want to use some kind of weight balancing in the loss function to prevent the neural network from overly predicting for the majority class. Does anybody know how to do the class balancing in Tensorflow?
P.S. I cannot solve this by over-sampling the minority classes because I am training a convolutional-deconvolutional neural network that does medical image segmentation. Each pixels is assigned to a distinct class in this task. I cannot over sample pixels in this task.
Thanks a lot!:D
Than