In this project, we propose an approach for data preprocessing based on nuImages database.
Environment requirements
- Ubuntu 20.04
- Python 3.8
- Pytorch 2.1.2
- CUDA 12.1
The following installation guild suppose Ubuntu=20.04
python=3.8
pytorch=2.1.2
and cuda=12.1
. You may change them according to your system, but linux is mandatory.
- Create a conda virtual environment and activate it.
conda create -n TOD2D python=3.8
conda activate TOD2D
- Clone the repository.
git clone https://github.com/LuckyMax0722/TOD2D.git
- Install the PyTorch and PyTorch Lightning
conda install pytorch==2.1.2 torchvision==0.16.2 torchaudio==2.1.2 pytorch-cuda=12.1 -c pytorch -c nvidia
pip install pytorch-lightning==2.1.4
- Install the dependencies.
pip install opencv-python
pip install easydict
pip install matplotlib
pip install pandas
pip install ipython
pip install psutil
pip install seaborn
- Install the visualization
pip install tensorboard
pip install protobuf==3.19.6
- First, you need to register/login on DriveU to download the DriveU Traffic Light Dataset (DTLD).
The dataset divides the data according to German cities. You can download the data and labels for individual cities, e.g. DTLD/Berlin, or the entire dataset DTLD.
For detail information, please refer to DTLD
Your folder should look like this:
data
├── Berlin
│ ├── Berlin1
│ ├── 2015-04-17_10-50-05
│ ├── DE_..._k0.tiff
│ ├── DE_..._nativeV2.tiff
│ ├── .......
│ ├── .......
│ ├── Berlin2
├── Bochum
│ ├── .......
├── DTLD_Labels_v2.0
- Before processing the data, please set the base path of the project in
lib/config.py
.
# Main Path
...
CONF.PATH.BASE = '.../TOD2D' # TODO: change this
...
CONF.PATH.LABELS = os.path.join(CONF.PATH.DATA, 'DTLD_Labels_v2.0/v2.0/DTLD_all.json') # TODO: change this if use different data
- First you need to use a data converter to convert the DTLD into a Classifier format dataset.
cd TOD2D
python tools/converter_dtld2cls.py
Your folder should look like this:
dataset_cls
├── dtld_cls
│ ├── images
│ ├── DE_..._k0_0.jpg
│ ├── DE_..._k0_1.jpg
│ ├── .......
│ ├── labels
│ ├── dtld_cls.txt
- We manually divided the labels into the categories shown in the table below:
Traffic light color | Class number |
---|---|
Red | 0 |
Yellow | 1 |
Green | 2 |
Off | 3 |
Traffic light type | Class number |
---|---|
Circle | 0 |
Left | 1 |
Right | 2 |
Straight | 3 |
Other | 4 |
In this work, the label of each image consists of color and type. Based on the above table, some examples can be given, e.g. RedStraight = 0,3
, Yellow = 1,4
and Greenbicycle = 2,4