sgoldenlab / simba

SimBA (Simple Behavioral Analysis), a pipeline and GUI for developing supervised behavioral classifiers
https://simba-uw-tf-dev.readthedocs.io/
GNU General Public License v3.0
286 stars 139 forks source link

Trailing slash removed from path #122

Closed florianduclot closed 3 years ago

florianduclot commented 3 years ago

Describe the bug Using the multicrop tool, the trailing slash in the Input Folder path is removed, leading to wrong path for glob() to find the input videos.

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Tools'
  2. Click on 'Multi-crop'
  3. Click on "Browse Folder" and enter absolute path to folder containing the videos /path/to/videos/folder/: the Video Folder text area then shows path/to/videos/folder.
  4. Enter mp4 as Video type
  5. This results in the search path being: /path/to/videos/folder./*.mp4: this results in no video file being found despite the given folder including a .mp4 video file.

Expected behavior The video(s) should be correctly found.

Desktop (please complete the following information):

Additional context SimBA was installed as follows.

conda create -n simbaenv -c conda-forge python=3.6.10 wxpython=4.0.4
conda activate simbaenv
pip install simba-uw-no-tf
pip uninstall shapely
conda install -c conda-forge shapely
conda install -c conda-forge ffmpeg

Workaround Manually adding the removed trailing slash in multicrop.py works: Current: https://github.com/sgoldenlab/simba/blob/b69668bbe0e11a95f6d69b0efb587290f0753bd3/simba/multiplecrop.py#L10

Replaced by:

    videoFtype = "/." + '/*.' + vtype

I'm not familiar with Tkinter and how paths are processed from the user input (or even if it's Tkinter responsible here), so I wouldn't be surprised if it's related to the fact that I'm running under Linux (which I believe is not supported for SimBA). I'm not sure it qualifies for a fix as a result but it would certainly be appreciated if a simple cross-platform solution exists.

In advance, thanks a lot for your time!

sgoldenlab commented 3 years ago

Thank you so much for the detail report about this bug.

I have fixed the code and wonder if you can give it a try and let me know if this works on your end. If not, I will try it again and make sure it works for Linux users too!

Please install the development version of SimBA as it is the latest SimBA version that we worked on everyday.

Installation

conda create -n simbadev -c conda-forge python=3.6.10 wxpython=4.0.4
conda activate simbadev 
pip install simba-uw-tf-dev==0.84.8
pip uninstall shapely
conda install -c conda-forge shapely
conda install -c conda-forge ffmpeg
florianduclot commented 3 years ago

I have fixed the code and wonder if you can give it a try and let me know if this works on your end.

I can confirm that it now works using simba-uw-tf-dev==0.84.8 installed following your instructions.

Thanks a lot for spending the time to fix it!

I'll close this issue as it is fixed.