-
Notifications
You must be signed in to change notification settings - Fork 386
PyTorch ver 1.0: keras 3.+ with pytorch backend for nn_models.py and … #1515
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
base: dev
Are you sure you want to change the base?
Conversation
…associated files, pytorch replaces tensorflow for Volpy's mrcnn folder, parts of cnmf, and components evaluation. Additional testing files implemented and added, and demo folders updated. Lastly, the new pytorch models (weights-layers converted from tensorflow) have been added
…ents_evaluation.py
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.
First batch of things.
If it's not too much effort, you can also consider adding type annotations to any new functions you feel like, but there's no real need for it, it'd just be nice (I can do it later if you don't want to)
]) | ||
display_table(table) | ||
fname = fnames[ind] | ||
return np.load(dir + fname)['img'], dir + fname |
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.
prefer os.path.join
caiman/utils/utils.py
Outdated
import inspect | ||
import h5py |
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.
These two somehow ended up out of alphabetical order
caiman/components_evaluation.py
Outdated
print(f"USING MODEL (tensorflow API): {model_file}") | ||
loaded_model = caiman.utils.utils.load_graph(model_file) | ||
raise FileNotFoundError(f"File for requested model {model_name} not found") | ||
print(f"Using model: {model_file}") |
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.
This probably should be using the logger rather than print
@@ -2009,8 +2020,7 @@ def get_candidate_components(sv, dims, Yres_buf, min_num_trial=3, gSig=(5, 5), | |||
gHalf=(5, 5), sniper_mode=True, rval_thr=0.85, |
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 know it's not necessarily code you added, but as I assume you've had to understand this function to rework it, any docs you could add to code-dense parts of this function that might help with understanding would be really useful
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.
Sounds good. I have some notes, so I could add them in.
…associated files, pytorch replaces tensorflow for Volpy's mrcnn folder, parts of cnmf, and components evaluation. Additional testing files implemented and added, and demo folders updated. Lastly, the new pytorch models (weights-layers converted from tensorflow) have been added
Description
PyTorch dependencies are added, Keras is updated to have PyTorch backend, and Tensorflow dependencies are removed. Models are updated into the
.pt
format and apytorch_model_arch.py
file is added which contains the model architecture for these two files. The Ring CNN model (which usescaiman.utils.nn_models.py
andcaiman.source_extraction.cnmf.online_cmf.py
has been updated for compatibility with torch and keras 3.+. Volpy's MRCNN module (and its respective files) have been updated with pytorch training, validation, and inferencing. Demo notebooks have been updated given these new changes.test_pytorch.py
is added to test the pytorch dependency withtest_tensorflow.py
removed, whiletest_mrcnn.py
has been updated to match the Volpy revisions.Fixes # (issue)
Dependency changes with revisions to Volpy, component evaluations, and Ring CNN.
Please delete options that are not relevant.
Branching
Has your PR been tested?
Yes, it has been tested.
If you're fixing a bug or introducing a new feature it is recommended you run the tests by typing
caimanmanager test
and
caimanmanager demotest
prior to submitting your pull request.
Please describe any additional tests that you ran to verify your changes. If they are fast you can also
include them in the folder 'caiman/tests/
and name them
test_***.py` so they can be included in our lists of tests.