Closed tochenan closed 5 years ago
Hi Mingran,
Sorry for the late reply. For the problem you brought up here, the direct cause should be that intensity_filter(scmn) returns a column vector instead of a scalar, but this is in practice impossible to happen unless scmn is a matrix (for example), which also confuses me. If possible, do you mind sending me a small video clip, or instead you can help set a breakpoint on line 113 of pix_select and then check the dimension of scmn and intensity_filter(scmn). You can do so by skipping data concatenation and neural enhancing of course.
Sorry I could not access the file you shared.
I can access the data now, but is this dataset the one you tried and found the error message?
yes, that is the one I tried.
I tried to run min1pipe_HPc.m on the same video and the same error message seems to pop out
I tested the video, and with the parameters I chose (Fsi=20,Fsi_new=5,spatialr=0.5,se=5) I did not replicate the issue you mentioned, but it indeed led me to some other minor bug, which has been corrected. And I notice there are only 347 frames in your case but the video you gave me contains 1684 frames. Would you please share the parameters you used (however I do not think different parameters should matter).
I think I used the same parameter as you did. After running my video through min1pipe_HPC.m, I found the number of frames become 1684 frames. Hope that helps
weirdly, when I tried to run the program on the demo video, everything seems to be alright
Try running the video file with the updated package using min1pipe.m, and overwrite everything that already exists. See if you still have the same issue.
Hi Jinghao, I re-downloaded the program and ran the demo_min1pipe.m again and everything seems to be alright. However, when I was trying to run the same program on another video I had, I got the same error message. - quite confused by that
Since I cannot replicate the problem you have, I suggest you follow the debug process I described earlier, to really locate the issue you have on your machine. It confuses me as well.
Dear JinghaoLu, I ran into the same problem when trying _demomin1pipe.m (Fsi = 20; Fsi_new = 5; spatialr = 1; se = 5) on .avi files collected with the UCLA miniscope (in total 30 mins).
_intensityfilter(scmn) returns 0 (see below), therefore the dimensions dont match up:
_size (scmn)
ans = 18609 1
size (intensityfilter(scmn)) ans = 0 1
_idxuse3 = scmn > intensityfilter(scmn) Error using > Matrix dimensions must agree.
in _intensityfilter the variable tmpg has only negative values, therefore idthres = find(tmpg >= 0, 1) returns an empty value.
How I can solve this issue?
That's useful. I will have a look at it soon.
Dear JinghaoLu,
thanks for your fast response.
A quick update: on another recording from a different animal (same parameters but spatialr = 0.5) the script _demomin1pipe.m worked without any errors.
So maybe its due to the recording? On first glance, the .avis of the previous recording (where the script did not work) seem fine (same size, no drastic change in image quality) So I dont know what could be wrong with my previous recording.
Best,
Martin
Hi Jinghao Just an update of my situation, yesterday when I tried to run the program, the old error didn't pop out but a CUDA error occured :CUDA_ERROR_LAUNCH_FAILED: unspecified launch failure. In order to run another program on my computer, I downloaded CUDA9 and uninstalled CUDA 10, a different error took place when I tried to run demo_min1pipe.m: Error using gpuDevice (line 26) There is a problem with the graphics driver or with this GPU device. Be sure that you have a supported GPU and that the latest driver is installed.
Error in select_gpu (line 6) d = gpuDevice(i);
Error in frame_reg (line 49) select_gpu;
Error in min1pipe (line 103) [m, corr_score, raw_score, scl] = frame_reg(m, imaxy, se, Fsi_new, pixs, scl, sigma_x, sigma_f, sigma_d);
Error in demo_min1pipe (line 14) [fname, frawname, fregname] = min1pipe(Fsi, Fsi_new, spatialr, se, ismc, flag);
Error in run (line 91) evalin('caller', strcat(script, ';'));
Caused by: The graphics driver was found, but it is too old. The graphics driver on your system supports CUDA version 9. The required CUDA version is 10 or greater.
Is that due to the parallel processing toolbox requirement on the CUDA version? if it is, I am just wondering why I got the CUDA launch failure error
@martinjendryka I could not come up with any reason why tmpg is all negative, but I did land on some fixes that might help increase the robustness. The code is updated, and feel free to update after testing.
@tochenan Are you using matlab 2019? It requires version 10 for the parallel toolbox to work in this specific matlab version, so there is no other choice unless you downgrade to matlab 2018 or earlier if you have to keep CUDA version 9 or before.
hello Jinghao, sorry it is me again.
I fixed the CUDA problem and for a while min1pipe was working pretty well, however when I was running it with another video today, it gave me the following error message. Later I ran it with the demo data and it generated the same error
Done refinement, 0.56766 seconds Error using corr (line 91) Requires a data matrix X.
Error in sig_sim (line 36) sigcor = corr(datasmthf');
Error in seeds_merge (line 21) corrdata = sig_sim(datasmth, cutoff, pkcutoff, false);
Error in pix_select (line 178) [idusef, datasmthf, datusef, cutofff, pkcutofff] = seeds_merge(maxall, iduse, datuse, datasmth, cutoff, pkcutoff, sz, corrthres);
Error in min1pipe (line 125) [roi, sig, bg, bgf, seeds, datasmth0, cutoff0, pkcutoff0] = pix_select(m, mask, sz, Fsi_new, sigthres, corrthres);
Error in run (line 91) evalin('caller', strcat(script, ';'));
Sorry I cannot replicate the issue, but there seems to be some other problem that causes the datasmth to be empty. Based on the time spent in refinement, 0.56766, it seems the data variable is already empty from the beginning of the pix_select. You may want to check if required toolboxes are missing/removed accidentally, and run the code again on demo data with both overwrite flag to be "y".
thank you for the advice, I checked the toolbox installation and it seems that they are all present. I tried to run min1pipe_HPC.m on another video and it worked yesterday however when it is back to the video I ran originally yesterday, the same error popped up.
The following are the two output codes for the two videos:
one that is not working
min1pipe_HPC Redo the analysis? (y/n)y Overwrite raw .mat file (data)? (y/n)y Begin collecting datasets info Done collecting datasets info, time: 6.5241 Begin data cat 4100 Done data cat, time: 50.8975 Overwrite neural enhanced & registrated .mat file (data)? (y/n)y Begin dirts clean #1/1 batch Starting parallel pool (parpool) using the 'local' profile ... Connected to the parallel pool (number of workers: 8). Done frame #3200/4134 Done dirts clean #1/1 batch Begin anisotropic diffusion #1/1 batch done frame #4100/4134 Done anisotropic diffusion #1/1 batch Begin background removal #1/1 batch Done frame #3600/4134 Done background removal #1/1 batch Begin saving Ydebg #1/1 batch Done saving Ydebg #1/1 batch Elapsed time is 189.165357 seconds. Done neural enhancing, time 192.8102 Using GPU Device #1 Total Memory: 6987212390 Begin initial computation of translation score computed score of frame #4130/4134 Done initialization, 76.5602 seconds Begin intra-section Done intra-section, 399.3056 seconds Begin nonstable-section Done nonstable-LogDemons section # 135/146 Done nonstable-section, 489.9254 seconds Begin inter-section ... Done data prep Done loop #1/5 Done loop #2/5 Done loop #3/5 Done loop #4/5 Done loop #5/5 Done inter-section, 908.8925 seconds Begin final computation of translation score computed score of frame #4130/4134 Done frame reg, total time: 957.958 seconds Done randomized seeds init Elapsed time is 4.773213 seconds. Done coarse selection, 10.7196 seconds Done refinement, 11.0553 seconds Error using corr (line 91) Requires a data matrix X.
Error in sig_sim (line 36) sigcor = corr(datasmthf');
Error in seeds_merge (line 21) corrdata = sig_sim(datasmth, cutoff, pkcutoff, false);
Error in pix_select (line 178) [idusef, datasmthf, datusef, cutofff, pkcutofff] = seeds_merge(maxall, iduse, datuse, datasmth, cutoff, pkcutoff, sz, corrthres);
Error in min1pipe_HPC (line 124) [roi, sig, bg, bgf, seeds, datasmth0, cutoff0, pkcutoff0] = pix_select(m, mask, sz, Fsi_new, sigthres, corrthres);
the one that is working:
run min1pipe_HPC.m Begin collecting datasets info Done collecting datasets info, time: 5.058 Begin data cat Done data cat, time: 176.0628 Begin dirts clean #1/2 batch Done frame #2600/2960 Done dirts clean #1/2 batch Begin anisotropic diffusion #1/2 batch
done frame #2900/2960 Done anisotropic diffusion #1/2 batch Begin background removal #1/2 batch Done frame #2700/2960 Done background removal #1/2 batch Begin saving Ydebg #1/2 batch Done saving Ydebg #1/2 batch Begin dirts clean #2/2 batch Done frame #2300/2959 Done dirts clean #2/2 batch Begin anisotropic diffusion #2/2 batch done frame #2900/2959 Done anisotropic diffusion #2/2 batch Begin background removal #2/2 batch Done frame #2700/2959 Done background removal #2/2 batch Begin saving Ydebg #2/2 batch Done saving Ydebg #2/2 batch Elapsed time is 112.979956 seconds. Done neural enhancing, time 119.8014 Using GPU Device #1 Total Memory: 6987212390 Begin initial computation of translation score computed score of frame #5328/5919 Done initialization, 58.0721 seconds Begin intra-section Done intra_section # 970/972, batch 1/1 Done intra-section, 353.2144 seconds Begin nonstable-section Done nonstable-LogDemons section # 401/275 Done nonstable-section, 546.3257 seconds Begin inter-section ... Done data prep Done loop #1/5 Done loop #2/5 Done loop #3/5 Done loop #4/5 Done loop #5/5 Done inter-section, 1137.6825 seconds Begin final computation of translation score computed score of frame #5328/5919 Done frame reg, total time: 1203.7589 seconds Done randomized seeds init Elapsed time is 6.312901 seconds. Done coarse selection, 14.8114 seconds Done refinement, 16.0089 seconds Done #45/48 Done pix select, time: 56.9847 seconds Estimating the noise power for each pixel from a simple PSD estimate... done Done init, use 0.13769 seconds Done BPDN, use 19.4538 seconds Done postprocessing, use 20.526 seconds Done refine roi, total time: 23.9017 seconds 2 out of 48 components updated 5 out of 48 components updated 18 out of 48 components updated 48 out of 48 components updated 1 out of 48 components updated 3 out of 48 components updated 7 out of 48 components updated 19 out of 48 components updated 48 out of 48 components updated Done refine sig, 4.6874 seconds Done merge roi, 0.76863 seconds Done init, use 0.12934 seconds Done BPDN, use 21.33 seconds Done postprocessing, use 22.2851 seconds Done refine roi, total time: 25.6629 seconds 46 out of 46 components updated Done refine sig, 4.5231 seconds 46 out of 46 components updated Done merge roi, 0.76863 seconds Done init, use 0.12934 seconds Done BPDN, use 21.33 seconds Done postprocessing, use 22.2851 seconds Done refine roi, total time: 25.6629 seconds 1 out of 46 components updated 3 out of 46 components updated 7 out of 46 components updated 17 out of 46 components updated 46 out of 46 components updated 3 out of 46 components updated 8 out of 46 components updated 20 out of 46 components updated 46 out of 46 components updated Done refine sig, 4.5231 seconds 1 out of 46 components updated 3 out of 46 components updated 6 out of 46 components updated 18 out of 46 components updated 46 out of 46 components updated 2 out of 46 components updated 4 out of 46 components updated 7 out of 46 components updated 19 out of 46 components updated 46 out of 46 components updated Done refine sig, 70.2046 seconds Done all, total time: 1711.7789 seconds
Thanks for the message. I however gain no more idea on the specific cause of the problem based on the message, so I have to ask you to set some breakpoints and run the codes on the video that's not working: line 127, 153, 167, 178 in pix_select.m. Each time the codes pause, look for variable "datuse" and write down the size, and then press continue.
Hi Jinghao, I checked that the size of the matrix datuse is 15739*4134 at all the breakpoints, but after line 178 in pix_selection, it seems that the variable is no longer there
The size of datuse should be decreasing along the breakpoints, and the size you gave me seems the initial size at line 127. I guess either you did not run debugger the correct way, or if you described the observation correctly, there is something wrong in the skewness filter which is between line 167 and 178. Also it is still likely that other processing packages contain functions of the same name so the data are not processed correctly.
So I suggest make sure you correctly run the debugger first, otherwise you have to share the file with me again.
Hi Jinghao, Sorry I think I mistakenly took the size of datause rather than datuse. I checked it this morning and it seems that the size of datuse is 0*4134 at line 126 and it didn't change when I continue running the program.
I also copied the link to the video here, hope that helps.
Mingran
I tested the video, and it looks like there is a hidden issue occurring only to a few cases, that is buried deep in the codes which I now corrected it. Hope it solves the problem.
It worked! Thank you so much!!
Hi Jinghao, Recently I tried to run MIN1PIPE on one of my calcium imaging videos but get the following error code: (just copied everything I got from matlab here)
Overwrite raw .mat file (data)? (y/n)y Begin collecting datasets info Done collecting datasets info, time: 6.1569 Begin data cat 100 200 300 Done data cat, time: 9.3392 Begin dirts clean #1/1 batch Starting parallel pool (parpool) using the 'local' profile ... connected to 8 workers. Done frame #100/347 Done frame #200/347 Done frame #300/347 Done dirts clean #1/1 batch Begin anisotropic diffusion #1/1 batch done frame #200/347 done frame #100/347 done frame #300/347 Done anisotropic diffusion #1/1 batch Begin background removal #1/1 batch Done frame #100/347 Done frame #200/347 Done frame #300/347 Done background removal #1/1 batch Begin saving Ydebg #1/1 batch Done saving Ydebg #1/1 batch Elapsed time is 63.150927 seconds. Done neural enhancing, time 63.4863 Using GPU Device #1 Total Memory: 7006479974 Begin initial computation of translation score computed score of frame #70/347 computed score of frame #105/347 computed score of frame #35/347 computed score of frame #175/347 computed score of frame #140/347 computed score of frame #210/347 computed score of frame #315/347 computed score of frame #245/347 computed score of frame #280/347 Done initialization, 20.8758 seconds Begin intra-section Done intra_section # 12/64, batch 1/1 Done intra_section # 24/64, batch 1/1 Done intra_section # 6/64, batch 1/1 Done intra_section # 36/64, batch 1/1 Done intra_section # 18/64, batch 1/1 Done intra_section # 30/64, batch 1/1 Done intra_section # 48/64, batch 1/1 Done intra_section # 42/64, batch 1/1 Done intra_section # 60/64, batch 1/1 Done intra_section # 54/64, batch 1/1 Done intra-section, 49.9303 seconds Begin nonstable-section Done nonstable-LogDemons section # 16/20 Done nonstable-LogDemons section # 6/20 Done nonstable-LogDemons section # 10/20 Done nonstable-LogDemons section # 4/20 Done nonstable-LogDemons section # 12/20 Done nonstable-LogDemons section # 14/20 Done nonstable-LogDemons section # 20/20 Done nonstable-LogDemons section # 2/20 Done nonstable-LogDemons section # 18/20 Done nonstable-LogDemons section # 8/20 Done nonstable-section, 198.2327 seconds Begin inter-section ... Done data prep Done loop #1/3 Done loop #2/3 Done loop #3/3 Done inter-section, 394.9874 seconds Begin final computation of translation score computed score of frame #70/347 computed score of frame #175/347 computed score of frame #35/347 computed score of frame #105/347 computed score of frame #140/347 computed score of frame #245/347 computed score of frame #210/347 computed score of frame #280/347 computed score of frame #315/347 Done frame reg, total time: 399.557 seconds Done randomized seeds init Elapsed time is 3.669845 seconds. Error using > Matrix dimensions must agree.
Error in pix_select (line 113) idxuse3 = scmn > intensity_filter(scmn);
Error in min1pipe (line 125) [roi, sig, bg, bgf, seeds, datasmth0, cutoff0, pkcutoff0] = pix_select(m, mask, sz, Fsi_new, sigthres, corrthres);
Error in run (line 91) evalin('caller', strcat(script, ';'));
Do you have any suggestion to fix this? Thank you.
Mingran