NifTK / NiftyNet

[unmaintained] An open-source convolutional neural networks platform for research in medical image analysis and image-guided therapy
http://niftynet.io
Apache License 2.0
1.36k stars 404 forks source link

Added GAN parameter for logging generated images to Tensorboard #477

Open javierbg opened 4 years ago

javierbg commented 4 years ago

Status

WORK IN PROGRESS

Description

The goal of this change is to add a new parameter to the GAN application in order to log 2D views of 3D images in Tensorboard. It adds a tensorboard_n_fake_images argument to the GAN section, with a default of zero. This is the number of images that will be logged to Tensorboard at each training logging step (tensorbard_every_n), 3 views (sagittal, coronal and axial) for each image.

This was already implemented in segmentation tasks, but not GAN. Some of the implementation decissions previously taken have affected the way this was implemented, so as to not break previous work: I've only added, not modified.

In particular the max_out parameter in niftynet.io.misc_io.image3, and the max_outputs parameter in niftynet.io.misc_io.image3_sagittal, niftynet.io.misc_io.image3_axial and niftynet.io.misc_io.image3_coronal has made it a little difficult to implement. This has introduced some code repetition: as far as I know, it's not possible to pass this argument to OutputsCollector.add_to_collection, so new functions without these arguments needed to be created.

In my opinion, this parameter could be removed and just take a slice of the tensor to log before passing it in, like I've done in GANApplication, but I don't have the necessary knowledge about previous code to assess this well.

Types of changes

Todos

Impacted Areas in Application

List general components of the application that this PR will affect: