|
860 | 860 | " <h4>Task 6: U-Net Implementation</h4>\n", |
861 | 861 | " <p>Now we will implement our U-Net! We have written some of it for you - follow the steps below to fill in the missing parts.</p>\n", |
862 | 862 | " <ol>\n", |
863 | | - " <li>Declare a list of encoder (left) and decoder (right) ConvBlocks. Carefully consider the input and output feature maps for each ConvPass!</li>\n", |
| 863 | + " <li>Declare a list of encoder (left) and decoder (right) ConvBlocks. Carefully consider the input and output feature maps for each ConvPass!\n", |
| 864 | + " <ul>\n", |
| 865 | + " <li><strong>Hint:</strong> Consider implementing helper functions to calculate the encoder and decoder blocks separately - this will make your code more readable and easier to debug.</li>\n", |
| 866 | + " </ul>\n", |
| 867 | + " </li>\n", |
864 | 868 | " <li>Declare an Upsample, Downsample, CropAndConcat, and OutputConv block.</li>\n", |
865 | 869 | " <li>Implement the <code style=\"color: black\">forward</code> function, applying the modules you declared above in the proper order.</li>\n", |
866 | 870 | " </ol>\n", |
|
943 | 947 | " # TASK 6.1A: Initialize list here\n", |
944 | 948 | " # Loop through each level of the encoder from top (level=0) to bottom (level=self.depth - 1)\n", |
945 | 949 | " for level in range(self.depth): \n", |
946 | | - " # conv = \n", |
| 950 | + " input_features,output_features = ...\n", |
| 951 | + " conv = ...\n", |
947 | 952 | " # Adding conv module to the list\n", |
948 | 953 | " self.left_convs.append(conv)\n", |
949 | 954 | " # right convolutional passes\n", |
|
952 | 957 | " # Loop through each level of the decoder from top (level=0) to one above bottom (level=self.depth - 2)\n", |
953 | 958 | " for level in range(self.depth - 1):\n", |
954 | 959 | " # Initialize conv module\n", |
955 | | - " # conv = \n", |
| 960 | + " input_features,output_features = ...\n", |
| 961 | + " conv = ... \n", |
956 | 962 | " # Adding conv module to the list\n", |
957 | 963 | " self.right_convs.append(conv)\n", |
958 | 964 | " \n", |
|
973 | 979 | " # TASK 6.3C: Implement decoder here\n", |
974 | 980 | " ...\n", |
975 | 981 | " # TASK 6.3D: Apply the final convolution and return the output\n", |
976 | | - " return" |
| 982 | + " return\n", |
| 983 | + "\n", |
| 984 | + " def compute_fmaps_encoder(self, level: int) -> tuple[int, int]:\n", |
| 985 | + " \"\"\"Compute the number of input and output feature maps for\n", |
| 986 | + " a conv block at a given level of the UNet encoder (left side).\n", |
| 987 | + " \"\"\"\n", |
| 988 | + " return ...\n", |
| 989 | + " \n", |
| 990 | + " def compute_fmaps_decoder(self, level: int) -> tuple[int, int]:\n", |
| 991 | + " \"\"\"Compute the number of input and output feature maps for a conv block\n", |
| 992 | + " at a given level of the UNet decoder (right side).\n", |
| 993 | + " \"\"\"\n", |
| 994 | + " \n", |
| 995 | + " return ..." |
977 | 996 | ] |
978 | 997 | }, |
979 | 998 | { |
|
0 commit comments