Coding Phase 1.3
Hi!
Here, the 'model' is UNet and 'input' is the INDArray of input images.
Welcome back to my blog! This week I worked further on the implementation of U-Net using deeplearning4j. According to what was decided in the last meeting, there were two tasks I needed to focus primarily on:
1. Writing a function for model inference.
For model inferring using deeplearning4j, we can use
INDArray output = model.output(input)Here, the 'model' is UNet and 'input' is the INDArray of input images.
I used the code from
https://gist.github.com/AlexDBlack/3a4f58edcf243ef4d3faa73ee176eb04 as a template, which worked after introducing some relevant changes. I modified the original U-Net code by adding this function.
By now, it was certain that there was some problem with the code and maybe the model was not getting trained properly. So I changed some parameters (like learning rate) one by one and run the code again. Disappointingly, the output did not change.I now tried to run the code https://github.com/montardon/unetdl4j/blob/master/TrainUnetModel.java, as it seemed more likely to work. There were a few errors, which I was able to fix. After making all appropriate changes, I run this code with 100 images from our dataset over 5 epochs. This is the result. An improvement, I reckon......
.......but still, a long way to go.
https://gist.github.com/AlexDBlack/3a4f58edcf243ef4d3faa73ee176eb04 as a template, which worked after introducing some relevant changes. I modified the original U-Net code by adding this function.
2. Training the U-Net model on 100 images from the original dataset over 50 epochs.
As a precursor to training the model with 100 images, I decided to test the modified code first. I run it with 5 images from our dataset, over 5 epochs. I got a blank image.For further verification, I then trained the model with 100 images over 50 epochs (as instructed).
Unfortunately, the result was again a plain white, blank image.
The image was so very blank that I had to view it like this! |
By now, it was certain that there was some problem with the code and maybe the model was not getting trained properly. So I changed some parameters (like learning rate) one by one and run the code again. Disappointingly, the output did not change.
Inferred image v/s Ground truth |
After this, I finally decided to train the model on 100 images over 50 epochs.
I am now working on writing code for binarizing the image obtained as an output. Thanks to my mentors for their awesome guidance!
Will be back with further updates
Tạm biệt!
Comments
Post a Comment