Giter Site home page Giter Site logo

shipdetection's Introduction

shipsnet-detector

This repository contains scripts that enable the automatic detection of container ships in Planet imagery using machine learning techniques. Included are files which define a machine learning model, train it using the ShipsNet dataset, and apply it across an entire image scene to highlight ship detections.

Methodology

ShipsNet is a labeled training dataset consiting of image chips extracted from Planet satellite imagery. It contains hundreds of 80x80 pixel RGB image chips labeled with either a "ship" or "no-ship" classification. Machine learning models can be trained against this data to classify any given input chip into either one of these classes.

With an accurately trained model, this classification process can be extended to a full Planet image scene by using a sliding window technique. A 80x80 pixel window is moved across each pixel position in the image, extracted, and classified by the model. Neighboring window poistions that are classified as "ship" are then clustered into a single detection. These detections are highlighted with a bounding box in a copy of the original Planet scene.

See an example of the results below.

Additional Results

Setup

Python 3.5+ is required for compatability with all required modules

# Clone this repository
git clone https://github.com/rhammell/shipsnet-detector.git

# Go into the repository
cd shipsnet-detector

# Install required modules
pip install -r requirements.txt

Model

A convolutional neural network (CNN) is defined within the model.py module using the TFLearn library. This model supports the 80x80x3 input dimensions of the ShipsNet image data.

Training

The defined CNN can be trained with the JSON version of the ShipsNet dataset and saved to a Tensorflow .tfl file for later use. Train the model by running train.py and passing the path to shipsnet.json and the path to the output .tfl file as arguments.

# Train the model
mkdir models
python train.py "shipsnet.json" "models/model.tfl"

The latest version of shipsnet.json is available through the ShipsNet Kaggle page, which has further information describing the dataset layout.

Detector

A trained model can be applied across entire images using the sliding window detector function detector.py, which takes the model file path, input image path, and optional output image path as arguments. The output image will cluster positive detections and draw a bounding box around their center point.

Example images are contained in the images directory.

# Run on demo image with default output path
python detector.py "models/model.tfl" "images/scene_1.png"

# Run on demo image with defined output path
python detector.py "models/model.tfl" "image/scene_1.png" "image/scene_1_detections.png"

shipdetection's People

Stargazers

 avatar hz avatar  avatar JerryShang avatar  avatar NingLi avatar  avatar  avatar  avatar  avatar  avatar tianruozhang 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.