DrCoffey / DeepSqueak

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

In multidetect merging boxes fails and produces an error. #177

Closed BerendWijers closed 2 years ago

BerendWijers commented 2 years ago

Hi Dr. Coffey,

I'm assisting a Postdoc and her Master Student in the setup of an analysis pipeline, using Deep Squeak. I've run into a technical issue and I'm hoping you can help me resolve it. I've provided a description below. Thank you in advance!

Describe the bug When using Multi-detect, after the first audio file has been analysed the merging boxes step fails and produces an error causing the GUI to hang on 'Merging boxes..'

The error message is:

Unrecognized function or variable 'h'.

Error in merge_boxes (line 45)
if ~any(Accepted); close(h); return; end

Error in SqueakDetect (line 143)
Calls = merge_boxes(AllBoxes, AllScores, AllClass, audio_info, 1, score_cuttoff, 0);

Error in multinetdect_Callback (line 80)
        Calls = [Calls;
        SqueakDetect(AudioFile,NeuralNetwork,handles.audiofiles(CurrentAudioFile).name,Settings(:,k),j,length(audioselections),networkname)];

Error in gui_mainfcn (line 95)
        feval(varargin{:});

Error in DeepSqueak (line 29)
    gui_mainfcn(gui_State, varargin{:});

Error in matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DeepSqueak('multinetdect_Callback',hObject,eventdata,guidata(hObject),0)

Error while evaluating UIControl Callback.

To Reproduce Steps to reproduce the behavior: With the attached audio/detection files:

  1. In the main windows go to 'multidetect'
  2. Select files 1-4 (attached)
  3. Set settings for both networks:
    • Networks: Long Rat Detector Yolo R1 and Rat Detector Yolo R1
    • Total Analysis Length: 0
    • Frequency Cut-off High: 90
    • Frequency Cut-off Low: 18
    • Score Threshold: 0.7
    • Append data to filename: 1
  4. Wait for the first audio file to be processed
  5. See error in MATLAB console

Expected behavior I expect merging boxes step to resolve and the detection to continue with the next file(s).

Additional context Before this error, a warning is issued:

During the 'Loading network' step, this warning is issued.

Warning: While loading an object of class 'nnet.cnn.TrainingOptionsSGDM':
The value of 'CheckpointPath' is invalid. Checkpoint path must be a char array and an existing directory
with write permission. 
> In multinetdect_Callback (line 77)
In gui_mainfcn (line 95)
In DeepSqueak (line 29)
In matlab.graphics.internal.figfile.FigFile/read>@(hObject,eventdata)DeepSqueak('multinetdect_Callback',hObject,eventdata,guidata(hObject),0) 

Software:

Hardware:

Files https://filesender.surf.nl/?s=download&token=721de2d1-e231-4ee9-988f-7d372cc77f73

DrCoffey commented 2 years ago

Hey @BerendWijers

This crash happened because the long network found a few calls but none of them passed the 0.7 score threshold, and DeepSqueak got confused. I fixed the bug, and it should run fine now if you update DeepSqueak.