Generic ecosystem for feature extraction from aerial and satellite imagery

Overview

Note: Robosat is neither maintained not actively developed any longer by Mapbox. See this issue.
The main developers (@daniel-j-h, @bkowshik) are no longer with Mapbox.

RoboSat

Generic ecosystem for feature extraction from aerial and satellite imagery RoboSat pipeline extracting buildings from aerial imagery Berlin aerial imagery, segmentation mask, building outlines, simplified GeoJSON polygons

Table of Contents

  1. Overview
  2. Installation
  3. Usage
  4. Extending
  5. Contributing
  6. License

Overview

RoboSat is an end-to-end pipeline written in Python 3 for feature extraction from aerial and satellite imagery. Features can be anything visually distinguishable in the imagery for example: buildings, parking lots, roads, or cars.

Have a look at

The tools RoboSat comes with can be categorized as follows:

  • data preparation: creating a dataset for training feature extraction models
  • training and modeling: segmentation models for feature extraction in images
  • post-processing: turning segmentation results into cleaned and simple geometries

Tools work with the Slippy Map tile format to abstract away geo-referenced imagery behind tiles of the same size.

The data preparation tools help you with getting started creating a dataset for training feature extraction models. Such a dataset consists of aerial or satellite imagery and corresponding masks for the features you want to extract. We provide convenient tools to automatically create these datasets downloading aerial imagery from the Mapbox Maps API and generating masks from OpenStreetMap geometries but we are not bound to these sources.

The modelling tools help you with training fully convolutional neural nets for segmentation. We recommend using (potentially multiple) GPUs for these tools: we are running RoboSat on AWS p2/p3 instances and GTX 1080 TI GPUs. After you trained a model you can save its checkpoint and run prediction either on GPUs or CPUs.

The post-processing tools help you with cleaning up the segmentation model's results. They are responsible for denoising, simplifying geometries, transforming from pixels in Slippy Map tiles to world coordinates (GeoJSON features), and properly handling tile boundaries.

If this sounds almost like what you need, see the extending section for more details about extending RoboSat. If you want to contribute, see the contributing section for more details about getting involved with RoboSat.

Installation

We provide pre-built Docker images for both CPU as well as GPU environments on Docker Hub in mapbox/robosat.

Using a CPU container to show all available sub-commands

docker run -it --rm -v $PWD:/data --ipc=host --network=host mapbox/robosat:latest-cpu --help

Using a GPU container (requires nvidia-docker on the host) to train a model

docker run --runtime=nvidia -it --rm -v $PWD:/data --ipc=host mapbox/robosat:latest-gpu train --model /data/model.toml --dataset /data/dataset.toml --workers 4

Arguments

  • --runtime=nvidia enables the nvidia-docker runtime for access to host GPUs
  • --ipc=host is required for shared memory communication between workers
  • --network=host is required for network communication in the download tool
  • -v $PWD:/data makes the current directory on the host accessible at /data in the container

For installation from source (requires installing dependencies) see the Dockerfiles in the docker/ directory.

Usage

The following describes the tools making up the RoboSat pipeline. All tools can be invoked via

./rs 
    
    

    
   

Also see the sub-command help available via

./rs --help
./rs 
   
     --help

   

Most tools take a dataset or model configuration file. See examples in the configs directory. You will need to adapt these configuration files to your own dataset, for example setting your tile resolution (e.g. 256x256 pixel). You will also need to adapt these configuration files to your specific deployment setup, for example using CUDA and setting batch sizes.

rs extract

Extracts GeoJSON features from OpenStreetMap to build a training set from.

The result of rs extract is a GeoJSON file with the extracted feature geometries.

The rs extract tool walks OpenStreetMap .osm.pbf base map files (e.g. from Geofabrik) and gathers feature geometries. These features are for example polygons for parking lots, buildings, or roads.

rs cover

Generates a list of tiles covering GeoJSON features to build a training set from.

The result of rs cover is a file with tiles in (x, y, z) Slippy Map tile format covering GeoJSON features.

The rs cover tool reads in the GeoJSON features generated by rs extract and generates a list of tiles covering the feature geometries.

rs download

Downloads aerial or satellite imagery from a Slippy Map endpoint (e.g. the Mapbox Maps API) based on a list of tiles.

The result of rs download is a Slippy Map directory with aerial or satellite images - the training set's images you will need for the model to learn on.

The rs download tool downloads images for a list of tiles in (x, y, z) Slippy Map tile format generated by rs cover.

The rs download tool expects a Slippy Map endpoint where placeholders for {x}, {y}, and {z} are formatted with each tile's ids. For example, for the Mapbox Maps API: https://api.mapbox.com/v4/mapbox.satellite/{z}/{x}/{y}@2x.webp?access_token=TOKEN.

rs rasterize

Rasterizes GeoJSON features into mask images based on a list of tiles.

The result of rs rasterize is a Slippy Map directory with masks - the training set's masks you will need for the model to learn on.

The rs rasterize tool reads in GeoJSON features and rasterizes them into single-channel masks with a color palette attached for quick visual inspection.

rs train

Trains a model on a training set made up of (image, mask) pairs.

The result of rs train is a checkpoint containing weights for the trained model.

The rs train tool trains a fully convolutional neural net for semantic segmentation on a dataset with (image, mask) pairs generated by rs download and rs rasterize. We recommend using a GPU for training: we are working with the AWS p2 instances and GTX 1080 TI GPUs.

Before you can start training you need the following.

  • You need a dataset which you should split into three parts: training and validation for rs train to train on and to calculate validation metrics on and a hold-out dataset for final model evaluation. The dataset's directory need to look like the following.

    dataset
    ├── training
    │   ├── images
    │   └── labels
    └── validation
        ├── images
        └── labels
    
  • You need to calculate label class weights with rs weights on the training set's labels

  • You need to add the path to the dataset's directory and the calculated class weights and statistics to the dataset config.

rs export

Exports a trained model in ONNX format for prediction across different backends (like Caffe2, TensorFlow).

The result of rs export is an ONNX GraphProto .pb file which can be used with the ONNX ecosystem.

Note: the rs predict tool works with .pth checkpoints. In contrast to these .pth checkpoints the ONNX models neither depend on PyTorch or the Python code for the model class and can be used e.g. in resource constrained environments like AWS Lambda.

rs predict

Predicts class probabilities for each image tile in a Slippy Map directory structure.

The result of rs predict is a Slippy Map directory with a class probability encoded in a .png file per tile.

The rs predict tool loads the checkpoint weights generated by rs train and predicts semantic segmentation class probabilities for a Slippy Map dataset consisting of image tiles.

rs masks

Generates segmentation masks for each class probability .png file in a Slippy Map directory structure.

The result of rs masks is a Slippy Map directory with one single-channel image per tile with a color palette attached for quick visual inspection.

The rs masks tool loads in the .png tile segmentation class probabilities generated by rs predict and turns them into segmentation masks. You can merge multiple Slippy Map directories with class probabilities into a single mask using this tool in case you want to make use of an ensemble of models.

rs features

Extracts simplified GeoJSON features for segmentation masks in a Slippy Map directory structure.

The result of rs features is a GeoJSON file with the extracted simplified features.

The rs features tool loads the segmentation masks generated by rs masks and turns them into simplified GeoJSON features.

rs merge

Merges close adjacent GeoJSON features into single features.

The result of rs merge is a GeoJSON file with the merged features.

The rs merge tool loads GeoJSON features and depending on a threshold merges adjacent geometries together.

rs dedupe

Deduplicates predicted features against existing OpenStreetMap features.

The result of rs dedupe is a GeoJSON file with predicted features which are not in OpenStreetMap.

The rs dedupe deduplicates predicted features against OpenStreetMap.

Note: rs extract to generate a GeoJSON file with OpenStreetMap features.

rs serve

Serves tile masks by providing an on-demand segmentation tileserver.

The rs serve tool implements a Slippy Map raster tileserver requesting satellite tiles and applying the segmentation model on the fly.

Notes: useful for visually inspecting the raw segmentation masks on the fly; for serious use-cases use rs predict and similar.

rs weights

Calculates class weights for a Slippy Map directory with masks.

The result of rs weights is a list of class weights useful for rs train to adjust the loss based on the class distribution in the masks.

The rs weights tool computes the pixel-wise class distribution on the training dataset's masks and outputs weights for training.

rs compare

Prepares images, labels and predicted masks, side-by-side for visual comparison.

The result of rs compare is a Slippy Map directory with images that have the raw image on the left, the label in the middle and the prediction on the right.

rs subset

Filters a Slippy Map directory based on a list of tile ids.

The result of rs subset is a Slippy Map directory filtered by tile ids.

The main use-case for this tool is hard-negative mining where we want to filter false positives from a prediction run.

Extending

There are multiple ways to extend RoboSat for your specific use-cases. By default we use Mapbox aerial imagery from the Maps API and feature masks generated from OpenStreetMap geometries. If you want to bring your own imagery, masks, or features to extract, the following will get you started.

Bring your own imagery

RoboSat's main abstraction is the Slippy Map tile format. As long as your imagery is geo-referenced and you can convert it to a Slippy Map directory structure to point the command lines to, you are good to go. Make sure imagery and masks are properly aligned.

Bring your own masks

RoboSat's main abstraction is the Slippy Map tile format. As long as you can convert your masks to a Slippy Map directory structure to point the command lines to, you are good to go. Masks have to be single-channel .png files with class indices starting from zero. Make sure imagery and masks are properly aligned.

Add support for feature in pre-processing

Pre-processing (rs extract) is responsible for turning OpenStreetMap geometries and tags into polygon feature masks. If you want to add a new feature based on geometries in OpenStreetMap you have to:

And that's it! From there on the pipeline is fully generic.

Add support for feature in post-processing

Post-processing (rs features) is responsible for turning segmentation masks into simplified GeoJSON features. If you want to add custom post-processing for segmentation masks you have to:

And that's it! From there on the pipeline is fully generic.

Contributing

We are thankful for contributions and are happy to help; that said there are some constraints to take into account:

  • For non-trivial changes you should open a ticket first to outline and discuss ideas and implementation sketches. If you just send us a pull request with thousands of lines of changes we most likely won't accept your changeset.
  • We follow the 80/20 rule where 80% of the effects come from 20% of the causes: we strive for simplicity and maintainability over pixel-perfect results. If you can improve the model's accuracy by two percent points but have to add thousands of lines of code we most likely won't accept your changeset.
  • We take responsibility for changesets going into master: as soon as your changeset gets approved it is on us to maintain and debug it. If your changeset can not be tested, or maintained in the future by the core developers we most likely won't accept your changeset.

License

Copyright (c) 2018 Mapbox

Distributed under the MIT License (MIT).

Comments
  • questions related to offline geotiff image and export option

    questions related to offline geotiff image and export option

    Hi, It looks very nice development. I have few queries:

    1.Can we run this module on Geotiff image already available in my machine if yes, how? how to convert it to slippy map format ? do one requires full scene or multiple pieces of one scene? 2. Pls give guidelines for offline (without internet ) processing.

    1. If I have segmented version (classified building image in png format) of the images available and just want to use your post processing tool for saving in to geojson or shape file, how to do that ?

    thanks

    opened by jaigsingla 34
  • rs command doesnt works

    rs command doesnt works

    Hi, thanks for this job. after runing docker run -it --rm -v $PWD:/data --ipc=host --network=host mapbox/robosat:latest-cpu --help it looks like everything is good, but when try to run rs command it says "The order "rs" was not found", any idea why is this happening?? thanks rs

    opened by balla-999 13
  • "Out of memory" error. Can anything be done?

    rs train and rs predict fail with CUDA error: out of memory.

    I have a nVidia GeForce GT 710 which is admittedly pretty low end. The specs say it has 2GB of memory, but nvidia-smi only says 978MB (~1 "giga" byte) 🤔.

    When I set batch_size = 1, and images_size = 256 (and in rs download I download the 256x256 (ie. no @2x suffix)), I still get the same error. It takes a few seconds before I get a python error of RuntimeError: CUDA error: out of memory``, rather than ~1 second, so it feels like it's lasting more before OOMing. But it still fails. This happens onrs trainandrs predict`.

    Is there any way to make robosat use less memory so that I can at least run this on my GPU rather than my CPU? Or must I just accept that my hardware isn't good enough? I know very little about graphics cards, cuda, or torch, or computer vision stuff.


    I run it on my CPU with by installing torch with pip install --upgrade https://download.pytorch.org/whl/cpu/torch-0.4.0-cp36-cp36m-linux_x86_64.whl, and setting cuda = false in model.toml. It works, and for tiny areas, I can get results in a few hours. But I'd love if it could be faster.


    $ nvidia-smi
    Wed Oct 10 18:21:07 2018       
    +-----------------------------------------------------------------------------+
    | NVIDIA-SMI 390.87                 Driver Version: 390.87                    |
    |-------------------------------+----------------------+----------------------+
    | GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
    | Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
    |===============================+======================+======================|
    |   0  GeForce GT 710      Off  | 00000000:01:00.0 N/A |                  N/A |
    | 40%   38C    P8    N/A /  N/A |    177MiB /   978MiB |     N/A      Default |
    +-------------------------------+----------------------+----------------------+
                                                                                   
    +-----------------------------------------------------------------------------+
    | Processes:                                                       GPU Memory |
    |  GPU       PID   Type   Process name                             Usage      |
    |=============================================================================|
    |    0                    Not Supported                                       |
    +-----------------------------------------------------------------------------+
    

    and

    $ nvcc 
    nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2017 NVIDIA Corporation
    Built on Fri_Nov__3_21:07:56_CDT_2017
    Cuda compilation tools, release 9.1, V9.1.85
    

    My OS is Ubuntu 18.04.

    opened by amandasaurus 10
  • ./rs cover fails on

    ./rs cover fails on "road"

    STEP1: ./rs extract --type road ../osmPbf/utah-latest.osm.pbf ../osmPbf/road-extraction.geojson

    STEP2: ./rs cover --zoom 18 ../osmPbf/road-extraction.geojson ../osmPbf/utah-road-feature-cover.csv

    Fail Log:

    Traceback (most recent call last):
      File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/home/connor/Documents/Regia/ProjectApollo/building-ccn/robosat/robosat/tools/__main__.py", line 57, in <module>
        args.func(args)
      File "/home/connor/Documents/Regia/ProjectApollo/building-ccn/robosat/robosat/tools/cover.py", line 30, in main
        tiles.extend(map(tuple, burntiles.burn([feature], args.zoom).tolist()))
      File "/home/connor/.local/lib/python3.6/site-packages/supermercado/burntiles.py", line 54, in burn
        bounds = find_extrema(polys)
      File "/home/connor/.local/lib/python3.6/site-packages/supermercado/burntiles.py", line 22, in find_extrema
        xMax = totalArr[:, 0].max() - epsilon
    IndexError: too many indices for array
    
    
    opened by neverwiredhouse 10
  • Allow building type for ./rs features

    Allow building type for ./rs features

    Currently the only supported option is parking, which is incompatible with inputs trained on buildings.

    root@3d58a7d0d5c3:/app# ./rs features --type building --dataset config/dataset-building-middlebury.toml vt/rutland/masks/ vt/rutland/features/buildings-out.geojson
    usage: ./rs features [-h] --type {parking} --dataset DATASET masks out
    ./rs features: error: argument --type: invalid choice: 'building' (choose from 'parking')
    
    root@3d58a7d0d5c3:/app# ./rs features --dataset config/dataset-building-middlebury.toml vt/rutland/masks/ vt/rutland/features/buildings-out.geojson
    usage: ./rs features [-h] --type {parking} --dataset DATASET masks out
    ./rs features: error: the following arguments are required: --type
    root@3d58a7d0d5c3:/app# ./rs features --type parking --dataset config/dataset-building-middlebury.toml vt/rutland/masks/ vt/rutland/features/buildings-out.geojson
    Traceback (most recent call last):
      File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/app/robosat/tools/__main__.py", line 60, in <module>
        args.func(args)
      File "/app/robosat/tools/features.py", line 38, in main
        assert set(labels).issuperset(set(handlers.keys())), "handlers have a class label"
    AssertionError: handlers have a class label
    

    Am I correct that this will require another well-thought-out postprocessing handler?

    opened by wboykinm 9
  • Optimizing rs merge

    Optimizing rs merge

    rs merge is currently very slow for files with a large number of polygons (>20k). The merging part can be parallelized but the graph building takes very long.

    I will benchmark the results of graph construction, traversal etc. and post the results.

    Open for a discussion to improve this, if anyone has faced a similar issue, please feel free to contribute!

    opened by Venka97 8
  • Re-enable automated docker builds

    Re-enable automated docker builds

    Looking at https://hub.docker.com/r/mapbox/robosat/tags automated docker builds stopped working.

    In the logs (https://travis-ci.org/mapbox/robosat/builds/536326116#L722) we see

    Error response from daemon: Get https://registry-1.docker.io/v2/: unauthorized: incorrect username or password

    @jacquestardie could you look into this; the login probably changed and needs to be fixed in the Travis env so that the Travis workers can automatically build and push images.

    See our Travis file here

    https://github.com/mapbox/robosat/blob/bde13538ab85849d21e2c10e2e67ecb082296c3b/.travis.yml#L38-L58

    opened by daniel-j-h 8
  • Do not predict a file if the output already exists

    Do not predict a file if the output already exists

    This change makes rs predict not do any predictions if the resultant output file already exists. Sometimes when playing around, I'll run rs predict, then stop it. If I run it again, it'll redo predictions it's already done. With this change, you're not redoing work.

    opened by amandasaurus 8
  • rs merge: fail on 'Merging components'

    rs merge: fail on 'Merging components'

    Hello! Many thanks to the developers for this amazing framework! It is very helpful!

    I faced with problem when use rs merge (stage 'Merging components'):

    Traceback (most recent call last): File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "/usr/lib/python3.6/runpy.py", line 85, in _run_code exec(code, run_globals) File "/usr/src/app/robosat/tools/main.py", line 58, in args.func(args) File "/usr/src/app/robosat/tools/merge.py", line 79, in main area = int(round(project(merged, "epsg:4326", "esri:54009").area)) File "/usr/src/app/robosat/spatial/core.py", line 21, in project project = functools.partial(pyproj.transform, pyproj.Proj(init=source), pyproj.Proj(init=target)) File "/opt/venv/lib/python3.6/site-packages/pyproj/proj.py", line 295, in init self.crs = CRS.from_user_input(projparams if projparams is not None else kwargs) File "/opt/venv/lib/python3.6/site-packages/pyproj/crs.py", line 224, in from_user_input return cls(**value) File "/opt/venv/lib/python3.6/site-packages/pyproj/crs.py", line 146, in init super(CRS, self).init(projstring) File "pyproj/_crs.pyx", line 317, in pyproj._crs._CRS.init pyproj.exceptions.CRSError: Invalid projection: +init=esri:54009 +type=crs: (Internal Proj Error: proj_create: cannot expand +init=esri:54009 +type=crs)

    What is problem? Maybe I have wrong environment setup?

    opened by alektros 7
  • Constructing the slippy tiles back into larger images

    Constructing the slippy tiles back into larger images

    Hello, I'm wondering how, after you've built the training data folders for the masks and images, you can compile the slippy map tiles into a single (or at least many larger) images. As a check, I'd like to visually inspect the imagery that I've downloaded along with the corresponding classification masks. From my review of the Slippy Map format, given the format " /zoom/x/y.png", I should just be able to join the tiles in a grid fashion using the x and y values. Am I mistaken here?

    I extracted a rectangular region, yet I find that the "x" subdirectories contain often wildly different numbers of tiles. Any suggestions?

    Thanks!

    opened by CooperNederhood 7
  • Tool to write slippy map directory to a csv file

    Tool to write slippy map directory to a csv file

    We have a slippy map directory with X items (1000 in this example) and we want a subset of Y items (5 in this example). There are a couple of additional options that are common to data workflows:

    • Shuffle images at random, --shuffle
    • Get required number of images, --count

    Workflow

    $ find "images/" -type f | wc -l
    1000
    
    
    # Get a csv file for the slippy map directory.
    $ ./rs csv "images/" "images.csv" --shuffle true --count 5
    
    
    # Five items since we asked so with --count 5
    $ cat images.csv
    41483,95309,18
    41484,95309,18
    41505,94409,18
    41487,94309,18
    41504,94409,18
    

    The logical next step here is to use rs subset tool to get a subset of images per csv file.

    # Use csv to prepare a subset slippy map directory.
    $ ./rs subset "images/" "images.csv" "subset/"
    
    
    # Slippy map directory now has only the files in the csv.
    $ find "subset/" -type f
    subset/18/41505/94409.webp
    subset/18/41484/95309.webp
    subset/18/41504/94409.webp
    subset/18/41487/94309.webp
    subset/18/41483/95309.webp
    
    opened by bkowshik 7
  • Extracting segmentation masks from bbox coordinates

    Extracting segmentation masks from bbox coordinates

    Hello @daniel-j-h. Thank you for the amazing repository. However, I have some questions to use this repo for my project. I have an unlabeled dataset of UAV imagery with coordinates of bounding boxes ( min and max long and lat ). Is there a way to use your code to use OpenStreetMap to create segmentation masks as you did but instead by using coordinates of the bounding box of images?

    opened by dawoodwasif 2
  • Augmented data is stopping weight calculation and training.

    Augmented data is stopping weight calculation and training.

    @daniel-j-h Hello! I am working with Sentinel-2 data and successfully trained with 0.56 accuracy. Now I want to increase training data so I am trying data augmentation (rotation, zooming). I rotated and zoomed current data (I did the same for labels) with Keras library (ImageDataGenerator). New data has appropriate z/x/y names (continued from the last number of x). While calculating weights when it comes to new data I am getting:

    Traceback (most recent call last):
      File "weights.py", line 69, in <module>
    	main(args.dataset)
      File "weights.py", line 47, in main
    	counts += np.bincount(image.ravel(), minlength=num_classes)
    ValueError: operands could not be broadcast together with shapes (2,) (142,) (2,)
    

    What will be the reason? How should I solve it? Furthermore, I noticed that original data represents binary data (print (image)), while new data has values up to 255. What is a problem?

    When starting the training without calculating weights I am getting:

    /pytorch/aten/src/THC/THCTensorScatterGather.cu:188: void THCudaTensor_scatterFillKernel(TensorInfo<Real, IndexType>, TensorInfo<long, IndexType>, Real, int, IndexType) [with IndexType = unsigned int, Real = float, Dims = -1]: block: [41,0,0], thread: [98,0,0] Assertion `indexValue >= 0 && indexValue < tensor.sizes[dim]` failed.
    
    
    Traceback (most recent call last):
      File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
    	"__main__", mod_spec)
      File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
    	exec(code, run_globals)
      File "/usr/src/app/robosat/tools/__main__.py", line 58, in <module>
    	args.func(args)
      File "/usr/src/app/robosat/tools/train.py", line 129, in main
    	train_hist = train(train_loader, num_classes, device, net, optimizer, criterion)
      File "/usr/src/app/robosat/tools/train.py", line 185, in train
    	loss = criterion(outputs, masks)
      File "/opt/venv/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
    	result = self.forward(*input, **kwargs)
      File "/usr/src/app/robosat/losses.py", line 106, in forward
    	errors_sorted, indices = torch.sort(max_margin_errors, descending=True)
    RuntimeError: merge_sort: failed to synchronize: device-side assert triggered
    
    
    opened by manapshymyr-OB 1
  • RuntimeError: unexpected EOF, expected 2051578 more bytes. The file might be corrupted.

    RuntimeError: unexpected EOF, expected 2051578 more bytes. The file might be corrupted.

    Hello! @daniel-j-h Thank you for your project.

    I am having an error during prediction:

    sudo docker run --runtime=nvidia -it --rm -v $PWD:/data --ipc=host mapbox/robosat:latest-gpu predict --tile_size 512 --model /data/robosat/config/model-unet.toml --dataset /data/robosat/config/dataset-building.toml --checkpoint /data/robosat/checkpoint/checkpoint-00001-of-00010.pth /data/robosat/datasets /data/

    Traceback (most recent call last):
      File "/usr/lib/python3.6/runpy.py", line 193, in _run_module_as_main
        "__main__", mod_spec)
      File "/usr/lib/python3.6/runpy.py", line 85, in _run_code
        exec(code, run_globals)
      File "/usr/src/app/robosat/tools/__main__.py", line 58, in <module>
        args.func(args)
      File "/usr/src/app/robosat/tools/predict.py", line 60, in main
        chkpt = torch.load(args.checkpoint, map_location=map_location)
      File "/opt/venv/lib/python3.6/site-packages/torch/serialization.py", line 387, in load
        return _load(f, map_location, pickle_module, **pickle_load_args)
      File "/opt/venv/lib/python3.6/site-packages/torch/serialization.py", line 581, in _load
        deserialized_objects[key]._set_from_file(f, offset, f_should_read_directly)
    RuntimeError: unexpected EOF, expected 2051578 more bytes. The file might be corrupted.
    terminate called after throwing an instance of 'c10::Error'
      what():  owning_ptr == NullType::singleton() || owning_ptr->refcount_.load() > 0 ASSERT FAILED at /pytorch/c10/util/intrusive_ptr.h:350, please report a bug to PyTorch. intrusive_ptr: Can only intrusive_ptr::reclaim() owning pointers that were created using intrusive_ptr::release(). (reclaim at /pytorch/c10/util/intrusive_ptr.h:350)
    frame #0: std::function<std::string ()>::operator()() const + 0x11 (0x7fb856a7d441 in /opt/venv/lib/python3.6/site-packages/torch/lib/libc10.so)
    frame #1: c10::Error::Error(c10::SourceLocation, std::string const&) + 0x2a (0x7fb856a7cd7a in /opt/venv/lib/python3.6/site-packages/torch/lib/libc10.so)
    frame #2: THStorage_free + 0xca (0x7fb857a1729a in /opt/venv/lib/python3.6/site-packages/torch/lib/libcaffe2.so)
    frame #3: <unknown function> + 0x53a157 (0x7fb89f421157 in /opt/venv/lib/python3.6/site-packages/torch/lib/libtorch_python.so)
    frame #4: python3() [0x54f1c6]
    frame #5: python3() [0x573420]
    frame #6: python3() [0x4b1a48]
    frame #7: python3() [0x5891e8]
    frame #8: python3() [0x5add18]
    frame #9: python3() [0x5add2e]
    frame #10: python3() [0x5add2e]
    frame #11: python3() [0x5add2e]
    frame #12: python3() [0x5add2e]
    frame #13: python3() [0x5add2e]
    frame #14: python3() [0x56b906]
    <omitting python frames>
    frame #20: __libc_start_main + 0xe7 (0x7fb8c8cbbb97 in /lib/x86_64-linux-gnu/libc.so.6)
    
    Aborted (core dumped)
    

    I am running on my laptop, with GTX 1660TI. Do you think this is the reason for that? Furthermore, getting same error while trying with only CPU. Can you please comment on that?

    opened by manapshymyr-OB 1
  • Bringin own data

    Bringin own data

    Hello! @daniel-j-h Thank you for your project.

    I have some questions. 1 Can we bring own dataset(with labels) for example: https://github.com/phelber/EuroSAT. 2. If we can bring this data, should we convert them into PNG or robosat will work with multi spectral data? 3. How we should select the zoom level? I intend to use Sentinel - 2 data for building detection and not sure how to figure out appropriate zoom level. Thanks!

    opened by manapshymyr-OB 14
  • Error while training

    Error while training

    Hi,

    I am facing this issue while training.

    ERROR: resolutions for images and masks are in sync

    Not sure about the error.

    I have also checked for the resolutions of the image and labels and they all look good.

    Could you please explain more about this error.

    opened by Roosh27 1
  • poor prediction in satellite images

    poor prediction in satellite images

    Hi All,

    I am able to get 0.83 of IOU using the Tanzania dataset using your code and able to generate vector files after predictions.
    Now, I have a 50cm VHR image over an urban area and corresponding building shape files in geojson format. I applied the same techniques as in the Tanzania dataset and trained the model with an IOU of .67 But, generated segmentation probabilities do not look good, what can be the reason ? I have used batch_size of 16, image_size of 512, lr= 0.00005 and loss function of Lovasz. I will be happy to hear from you.

    regards, Jai

    opened by jaigsingla 4
Releases(v1.2.0)
  • v1.2.0(Jun 1, 2019)

    This release brings incredible new features and improvements from the community accumulated over the last months. We recommend to upgrade.

    The pre-built docker images are the recommended way of using robosat:

    • https://github.com/mapbox/robosat#installation
    • https://hub.docker.com/r/mapbox/robosat/

    Changes

    • rs train: state of the art losses and metrics. Lovasz loss as default, many many more small features and fixes in training and related tools. Thanks https://github.com/ocourtin

    • rs extract: fully automatated road training dataset creation Thanks https://github.com/DragonEmperorG

    • rs extract: batch feature extraction for datasets too big for memory Thanks http://github.com/daniel-j-h

    • rs rasterize: batch rasterization for datasets too big for memory Thanks http://github.com/daniel-j-h

    • Infrastructure: improved docker images, pre-trained weights in images, upgrades to CUDA 10.1, cudnn 7, and pytorch 1.1. Thanks http://github.com/daniel-j-h

    Source code(tar.gz)
    Source code(zip)
    bavaria-dop80-release-1.tar.gz(365.57 MB)
  • v1.1.0(Sep 12, 2018)

    Changes

    • rs train: new --checkpoint argument to re-start training (fine-tune) from a trained model checkpoint. Thanks https://github.com/ocourtin

    • rs train: memory usage reduction during validation by disabling expensive gradient computation. Thanks https://github.com/Jesse-jApps

    • rs train, rs predict: speedups using multiple workers and doing metric calculation on GPU. Thanks https://github.com/ocourtin

    • rs merge: polygon orientation fixes to respect the GeoJSON specification (right-hand rule). Thanks https://github.com/marsbroshok

    You can find automatically built Docker images as usual at https://hub.docker.com/r/mapbox/robosat/

    Source code(tar.gz)
    Source code(zip)
Owner
Mapbox
Mapbox is the location data platform for mobile and web applications. We're changing the way people move around cities and explore our world.
Mapbox
Train a deep learning net with OpenStreetMap features and satellite imagery.

DeepOSM Classify roads and features in satellite imagery, by training neural networks with OpenStreetMap (OSM) data. DeepOSM can: Download a chunk of

TrailBehind, Inc. 1.3k Nov 24, 2022
To propose and implement a multi-class classification approach to disaster assessment from the given data set of post-earthquake satellite imagery.

To propose and implement a multi-class classification approach to disaster assessment from the given data set of post-earthquake satellite imagery.

Kunal Wadhwa 2 Jan 5, 2022
YOLTv5 rapidly detects objects in arbitrarily large aerial or satellite images that far exceed the ~600×600 pixel size typically ingested by deep learning object detection frameworks

YOLTv5 rapidly detects objects in arbitrarily large aerial or satellite images that far exceed the ~600×600 pixel size typically ingested by deep learning object detection frameworks.

Adam Van Etten 145 Jan 1, 2023
HiFT: Hierarchical Feature Transformer for Aerial Tracking (ICCV2021)

HiFT: Hierarchical Feature Transformer for Aerial Tracking Ziang Cao, Changhong Fu, Junjie Ye, Bowen Li, and Yiming Li Our paper is Accepted by ICCV 2

Intelligent Vision for Robotics in Complex Environment 55 Nov 23, 2022
TorchIO is a Medical image preprocessing and augmentation toolkit for deep learning. Part of the PyTorch Ecosystem.

Medical image preprocessing and augmentation toolkit for deep learning. Part of the PyTorch Ecosystem.

Fernando Pérez-García 1.6k Jan 6, 2023
Flax is a neural network ecosystem for JAX that is designed for flexibility.

Flax: A neural network library and ecosystem for JAX designed for flexibility Overview | Quick install | What does Flax look like? | Documentation See

Google 3.9k Jan 2, 2023
Elegy is a framework-agnostic Trainer interface for the Jax ecosystem.

Elegy Elegy is a framework-agnostic Trainer interface for the Jax ecosystem. Main Features Easy-to-use: Elegy provides a Keras-like high-level API tha

null 435 Dec 30, 2022
Models Supported: AlbUNet [18, 34, 50, 101, 152] (1D and 2D versions for Single and Multiclass Segmentation, Feature Extraction with supports for Deep Supervision and Guided Attention)

AlbUNet-1D-2D-Tensorflow-Keras This repository contains 1D and 2D Signal Segmentation Model Builder for AlbUNet and several of its variants developed

Sakib Mahmud 1 Nov 15, 2021
NFT-Price-Prediction-CNN - Using visual feature extraction, prices of NFTs are predicted via CNN (Alexnet and Resnet) architectures.

NFT-Price-Prediction-CNN - Using visual feature extraction, prices of NFTs are predicted via CNN (Alexnet and Resnet) architectures.

null 5 Nov 3, 2022
Feature extraction made simple with torchextractor

torchextractor: PyTorch Intermediate Feature Extraction Introduction Too many times some model definitions get remorselessly copy-pasted just because

Antoine Broyelle 89 Oct 31, 2022
Code for the CVPR 2021 paper: Understanding Failures of Deep Networks via Robust Feature Extraction

Welcome to Barlow Barlow is a tool for identifying the failure modes for a given neural network. To achieve this, Barlow first creates a group of imag

Sahil Singla 33 Dec 5, 2022
Cascading Feature Extraction for Fast Point Cloud Registration (BMVC 2021)

Cascading Feature Extraction for Fast Point Cloud Registration This repository contains the source code for the paper [Arxive link comming soon]. Meth

null 7 May 26, 2022
Experiments on Flood Segmentation on Sentinel-1 SAR Imagery with Cyclical Pseudo Labeling and Noisy Student Training

Flood Detection Challenge This repository contains code for our submission to the ETCI 2021 Competition on Flood Detection (Winning Solution #2). Acco

Siddha Ganju 108 Dec 28, 2022
An algorithm that handles large-scale aerial photo co-registration, based on SURF, RANSAC and PyTorch autograd.

An algorithm that handles large-scale aerial photo co-registration, based on SURF, RANSAC and PyTorch autograd.

Luna Yue Huang 41 Oct 29, 2022
Official code for 'Robust Siamese Object Tracking for Unmanned Aerial Manipulator' and offical introduction to UAMT100 benchmark

SiamSA: Robust Siamese Object Tracking for Unmanned Aerial Manipulator Demo video ?? Our video on Youtube and bilibili demonstrates the evaluation of

Intelligent Vision for Robotics in Complex Environment 12 Dec 18, 2022
UAV-Networks-Routing is a Python simulator for experimenting routing algorithms and mac protocols on unmanned aerial vehicle networks.

UAV-Networks Simulator - Autonomous Networking - A.A. 20/21 UAV-Networks-Routing is a Python simulator for experimenting routing algorithms and mac pr

null 0 Nov 13, 2021
FactSeg: Foreground Activation Driven Small Object Semantic Segmentation in Large-Scale Remote Sensing Imagery (TGRS)

FactSeg: Foreground Activation Driven Small Object Semantic Segmentation in Large-Scale Remote Sensing Imagery by Ailong Ma, Junjue Wang*, Yanfei Zhon

Kingdrone 43 Jan 5, 2023
Change is Everywhere: Single-Temporal Supervised Object Change Detection in Remote Sensing Imagery (ICCV 2021)

Change is Everywhere Single-Temporal Supervised Object Change Detection in Remote Sensing Imagery by Zhuo Zheng, Ailong Ma, Liangpei Zhang and Yanfei

Zhuo Zheng 125 Dec 13, 2022
A PyTorch implementation of Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks

SVHNClassifier-PyTorch A PyTorch implementation of Multi-digit Number Recognition from Street View Imagery using Deep Convolutional Neural Networks If

Potter Hsu 182 Jan 3, 2023