Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

ImportError: cannot import name 'NiftiDataset' from 'monai.data' (/usr/local/lib/python3.7/dist-packages/monai/data/__init__.py) #2886

Closed
Sebagam opened this issue Sep 3, 2021 · 18 comments
Labels
question Further information is requested

Comments

@Sebagam
Copy link

Sebagam commented Sep 3, 2021

Hi all,

When trying to run MONAI on google colab:

ImportError: cannot import name 'NiftiDataset' from 'monai.data' (/usr/local/lib/python3.7/dist-packages/monai/data/init.py)

This issue was not present a few months ago.

Best,
Sebastian

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 3, 2021

Hi @Sebagam ,

Thanks for your interest here.
We already changed it to ImageDataset in v0.5.

Thanks.

@Nic-Ma Nic-Ma added the question Further information is requested label Sep 3, 2021
@Sebagam
Copy link
Author

Sebagam commented Sep 3, 2021

Ok, thanks.
It looks that I have other compatibility issues.
How can I install v0.4?

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 3, 2021

Maybe you can try pip install monai==0.4.0?

Thanks.

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 3, 2021

But I strongly suggest you to update with MONAI v0.6 as we integrated many enhancements.

Thanks.

@Sebagam
Copy link
Author

Sebagam commented Sep 4, 2021 via email

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 5, 2021

Hi @Sebagam ,

If you check the error log, you can find that the data shape is wrong:
Shape: (1, 166, 256, 256, 1)
Actually your data already has channel dim at the last dim, you should not use AddChannel transform, you can use EnsureChannelFirst or AsChannelFirst transform.

Thanks.

@Sebagam
Copy link
Author

Sebagam commented Sep 6, 2021 via email

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 6, 2021

Hi @Sebagam ,

I think maybe it's some PyTorch multi-processing issue? Can you try again with num_workers=0?

Thanks.

@Sebagam
Copy link
Author

Sebagam commented Sep 8, 2021 via email

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 8, 2021

Hi @Sebagam ,

Seems something wrong with your data shape?
Could you please help add EnsureChannelFirst transform at the beginning of your transform chain?

Thanks.

@Sebagam
Copy link
Author

Sebagam commented Sep 9, 2021 via email

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 9, 2021

Hi @Sebagam ,

As you are using array-based transforms instead of dict-based transforms, it may not work well.
Could you please help change to AsChannelFirst transform?

Thanks.

@Sebagam
Copy link
Author

Sebagam commented Sep 9, 2021 via email

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 9, 2021

I think maybe you can print out the model predictions, see whether it's overfitting?
@wyli @ericspod Could you guys help please share some comments about the training status?

Thanks in advance.

@Sebagam
Copy link
Author

Sebagam commented Sep 9, 2021 via email

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 9, 2021

I think you can turn off all the warnings, referring to:
https://stackoverflow.com/questions/14463277/how-to-disable-python-warnings

Thanks.

@Sebagam
Copy link
Author

Sebagam commented Sep 10, 2021 via email

@Nic-Ma
Copy link
Contributor

Nic-Ma commented Sep 10, 2021

Hi @wyli ,

Do you know something about this Nibabel warning?

Thanks in advance.

@Project-MONAI Project-MONAI locked and limited conversation to collaborators Sep 13, 2021
@wyli wyli closed this as completed Sep 13, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants