# WNet segmentation for unsupervised Images

**WNet WNet segmentation **

This is a tensorflow implementation of **WNet segmentation** for unsupervised image segmentation. The architecture in **WNet**** segmentation** for unsupervised image classification based on shape that can be rebuilt Original input images and predictions of the segmentation Maps without labeling information.

W-Net architecture consists of an UEnc on the left and a corresponding UDec on the right. It contains 46 Convolutional layers are organized into 18 modules, marked with red rectangles. Each module is composed of two convolutional layers measuring 3 x 3. Layers. The network’s dense prediction base is made up of nine modules. The second 9 correspond to the reconstruction coder.

Two Unets are used to build the WNet. They act as an autoencoder, transforming image to segment map and then back to image. To improve segmentation, an additional soft normalized term is used in the implementation. The soft normalized cut measures how the segmentation maps aggregates. This measurement can be optimized to eliminate any noise or noisy fragments from the segmentation map. Please refer to the original paper for details of normalized cut.

The normalized cut measures how well the segmentation is.

(1) We calculate the weight connections between pixels by their respective positions in an image.

`(a) Distance between pixels, i.e. (R+G+B)/3.`

(b) Distances between pixels.

If pixels have strong connections, they are more likely to be of the same class.

(2) The weight connection is used to calculate the association and disassociation.

`(a) Associate: summation(weight_connected) within the class.`

(b) Disassociate: summation(weight_connected) between the class.

(c) Normalized cut stage = Disassociate / Associate

### UNet enhanced version:

Unsupervised Image segmentation and a proposal for a new deep architecture. The ideas from supervised Semantic segmentation methods include concatenating two fully-convolutional networks into one, and in particular using convolutional networks to concatenate them together into an. Autoencoder – one for decoding and one to encode. The encoding layer generates a k-way prediction pixelwise, Both the reconstruction error and the autoencoder’s error in the coder are included The normalized cut made by the encoder is jointly Training can be reduced to a minimum. Combining with the appropriate Our algorithm’s postprocessing involved hierarchical segmentation and conditional random field smoothing. Outperforms many other competitors in benchmark Berkeley Segmentation Data Set. **Encoder-Decoder:**

One of the most well-known and widely used encoder-decoders is Methods used in unsupervised feature-learning Enc maps the input (e.g., an image patch) to a code. An image patch) to a Compact feature representation and then the decoder Dec . The input is reproduced from its lower-dimensional representation. This paper describes how an encoder is designed to map the input to a dense segmentation layer that uses pixelwise segments. The same spatial dimension as a low-dimensional one. The decoder then reconstructs the prediction layer densely.

### Run Program :

```
(1) This code was tested using tensorflow1.9 and python3.6. It also uses
a GTX1080 graphics card. Please refer the [FCN code by shekkizh]
(https://github.com/shekkizh/FCN.tensorflow) for further enviroment.
```

### Results:

You can perform unsupervised image segmentation with or without soft normalized cuts.

(1) This work involved the testing of 5 modules **WNet segmentation**.

(2) VOC2012 image resized to 128 * 128 pixels to limit memory.

(3) The Wnet is the first train to have a 0.65 dropout rate for 50000 iterations. After that, retrain with 0.3 and go on for 50000 more.

(5) Every 10000 iterations, the learning rate is cut by half.

** Visit for more** : https://arxiv.org/abs/1711.08506

The UEnc consists in a contracting pathway (the first half). To capture context and an corresponding expansive path (the(second half) that allows precise localization as in the original UNet architecture. An initial step in the contracting process is to Initial module that performs convolution of input images. The output sizes for an example input image resolution is 224×224 in the figure. Modules can be connected We double the number of a maximum-pooling layer by using 2 x 2.Each downsampling step features channel. Modules are connected by transposed 2D convolution layers in the vast path. At this point, we have halved the number of feature channel. Each step of upsampling. The input to the U-Net model is the same as in the UNet model. Each module of the contracting pathway is also bypassed. Output of the corresponding module in an expansive path recover lost spatial information due to downsampling. The Final convolutional layer of UEnc is a 1-x-1 convolution The softmax layer is then followed by the 1×1 convolution maps. The 1×1 convolution maps Each 64-component feature vector is to be used in the desired number Classes K are rescaled by the softmax layer. The range contains the elements of K-dimensional output.(0,1) and sum up to 1. The architecture of the UDec looks similar except that it reads the output from the UEncThe size of 224x224xK. The UDec is a convolution 1 x 1 to map 64-components Reconstruction of the original input using feature vector