Code Monkey home page Code Monkey logo

sink-seg's Introduction

Automatic Segmentation of Sinkholes Using a Convolutional Neural Network

M. Usman Rafique, Nathan Jacobs, Junfeng Zhu

PaperPDFDataset

This repository contains PyTorch code for the following paper:

M. Usman Rafique, Junfeng Zhu, Nathan Jacobs "Automatic Segmentation of Sinkholes Using a Convolutional Neural Network", AGU Earth and Space Science Journal, 2022.

Setting Up

Installation

We recommend using a virtual environment with anaconda. If you don't already have anaconda installed, please visit this page to install anaconda: https://docs.anaconda.com/anaconda/install/index.html

We provide a virtual environment file environment.yml in this repository that can be used to make a suitable virtual environment. In terminal, go to the path of this repo and use this command:

conda env create -f environment.yml

Once you set up the virtual environment (named sinkhole), you can activate it by:

conda activate sinkhole

Dataset

Our dataset has been publicly released at Zenodo: DOI

Please download all the files in a directory named data in this repository. The data is released under the Creative Commons Attribution 4.0 license.

Training

To train a model, first set up the required settings in the config.py file. The default settings use two-channel DEM derivatives as input and a Unit Gaussian normalization. Other inputs and normalization options are available. Additionally, data and optimization settings can also be set in the config file.

To start training, simply use the command:

python3 train.py

At the end of the training, the trained model checkpoint and training logs will be saved in the cfg.train.out_dir specified in the config.py file.

Evaluation

To evaluate a trained model, set the same cfg.train.out_dir in config.py that was used to train the model and run the command:

python3 evaluate.py

Metrics will be displayed in the terminal and saved to the cfg.train.out_dir directory. This script performs a sweep of different thresholds on the val set and saves the best threshold in a file best_threshold.txt as well.

Visualization

To generate qualitative visual results, run the command

python3 visualize.py

As before, it is required that cfg.train.out_dir in config.py specifies a directory that contains a trained model checkpoint.

Acknowledgement

We thank Nicole Wong and Aram Ansary Ogholbake for testing the code.

Citation

If you find this paper or code helpful, please cite our paper:

@article{rafique2022automatic,
  title={Automatic Segmentation of Sinkholes using a Convolutional Neural Network},
  author={Rafique, M. Usman and Zhu, Junfeng and Jacobs, Nathan},
  journal={AGU Earth and Space Science Journal},
  year={2022},
  publisher={Wiley Online Library}
}

sink-seg's People

Contributors

usman-rafique avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

sink-seg's Issues

OSError: [Errno 22] Invalid argument while running evaluation file

Hello, I have been trying to implement your code as we want to work in a similar direction, however, I came across the following error while running the Evaluation file;

" File "C:\Users\danish\anaconda3\envs\sink-holes\lib\multiprocessing\reduction.py", line 60, in dump
ForkingPickler(file, protocol).dump(obj)

OSError: [Errno 22] Invalid argument

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\danish\anaconda3\envs\sink-holes\lib\multiprocessing\spawn.py", line 116, in spawn_main
exitcode = _main(fd, parent_sentinel)
File "C:\Users\danish\anaconda3\envs\sink-holes\lib\multiprocessing\spawn.py", line 126, in _main
self = reduction.pickle.load(from_parent)
_pickle.UnpicklingError: pickle data was truncated "

Would you please help me identify what is causing this issue?

Thank you!

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.