Skip to content

babaee74/U-Net-1D

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Sure! Here's a revised version of your text that you can use for your GitHub page:


1D U-Net for Breathing Data Reconstruction

Welcome to my GitHub repository! This project is based on the paper titled "A new deep convolutional neural network design with efficient learning capability: Application to CT image synthesis from MRI" (link to the paper).

In this project, I have implemented a 1D version of the U-Net architecture using 1D convolution layers. Inspired by the paper's approach, I have incorporated a novel method of maxpooling and retaining the maxpooling indices as features. These features are then concatenated to the corresponding U-Net layers, enabling the reconstruction of the breathing data.

The goal of this project is to apply the adapted 1D U-Net model to the PhysioNet Challenge dataset (link to the dataset). The PhysioNet Challenge dataset provides a unique opportunity to reconstruct breathing data and tackle the challenges associated with physiological signal processing.

The Maxpool layer with indices was implemented from scratch:

def tf_max_pool_with_masks(x, 
                           ksize = [1,1,2,1], 
                           strides = [1,1,2,1], 
                           padding = "VALID", 
                           data_format='NHWC',
                           output_dtype=tf.dtypes.int64, 
                           include_batch_in_index=True):
  """
    x = input tensor of size BTC, B=Batch, T:Time step, C:Channel
    ksize: kernel size for each dim
    strides: strides of each dim
    data_format:channel last or not
    output_dtype: int64 or int32
    include_batch_in_index:An optional boolean. Defaults to True. Whether to include batch dimension in flattened index of argmax. 
  """
  input = tf.reshape(x, shape=(x.shape[0], 1, x.shape[1],x.shape[2]))
  output, argmax = tf.nn.max_pool_with_argmax(input, 
                                              ksize = [1,1,2,1], 
                                              strides = [1,1,2,1], 
                                              padding = "VALID", 
                                              data_format='NHWC',
                                              output_dtype=tf.dtypes.int64, 
                                              include_batch_in_index=True
                                              )
  
  #a = tf.reshape(output, shape=(-1,1))
  indices = tf.reshape(argmax, shape=(-1,1))
  input_flatten = tf.reshape(input, shape=(-1,1))
  tensor = tf.zeros_like(input_flatten, dtype=tf.float32)
  updates = tf.ones_like(indices, dtype=tf.float32)
  mask = tf.tensor_scatter_nd_update(tensor, indices, updates)
  mask = tf.reshape(mask, shape=x.get_shape().as_list())
  output = tf.reshape(output, shape=(output.shape[0],output.shape[2],output.shape[3]))
  return output, mask

I'm excited to share my progress on this project and hope that my adapted 1D U-Net model will prove effective in reconstructing the breathing data from the PhysioNet Challenge dataset. Feel free to explore the code and documentation in this repository. If you have any questions or suggestions, please don't hesitate to reach out.

Happy coding!


Feel free to customize and modify the text according to your preferences and specific details of your project. Good luck with your GitHub page and the development of your 1D U-Net model!

Releases

No releases published

Packages

No packages published