An Artificial Neural Network based Traffic Light Transition Controller for intersections.
See TensorFlow implementation here.
AppVeyor | |
License | |
For the Badge |
Given the previous and current light pair, the controller must predict the next light pair.
The controller must receive two inputs,
-
Previous light pair at
t - 1
-
Current light pair at
t
.
+-----------+
TL(t - 1) -------->| |
| ANN |-------> TL(t + 1)
TL(t) -------->| |
+-----------+
And outputs the next pair at t + 1
.
Transitions will be implemented for a pair of traffic lights with the following sequence of pairs:
Light Sequence Pair | ||
---|---|---|
Traffic Light 1 | Traffic Light 2 | Time |
RED | GREEN | t1 |
RED | AMBER | t2 |
RED | RED | t3 |
GREEN | RED | t4 |
AMBER | RED | t5 |
RED | RED | t6 |
Having two inputs and one output, the Neural Network architecture will be based on the typical logic gate Neural Network architecture:
- Two input neurons
I1
,I2
- Two hidden layer neurons
H1
,H2
- One output neuron
O1
The neural network will be a Feedforward neural network, having the Logistic Sigmoid equation as its activation function.
1
S(t) = __________
-t
1 + e
Training will be done using Gradient Descent Backpropagation.
In order to simplify training, numerical values are mapped with each pair, just like how an index is associated for each row in an array.
We made sure that these numerical values assigned are in the Logistic Sigmoid's curve ranges (0
to 1
).
Light Sequence Pair | ||
---|---|---|
Traffic Light 1 | Traffic Light 2 | Numerical Value |
RED | GREEN | 0.1 |
RED | AMBER | 0.2 |
RED | RED | 0.3 |
GREEN | RED | 0.4 |
AMBER | RED | 0.5 |
RED | RED | 0.6 |
The training data are as follows:
Inputs at input.csv |
Outputs at target.csv |
|
---|---|---|
t - 1 | t | t + 1 |
0.1 | 0.2 | 0.3 |
0.2 | 0.3 | 0.4 |
0.3 | 0.4 | 0.5 |
0.4 | 0.5 | 0.6 |
0.5 | 0.6 | 0.1 |
0.6 | 0.1 | 0.2 |
Using 50 training sets (or repetitions of these in a file) in 1000 epochs is enough for the network to learn.
-
To re-train, run
NeuralNetwork.exe
.- parameters are optional, in case nothing is provided, the defaults are
data/input.csv
,data/target.csv
,1000
- parameters are optional, in case nothing is provided, the defaults are
> .\TrafficLightNeuralNetwork\bin> NeuralNetwork.exe <string:input_path> <string:target_path> <int:max_epochs>
weights.csv
has its weights updated after re-train, with the following format:
I1 to H1 | I2 to H1 | Bias to H1 | I1 to H2 | I2 to H2 | Bias to H2 |
---|---|---|---|---|---|
H1 to O1 | H2 to O2 | Bias to O2 | none | none | none |
- Training data can be viewed at
input.csv
andtarget.csv
- March 19-22, 2017 (Initial Development)
- March 23, 2017 onwards (Maintenance)
- March 26, 2017 (GitHub debut)
Developers |
Raymel Francisco |
Emilson Olaño |
Contributors |
John Paul Magturo |
Denzel Rañada |
Kaiser Sternberg |
Christian Bisnar |
This project is licensed under MIT License.
MIT License
Copyright (c) 2017 Raymel Francisco, Emilson Olaño, John Paul Magturo, Denzel Rañada, Kaiser Sternberg, and Christian Bisnar
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.