Giter Club home page Giter Club logo

fanton-dev / traffic-brain Goto Github PK

View Code? Open in Web Editor NEW
4.0 2.0 1.0 99.4 MB

Traffic Brain is an open-source traffic light embedded system taking use of a machine learning classification model for decision making automation.

License: MIT License

Shell 0.04% Jupyter Notebook 92.20% TypeScript 0.86% CSS 0.01% HTML 2.83% Python 3.59% Dockerfile 0.06% JavaScript 0.41%
traffic-brain python yolov2 spring-boot raspberry-pi traffic-light embedded

traffic-brain's People

Contributors

angel-penchev avatar dependabot[bot] avatar simo1209 avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

lekoon

traffic-brain's Issues

[Feature] Transform the loaded image

Describe the feature you'd like
The classification model takes a 3D array with shape (512, 512, 3) with the RGB values of every pixel, divided by 255 (so the values are from 0 to 1). You should resize the loaded image to the given resolution (512x512, preferably with anti-aliasing), convert it to an array of pixel values and divide them.

Additional context
Traffic Brain Networking Converts image

[Feature] POST /animation

Describe the feature you'd like
Make a path for animation json submissions. Check whether it contains valid data in all the fields: "name": str, "fps": number, "looped": bool, "frames": 3D list.

[Test] Create unit tests for the image recognition

Describe the feature you'd like
Create a test for:

  • Loading the image
  • Transforming the image
  • Sending the image to GCE model
  • Parsing the model response

These tests will be used for continuous integration (CI).

[Bug] Camera being used after /live is no longer being used

Describe the bug
The camera is still being used after the generator at "/information/live" is no longer used.

To Reproduce
Steps to reproduce the behavior:

  1. Go to "/information/live"
  2. Close the page
  3. Check the server camera status

Expected behavior
Camera no longer to be enabled when the path is not used.

[Test] Create unit tests for DataGenerator class

Describe the feature you'd like
Write unit tests testing the functionalities of the DataGenerator class functions. Tests shoud have coverage of the following functions:

  • parse_annotations
  • generate_tf_dataset
  • augment_dataset
  • process_image_bboxes.

Additional context
For testing, sample 3 images with annotations and assert from their expected output.

[Feature] GET /status on the embedded server

Describe the feature you'd like
On the flask server, make a GET /status request, which should return a JSON response containing status of all 3 lights and maybe additional information in the future.

[Deploy] Embedded CD

Describe the feature you'd like
Make it so the embedded server code is deployed on the Raspberry when code is committed to the "embedded/raspberry" path.

[Feature] Code the Raspberry Pi - Handling stage changes

Describe the feature you'd like
Handling of traffic light stage changes:

  • Take a single variable input of "Green" or "Red"
  • Start the 5 second 7-Seg timer on state change
  • After the timer runs out, switch to the yellow light
  • After 1.5 seconds, change the light to its final state

[Refactor] Refactor embedded server code

Describe the feature you'd like
Refactor the embedded server to comply with the standard flask project structure.

Additional context
Reference to documentation of the project structure could be found here.

[Feature] Communicate with GCE deployed model

Describe the feature you'd like
Using the GCE API connect to the model and forward the array. You may refer to this to see the same thing implemented in NodeJS. When you reach the part where authentication for GCE is required, contact me.

Additional context
Traffic Brain Networking Send to cloud

[Test] Unit tests for embedded flask server

Describe the feature you'd like
Research on how you test the following Flask server requests:

  • GET /information/live - Check if it returns a stream of .jpg images for 2 seconds
  • GET /information/status - Check if it returns a valid status dictionary.
  • POST /traffic-light/change_lights?red=filled&yellow=empty&green=empty - Check if it returns {"green":"empty","red":"filled","yellow":"empty"} without errors on the Pi
  • POST /traffic-light/change_lights?red=wrong_arg - Check if it returns "Invalid animation passed for "red"." with status code 400.
  • POST /traffic-light/animation - Check if JSON is stored on valid input.
  • POST /traffic-light/animation - Check if an error 400 is returned with message "Invalid animation JSON.".

[Feature] Init server

Describe the feature you'd like

  • Checkout a branch named 'feature/server'.
  • Initialize Spring server. Check the schematic below and decide on the dependencies you want to install.

Additional context
For GCP installation reference you may check this.
Schematic of the project:
image

[Deploy] Create Classification CD hook

Describe the feature you'd like
Create a Continuous Deployment hook which should these things:

  • Train the model in Google Cloud
  • Store the model in the Google Cloud storage bucket
  • Load and deploy the model using the Google Cloud Machine Learning Engine

Additional context
Similar implementation could be referenced here.

[Misc] Source all the project parts

Describe the feature you'd like
Find all the parts used in the KiCad schematic and buy them.

Parts list:

  • Raspberry Pi
  • 256x Red LEDs
  • 256x Yellow LEDs
  • 256x Green LEDs
  • 12x SNx4HC164 8-Bit Parallel-Out Serial Shift Registers
  • 96x 221ฮฉ resistors
  • 5V AC power supplies

[Feature] Parse the model response

Describe the feature you'd like
The YOLO neural network return spec is in shape (16, 16, 5, 12). The 16 x 16 spec represents image squares divisions (grid cells) with a side of 32 pixels (516/32 = 16). The 5 x 12 represents the 5 bounding box predictions a grid should propose. A bounding box prediction is with size 5 (x of box center, y of box center, w of the box, h of the box, probability that an object exists in this box) + 7 probabilities of a given class existing in the grid cell (classes listed here) = 12.

A much clearer explanation could be found here.

Now as the part you need to code. First you need to define two constants: MIN_SCORE = 0.5
and MIN_IOU = 0.45. Then you need to iterate over every grid cell (16 x 16 = 256 gird cells in total).
For each cell you iterate over the 5 bounding box predictions. If the 'probability that an object exists in this box' (the 5th element in the spec) is higher than MIN_SCORE and a given class probability is higher than MIN_IOU, then add one to the final dictionary for the given class. The dictionary should look something like this: { "bicycle": 0, "bus": 1, "car": 8, "horse": 0, "motorbike": 0, "person": 0, "train": 0 }.

Additional context
Traffic Brain Networking Convert responce

[Doc] Update READMEs

Describe the feature you'd like
Update information about each and every main component of the project before TuesFEST.

[Feature] Create a GPIO control interface

Describe the feature you'd like
Make it so you can display an animation on the 3 LED matrices. Figure out shift register data loading, frame display and a whole animation display.

[Feature] Add a navbar

Describe the feature you'd like
Create a navbar similar to the one in the UI concept.

Additional context
Web 1920 โ€“ 1

[Test] Create Classification CI

Describe the feature you'd like
Create a GitHub Actions continuous integration (CI) hook which should be run on a pull request. The .yml should execute all python tests and check whether the main notebook is executable.

[Feature] Add augmentation for the dataset

Describe the feature you'd like
Create data variations for training the classifier.

Additional context
Variations may include but are not limited to image flipping, contrast and brightness modifying.

[Feature] Implement NN training

Describe the feature you'd like
Implement compile and fit methods for the model with their respective required inputs and metric calculators.

[Test] Client CI

Describe the feature you'd like
Create continuous integration for the client, which should lint all the code, build the project and run all the tests.

[Feature] Make a LED controllable display

Describe the feature you'd like
Design a schematic to decode a BCD number (seconds until traffic light changes) with a BCD to 7-Seg Decoder and wire it with the LEDs to create the display.

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.