Code for Adaptive Traffic Signal Control on Devices with Extremely Limited Resources (IJCAI 2022).
- python=3.6.13
- torch=1.9.0+cu111
- numpy=1.19.2
- CityFlow=0.1.0
We made some modifications based on CityFlow v0.1.0 to enrich its APIs. To ensure reproducibility, please install our adapted CityFlow by:
cd CityFlow
pip install .
Note: all the following steps are performed in TinyLight
folder.
python 01_run_baseline.py --model=FixedTime --dataset=Atlanta
The model will be stored in {log_path}/TinyLight/model/
.
python 02_run_tiny_light.py --dataset=Atlanta
This step converts the floating-point operations into integer-only ones. It will generate a series of model files in {log_path}/TinyLightQuan/pc
and
{log_path}/TinyLightQuan/mcu
, which are used for evaluation in step 4.
python 03_run_tinylight_quan.py --dataset=Atlanta
You can run TinyLight on an Arduino Uno (with ATmega328P as the default MCU) by:
- replacing
TinyLight_MCU/model.h
with the corresponding.h
file in{log_path}/TinyLightQuan/mcu
, and - running the project in MCU
If you do not have an Arduino board on hand, we also provide an equivalent implementation of TinyLight (w/ PTQ) on computers to verify its performance on traffic. For this, please:
cd {log_path}/TinyLightQuan/mcu/
python setup.py build_ext --inplace
cd {project_dir}
python 04_run_tinylight_mcu.py --dataset=Atlanta
If you find our work helpful in your research, please consider citing our paper:
@article{TinyLight22,
author = {Dong Xing and
Qian Zheng and
Qianhui Liu and
Gang Pan},
title = {TinyLight: Adaptive Traffic Signal Control on Devices with Extremely Limited Resources},
journal = {CoRR},
volume = {abs/2205.00427},
year = {2022},
url = {https://doi.org/10.48550/arXiv.2205.00427},
doi = {10.48550/arXiv.2205.00427},
eprinttype = {arXiv},
eprint = {2205.00427},
}