Coder Social home page Coder Social logo

skyscan's Introduction

SkyScan

Automatically photograph planes that fly by!

A321

Airbus A321 at 32,000 feet

Overview

Building image datasets for machine learning applications can be slow and expensive. SkyScan demonstrates a low-cost system that uses sensors to automate the building of datasets appropriate for computer vision models. SkyScan uses a ground-based camera and software-defined radio to capture images and correlated identity information of commercial aircraft. The SkyScan field kit software runs on a Raspberry Pi and all devices are low-power, allowing the system to run for several hours off of a portable battery.

Table of Contents

  1. How it Works
  2. Hardware
  3. Software Architecture
  4. ML Pipeline
  5. Setup and Operation
  6. Additional Information

How it Works

To enable better tracking, most planes broadcast a signal known as Automatic Dependent Surveillance–Broadcast or ADS-B. This signal is at 1090MHz and can be easily received using a low cost Software Defined Radio (SDR), like the RTL-SDR which repurposes a digital TV chip.

From the ADS-B transmissions, you can get a plane's location and altitude. If you know where a plane is and where you are, you can do some math, point a camera at the plane and take a picture. If you have a Pan/Tilt camera lying around, you can have it automatically track a plane as it flies by and snap photos.

After a dataset has been collected, a model can be trained to build a plane detector and classifier using the labeled plane data.

System Diagram

Hardware

This project is built around the RaspberryPi 4, an RTL-SDR, and an Axis PTZ security camera. It could be extended to work with other SDRs or cameras.

Axis has a great API for their network cameras, and it should work with any of their PTZ cameras. The m5525 is nice because it supports continuous 360 degree rotation. You can literally have it spin around in circles, giving you complete coverage. The code has been tested with the 10x zoom Axis m5525 and the 30x zoom Axis p5655 cameras.

We are using the Nooelec NESDR SMArt v4 SDR. This is a nice and stable RTL-SDR. It is compact and doesn't block all the other ports on a Pi. Since you are just trying to capture local planes, you can get away with using any antenna you have lying around.

Field System Configurations

Two configurations were developed for this project, one with AC and one with DC power input.

configurations

CAD Files

The major components of the system were modelled in CAD software. A few 3D printed parts were designed to house and mount the things together. These files can be found in the hardware STL directory.

BOM

See the Hardware README for additional component details including a BOM.

Software Architecture

The different components for this project have been made into Docker containers. This modularity makes it easier to add in new data sources or cameras down the road. We have found that containers work really well on the Pi and help enforce that you have properly documented all of the software requirements.

+-------------+      +-------------+           +---------------+            +--------------+
|             |      |             |           |               |            |              |
|             |      |             |           |               |            |  Axis+PTZ    |
| Pi+Aware    +----->+  ADSB+MQTT  +---------->+ Tracker       +----------->+              |
|             | TCP  |             |  MQTT     |               |  MQTT      |              |
|             |      |             |  all      |               |  only      |              |
+-------------+      +-------------+  planes   +---------------+  tracking  +-------+------+
                                                                  plane             |
                                                                                    | HTTP API
                                                                                    | Pan/Tilt
                                                                                    v
                                +--------------------+                     +--------+---------+
                                |                    |                     |                  |
                                |                    |                     |                  |
                                |   MQTT Broker      |                     |    Axis m5525    |
                                |                    |                     |    Camera        |
                                |                    |                     |                  |
                                |                    |                     |                  |
                                +--------------------+                     +------------------+

Here is a brief overview of each component. There are additional details in the component's subdirectory

  • mikenye/piaware - This is a dockerized version of FlightAware's PiAware program. PiAware is actually just a wrapper around dump1090. Dump1090 is a small program that can use an RTL-SDR to receive an ADS-B transmission. The program uses these transmission to track where nearby planes are and display them on a webpage. It also outputs all of the messages it receives on a TCP port for other programs to use. We use this connection to get the plane information. PiAware adds the ability to send the information to FlightAware. You could probably just switch this to only use Dump1090.

  • ADSB-MQTT is a small Python program that reads in information collected by Dump1090 over a TCP port and publishes all the messages it receives onto the MQTT bus.

  • tracker receives all of the plane's location, determines how far away from the camera each one is and then finds the closest plane. The location and relative position of the closest plane is periodically published as an MQTT messages. Tracker needs to know the location and altitude of the camera in order to determine the plane's relative position.

  • axis-ptz receives updates on which plane to track over MQTT and then directs the PTZ camera towards the plane and takes a picture.

ML Pipelines

There are currently three different machine learning pipelines.

The first pipeline uses a series of Jupyter notebooks to prepare the image dataset, train object detection and classification models, and then evaluate those models. These notebooks can be found here. Instructions for using these notebooks can be found here.

The second pipeline re-packages much of the functionality found in the Jupyter notebooks into a Python script that can be run from the command line. The scripts and directions can be found here.

The third pipeline uses the YOLTv4 model to also perform object detection. The relevant notebooks can be found here.

Setup and Operation

Installation

Follow the steps below for installing the edge software.

  1. Install and Configure Raspberry Pi
  2. Configure Camera

System Operation

After the system has been installed, follow the steps below to set up the hardware and start the software.

Additional Information

Other helpful information about this project:

skyscan's People

Contributors

dphogan avatar jspeed-meyers avatar luke-iqt avatar mchadwick-iqt avatar meadej avatar rashley-iqt avatar rcaudill avatar trellixvulnteam avatar wiseman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

skyscan's Issues

"Nice to have" features for SkyScan

  • A config setting for turning camera movement and capture off. This would be helpful if you want to leave the system running but you don't want the camera moving or taking photos. This could be because it got cloudy out for a little or you are going to perform some quick maintenance on the camera (clean the lens).
  • Automatically start/stop capture & camera movement based on the time of day... it would be even better if you could have it vary based on sun-up and sun-down. This way you could stop taking photos when it is dusk out and there is not much light left.
  • Take into consideration the cloud layer. If there is a cloud layer at 10k feet, only track planes that are below this altitude. You could also make it simpler and just stop capture when it is cloudy. Conversely, you might be able to determine the visibility range based on whether the ML model can "spot" planes at different altitudes
  • Have some methodology for only capture airplanes based upon different filter for the manufacturer, model, aircraft type or configuration. This could be driven by the different fields in the FAA data... or only capture aircraft that are not in the FAA data..
  • It would be great to track the position of the sun and have the camera automatically avoid it. The Camera container could just refuse to move to PTZ locations where the sun is. You have have to do some calculations to correct for Yaw,Pitch,Roll

Improve security of MQTT system through authentication

Is your request related to a problem? Please describe.
Currently, connections on the MQTT system are not authenticated, which introduces vulnerabilities as far as who can access the system and what they can do. To avoid this, we should establish authentication and authorization routines.

Describe the solution you'd like

  • use TLS with certificate credentials from certificate authority (CA) for all connections.
  • Inbound ports on MQTT system should be disabled at the the edge clients
  • Only TCP/IP ports (8883, 443) should be open on the MQTT server
  • Use username and password for MQTT clients at servers

Support for ONVIF ptz cameras?

Any possible chance of supporting ONVIF cameras in the future, the robotastic fork supposedly has support for ONVIF but I was not able to get it working, and the mqtt module seems to only run on a arm. I am trying to run this on amd64.

Change EGI container from privileged flag to device flag

Is your feature request related to a problem? Please describe.
Right now, the EGI container, which is the standard interface that works on multiple service providers, runs using the privileged flag on docker. This effectively means that the container has all the capabilities of the host machine, suggesting that a permissions leak is possible.

Describe the solution you'd like
To fix this, we should use a device flag, which does not enable access to the same information that a privileged flag might. At the same time, further testing will be necessary to avoid SkyScan performance impacts.

Calc 3D distance between positions

Currently, the distance of different planes from the camera is calculated based solely on their 2d positions. The Altitude of the planes should also be taken into consideration.

An additional function should be added, based on coordinate_distance() that also takes in altitude and calculates the relative distance in 3 dimensional space between them.

The calls will need to be updated to use this new function:
https://github.com/IQTLabs/SkyScan/blob/main/tracker/flighttracker.py#L156
https://github.com/IQTLabs/SkyScan/blob/main/tracker/flighttracker.py#L352
https://github.com/IQTLabs/SkyScan/blob/main/tracker/flighttracker.py#L374
https://github.com/IQTLabs/SkyScan/blob/main/tracker/flighttracker.py#L413
https://github.com/IQTLabs/SkyScan/blob/main/tracker/flighttracker.py#L430

Run in PC

Is it possible to make this run on a PC with Ubuntu Linux?

Inquiry about specific OS used/supported and Docker version.

I was wondering what specific OS is used on the RaspberryPi for this project and what specific versions of Docker Engine and Docker Compose are used.

I am trying to recreate the software setup, but run into some errors with Docker.

When running 'docker-compose build' in this guide: https://github.com/IQTLabs/SkyScan/blob/main/configure-pi.md , the output is "Building 0.0s (0/0)"
meaning that it didn't recognize any build targets.

Also, in the docker-compose up command, there is an error:
"no matching manifest for linux/arm/v7 in the manifest list entries"
suggesting an issue with the OS I am using (Raspbian GNU/Linux 10 (buster)).

Thanks in advance for any feedback.

Issue when running containers through docker-compose up

We are attempting to run this project on this setup:
Software: Latest commit on main branch as of today.
OS - arm64 (2021-10-30 Bullseye)
Hardware - RaspberryPi4

When running docker-compose up, the images are successfully pulled. When running the images, however, we get some errors such as:

" ERROR:root:Unable to detect Coral boardFailed to load delegate from libedgetpu.so.1"

"cp: can't stat '/etc/letsencrypt/live/broker.mqtt.local/*.pem': No such file or directory
mqtt_1 | cat: can't open '/run/secrets/mqtt_user': No such file or directory
mqtt_1 | cat: can't open '/run/secrets/mqtt_pass': No such file or directory"

"axis-ptz_1 | raise ValueError('Invalid host.')
axis-ptz_1 | ValueError: Invalid host.
"

These errors raised a few questions:

  1. Do we need to have a coral board?
  2. Is a GPS device required for this project?
  3. If a GPS device is required, is there a way to run the project by disabling the need for the GPS?

We are a small group working on our summer internship research project and would greatly appreciate any guidance with getting this project set up. We would appreciate a point of contact and are open to receiving any communications through my email: [email protected].

Thank you for your time!

Feature Request: Drone Detection and Detect by Camera without ADS-B

Would love for the camera to scan around and look for planes or drones it hasn't detected via ADS-B and attempt to identify them from training set.

Additionally could add in WiFi detection for Drone Remote ID.

I would also like to be able to record an additional column when an aircraft is in range via Camera and/OR ADS-B for say 60 seconds or higher and that gets added to database row entry.

Event better if it can alert me one way or another.

Improve secure use of Jupyter Notebook

Is your feature request related to a problem? Please describe.
Currently, multiple IP's can listen to the notebook server, which means passwords are vulnerable.

Describe the solution you'd like
Docker secrets enables you to centrally manage sensitive data, such as passwords, and limit the containers that have access to this data. Ultimately, using docker secrets would improve password security.

Camera should use HTTPS

Is your request related to a problem? Please describe.
As of now, camera interaction occur over HTTP, which is not a secure connection. Similar to issue #57, addressing unsafe camera interactions will require using TLS certificates.

Describe the solution you'd like
The camera should be configured to use HTTPS and refuse connections over HTTP. The existing setup already includes a strong username and password.

Testing 1, 2, 3?

@luke-iqt, I am going to have to call the test police. I don't see a single test. For the machine learning journal club this Wednesday, I am doing a presentation on pytest, the popular python testing framework. I am thinking of adding tests to one of the Labs projects that doesn't already have tests. I was considering this project. If there was one file in here that you would appreciate tests for, which one is it? You can also say, "Test police! Get out of here!"

Convert Pressure Altitude to Geometric Altitude

ADS-B altitude is reported as pressure altitude, not geometric altitude. A conversion will have to be done, and may require a barometer at the base station.

Note: this is critical for aiming accuracy for near tracking. Large slant ranges will minimize the practical impact of this effect.

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.