Skip to content
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

Error in U-Net_2D_Multilabel_ZeroCostDL4Mic.ipynb: IndexError: list index out of range #52

Open
jazberna1 opened this issue Aug 26, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@jazberna1
Copy link

I get the following error in section 5.1 Generate prediction(s) from unseen dataset when running the notebook U-Net_2D_Multilabel_ZeroCostDL4Mic.

IndexError: list index out of range

The error happens in function_29, in the following line:

print('Model input size: '+str(Input_size[0])+'x'+str(Input_size[1]))

I believe what is happening here is that Input_size is [(None, 256, 256, 1)], where Input_size[0] is the None (the batch size)

If comment the Input_size everywhere in the function I am able to get the predictions:
Screenshot 2024-08-26 at 21 57 46

To Reproduce
I have run the following sections of the notebook:

  1. Install U-Net dependencies
    1.1. Load key dependencies
  2. Select your parameters and paths
    2.1. Setting main training parameters
    2.2. Data augmentation
    Here I disable Use_Data_augmentation
    2.3. Using weights from a pre-trained model as initial weights
  3. Using the trained model
    5.1 Generate prediction(s) from unseen dataset
    Here in setion 5.1 is where I get the error.

Describe the bug
See beginning of the message

Expected behavior
Get model predictions

Screenshots
Screenshot 2024-08-26 at 21 59 47

Desktop (please complete the following information):

  • OS: macOS Monterey
  • Browser: chrome
  • Version: chrome version 127.0.6533.122

My version of the notebook is:

6. Version log
v2.1.2:

Correct for data loading to avoid .DS_Store or similar
v2.1.1:

Replaced all absolute pathing with relative pathing
v2.1:

Updated to TensorFlow 2.11
Updated to fpdf2 and add lines to ensure a proper format. Correct keras package version parsing.

Smartphone (please complete the following information):
Does not apply

@jazberna1 jazberna1 added the bug Something isn't working label Aug 26, 2024
@github-staff github-staff deleted a comment Aug 27, 2024
@IvanHCenalmor
Copy link
Collaborator

Hello @jazberna1,

Sorry for the delay, it has been a really busy week 😅
Seems like the code it's failing when getting the input size, I will take a look to the notebook in ZeroCostDL4Mic.
I will see if I can reproduce the error and fix it, when I manage to solve the issue I will let you know here with another comment 🤗

One quick question to try to reproduce the error, when using section 2.3. Using weights from a pre-trained model as initial weights. Did you used any previous weights?

Thank you for reporting the bug! ❤️

@jazberna1
Copy link
Author

Hello Ivan,

Thanks for coming back to me.
To your question:
when using section 2.3. Using weights from a pre-trained model as initial weights. Did you used any previous weights?

In section 2.3 I have:
Screenshot 2024-08-29 at 14 56 43

Then I go straight to 5.1 Generate prediction(s) from unseen dataset where I have:
Screenshot 2024-08-29 at 14 58 22

Inside the results folder I have unet_2d_multlilabel/weights_best.hdf5 so like this:
results/unet_2d_multlilabel/weights_best.hdf5

Then I comment out the line to avoid the error:
print('Model input size: '+str(Input_size[0])+'x'+str(Input_size[1]))

click 'Load and run' and get the predictions:
Screenshot 2024-08-29 at 15 04 10

Hope this helps!
Jorge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants
@jazberna1 @IvanHCenalmor and others