-
Notifications
You must be signed in to change notification settings - Fork 6
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
Part 2: GAN for image translation #7
base: main
Are you sure you want to change the base?
Conversation
part_2/solution.py
Outdated
# %% [markdown] | ||
""" | ||
<div class="alert alert-info"> | ||
|
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.
since you are using mixed between html and markdown these don't render well in VSCode.
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.
Take a look at all the markdown cells
phase2nuclei_model.module.optimizer_D, | ||
) | ||
# %% | ||
train_model( |
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.
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
Cell In[12], line 2
1 # %%
----> 2 train_model(
3 opt,
4 phase2nuclei_model,
5 visualizer,
6 dataset_train,
7 dataset_val,
8 optimizer_G,
9 optimizer_D,
10 start_epoch,
11 epoch_iter,
12 writer,
13 )
File ~/data/06_image_translation/part2/GAN_code/GANs_MI2I/pix2pixHD/train_dlmbl.py:209, in train(opt, model, visualizer, dataset_train, dataset_val, optimizer_G, optimizer_D, start_epoch, epoch_iter, writer)
206 train_loss_D_fake, train_loss_D_real, train_loss_G_GAN, train_loss_G_Feat, train_loss_G_VGG, = train_epoch(opt, model, visualizer, dataset_train, optimizer_G, optimizer_D, total_steps, epoch, epoch_iter)
208 [val_loss_D_fake, val_loss_D_real, val_loss_G_GAN, val_loss_G_Feat, val_loss_G_VGG], virtual_stain, fluorescence, brightfield = val_epoch(opt, model, dataset_val)
--> 209 visualizer.results_plot(brightfield,fluorescence,virtual_stain,['Phase Contrast', 'Fluorescence', 'Virtual Stain'],writer,epoch,rows=brightfield.shape[0])
211 # Tensorboard Logging
212 epoch_discriminator = {'fake_is_fake': train_loss_D_fake, 'real_is_real': train_loss_D_real}
File ~/data/06_image_translation/part2/GAN_code/GANs_MI2I/pix2pixHD/util/visualizer.py:190, in Visualizer.results_plot(self, input_x, target, predictions, titles, writer, epoch, rows)
187 fig, axs = plt.subplots(input_x.shape[0], 3, figsize=(10, 30))
189 # Set the titles for each column
--> 190 axs[0, 0].set_title(titles[0])
191 axs[0, 1].set_title(titles[1])
192 axs[0, 2].set_title(titles[2])
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
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.
I suggest you split this visualizer and show the stuff 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.
Hi Ed I have commited the fix for this to the https://github.com/Tonks684/GANs_MI2I repo (Tonks684/GANs_MI2I@47c6344). It was due to the default batch being set to 1 (for speed of showing the training but the plot expected multiple images to display). The plot now works for batch size 1 and the default batch size has been set to 8 to show the students multiple images
…structions for using the same environment as part1
All packages are installed that are suggested. @edyoshikun are you aware of any other dependencies? |
- removing unecessary dependencies
Ah yes, good catch. I'll fix the coco-metrics dependency. I forgot in viscy we have the custom |
- fixing typos for plotting and tensorboard - typos for saving into the csv
- fixing paths on setup.sh and python
This PR has exercise 2 using the GAN approach. Ideally, this should be merged after #6 or merged into #6.
I put the previous PR here to see if someone else can reproduce my errors here.
Major Changes:
TODO:
part_1
beforepart_2
setup.sh
runs