Image Alarms
This is a page dedicated to investigating the viability of detecting dry-weather flows via an installed camera (mostly the BoSLcam).
The initial outline of the study can be found in the abstract submission: BoSLcam illicit discharge detection: File:Catsamas udm2025 submission.pdf
The segment videos mentioned in the above abstract are provided in the gallery below.
segment 0
segment 1
segment 2
segment 3
segment 4
2nd March 2025
The initial next steps of this project are to explore how the water depth can be calibrated without an external depth sensor. The current main issue had is that the simple image analysis algorithm requires initial calibration to correlate the water width with the water depth. Current this requires initial measurements via an in water depth sensor to calibrate, however my idea for overcoming this is to build a larger remote image analysis algorithm that can determine this from uploaded images. This page will now explore development of this remote algorithm to directly measure depth from images.
From some initial guidance, it appears that the best approach to use is to apply transfer learning to a an existing convolutional neural network (CNN) model. It seems that PyTorch is a fairly well-supported framework to do this in. Here, a pretrained classifier can be used with its final layer swapped out for a linear one.
Within PyTorch, I have used the RESNET18 model and pretrained weights yet modified the final layer to be linear rather than so that it can be used for the scalar depth regression. I then trained (fine tuned?) this model on the segment 0 and 2 datasets (so that it had an example of multiple camera orientations). This fine-tuned model was then used to predict the depth measurements for all give segments. The results are shown in the gallery below. Unsurprisingly, segments 0 and 2 perform very well (though perhaps a bit surprising considering that there is significant sunlight in segment 0 and our previous algorithm only managed an R^2 of 0.19). The remaining segments have a decent (0.5) to good (0.97) correlation, however more concerning is that the gradient and intercept are both pretty far from 1 and 0 (down to 0.5 for the gradient and 5 mm for the intercept, this is a lot considering the water depth only reaches 50 mm max in these examples). Despite these present issues I'm quite happy with the results considering they were achieved within an afternoon of tinkering. I also think they show great promise. From here I need to read more about ML architectures and their training and interpretation, explore the possibility of including additional metadata, and also source additional, more diverse, training data. Given we also have additional labels of the turbidity, etc, it will be interesting to see if adding these labels to the data aids the performance of the ML as it now has a better perspective of the data space. Another interesting label to add will be the derivative of the water depth.