DrCoffey / DeepSqueak

DeepSqueak v3: Using Machine Vision to Accelerate Bioacoustics Research
BSD 3-Clause "New" or "Revised" License
369 stars 88 forks source link

Continued issue with new Deepsqueak #12

Closed cmlenell1 closed 5 years ago

cmlenell1 commented 5 years ago

The detect function of the newest version of deepsqueak downloaded today 12/19/2018 yields the following error "Warning: Error in Network, Skiping Audio Chunk

In SqueakDetect (line 115) In multinetdect_Callback (line 93) In gui_mainfcn (line 95) In DeepSqueak (line 30) In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DeepSqueak('multinetdect_Callback',hObject,eventdata,guidata(hObject),1) Struct contents reference from a non-struct array object."

DrCoffey commented 5 years ago

That is our generic error for when there is a problem with the detect function. Can you give me some more information?

What version of Matlab you are using? What network/networks are you using? What audio file are you using?

Thanks, Kevin

cmlenell1 commented 5 years ago

Hi Dr Coffey,

I am using Matlab2017b. I am using the ratshortcall network and I am analyzing a 10 min wav file containing many elicited 50kHz rat USVs. I was not able to get the new version of deepsqueak to work on the Matlab2017b or2018b. I was previously able to use Deepsqueak to analyze these same files.

Best,

Charlie

On Wed, Dec 19, 2018 at 2:15 PM DrCoffey notifications@github.com wrote:

That is our generic error for when there is a problem with the detect function. Can you give me some more information?

What version of Matlab you are using? What network/networks are you using? What audio file are you using?

Thanks, Kevin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DrCoffey/DeepSqueak/issues/12#issuecomment-448711886, or mute the thread https://github.com/notifications/unsubscribe-auth/ArW3-eT1cxcjAkEfvHfhrpkEF7hm4nlKks5u6pBrgaJpZM4ZaOJC .

-- Charles Lenell, M.S., CCC-SLP

DrCoffey commented 5 years ago

Are you using the old network or the new one that is included with 2.0 "Short Rat Cal_Network_V2"?

If you don't mind sharing an audio file via google drive or something I can test it over here?

Sorry for the inconvenience.

-Kevin

DrCoffey commented 5 years ago

Also, you could try deleting the settings.mat file in the main directory and restarting DeepSqueak

cmlenell1 commented 5 years ago

Hi Dr. Coffey,

I am using the new networks and unfortunately, deleting the settings.mat file did not resolve the errors for either Matlab2017b or Matlab2018b. I work in Aaron Johnson's lab. Any files he sent are representative of the data we have collected and I'm trying to analyze. If you need an additional audio file, I can upload another.

Thanks!

Charlie Lenell Charles Lenell, M.S., CCC-SLP

On Wed, Dec 19, 2018 at 3:11 PM DrCoffey notifications@github.com wrote:

Also, you could try deleting the settings.mat file in the main directory and restarting DeepSqueak

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DrCoffey/DeepSqueak/issues/12#issuecomment-448728234, or mute the thread https://github.com/notifications/unsubscribe-auth/ArW3-YMuMOmi2s-BNhCWTsQpBjpsA5p3ks5u6p1YgaJpZM4ZaOJC .

DrCoffey commented 5 years ago

Ok, we're going to have to do this the smart way.

  1. Open SqueakDetect.m from the functions folder.
  2. Click on the left bar right next to line 93, you should see a red circle pop up. capture
  3. Run DeepSqueak normally and try to detect a file.
  4. The code should stop just before it runs line 93.
  5. Right click in your workspace and hit "save"
  6. Send me the saved workspace.mat file. I think you can upload it by dragging it into a message here.

Then I can see exactly whats going on and get to the bottom of this!

cmlenell1 commented 5 years ago

Hi Dr. Coffey,

I was able to get the latest version of deepsqueak working using the 2018b; however, the detection is locating fewer vocalizations than when I manually was able to change the detection settings (and increase the gain to 3 or 4). We have a few USVs that are short and/or quiet, any suggestions?

Charlie

Charles Lenell, M.S., CCC-SLP

On Thu, Dec 20, 2018 at 2:05 PM DrCoffey notifications@github.com wrote:

Ok, we're going to have to do this the smart way.

  1. Open SqueakDetect.m from the functions folder.
  2. Click on the left bar right next to line 93, you should see a red circle pop up. [image: capture] https://user-images.githubusercontent.com/39605011/50305131-db997580-0446-11e9-8092-ae0c8e4d5063.PNG
  3. Run DeepSqueak normally and try to detect a file.
  4. The code should stop just before it runs line 93.
  5. Right click in your workspace and hit "save"
  6. Send me the saved workspace.mat file. I think you can upload it by dragging it into a message here.

Then I can see exactly whats going on and get to the bottom of this!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DrCoffey/DeepSqueak/issues/12#issuecomment-449103149, or mute the thread https://github.com/notifications/unsubscribe-auth/ArW3-QugXaLU8EqeVugEebGpZaCgkIYmks5u69-WgaJpZM4ZaOJC .

DrCoffey commented 5 years ago

Glad you got it working! In building DeepSqueak we discovered that people have wildly different gain settings on their recordings, some 100x louder than others. We really wanted DeepSqueak to just work on everyone's files, so we attempt to auto scale everything. The new networks are also much more robust to noise, but as a result are a little less sensitive. I would try both the All Calls network and the Rat calls network and see which is better for your calls.

Second, If you wan't to play with the scaling you still can. On line #86 of Squeak Detect we perform auto scaling.

86: im = mat2gray(s,[med.1 med30]);

I would lower the 30 in increments of 5 until you maximize detection. This will make the quiet calls louder but will lower the range.

cmlenell1 commented 5 years ago

The detection also seems highly dependent on the overlap and analysis chunk values with smaller values having higher detections. Is that normal?

Charles Lenell, M.S., CCC-SLP

On Thu, Dec 20, 2018 at 5:01 PM DrCoffey notifications@github.com wrote:

Glad you got it working! In building DeepSqueak we discovered that people have wildly different gain settings on their recordings, some 100x louder than others. We really wanted DeepSqueak to just work on everyone's files, so we attempt to auto scale everything. The new networks are also much more robust to noise, but as a result are a little less sensitive. I would try both the All Calls network and the Rat calls network and see which is better for your calls.

Second, If you wan't to play with the scaling you still can. On line #86 of Squeak Detect we perform auto scaling.

86: im = mat2gray(s,[med.1 med30]);

I would lower the 30 in increments of 5 until you maximize detection. This will make the quiet calls louder but will lower the range.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DrCoffey/DeepSqueak/issues/12#issuecomment-449149376, or mute the thread https://github.com/notifications/unsubscribe-auth/ArW3-WIcOhJ4DLqY4CJ6WQGA3cP0U5bAks5u7Ai0gaJpZM4ZaOJC .

DrCoffey commented 5 years ago

Each chunk in converted to an image and the neural network proposes a bunch of regions to look for calls, so it will be a little different with different chunks. I just tried 2-10s chunks on our example mouse file and saw ~5% variance in detection, with the best detection at ~5s. Are you seeing more variance than that?

Just curious, how fast is it running for you, and what kind of GPU do you have?

cmlenell1 commented 5 years ago

The name of the graphics card is NVIDIA NVS 310. I'm not sure if that's the GPU..

The best detection I got was using an analysis chunk of 0.1 and a overlap of 0.03 detecting ~100/120 USVs. Because the chunk is so small, it runs at 0.5x detection speed. Does that seem reasonable?

Charles Lenell, M.S., CCC-SLP

On Thu, Dec 20, 2018 at 5:37 PM DrCoffey notifications@github.com wrote:

Each chunk in converted to an image and the neural network proposes a bunch of regions to look for calls, so it will be a little different with different chunks. I just tried 2-10s chunks on our example mouse file and saw ~5% variance in detection, with the best detection at ~5s. Are you seeing more variance than that?

Just curious, how fast is it running for you, and what kind of GPU do you have?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DrCoffey/DeepSqueak/issues/12#issuecomment-449158083, or mute the thread https://github.com/notifications/unsubscribe-auth/ArW3-cnn52zFCw-P1zWQh3nbnc5e7Nw2ks5u7BEQgaJpZM4ZaOJC .

DrCoffey commented 5 years ago

Interesting, that is a really small chunk size and really slow speed. We usually detect 5-10 second chunk sizes at ~30x. We test on a 1070 ti which is a significantly bigger graphics card, but we usually still get 10x or so on smaller cards.

I'm really curious why that tiny chunk size is detecting better. If you feel like sharing the wav file and DeepSqueak detection file I can take a closer look. No worries if you would rather just keep doing what works.

Also, overlap will add to the chunk size, so if you did chunk=.5, overlap=.5 you would get a 1s window that slides by .5s and you would have complete overlap, and detect every section twice.

cmlenell1 commented 5 years ago

I would appreciate if you took a look and let me know what you think the best detection paramaters would be for this file.

What is the best way to share this unpublished data?

Charles Lenell, M.S., CCC-SLP

On Fri, Dec 21, 2018 at 2:14 PM DrCoffey notifications@github.com wrote:

Interesting, that is a really small chunk size and really slow speed. We usually detect 5-10 second chunk sizes at ~30x. We test on a 1070 ti which is a significantly bigger graphics card, but we usually still get 10x or so on smaller cards.

I'm really curious why that tiny chunk size is detecting better. If you feel like sharing the wav file and DeepSqueak detection file I can take a closer look. No worries if you would rather just keep doing what works.

Also, overlap will add to the chunk size, so if you did chunk=.5, overlap=.5 you would get a 1s window that slides by .5s and you would have complete overlap, and detect every section twice.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DrCoffey/DeepSqueak/issues/12#issuecomment-449474456, or mute the thread https://github.com/notifications/unsubscribe-auth/ArW3-eZUw1wEd_KjKoZl9m2y_kccD5qpks5u7TMJgaJpZM4ZaOJC .

DrCoffey commented 5 years ago

Hey,

I would just de-identify the file and put it up on google drive or dropbox or onedrive.

-Kevin

cmlenell1 commented 5 years ago

Here is the file in question. Thanks so much!

shared_USV_deepsqueak.wav https://drive.google.com/file/d/1U-bRYD-q6TScC7-GlxXSNjd62NsH-kf1/view?usp=drive_web

Charles Lenell, M.S., CCC-SLP

On Fri, Dec 21, 2018 at 3:04 PM DrCoffey notifications@github.com wrote:

Hey,

I would just de-identify the file and put it up on google drive or dropbox or onedrive.

-Kevin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DrCoffey/DeepSqueak/issues/12#issuecomment-449485830, or mute the thread https://github.com/notifications/unsubscribe-auth/ArW3-cVcTfkhaK5SvCb5yjyiwCJ39Iefks5u7T7MgaJpZM4ZaOJC .

DrCoffey commented 5 years ago

Hey Charles,

The file you sent is very quiet. You are only using ~2% of the range available to you. I would recommend turning your gain up considerably.

By limiting the range on the Spectrogram production you can increase the detection rate. I was able to detect pretty well with 3s chunks, 1s overlap and the following line change:

Squeak Detect Line #86: im = mat2gray(s,[med.75 med5]);

There were modest gains for smaller chunks, but a big hit to speed.

It looks like you are using really nice condenser mics, so I would try to optimize your gain settings there. That would improve detection far more then fiddling with the settings in DeepSqueak.

Hope all that helps. I'm going to close this particular issue, but if you have any other problems don't hesitate to open another issue!

-Kevin

cmlenell1 commented 5 years ago

Ok sounds good. Thanks for all your help with this!

Charles Lenell, M.S., CCC-SLP

On Fri, Dec 21, 2018 at 4:18 PM DrCoffey notifications@github.com wrote:

Hey Charles,

The file you sent is very quiet. You are only using ~2% of the range available to you. I would recommend turning your gain up considerably.

By limiting the range on the Spectrogram production you can increase the detection rate. I was able to detect pretty well with 3s chunks, 1s overlap and the following line change:

Squeak Detect Line #86: im = mat2gray(s,[med.75 med5]);

There were modest gains for smaller chunks, but a big hit to speed.

It looks like you are using really nice condenser mics, so I would try to optimize your gain settings there. That would improve detection far more then fiddling with the settings in DeepSqueak.

Hope all that helps. I'm going to close this particular issue, but if you have any other problems don't hesitate to open another issue!

-Kevin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DrCoffey/DeepSqueak/issues/12#issuecomment-449500843, or mute the thread https://github.com/notifications/unsubscribe-auth/ArW3-T4g4zliPkcuIxUTq5Cr93cPL6dlks5u7VBBgaJpZM4ZaOJC .