Giter VIP home page Giter VIP logo

dbscorer's Introduction

Visitors

Automatic Mobility Based Behavioral Quantification ( With Option for Manual Scoring ).

We've enhanced DBscorer's functionality and usability. We advise using DBscorerV2.

DBscorerV3 will come soon with few changes in GUI and outputs files. Soon, we will be releasing a program to analyse mouse behaviour in commonly used behaviour tests such as for anxiety and spatial memory.

Validation Results of DBscorer V2

alt text

alt text

Installation:

Windows (Tested):

  1. Install the MATLAB runtime 9.9 first.

  2. Click the DBscorerV2 app to launch the GUI.

Mac (Need MATLAB):

Use DBscorerV2 exported.m file.

Notes

  1. Mount the camera using a tripod.
  2. The background should be free of glare and shadows. To prevent shadows and glares, use diffuse indirect light. Use a non-shiny background.
  3. Crop a rectangular area so that all animal parts are contained within it while avoiding the surrounding area. View the demo video.
  4. The size of the video imposes restrictions on DBscorer. In such cases, downsample or convert the video. (Issue is fixed in DBscorer V2).
  5. Video should have a constant frame rate. If not, then convert with ffmpeg or any other program you prefer.
  6. Do not use a video with very low or very high immobility for threshold generation, it might fail to compute threshold in such cases. Immobility between 30-70% works best. Check your file name after you generate the manual analysis; it should be in pairs, FST.mat and FST manual.mat.
  7. Your video name or entered info should not contain full stop (.).

To prevent issues with detection, it is always a good idea to enhance video quality while recording. To test and get a sense of the recording conditions, kindly view the sample videos.

Sample Videos

TST Sample Video

FST Sample Video

Video Pre-Processing

This can be easily done using ffmpeg software.

  1. Create a folder and name it "Convert".

  2. Place the convert.bat file, ffmpeg.exe and all videos in the same folder.

  3. Create a subfolder in "Convert" and name it "Output".

  4. Double click the "Convert.bat" file to start conversion.

DBscorerV2

Convert the videos to a constant frame rate video in a MATLAB-supported video format (mp4, avi, mov). Use ffmpeg as described. You may downsample the video if needed. You can select one video file at a time for processing. Please follow the steps below.

Steps:

  1. Load Video: Use this button to load the video to be analyzed. Pressing this button would open a window for file selection. Click on your video file that is to be analyzed and click open. This will open a “figure window” showing the first frame.

  2. Figure Window: Use this button to reopen the figure window if you have closed it.

  3. Start (s) and End (s): Use this to define the start and end (seconds) of the video analysis. Figure window will help you to choose the start and end points appropriately.

  4. Time: This shows the total duration of video to be analyzed. This field is not editable.

  5. Label: You can use this field to add labels. Do not use any special characters or file extensions here (alphanumeric characters only).

  6. Create Background: You can create a clean background (without a mouse) for a selected part of the video using this. In most cases you will get a clean background. In case you do not get a clean background image, you can change start and end such that you get a clean background. After getting a clean background, you should change the start and end points back to their original values for analysis.

  7. Fix Background: If the background is not clean even after step no 7 then click fix background button to select the area covering artifact pixels as shown in the demo video.

  8. Mark ROI: For TST and FST, select the area where the animal remains for the analysis period. The animal should not go outside the selected area throughout the analysis period.

  9. Process Video: You can use this button to perform the immobility analysis. This will create a .mat file for each animal which will be used for subsequent analysis. You can repeat the steps to process all the animals.

Jump to step no 16 for automated analysis using the recommended threshold.

  1. Manual Scoring: Do manual scoring either to determine an optimal threshold or you want to do manual analysis in a more detailed fashion than using a stopwatch. To perform manual scoring for obtaining the optimal threshold, you will have to perform all the previous steps in that order. We do not recommend performing manual scoring for threshold determination steps by non-experts. Because this will lead to erroneous threshold. Instead you can use the recommended threshold. Recommended threshold for FST is 1.6 , and TST is 0.6. For threshold determination, we recommend manually analyzing 3-4 randomly chosen videos (first and last 2 minutes of each video will result in better threshold determination).

  2. Play and State: These buttons are used for manual scoring. They will be activated only when the manual scoring option is selected. Video will be paused at frame 1 of analysis by default and pressing “play” will start playing the video. Use the state button to switch between mobile (Green) and immobile(Magenta). You will also see a colored strip on top of the video corresponding to the state you have selected to aid in manual scoring. The default state is mobile.

  3. Clip: Clip value removes periods of state switching. A clip value of 1 (recommended) will clip data from pre and post-transition while determining the optimal threshold. Doing this accounts for the delay in changing the toggle button.

  4. Get Threshold: Once you manually score 3-4 videos, you can select all the .mat files to get an optimum threshold. It will generate a csv file with optimum threshold value and AUC, precision and recall for the threshold ( Higher the better). You can then use the threshold for rest of videos in the batch.

  5. Time threshold is the minimum time required to say an animal is immobile or not. Let's say you consider that an animal is immobile when it remains immobile for at least 2 seconds. Doing so will remove any immobility period that is less than 2 seconds and it will reduce the total immobility %.

0 0 0 1 0 0 0 1 1 0 1 1 0 0 1 0 1 0 . Before (7 second immobile, latency 4, 5 bouts)

0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 . After(4 second immobile, latency 8, 2 bouts)

  1. Compile Manual: This step is required only if you wish to do complete manual analysis and not required for threshold determination. Once you finish scoring all the videos manually, you can select all the .mat files by clicking the “compile manual button”. It will generate an excel sheet containing all the data together. It compiles only the .mat files generated from manual scoring. It will also generate a raster plot in order that is there in the excel sheet.

  2. Compile: This button works in a similar manner as earlier except for automated analysis. Here, once you process all the videos, you can select all the .mat files generated from the “process video”(step 9). It will generate an excel sheet containing all the data together. It will also generate a raster plot in order that is there in the excel sheet.

Published in eNeuro

Please cite the paper if you use the code.

Detecting Animal Activity in Long Video

If you have a long video recorded, it is also possible to detect animal activity (not shown with data, but the concept is the same).

dbscorer's People

Contributors

arnabaws avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

dbscorer's Issues

Compile button issue

So I can get through all the steps of DBscorer and i have the .mat files generated for all my mice, the only issue however, is that compile doesn't do anything except open an empty matlab figure window. No excel sheets are created.

Also a side question- is it pointless to use dbscorer if my camera view angle for FST is a birds eye view instead of a side view?

DBscorer doesn't work

Greetings! Thank you very much for such a wonderful program! Not only does it look pretty nice but the installation of a very expensive Matlab is also not required. I installed everything according to the instructions, but I think DBscorer does not work. I upload the video, indicate the ending time and animal ID, then press the "Mark Area" button, and choose the area. When I finish the selection, Figure 2 arrives, then gone and I hear the error sound without any text or windows with error. I just see the yellow button "Cropping..." instead of "Mark Area" and nothing happens. The video icon is still uncropped. If I press other buttons, I hear the only error sound again. I tried to run DBscorrer as administrator, but it didn't help.

Could you please help me to run the program?

Issue getting threshold from manual scoring

Hello,

I am trying to use the Get Threshold feature to get the optimal threshold for my particular experiments. I've scored 3 videos manually and have successfully generated their .mat files. However, when I click on Get Threshold and select those .mat files, an error sound plays and no CSV file is generated. Is there something I'm not doing to generate the CSV file? Hoping to get the automatic scoring working to my liking! Thanks so much.

Start/End Times & Compiled Data

Hello,

This is my first time using DBscorer V2. I've successfully processed the FST sample video using the recommended threshold and am able to compile the data, but I'm having trouble with the Start/End times as they relate to the compiled results for individual animal.

Firstly, am I correct that the "Start Time (s)" & "End Time (s)" values must be set prior to clicking "Process Video", and that those times determine the range of the video that will be scored? I'm finding that once I process a video, changes to these fields change the compiled results even if the time range is greater than that of the processed video. That is, compiling with values 0-30 vs 10-30 yield different results for the same video processed from 10-30. Is this an improper use of this function? The "endsec" values in the compiled *.csv show similar times, however all the other values have changed except for the bin size. If you could clarify how to ensure the compiled data reflects only the scored period of time for each animal/ROI, that would be very helpful!

Also, is there a way to have the raw time, in seconds, included in the results compilation, instead of or in addition to the percent time immobile? Or is that data stored in any of the generated files? The raw values are the data I use for analysis and I think this will help with troubleshooting and calibration.

Thank you!

AI Detection Issue: Animals Not Detected in Video

I am reaching out to you with an issue I am experiencing while using the DBscorerv2 for analyzing forced swim tests in my animal study. I have been following the example video and instructions provided, but I have encountered a problem with the AI detection feature.

Upon initiating the manual scoring process, the AI detection seems to only focus on the top part of the video(as shown below), resulting in the failure to detect the animals in the video. This issue is preventing me from effectively using the program to analyze my data.

Initially, I suspected that there might be an issue with my videos. However, after testing the program with your example videos, the same situation occurs, which suggests the issue may be within the software itself.

I would greatly appreciate your assistance in resolving this issue. If you could provide any guidance on possible solutions or recommendations on how to address this problem, it would be very helpful.

1681195221515

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.