You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AttributeError: 'deeptrack.deeplay' has no attribute 'Model' and RuntimeError with channel mismatch #242
I downloaded the 03. distinguishing_particles_in_brightfield_tutorial.ipynb from the tutorial and ran it locally. However, I encountered the following error when executing the code:
My pytorch version is 2.2.1 and python version is 3.11.5.
Is my modification to use dl.Regressor instead of dl.Model correct? If yes, how can I handle the RuntimeError related to channel mismatch in the following code?
In the deeplay tutorial, it's mentioned that the .fit() method handles training, validation, and logging, and also selects the best device (GPU if available). However, it seems to always train on the CPU. How can I force the training loop to run on the GPU?
I got the error: RuntimeError: expected scalar type Long but found Float .
The error seems to originate from: return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing) located in lighting\pytorch\trainer\trainer.py.
Could you help clarify how to resolve this issue? Is it related to the data type of the labels or inputs in the train_loader? Or is it a compatibility issue with the Lightning package? My lightning package version is 2.5.0.post0.
Activity
giovannivolpe commentedon Dec 27, 2024
It should work if you make the following additional changes:
and for the image prediction:
Please, check it and let us know if you need more help.
Note: We're in the process to adapt all examples to DeepTarck2 2.0.0 to accommodate the shift to torch and deeplay from TensorFlow and Keras.
Some already updated notebooks that might be relevant for you are here:
https://github.com/DeepTrackAI/DeepLearningCrashCourse/blob/main/Ch05_UNet/ec05_1_unet/unet.ipynb
https://github.com/DeepTrackAI/DeepLearningCrashCourse/blob/main/Ch05_UNet/ec05_A_qdots_localization/qdots_localization.ipynb
https://github.com/DeepTrackAI/DeepLearningCrashCourse/blob/main/Ch05_UNet/ec05_B_cell_counting/cell_counting.ipynb
giovannivolpe commentedon Dec 27, 2024
@LiYuan-SJTU We have now corrected the notebook and it's working. See: https://github.com/DeepTrackAI/DeepTrack2/blob/develop/examples/tutorials/03.%20distinguishing_particles_in_brightfield_tutorial.ipynb
LiYuan-SJTU commentedon Dec 28, 2024
Thank you for providing the updated version of
03. distinguishing_particles_in_brightfield_tutorial.ipynb. I’ve tried running the new version, but I encountered another issue.When executing the following line:
I got the error:
RuntimeError: expected scalar type Long but found Float.The error seems to originate from:
return torch._C._nn.cross_entropy_loss(input, target, weight, _Reduction.get_enum(reduction), ignore_index, label_smoothing)located inlighting\pytorch\trainer\trainer.py.Could you help clarify how to resolve this issue? Is it related to the data type of the labels or inputs in the train_loader? Or is it a compatibility issue with the Lightning package? My lightning package version is 2.5.0.post0.
Thanks again for your assistance!