-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[DOC] Adds Iñigo's blogposts of Weeks 1 and 2 #39
Merged
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
81d7cee
[DOC] Adds blogpost Iñigo's blogpost of Week 1
itellaetxe 7483a03
FIX: RCorrects bad RST URL syntax & deletes mentions to week 0 work
itellaetxe c6bfe87
DOC: Adds Iñigo's week 1 and 2 blogposts
itellaetxe 9ead66d
FIX: Single underscore instead of two for RST URLs
itellaetxe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
First Week into GSoC 2024: Building the AutoEncoder, writing the training loop | ||
============================================================================== | ||
|
||
.. post:: May 31 2024 | ||
:author: Iñigo Tellaetxe | ||
:tags: google | ||
:category: gsoc | ||
|
||
|
||
What I did this week | ||
~~~~~~~~~~~~~~~~~~~~ | ||
I finished becoming familiar with the TensorFlow + Keras basics and I wrote the training loop and a couple of scripts for instantiating and training the AutoEncoder. | ||
Data loading was also addressed and I am able to load the data from the FiberCup dataset in .trk format using `NiBabel <https://nipy.org/nibabel/>`__, transform it into NumPy arrays, and feed it into the network. | ||
|
||
What is coming up next week | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Because the training loop is taking too long, I will refactor the code to make it more modular and more in the TensorFlow style. Also, other DIPY models are implemented in this fashion, what will contribute to consistency across the library. | ||
I think I have yet to get the hang of the TensorFlow way of doing things. | ||
I plan to use a class for the ``Encoder`` and another one for the ``Decoder``. Then I will bring them together under an ``AutoEncoder`` class that inherits from the Keras ``Model`` class. | ||
This will allow me to use the ``fit`` method from the Keras ``Model`` class and make the training loop more efficient, together with easing its usage. I will just have all the relevant training parameters to the ``compile`` method, to later call the ``fit`` method to train the model, taking care of the weight updates more efficiently than my handmade training loop. | ||
|
||
Did I get stuck anywhere | ||
~~~~~~~~~~~~~~~~~~~~~~~~ | ||
Getting the handmade training loop up and running gave me a couple of headaches because the weight update was taking ages. I am still stuck here and that is why I will refactor the code next week. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
Second Week into GSoC 2024: Refactoring the AutoEncoder, preliminary results | ||
============================================================================ | ||
|
||
.. post:: June 7 2024 | ||
:author: Iñigo Tellaetxe | ||
:tags: google | ||
:category: gsoc | ||
|
||
|
||
What I did this week | ||
~~~~~~~~~~~~~~~~~~~~ | ||
This week I refactored the AutoEncoder code to match the design patterns and the organization of other Deep Learning models in the DIPY repo; and to make the training loop more efficient and easy to use. I transferred my code to a `separate repo <https://github.com/itellaetxe/tractoencoder_gsoc>`_ to keep the DIPY repo clean and to experiment freely. Once the final product is working, I will merge it into DIPY. I also packaged the whole repo so I can use it as a library. | ||
Training experiments were run for a maximum of a 150 epochs, with variable results. They are not amazing, but at least we get some reconstruction of the input tracts from FiberCup, which seems to be on the right track. I also implemented training logs that report the parameters I used for training, so I can reproduce the results at any time. This still needs work though, because not all parameters are stored. Need to polish! | ||
The left image shows the input tracts, and the middle and right images show two reconstructions from two different training experiments. | ||
|
||
.. image:: /_static/images/fibercup_preliminary_results.png | ||
:alt: Preliminary results of the AutoEncoder training for a subset of plausible fibers of the FiberCup dataset. | ||
:width: 600 | ||
|
||
What is coming up next week | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
With the help of my mentors, we identified possible improvements to the AutoEncoder training process. Yesterday I investigated how PyTorch weights are initialized in convolutional kernels and in Keras Dense layers using the `He Initialization <https://paperswithcode.com/paper/delving-deep-into-rectifiers-surpassing-human>`_. Using custom initializers, one can mimic the same behavior in TensorFlow, which I started to implement also yesterday. | ||
This week should focus on trying to reproduce the small implementation differences that might be causing the model to not converge as the PyTorch one. I will also try to finish implementing the He Initialization in TensorFlow. | ||
|
||
|
||
Did I get stuck anywhere | ||
~~~~~~~~~~~~~~~~~~~~~~~~ | ||
I got a bit stuck refactoring the code to match the DIPY design patterns and also with the TensorFlow implementation itself, because the output shape of the ``Encoder`` and the input shape of the ``Decoder`` were not matching. | ||
After investigating what caused this issue, I discovered that ``tf.shape`` was not giving me the usual (and expected) shape of the tensor, conveniently stored in a ``tuple``. I found this behavior strange, but I solved the problem just calling a ``.shape`` method on the Tensor, which does give me the shape tuple I needed. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Again, a single underscore is enough in links: https://www.sphinx-doc.org/en/master/usage/restructuredtext/basics.html#hyperlinks
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed, thanks :)