Skip to content

codeaudit/OSMDeepOD

 
 

Repository files navigation

MIT License Codacy Badge Build Status Stories in Ready

OSMDeepOD - OSM and Deep Learning based Object Detection from Aerial Imagery

This is a project about object detection from aerial imagery using open data from OpenStreetMap (OSM) project as massive training data and areal imagery, wordwide or local. This project has been formerly known as "OSM-Crosswalk-Detection"; now ot's called OSMDeepOD, pronounced "OSM Deep 'Oh 'Dee"!

Keywords: Big Data; Data Science; Data Engineering; Machine Learning; Artificial Intelligence; Neuronal Nets; Imagery; Volunteered Geographic Information; Crowdsourcing; Geographic Information Systems; Infrastructure; Parallel Programming.

Introduction

OSM-Crosswalk-Detection is a highly scalable image recognition software for aerial photos (orthophotos). It uses the open source software library TensorFlow, with a retrained Inception V3 neuronal network, to detect crosswalks along streets.

This work started as part of a semester thesis autumn 2015 at Geometa Lab, University of Applied Sciences Rapperswil (HSR).

Overview

Marcitecture

Process

Detection-Example1

Getting Started

Prerequisites

  • Python

    At the moment, we support python 3.x

  • Docker

    In order to use volumes, I recommend using docker >= 1.9.x

  • Bounding Box of area to analyze

    To start the extraction of crosswalks within a given area, the bounding box of this area is required as arguments for the manager. To get the bounding box the desired area, you can use https://www.openstreetmap.org/export to select the area and copy paste the corresponding coordinates. Use the values in the following order when used as positional arguments to manager: left bottom right top

Usage

The simplest way to use the detection process is to clone the repository and build/start the docker containers.

git clone https://github.com/geometalab/OSM-Crosswalk-Detection.git
cd OSM-Crosswalk-Detection/dockerfiles/
sudo python docker_run.py -r -d

After the previous shell commands you have started a redis instance for data persistance and a container for the detection process. Now you should be connected to a tty of the crosswalk_detection container. If you have a nvida GPU and nvidia-docker installed the detection algorithm will automatically use this GPU1.

To start the detection process use the src/role/main.py2 script.

  1. Use the manger option to select the detection area and generate the jobs stored by the redis instance
python3 main.py --redis 172.17.0.25 --port 40001 --pass crosswalks manager 9.345101 47.090794 9.355947 47.097288 --tag junction roundabout --search roundabout --no_compare --zoom_level 17 --orthofoto other

The default settings of --tag, --search, and --zoom_level are for crosswalk detection. The parameter '--orthofoto' is for the image source.

  1. Start the detection algorithm. The results are also stored by the redis instance.
python main.py --redis 127.0.0.1 --port 40001 --pass crosswalks jobworker
  1. Collect the results in a simple JSON file.
python main.py --redis 127.0.0.1 --port 40001 --pass crosswalks resultworker

If you have execute the result worker in the docker container you can move the crosswalks.json file to the /crosswalk/ directory which is map to your host.

Own Orthofotos

To use your own Orthofotos you have to do the following steps:

1. Add a new directory to src/data/orthofoto
2. Add a new module to the directory with the name: 'your_new_directory'_api.py
3. Create a class in the module with the name: 'Your_new_directory'Api   (First letter needs to be uppercase)
4. Implement the function 'def get_image(self, bbox):' and returns a pillow image of the bbox
5. After that you can use your api with the parameter --orthofots 'your_new_directory'

If you have problems with the implementation have a look at the wms or other example.

Dataset

During this work, we have collected our own dataset with swiss crosswalks and non-crosswalks. The pictures have a size of 50x50 pixels and are available by request.

Crosswalk Examples

Picture 3: Crosswalk Examples

No-Crosswalk Examples

Picture 4: No Crosswalk Examples

Links

Notes

1: The crosswalk_detection container is based on the nvidia/cuda:7.5-cudnn4-devel-ubuntu14.04 image, may you have to change the base image for your GPU. 2: For more information about the main.py use the -h option.

About

OSMDeepOD - OSM and Deep Learning based Object Detection from Aerial Imagery (formerly known as "OSM-Crosswalk-Detection")

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 99.9%
  • Shell 0.1%