This repository contains scripts and example files to evaluate the performance of Koster Seafloor Observatory (KSO, or PLatform for Analysis of SUBSea IMages, PLAN-SUBSIM) species detection models, and to convert such model observations into GIS layers. It features custom-made R functions built around the KSO YOLO object detection models output, and Python scripts for geoprocessing in QGIS (PyQGIS). Koster Seafloor Observatory is a project run by University of Gothenburg, Ocean Data Factory Sweden, Swedish Biodiversity Data Infrastructure and Wildlife.ai, which uses machine learning to map marine species from large volumes of image data. It was released in 2020 and has since developed both technologically and expanded its range of ecological applications, and this repository is the result of a student project along the way.
The consisting R functions are:
compare.film.by.film
: Calculate confusion matrix statistics for different species in different films at different confidence thresholds.summarize.by.species
: Summarize the confusion matrices for all films into a single confusion matrix per species and parameter set.annotate.grid.cells
: Annotate vector layer subunits of a timed route, like grid cells or segments of a line track, with the highest model confidence value for each species within that unit. Alternatively, annotate with the positive predictive value (PPV), or just presence/absence.save.to.file
: Save the results (data frame or list of data frames) to a new XLSX workbook or CSV file.The code relies on the openxlsx R package to read and write XLSX files, but other than that everything works entirely in base-R. Instructions on how to use these scripts can be found in the /r_scripts README.md file, and a more detailed explanation is also available as embedded comments within the scripts.
There are two geoprocessing Python scripts for QGIS 3. Both take an input layer of waypoints and create a timed route polyline layer where the length of each line segment...
LineRoute.py
: ...corresponds to a given number of seconds.GridRoute.py
: ...is determined by the lines of a grid overlay, and enter/exit times for every crossed grid cell are calculated.Instructions on how to use these scripts can be found in the /geoprocessing README.md file.
For more info on the technical aspects of KSO, please visit the Github profile of Ocean Data Factory Sweden, which hosts its official repositories. More info on the project in general can be found on the KSO Zooniverse pages, and in the first published scientific paper describing the system:
Anton, V., Germishuys, J., Bergström, P., Lindegarth, M., & Obst, M. (2021). An open-source, citizen science and machine learning approach to analyse subsea movies. Biodiversity Data Journal, 9, e60548. https://doi.org/10.3897/BDJ.9.e60548