flatironinstitute / CaImAn-MATLAB

Complete Matlab pipeline for large scale calcium imaging data analysis
GNU General Public License v2.0
252 stars 147 forks source link

Error message in using demo_patches.m - Unable to read HDF5 file 'cnn_model.h5'. The error message was: 'The filename specified was either not found on the MATLAB path or it contains unsupported characters.'' #78

Closed hubhubhang closed 6 years ago

hubhubhang commented 6 years ago

demo_patches_512x512x6810_trial1 Estimating the noise power for each pixel from a simple PSD estimate... done No temporal downsampling is performed. Consider temporal downsampling if the recording is very long. Warning: Normalization by noise value is not performed since noise values are not provided. \n In initialize_components (line 67) In CNMF/initComponents (line 185) In CNMF/fit (line 392) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) starting resampling Initializing components with greedy method found 10 out of 50 neurons.. Estimating the noise power for each pixel from a simple PSD estimate... done No temporal downsampling is performed. Consider temporal downsampling if the recording is very long. Warning: Normalization by noise value is not performed since noise values are not provided. \n In initialize_components (line 67) In CNMF/initComponents (line 185) In CNMF/fit (line 392) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) starting resampling Initializing components with greedy method found 10 out of 50 neurons.. Estimating the noise power for each pixel from a simple PSD estimate... done No temporal downsampling is performed. Consider temporal downsampling if the recording is very long. Warning: Normalization by noise value is not performed since noise values are not provided. \n In initialize_components (line 67) In CNMF/initComponents (line 185) In CNMF/fit (line 392) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) starting resampling Initializing components with greedy method found 10 out of 50 neurons.. Estimating the noise power for each pixel from a simple PSD estimate... done No temporal downsampling is performed. Consider temporal downsampling if the recording is very long. Warning: Normalization by noise value is not performed since noise values are not provided. \n In initialize_components (line 67) In CNMF/initComponents (line 185) In CNMF/fit (line 392) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) starting resampling Initializing components with greedy method found 10 out of 50 neurons.. found 20 out of 50 neurons.. found 20 out of 50 neurons.. found 30 out of 50 neurons.. found 20 out of 50 neurons.. found 30 out of 50 neurons.. found 20 out of 50 neurons.. found 30 out of 50 neurons.. found 40 out of 50 neurons.. found 30 out of 50 neurons.. found 40 out of 50 neurons.. found 40 out of 50 neurons.. found 50 out of 50 neurons.. found 40 out of 50 neurons.. found 50 out of 50 neurons.. Refining initial estimates with HALS... done found 50 out of 50 neurons.. Refining initial estimates with HALS... done found 50 out of 50 neurons.. Refining initial estimates with HALS... done Warning: One or more ties for n-th place occurred when selecting objects. Some objects were not selected. In bwpropfilt (line 97) In bwareafilt (line 34) In parallel_function (line 478) In threshold_components (line 39) In update_spatial_components (line 181) In CNMF/updateSpatial (line 196) In CNMF/fit (line 393) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) Updated spatial components 10 out of total 50 temporal components updated Warning: One or more ties for n-th place occurred when selecting objects. Some objects were not selected. In bwpropfilt (line 97) In bwareafilt (line 34) In parallel_function (line 478) In threshold_components (line 39) In update_spatial_components (line 181) In CNMF/updateSpatial (line 196) In CNMF/fit (line 393) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) Warning: One or more ties for n-th place occurred when selecting objects. Some objects were not selected. In bwpropfilt (line 97) In bwareafilt (line 34) In parallel_function (line 478) In threshold_components (line 39) In update_spatial_components (line 181) In CNMF/updateSpatial (line 196) In CNMF/fit (line 393) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) Warning: One or more ties for n-th place occurred when selecting objects. Some objects were not selected. In bwpropfilt (line 97) In bwareafilt (line 34) In parallel_function (line 478) In threshold_components (line 39) In update_spatial_components (line 181) In CNMF/updateSpatial (line 196) In CNMF/fit (line 393) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) Updated spatial components 10 out of total 50 temporal components updated Warning: One or more ties for n-th place occurred when selecting objects. Some objects were not selected. In bwpropfilt (line 97) In bwareafilt (line 34) In parallel_function (line 478) In threshold_components (line 39) In update_spatial_components (line 181) In CNMF/updateSpatial (line 196) In CNMF/fit (line 393) In run_CNMF_patches>process_patch_object (line 386) In parallel_function>make_general_channel/channel_general (line 917) In remoteParallelFunction (line 46) Updated spatial components 10 out of total 50 temporal components updated 20 out of total 50 temporal components updated 30 out of total 50 temporal components updated 40 out of total 50 temporal components updated 50 out of total 50 temporal components updated 10 out of total 50 temporal components updated 20 out of total 50 temporal components updated 30 out of total 50 temporal components updated 40 out of total 50 temporal components updated 50 out of total 50 temporal components updated 10 out of total 50 temporal components updated 20 out of total 50 temporal components updated 30 out of total 50 temporal components updated 40 out of total 50 temporal components updated 50 out of total 50 temporal components updated 10 out of total 50 temporal components updated 20 out of total 50 temporal components updated 30 out of total 50 temporal components updated 40 out of total 50 temporal components updated 50 out of total 50 temporal components updated Error using importKerasNetwork (line 86) Unable to read HDF5 file 'cnn_model.h5'. The error message was: 'The filename specified was either not found on the MATLAB path or it contains unsupported characters.''

Error in cnn_classifier (line 46) net_classifier = importKerasNetwork(classifier,'ClassNames',["rejected","accepted"]);

Error in CNMF/CNNClassifier (line 250) [obj.keep_cnn,obj.val_cnn] = cnn_classifier(obj.A,obj.dims,classifier,obj.options.cnn_thr);

Error in CNMF/fit (line 396) obj.CNNClassifier('cnn_model.h5');

Error in run_CNMF_patches>process_patch_object (line 386) CNM.fit(Y,options,K);

Error in run_CNMF_patches (line 105) parfor i = 1:n_patches

Error in demo_patches_512x512x6810_trial1 (line 62) [A,b,C,f,S,P,RESULTS,YrA] = run_CNMF_patches(data,K,patches,tau,p,options);

hubhubhang commented 6 years ago

I do have a HDF5 file called "cnn_model.h5" in my package location, but the program is unable to read it.

epnev commented 6 years ago

@hubhubhang What is your matlab version? Do you encounter the same error as described here?

hubhubhang commented 6 years ago

My MATLAB version is R2018a. I will check the link tonight.

hubhubhang commented 6 years ago

I've just checked (using the command from that link), my HDF5 library version is

[ver_major,ver_minor,ver_patch] = H5.get_libversion ver_major = 1 ver_minor = 8 ver_patch = 12

And I've tried both running the codes "h5disp('swmr_test.h5')" and "h5disp('cnn_model.h5')". In both cases, I am encountering the same error as in the link you sent.

epnev commented 6 years ago

@hubhubhang I'm not sure what's wrong. I tried with many different MATLAB versions, including R2018a. In all cases I get same the library version as you

[ver_major,ver_minor,ver_patch] = H5.get_libversion ver_major = 1 ver_minor = 8 ver_patch = 12

but the file is read without any problems. Is the cnn_model.h5 located in your main CaImAn-MATLAB folder?

hubhubhang commented 6 years ago

Yes, I checked that cnn_model.h5 is located in my main CaImAn-MATLAB folder.

Maybe it's because the older version of HDF5 library still remain in your computer even after you installed R2018a?

Anyway, I can try to first use the format converting tools from the link you provided and see if it works. I will keep you posted. Thanks.

epnev commented 6 years ago

I'll see if I can try on a clean machine see if that's the reason.

epnev commented 6 years ago

In the meantime, you can also bypass this step as the code suggests.

epnev commented 6 years ago

@hubhubhang I also tried on a clean windows machine with a single matlab installation and it worked fine again with the same version of the HDF5 library

hubhubhang commented 6 years ago

I found the reason why not working.

I put my CaImAn-MATLAB folder on Dropbox and ran the calculation there, so there may be some synchronization problem due to Dropbox causing the download of the "cnn_model.h5" not complete. The size of "cnn_model.h5" downloaded when running the calculation on Dropbox is just 8872KB.

Then, I went to "cnn_classifier.m" and download the "cnn_model.h5" directly using the Dropbox link provided there. And then the size of the "cnn_model.h5" I downloaded is now 26,164KB, which I think it's the size of the complete file. I put this 26,164KB "cnn_model.h5" in the CaImAn-MATLAB folder manually and then the error message I saw has gone now.

FYI, I did try the suggestion in the link you sent above, but it's a bit complicated so I stopped and went to double check the download of the "cnn_model.h5" first.

Thanks again for the help.

epnev commented 6 years ago

Thanks for the update, glad it's working now.