GithubHelp home page GithubHelp logo

blockagedetection_networks's Introduction

blockagedetection_networks

This code accompanies our paper currently under revision: Vandaele R., Ojha V., Dance S.-L., Deep Learning for Automated Trash Screen Blockage Detection Using Cameras: Actionable Information for Flood Risk Management, Journal of Hydroinformatics

The python code allows user to detect blockage on new trash screen images using the networks developed during our publication. For the moment, this code does not allow to train the networks.

  • classification_network.py corresponds to the classification approach
  • padim.py corresponds to the anomaly detection approach
  • siamese_network.py corresponds to the Siamenese network approach

The crop_coordinates.txt file contains the coordinates of the windows we manually delineated for each trash screen camera used for our publication.

The corresponding dataset (images and optimized network weights) can be found at: https://researchdata.reading.ac.uk/498/

  • The test cameras used in our publication were Cornwall_Crinnis, Cornwall_MevagisseyPreScreen, Devon_BarnstapleBradiford and sites_sistontunnel_cam1
  • The networks have not been trained on the test cameras

Requirements

  • numpy (tested with version 1.24.3)
  • pytorch (tested with version 2.1.0)
  • torchvision (tested with version 0.15.2)

How to use

Let's say that the dataset obtained at https://github.com/rvandaele/blockagedetection_networks has been extracted at the location /home/user/blockagedetection_dataset

In the code, the

  • the model filepaths variable must be assigned to the corresponding network weights (e.g.,
    • model_filepath must be assigned to /home/user/blockagedetection_dataset/weights/classification.pth for classification_network.py and to /home/user/blockagedetection_dataset/weights/siamese.pth for siamese_network.py
    • padim_mean_fpath must be assigned to /home/user/blockagedetection_dataset/weights/padim_resnet_mean_4.pth and padim_cov_fpath must be assigned to /home/user/blockagedetection_dataset/weights/padim_resnet_cov_4.pth
  • the image_filenames variable must be assigned to a list of images for which the user wants an estimation, e.g ["/home/user/blockagedetection_dataset/images/Cornwall_Crinnis/clear/2022_01_28_15_07.jpg", "/home/user/blockagedetection_dataset/images/Cornwall_Crinnis/blocked/2022_02_08_16_08.jpg"]
  • the x_min, x_max, y_min, y_max can be assigned to select a region of interest within the trash screen image (see crop_coordinates.txt for the values that were used in our work, leave to -1 if you don't want to use any window)
  • For siamese_network.py, you also need to mention a list of clear reference images by assigning the variable clean_ref_imgs, e.g ["/home/user/blockagedetection_dataset/images/Cornwall_Crinnis/clear/2022_03_26_06_10.jpg", "/home/user/blockagedetection_dataset/images/Cornwall_Crinnis/clear/2022_03_28_13_10.jpg"]

You can then launch the evaluation script in command line using python. The script will return blockage scores and classes for each image within the image_filenames list

blockagedetection_networks's People

Contributors

rvandaele avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.