A machine learning pipeline for detecting explosive fishing activities in underwater audio recordings. This system helps protect marine ecosystems by automatically identifying illegal blast fishing practices.
The code in this repository was used to support the forthcoming publication: Widespread bomb fishing in Indo-pacific archipelago revealed through machine learning accelerated passive acoustic monitoring, Williams et al., (2025). See the study for further details.
The original code to develop and deploy the model can be found in archive. As part of the ongoing development of this work, much of this code is being refactored and the model improved to support others in using this approach.
Important Note: Do not expect our model to generalise well to new locations without retraining it. Please consider retraining the model on your own data. Our code in development in the retraining_scripts directory may help with this.
Use our pre-trained legacy model to detect bomb fishing events in raw HydroMoth audio recordings (sampled at 8 kHz).
Inference (supported): Use the inference scripts that support both the legacy and retrained models:
# Navigate to inference directory
cd inference
# Edit inference_parent.py to set your paths:
# - new_audio_dir: path to your WAV files
# - output_folder: where results should be saved
# - model_dir: path to ../models/legacy_model (or your .keras file)
# - decision_threshold: tune detection sensitivity
# For legacy model (requires conda)
conda env create -f set_up/linux_env.yml
conda activate conda-bomb-env
python inference_parent.py
# For modern .keras models (requires UV)
uv run python inference_parent.py
Legacy Scripts: The older legacy parent_script.py and child_script.py have been archived. Use inference_parent.py for better features and compatibility.
The inference will generate audio files of suspected bomb fishing incidents for manual verification alongside CSV files with:
Status: Currently in development - use with caution
A complete pipeline to retrain models with your own annotated data. This is actively being improved and may have bugs or incomplete features.
# Install UV package manager (recommended for development)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run retraining pipeline (experimental)
cd retraining_scripts
uv run python run_complete_pipeline.py
Documentation for Retraining:
Future Improvements (in development):
# Create conda environment with exact dependencies
conda env create -f set_up/linux_env.yml
conda activate conda-bomb-env
# Install UV package manager
curl -LsSf https://astral.sh/uv/install.sh | sh
# UV automatically manages dependencies from pyproject.toml
uv run python --version # Test that UV works
# GPU support:
uv sync --group gpu
uv run --group gpu python retraining_scripts/train_model.py
# CPU support:
uv sync --group cpu
uv run --group cpu python retraining_scripts/train_model.py
# Default (auto-detects available hardware)
uv sync
uv run python retraining_scripts/train_model.py
uv venv .venv
source .venv/bin/activate
uv pip install -e .
Bomb-Fishing/
├── inference/ # Production-ready inference scripts
│ ├── inference_parent.py # Main inference script (EDIT PATHS HERE)
│ ├── inference_child.py # Child process for batch processing
│ └── README.md # Inference documentation
├── models/ # Trained models
│ └── legacy_model/ # Original study model (TensorFlow SavedModel)
│ ├── saved_model.pb
│ ├── keras_metadata.pb
│ └── variables/
├── archive/ # Original study code & data
│ ├── model_training/ # Jupyter notebooks from original study
│ ├── model_deployment/ # Legacy deployment scripts and code
│ ├── misc/ # Analysis scripts and notebooks from study
│ └── README.md # Original study documentation
├── set_up/ # Environment configurations
│ ├── linux_env.yml # Conda environment for legacy model inference
│ └── get_gpu_working.md # GPU setup guide
├── retraining_scripts/ # Development - model retraining pipeline
│ ├── README.md # Experimental - use with caution
│ ├── QUICK_START.md
│ ├── run_complete_pipeline.py
│ ├── data_preprocessing.py
│ ├── extract_features.py
│ ├── train_model.py
│ ├── eval_model.py
│ └── tune_threshold.py
├── misc/ # Utility scripts and notebooks
├── data/ # Your datasets (create during setup)
└── logs/ # Training logs and outputs
conda env create -f set_up/linux_env.ymlconda activate conda-bomb-envinference/inference_parent.py with your pathscd inference && python inference_parent.pycurl -LsSf https://astral.sh/uv/install.sh | shcd retraining_scripts && uv run python run_complete_pipeline.py| Model | Status | Format | Environment | Use Case |
|---|---|---|---|---|
| Legacy Model | ✅ Production | TensorFlow SavedModel | Conda + TF 2.10 | Inference on new data |
| New Models | ⚠️ In Development | .keras (planned) | UV + Python 3.9+ | Future improved models |
The retraining scripts and modern model formats are actively being developed. Use the legacy inference pipeline for reliable results.
If you use this code in your research, please cite:
Williams et al., (2025). Widespread bomb fishing in Indo-pacific archipelago revealed through
machine learning accelerated passive acoustic monitoring. [Journal details pending publication]
See LICENSE for details.
Need Help?
retraining_scripts/78 commits
21 commits
Jupyter Notebook
96.4%
Python
3.1%
A machine learning pipeline for detecting explosive fishing activities in underwater audio recordings. This system helps protect marine ecosystems by automatically identifying illegal blast fishing practices.
The code in this repository was used to support the forthcoming publication: Widespread bomb fishing in Indo-pacific archipelago revealed through machine learning accelerated passive acoustic monitoring, Williams et al., (2025). See the study for further details.
The original code to develop and deploy the model can be found in archive. As part of the ongoing development of this work, much of this code is being refactored and the model improved to support others in using this approach.
Important Note: Do not expect our model to generalise well to new locations without retraining it. Please consider retraining the model on your own data. Our code in development in the retraining_scripts directory may help with this.
Use our pre-trained legacy model to detect bomb fishing events in raw HydroMoth audio recordings (sampled at 8 kHz).
Inference (supported): Use the inference scripts that support both the legacy and retrained models:
# Navigate to inference directory
cd inference
# Edit inference_parent.py to set your paths:
# - new_audio_dir: path to your WAV files
# - output_folder: where results should be saved
# - model_dir: path to ../models/legacy_model (or your .keras file)
# - decision_threshold: tune detection sensitivity
# For legacy model (requires conda)
conda env create -f set_up/linux_env.yml
conda activate conda-bomb-env
python inference_parent.py
# For modern .keras models (requires UV)
uv run python inference_parent.py
Legacy Scripts: The older legacy parent_script.py and child_script.py have been archived. Use inference_parent.py for better features and compatibility.
The inference will generate audio files of suspected bomb fishing incidents for manual verification alongside CSV files with:
Status: Currently in development - use with caution
A complete pipeline to retrain models with your own annotated data. This is actively being improved and may have bugs or incomplete features.
# Install UV package manager (recommended for development)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Run retraining pipeline (experimental)
cd retraining_scripts
uv run python run_complete_pipeline.py
Documentation for Retraining:
Future Improvements (in development):
# Create conda environment with exact dependencies
conda env create -f set_up/linux_env.yml
conda activate conda-bomb-env
# Install UV package manager
curl -LsSf https://astral.sh/uv/install.sh | sh
# UV automatically manages dependencies from pyproject.toml
uv run python --version # Test that UV works
# GPU support:
uv sync --group gpu
uv run --group gpu python retraining_scripts/train_model.py
# CPU support:
uv sync --group cpu
uv run --group cpu python retraining_scripts/train_model.py
# Default (auto-detects available hardware)
uv sync
uv run python retraining_scripts/train_model.py
uv venv .venv
source .venv/bin/activate
uv pip install -e .
Bomb-Fishing/
├── inference/ # Production-ready inference scripts
│ ├── inference_parent.py # Main inference script (EDIT PATHS HERE)
│ ├── inference_child.py # Child process for batch processing
│ └── README.md # Inference documentation
├── models/ # Trained models
│ └── legacy_model/ # Original study model (TensorFlow SavedModel)
│ ├── saved_model.pb
│ ├── keras_metadata.pb
│ └── variables/
├── archive/ # Original study code & data
│ ├── model_training/ # Jupyter notebooks from original study
│ ├── model_deployment/ # Legacy deployment scripts and code
│ ├── misc/ # Analysis scripts and notebooks from study
│ └── README.md # Original study documentation
├── set_up/ # Environment configurations
│ ├── linux_env.yml # Conda environment for legacy model inference
│ └── get_gpu_working.md # GPU setup guide
├── retraining_scripts/ # Development - model retraining pipeline
│ ├── README.md # Experimental - use with caution
│ ├── QUICK_START.md
│ ├── run_complete_pipeline.py
│ ├── data_preprocessing.py
│ ├── extract_features.py
│ ├── train_model.py
│ ├── eval_model.py
│ └── tune_threshold.py
├── misc/ # Utility scripts and notebooks
├── data/ # Your datasets (create during setup)
└── logs/ # Training logs and outputs
conda env create -f set_up/linux_env.ymlconda activate conda-bomb-envinference/inference_parent.py with your pathscd inference && python inference_parent.pycurl -LsSf https://astral.sh/uv/install.sh | shcd retraining_scripts && uv run python run_complete_pipeline.py| Model | Status | Format | Environment | Use Case |
|---|---|---|---|---|
| Legacy Model | ✅ Production | TensorFlow SavedModel | Conda + TF 2.10 | Inference on new data |
| New Models | ⚠️ In Development | .keras (planned) | UV + Python 3.9+ | Future improved models |
The retraining scripts and modern model formats are actively being developed. Use the legacy inference pipeline for reliable results.
If you use this code in your research, please cite:
Williams et al., (2025). Widespread bomb fishing in Indo-pacific archipelago revealed through
machine learning accelerated passive acoustic monitoring. [Journal details pending publication]
See LICENSE for details.
Need Help?
retraining_scripts/78 commits
21 commits
Jupyter Notebook
96.4%
Python
3.1%