SharkTrack User Guide
Overview
This page guides you to download SharkTrack and run it on your videos. This completes Step 1 of the BRUVS analysis process: Automatic Processing.
Given a folder or hard drive with BRUVS, SharkTrack automatically processes the videos, detects elasmobranchs, saves detection information in a CSV file, and stores a detection image for each individual elasmobranch found.
Once you have the output, move to Step 2: Manual Review, to compute MaxN.
Installing SharkTrack
If you don’t have experience with Python, don’t fear! Follow this guide step by step and you will have it running shortly.
Pre-Requirements
You must have Python 3.9 or above.
On Windows:
- Open Command Prompt (type
cmdin the search bar) - Run:
python --version
On macOS:
- Open Terminal (Spotlight or Applications > Utilities)
- Run:
python3 --version
Downloading the Model
- Download the latest release from GitHub Releases (download the zip file only)
- Unzip the folder to extract
sharktrack - Move
sharktrackto the Desktop
On Windows:
- Open the extracted
sharktrackfolder - If using Command Prompt: replace the text in the address bar with
cmdand hit Enter - If using Anaconda: copy the address, open Anaconda Prompt, and run
cd {the address}
On macOS / Linux:
- Right-click on the
sharktrackfolder - Click “New Terminal at Folder” (sometimes under Services)
Setup Environment
Now that you have the Terminal open at the sharktrack folder, set up the environment:
If you use Anaconda:
conda create -n sharktrack anacondaconda activate sharktrackpip install -r requirements.txtOn Windows (no Anaconda):
python -m venv venvvenv\Scripts\activate.batpip install -r requirements.txtOn macOS / Linux:
python3 -m venv venvThen:
source venv/bin/activatepip install -r requirements.txtRunning SharkTrack
Congratulations on setting up SharkTrack! From now on, whenever you want to run it, follow these steps.
You can move your videos into the ./input_videos folder inside SharkTrack, or specify a custom path.
If you use Anaconda:
conda activate sharktrackpython app.pyOn Windows:
venv\Scripts\activate.batpython app.pyOn macOS / Linux:
source venv/bin/activatepython app.pyConfiguration
You can configure SharkTrack by adding arguments to the command:
python app.py --arg1 {val1} --arg2 {val2} --arg3| Argument | Description | Default |
|---|---|---|
--input {path} | Path to the video folder. Processes all .mp4 videos recursively. | ./input_videos |
--stereo_prefix {prefix} | Only process videos whose filename starts with this prefix (for Stereo-BRUVS). | — |
--limit {n} | Maximum number of videos to process. | 1000 |
--conf {value} | Custom confidence threshold. | 0.25 |
--output {path} | Path to output folder. | ./outputs |
--peek | Run in Peek Mode. | False |
--chapters | Aggregate video chapters into one single video. | False |
--resume | Skip videos already analysed in the output path. | False |
Example:
python app.py --input G:\BRUVS_2023 --peek --stereo_prefix LRuns SharkTrack peek mode on all videos from G:\BRUVS_2023 starting with “L”.
SharkTrack Peek Mode
Use SharkTrack to extract interesting frames without full tracking. This “peek” version runs 5x faster, but it doesn’t track the shark or allow to compute MaxN.
Activate with the --peek argument:
python app.py --peekThe output will contain a peek_frames/ folder listing all detections.
Performance
| Mode | Feature | Inference Time | Limitations | Best For |
|---|---|---|---|---|
analyst (default) | Compute MaxN | ~27 min per video-hour | Slower; some GoPro versions unsupported | Species-ID and MaxN |
peek | Extract frames | ~9 min per video-hour | No annotation support; more frames to review | Quick frame extraction |
The pipeline is designed to minimise False Positives. It uses a very low confidence threshold to ensure close to all sharks are detected, but this causes ~5x “garbage detections” which the user manually rejects.
Troubleshooting
Installation and Setup
- Terminal says I need
git— Install it from git-scm.com, or download the source code from releases. python -m venv venvsayspythonnot found — Trypython3 -m venv venvorpy -m venv venv.venvmodule not found — Check your Python version (python --version). Ensure it’s 3.9+. If not, download from python.org.
GoPro Limitation
If you see the warning:
[ WARN:0@379.898] global cap_ffmpeg_impl.hpp:1541 grabFrame packet read max attempts exceeded...Your GoPro version is incompatible. Use the provided reformatting script:
python utils/reformat_gopro.py --input {Original video folder} --output {New video folder}Recommended GoPro workflow:
- Collect BRUVS videos
- Transfer from SD card using the reformat script:
Terminal window python utils/reformat_gopro.py --input PATH_TO_SD --output COPY_DESTINATION - Run SharkTrack overnight:
Terminal window python app.py --input COPY_DESTINATION