# Spinal Cord Segmentation in Ultrasound Medical Imagery
## 3 Proposed Method
### DenseNets and Fully Convolutional DenseNets  
In 2017, [PERSON] et al. [27] proposed the architecture of Densely Connected Convolutional Networks (or DenseNet) for image classification tasks. In this network, every layer is connected to every other layer in a feed-forward manner. Consequently, the input of every layer contains a concatenation of the feature maps of all preceding layers. Also, its own feature map is used as input in all subsequent layers. The network outperforms the state of the art networks on image classification problem, making it a strong feature extractor that can be used as a building block for other tasks like semantic segmentation. The network presents many advantages over its competitors. It mitigates the vanishing-gradient problem and reinforces feature propagation and reuse with smaller number of parameters. The architecture of the Dense block in Densenet is illustrated in Figure 6.  
Formally, if we consider an image \(x_{0}\) that passes through the DenseNet network that contains \(L\) layers. Each layer applies a transformation \(F_{l}()\) with \(l\) refers to the layer index. \(F_{l}()\) is composed of Convolution, Batch Normalization [24], ReLU [28] and Pooling [29]. If we set \(x_{l}\) as the output of the \(l\)th layer, \(x_{l}=F_{l}(x_{l-1})\) for the traditional convolutional network. But in the dense block of the Densenet architecture, the \(l\)th layer of receives as input the feature map of all the preceding layers as expressed in Equation (3):  
\[x_{l}=F_{l}([x_{0},x_{1},...,x_{l-1}]), \tag{3}\]  
where \([x_{0},x_{1},...,x_{l-1}]\) is the concatenation of the feature maps generated in the preceding layers.  
Figure 5: Spinal Cord semantic segmentation using U-Net architecture.  
Figure 6: Dense block in DenseNet architectureThe architecture of Densenet is reused within the semantic segmentation context in the algorithm Fully Convolutional DenseNet (or FC-DenseNet) [30] by merging it inside an U-Net like model. The architecture of FC-Densenet is illustrated in Figure 7. The encoder path of FC-DenseNet corresponds to a DenseNet network that contains dense blocks separated by normal layers (Convolutions, Batch normalization, ReLu, and pooling). These normal layers form the transition down block that reduces the spatial resolution of each feature map using the pooling operation. The last layer of the encoder path is denoted as the bottleneck of the network. FC-Densenet adds a decoder path that aims to recover the original spatial resolution of the image. This decoder part contains Dense Blocks separated by Transition up blocks. The Dense blocks are similar to their corresponding Dense blocks in the encoder. The Transition Up block contains the up-sampling operations (transposed convolutions) necessary to compensate the down-sampling operations (pooling) in the encoder path. Similarly to U-Net, the Dense block of the two paths are connected by skip connections to guide the reconstruction of the input spatial resolution through the up-sampling part of the network. We can note that in the down-sampling path, the output of the dense block is concatenated to the output of the previous transition block to form the input for the next Transition down block. This operation is not used in the up-sampling path to reduce computations because already we have skip connection concatenated to every Dense Block input. The last layer in FC-Densenet is a 1 \(\times\) 1 convolution followed by a softmax layer to generate for every pixel the per class distribution. The network is trained using cross-entropy loss calculated in a pixel-wise manner. The network can be trained from scratch without the need to train a feature extractor on external data as done in many state of the art segmentation algorithms. In our study, FC-DenseNet is proven to be the best tested algorithm in segmenting spinal cord when the pattern is already learned inside the training set. In this cases study, it outperforms U-Net.