This repository contains a Python implementation of the Fishsense lite pipeline. It contains tools for camera calibration, laser calibration, and fish length calculation. This pipeline assumes that you already have access to all the data necessary to run this pipeline. As this code is meant to be a temporary measure, the user may need to edit some file paths, so apologies in advance.
- Install the
poetry
packages.poetry install
. - Install
git annex
. On Ubuntu, executesudo apt install git-annex
. - Install
git-annex-remote-synology
from git-annex-remote-synology. - Run
git-annex-remote-synology setup --hostname e4e-nas.ucsd.edu
- Run
git annex enableremote synology
. - Download data
git annex copy --from=synology
.
We provide a docker
container which has the dependencies pre-installed. In order to use this, please ensure you have docker
installed on your system. When running Visual Studio Code, ensure that you use the option to reopen in the container. This step will time for the intial setup.
poetry run pytest
- Run
poetry install
. This will install all required dependencies. - Run
poetry shell
to execute all following commands within the poetry environment. - Create a
data
folder in this directory. Add araw
subdirectory and add your raw data inside. This can take whatever folder structure you need. - Process all raws by running
python camera_imaging_pipeline/process.py
. This will place all images insidedata/png
, copying whatever folder structure is insidedata/raw
. - Calibrate the lens using
python e4e_camera_calibration
. Documentation on this tool can be found here. - Undistort all laser and fish images using
python undistort_images.py
. This will place all images insidedata/png_rectified
, copying whatever folder structure is insidedata/png
. - Label laser calibration images using
python label_laser_calibration.py
.- This script uses the following command line arguments:
-i
or--input
specifies the input path which contains all rectified laser images.-o
or--output
specifies the location to save the generated csv file.
- Use the following key bindings when using this tool:
ESC
will skip the current image, use this when the laser dot is difficult to find, the calibration board is not completely in frame, or things are out of focus.r
will remove the current label, in case you make a mistakee
will save the added label and load the next image
- This script uses the following command line arguments:
- Calibrate the laser using
python laser_calibration.py
. This script uses the following command line arguments:-c
or--calib
specifies the location of the lens calibration file generated from step 3.-i
or--input
specifies the location of the csv file from part 5.-o
or--output
specifies the location to save the generated laser calibration file.
- Label the fish images using
python label_laser_fish.py
- This script uses the following command line arguments:
-i
or--input
specifies the input path which contains all rectified fish with laser images.-o
or--output
specifies the location to save the generated csv file.
- Click to label the laser dot, snout tip, and tail fork, in that order.
- Use the following key bindings when using this tool:
ESC
will skip the current image, use this when the laser dot is difficult to find, or things are out of focus.r
will remove all current labels, in case you make a mistakee
will save the added label and load the next image
- This script uses the following command line arguments:
- Run the fish analysis using
python fish_mass.py
. This script uses the following command line arguments:-c
or--cameracalib
specifies the location of the lens calibration file generated from step 3.-l
or--lasercalib
specifies the location of the laser calibration file generated from step 6.-i
or--input
specifies the location of the csv file generated from step 7.-o
or--output
specifies the location of the generated csv file containing fish lengths and masses.