Click4Ai

342.

Hard

Implement a U-Net architecture for image segmentation. A U-Net is a type of convolutional neural network (CNN) that is commonly used for image segmentation tasks. It consists of an encoder and a decoder, where the encoder is used to extract features from the input image and the decoder is used to upsample the features to the original image size. The U-Net architecture is particularly useful for segmenting images with small objects and textures.

**Example:** Given an input image, segment out the objects of interest.

**Constraints:** Use a U-Net architecture with a contracting path and an expansive path. Use a convolutional neural network (CNN) as the encoder and a transposed convolutional neural network (TCNN) as the decoder.

Test Cases

Test Case 1
Input: [[1, 2], [3, 4]]
Expected: [[0.5, 0.5], [0.5, 0.5]]
Test Case 2
Input: [[5, 6], [7, 8]]
Expected: [[0.75, 0.75], [0.75, 0.75]]
+ 3 hidden test cases