PAIDIVERPY: An Open-Source Python package designed to create pipelines for preprocessing image data for biodiversity analysis. Tobias Ferreira, Mojtaba Masoudi, Loic Van Audenhaege, Eric Orenstein, Colin Sauze, Jennifer Durden
INTRODUCTION Standardise Preprocessing Steps Maintain Detailed Documentation Version Control & Traceability Ensure each image and preprocessing step is traceable for reproducibility. an open-source Python package designed to create pipelines for preprocessing image data for biodiversity analysis.
OPEN-SOURCE DEVELOPMENT PROBLEM DISCOVERY SOLUTION IDENTIFICATION RELEASE DOCUMENTATION SCIENTIFIC IDEA CODE DESIGN DESIGN IMPLEMENTATION EXECUTION MAINTENANCE USER FEEDBACK TESTING / CI CODE REVIEW CODE QUALITY This session gives a brief overview of PAIDIVERPY’s development, highlighting the key steps in creating an open-source package.
OPEN-SOURCE DEVELOPMENT PROBLEM DISCOVERY SOLUTION IDENTIFICATION RELEASE DOCUMENTATION SCIENTIFIC IDEA CODE DESIGN DESIGN IMPLEMENTATION EXECUTION MAINTENANCE USER FEEDBACK TESTING / CI CODE REVIEW CODE QUALITY
PROBLEM Output evaluation Biodiversity metrics (Abundance, Diversity, etc) Training data prep AI Preprocessing BIODIVERSITY MONITORING IN IMAGERY Image preprocessing is essential to prepare data for AI models and ensuring trustworthy biodiversity metrics. Properly selecting and documenting preprocessing steps is crucial for reproducible biodiversity research. Biodiversity metrics (Abundance, Diversity, etc)
PROBLEM Morris et al 2014. Limnol. Oceanogr.: Methods 12, 795–809 -Image processing workflow for highfrequency deep-sea optical imagery, enabling correction, mosaicking, and annotation of largescale datasets from AUV surveys -Goal: produce accurate, high-resolution assessments of seafloor habitats and megafaunal distribution across multiple spatial scales.
PROBLEM Orenstein et al 2022. Limnol. Oceanogr.: Methods 18, 681-695 -Apply image preprocessing methods that prepare largescale plankton imagery for trait extraction and analysis -Enabling high-resolution ecological insights across diverse aquatic and terrestrial systems.
PROBLEM •Camera or instrument •Sampling methods and deployment •Site conditions •Multitude of image processing approaches •Numerous hyperparameters to adjust •Handle metadata •Different tools and manual process •Not intuitive for all types of users Image preprocessing is still a challenge Every project starts from scratch and does something slightly different
PROBLEM •Camera or instrument •Sampling methods and deployment •Site conditions •Multitude of image processing approaches •Numerous hyperparameters to adjust •Handle metadata •Different tools and manual process •Not intuitive for all types of users Image preprocessing is still a challenge Every project starts from scratch and does something slightly different Meshroom COLMAP
CONFIGURATION FILE -YAML format -Utilizes a jsonschema file for structure, generated using Pydantic Models -Jsonschema updated automatically on the CI/CD -Easy to build tools to validate the configuration file: -Python API -Online validation tool developed specifically for this package IMPLEMENTATION
IMPLEMENTATION IMAGE METADATA •Supports iFDO and CSV Files •Tools for validate and generate iFDO standard metadata
IMPLEMENTATION IMAGE FORMATS AND STORAGE •Handle local and remote images (Object Store) •Image Formats in Scientific Research: -Common formats: bmp, jpg, png, tiff -Scientific imaging often involves RAW or proprietary formats •Challenges with RAW and Scientific Formats -Standard libraries like OpenCV, PIL, and imageio cannot fully handle RAW or metadata-rich images -Some RAW formats can be opened using rawpy
IMPLEMENTATION IMAGE FORMATS •For others formats, it was necessary to build custom loaders •Manually parse headers, dimensions, byte order, etc •Parameters are inspired by the settings found in IrfanView
PERFORMANCE AND IMAGE HANDLING IMPLEMENTATION •The images are handled as Xarray datasets (chunked or not) -Sequential Processing (n_jobs = 1) -Parallel Processing (n_jobs > 1 or n_jobs = -1) → Threads -Dask Cluster (Local or Slurm) •Code for generating benchmark calculation 300 mb dataset 4 workers / 4 threads sequential
•CUSTOM ALGORITHMS IMPLEMENTATION •The user can create and use their own algorithm •Using importlib and subprocess to install dependencies and running the code TUTORIAL IN DOCUMENTATION: https://paidiverpy.readthedocs.io/en/latest/guide/custom_alg orithms/index.html
UI/UX Pipeline processing -Run as a python package: -3 lines of code -EXAMPLE NOTEBOOK -Run as CLI -Run as a docker container -Images in GHCR, updated whenever a new version is deployed
UI/UX •Running the package as a GUI $ paidiverpy -gui -Integrate HTML in the notebooks -Panel (HoloViz) -Convert pydantic models into forms -Integrate jupyter notebooks html into the application -The GUI is only available locally EXAMPLE
OPEN-SOURCE DEVELOPMENT PROBLEM DISCOVERY SOLUTION IDENTIFICATION RELEASE DOCUMENTATION SCIENTIFIC IDEA CODE DESIGN DESIGN IMPLEMENTATION EXECUTION MAINTENANCE USER FEEDBACK TESTING / CI CODE REVIEW CODE QUALITY
CODE QUALITY •TESTS -PYTEST / UNITEST -ABOVE 85% OF COVERAGE -INTEGRATE CODECOV ON THE CI FOR TEST COVERAGE •LINTING USING RUFF ON THE CI/CD
MAINTENANCE AND USER FEEDBACK Workshop with end-users •Stakeholder & End-User Workshop | Mar 2025 -Ready-to-use Environment on DSP / JASMIN -Interactive Tutorials (Jupyter Notebooks) -Curated Sample Datasets •2-3 Workshops with End-Users | 2025 and 2026 ? •Working together with scientists: development of a best practices manual (not directly related to the code) https://paidiver.github.io/paidiver-workshop/
OPEN-SOURCE DEVELOPMENT PROBLEM DISCOVERY SOLUTION IDENTIFICATION RELEASE DOCUMENTATION SCIENTIFIC IDEA CODE DESIGN DESIGN IMPLEMENTATION EXECUTION MAINTENANCE USER FEEDBACK TESTING / CI CODE REVIEW CODE QUALITY
NEXT STEPS •Publicise the package •Workshops with end users and test GUI •Add new preprocessing steps: feature matching, mosaicking, orthorectification, reprojection •Export metadata to AI friendly formats (such as Croissant) •Export images to other image formats, including GeoTIFF and OME-NGFF (Zarr)
IMPORTANT INFORMATION AND LINKS PAIDIVERPY is ready to use. However, it is still in active development, and frequent updates and changes are expected. The API and features may evolve as we continue improving it. -GitHub: https://github.com/paidiver/paidiverpy -Pypi: https://pypi.org/project/Paidiverpy/ -Documentation: https://paidiverpy.readthedocs.io/ -ZENODO: https://zenodo.org/records/15587056 -Workshop website: https://paidiver.github.io/paidiver-workshop This project was supported by NERC through the Tools for automating image analysis for biodiversity monitoring (AIAB) Funding Opportunity, reference code UKRI052.
Thank you!
[email protected]