U-Net from scratch

gram: <p>Hi,</p>
<p>I am working on implementing U-Net from scratch with the same architecture as it’s in the paper, guess I have built the model correct, but the problem is the model accuracy won’t increase or the DICE Score.</p>
<p>You can refer my code from my GitHub page, <a href="https://github.com/vence-andersen/UNet-PyTorch" rel="noopener nofollow ugc">vence-andersen/UNet-PyTorch: A U-Net implementation from scratch. (github.com)</a></p>
<p>I am new to Deep Learning hence I am finding it difficult to troubleshoot this problem. Help is much appreciated, thanks in advance.</p>
<p>The model summary is below</p>
<h1>
<a name="layer-typedepth-idx-output-shape-param-1" class="anchor" href="#layer-typedepth-idx-output-shape-param-1"></a>==========================================================================================<br>
Layer (type:depth-idx)                   Output Shape              Param #</h1>
<h1>
<a name="sequential-1-1-1-64-568-568-conv2d-2-1-1-64-570-570-1792-relu-2-2-1-64-570-570-conv2d-2-3-1-64-568-568-36928-relu-2-4-1-64-568-568-maxpool2d-1-2-1-64-284-284-sequential-1-3-1-128-280-280-conv2d-2-5-1-128-282-282-73856-relu-2-6-1-128-282-282-conv2d-2-7-1-128-280-280-147584-relu-2-8-1-128-280-280-maxpool2d-1-4-1-128-140-140-sequential-1-5-1-256-136-136-conv2d-2-9-1-256-138-138-295168-relu-2-10-1-256-138-138-conv2d-2-11-1-256-136-136-590080-relu-2-12-1-256-136-136-maxpool2d-1-6-1-256-68-68-sequential-1-7-1-512-64-64-conv2d-2-13-1-512-66-66-1180160-relu-2-14-1-512-66-66-conv2d-2-15-1-512-64-64-2359808-relu-2-16-1-512-64-64-maxpool2d-1-8-1-512-32-32-sequential-1-9-1-1024-28-28-conv2d-2-17-1-1024-30-30-4719616-relu-2-18-1-1024-30-30-conv2d-2-19-1-1024-28-28-9438208-relu-2-20-1-1024-28-28-convtranspose2d-1-10-1-512-56-56-2097664-sequential-1-11-1-512-52-52-conv2d-2-21-1-512-54-54-4719104-relu-2-22-1-512-54-54-conv2d-2-23-1-512-52-52-2359808-relu-2-24-1-512-52-52-convtranspose2d-1-12-1-256-104-104-524544-sequential-1-13-1-256-100-100-conv2d-2-25-1-256-102-102-1179904-relu-2-26-1-256-102-102-conv2d-2-27-1-256-100-100-590080-relu-2-28-1-256-100-100-convtranspose2d-1-14-1-128-200-200-131200-sequential-1-15-1-128-196-196-conv2d-2-29-1-128-198-198-295040-relu-2-30-1-128-198-198-conv2d-2-31-1-128-196-196-147584-relu-2-32-1-128-196-196-convtranspose2d-1-16-1-64-392-392-32832-sequential-1-17-1-64-388-388-conv2d-2-33-1-64-390-390-73792-relu-2-34-1-64-390-390-conv2d-2-35-1-64-388-388-36928-relu-2-36-1-64-388-388-conv2d-1-18-1-1-388-388-65-2" class="anchor" href="#sequential-1-1-1-64-568-568-conv2d-2-1-1-64-570-570-1792-relu-2-2-1-64-570-570-conv2d-2-3-1-64-568-568-36928-relu-2-4-1-64-568-568-maxpool2d-1-2-1-64-284-284-sequential-1-3-1-128-280-280-conv2d-2-5-1-128-282-282-73856-relu-2-6-1-128-282-282-conv2d-2-7-1-128-280-280-147584-relu-2-8-1-128-280-280-maxpool2d-1-4-1-128-140-140-sequential-1-5-1-256-136-136-conv2d-2-9-1-256-138-138-295168-relu-2-10-1-256-138-138-conv2d-2-11-1-256-136-136-590080-relu-2-12-1-256-136-136-maxpool2d-1-6-1-256-68-68-sequential-1-7-1-512-64-64-conv2d-2-13-1-512-66-66-1180160-relu-2-14-1-512-66-66-conv2d-2-15-1-512-64-64-2359808-relu-2-16-1-512-64-64-maxpool2d-1-8-1-512-32-32-sequential-1-9-1-1024-28-28-conv2d-2-17-1-1024-30-30-4719616-relu-2-18-1-1024-30-30-conv2d-2-19-1-1024-28-28-9438208-relu-2-20-1-1024-28-28-convtranspose2d-1-10-1-512-56-56-2097664-sequential-1-11-1-512-52-52-conv2d-2-21-1-512-54-54-4719104-relu-2-22-1-512-54-54-conv2d-2-23-1-512-52-52-2359808-relu-2-24-1-512-52-52-convtranspose2d-1-12-1-256-104-104-524544-sequential-1-13-1-256-100-100-conv2d-2-25-1-256-102-102-1179904-relu-2-26-1-256-102-102-conv2d-2-27-1-256-100-100-590080-relu-2-28-1-256-100-100-convtranspose2d-1-14-1-128-200-200-131200-sequential-1-15-1-128-196-196-conv2d-2-29-1-128-198-198-295040-relu-2-30-1-128-198-198-conv2d-2-31-1-128-196-196-147584-relu-2-32-1-128-196-196-convtranspose2d-1-16-1-64-392-392-32832-sequential-1-17-1-64-388-388-conv2d-2-33-1-64-390-390-73792-relu-2-34-1-64-390-390-conv2d-2-35-1-64-388-388-36928-relu-2-36-1-64-388-388-conv2d-1-18-1-1-388-388-65-2"></a>├─Sequential: 1-1                        [-1, 64, 568, 568]        –<br>
|    └─Conv2d: 2-1                       [-1, 64, 570, 570]        1,792<br>
|    └─ReLU: 2-2                         [-1, 64, 570, 570]        –<br>
|    └─Conv2d: 2-3                       [-1, 64, 568, 568]        36,928<br>
|    └─ReLU: 2-4                         [-1, 64, 568, 568]        –<br>
├─MaxPool2d: 1-2                         [-1, 64, 284, 284]        –<br>
├─Sequential: 1-3                        [-1, 128, 280, 280]       –<br>
|    └─Conv2d: 2-5                       [-1, 128, 282, 282]       73,856<br>
|    └─ReLU: 2-6                         [-1, 128, 282, 282]       –<br>
|    └─Conv2d: 2-7                       [-1, 128, 280, 280]       147,584<br>
|    └─ReLU: 2-8                         [-1, 128, 280, 280]       –<br>
├─MaxPool2d: 1-4                         [-1, 128, 140, 140]       –<br>
├─Sequential: 1-5                        [-1, 256, 136, 136]       –<br>
|    └─Conv2d: 2-9                       [-1, 256, 138, 138]       295,168<br>
|    └─ReLU: 2-10                        [-1, 256, 138, 138]       –<br>
|    └─Conv2d: 2-11                      [-1, 256, 136, 136]       590,080<br>
|    └─ReLU: 2-12                        [-1, 256, 136, 136]       –<br>
├─MaxPool2d: 1-6                         [-1, 256, 68, 68]         –<br>
├─Sequential: 1-7                        [-1, 512, 64, 64]         –<br>
|    └─Conv2d: 2-13                      [-1, 512, 66, 66]         1,180,160<br>
|    └─ReLU: 2-14                        [-1, 512, 66, 66]         –<br>
|    └─Conv2d: 2-15                      [-1, 512, 64, 64]         2,359,808<br>
|    └─ReLU: 2-16                        [-1, 512, 64, 64]         –<br>
├─MaxPool2d: 1-8                         [-1, 512, 32, 32]         –<br>
├─Sequential: 1-9                        [-1, 1024, 28, 28]        –<br>
|    └─Conv2d: 2-17                      [-1, 1024, 30, 30]        4,719,616<br>
|    └─ReLU: 2-18                        [-1, 1024, 30, 30]        –<br>
|    └─Conv2d: 2-19                      [-1, 1024, 28, 28]        9,438,208<br>
|    └─ReLU: 2-20                        [-1, 1024, 28, 28]        –<br>
├─ConvTranspose2d: 1-10                  [-1, 512, 56, 56]         2,097,664<br>
├─Sequential: 1-11                       [-1, 512, 52, 52]         –<br>
|    └─Conv2d: 2-21                      [-1, 512, 54, 54]         4,719,104<br>
|    └─ReLU: 2-22                        [-1, 512, 54, 54]         –<br>
|    └─Conv2d: 2-23                      [-1, 512, 52, 52]         2,359,808<br>
|    └─ReLU: 2-24                        [-1, 512, 52, 52]         –<br>
├─ConvTranspose2d: 1-12                  [-1, 256, 104, 104]       524,544<br>
├─Sequential: 1-13                       [-1, 256, 100, 100]       –<br>
|    └─Conv2d: 2-25                      [-1, 256, 102, 102]       1,179,904<br>
|    └─ReLU: 2-26                        [-1, 256, 102, 102]       –<br>
|    └─Conv2d: 2-27                      [-1, 256, 100, 100]       590,080<br>
|    └─ReLU: 2-28                        [-1, 256, 100, 100]       –<br>
├─ConvTranspose2d: 1-14                  [-1, 128, 200, 200]       131,200<br>
├─Sequential: 1-15                       [-1, 128, 196, 196]       –<br>
|    └─Conv2d: 2-29                      [-1, 128, 198, 198]       295,040<br>
|    └─ReLU: 2-30                        [-1, 128, 198, 198]       –<br>
|    └─Conv2d: 2-31                      [-1, 128, 196, 196]       147,584<br>
|    └─ReLU: 2-32                        [-1, 128, 196, 196]       –<br>
├─ConvTranspose2d: 1-16                  [-1, 64, 392, 392]        32,832<br>
├─Sequential: 1-17                       [-1, 64, 388, 388]        –<br>
|    └─Conv2d: 2-33                      [-1, 64, 390, 390]        73,792<br>
|    └─ReLU: 2-34                        [-1, 64, 390, 390]        –<br>
|    └─Conv2d: 2-35                      [-1, 64, 388, 388]        36,928<br>
|    └─ReLU: 2-36                        [-1, 64, 388, 388]        –<br>
├─Conv2d: 1-18                           [-1, 1, 388, 388]         65</h1>
<h1>
<a name="total-params-31031745-trainable-params-31031745-non-trainable-params-0-total-mult-adds-g-16772-3" class="anchor" href="#total-params-31031745-trainable-params-31031745-non-trainable-params-0-total-mult-adds-g-16772-3"></a>Total params: 31,031,745<br>
Trainable params: 31,031,745<br>
Non-trainable params: 0<br>
Total mult-adds (G): 167.72</h1>
<h1>
<a name="input-size-mb-374-forwardbackward-pass-size-mb-102389-params-size-mb-11838-estimated-total-size-mb-114601-4" class="anchor" href="#input-size-mb-374-forwardbackward-pass-size-mb-102389-params-size-mb-11838-estimated-total-size-mb-114601-4"></a>Input size (MB): 3.74<br>
Forward/backward pass size (MB): 1023.89<br>
Params size (MB): 118.38<br>
Estimated Total Size (MB): 1146.01</h1>