Home

Awesome

Tsinghua-Tencent 100K

Tsinghua-Tencent 100K is a benchmark for traffic-sign detection and classification. It provides 100,000 images containing 30,000 traffic-sign instances. It is focused on small object detection in real world. According to the paper, it said "A typical traffic-sign might be say 80 × 80 pixels, in a 2000 × 2000 pixel image, or just 0.2% of the image.". It means that the small objects such as traffic-sign occupy the very small proportion in input image.

This benchmark is built by Caffe and installed in Ubuntu 14.04.
I summarized how to setup this benchmark and learning/testing the CNN model which is proposed from this paper. I also added some codes for my experiment.

Table of Contents

Requirements: Hardware

I used Nvidia Geforce GTX 1080 Ti for learning the CNN model of this paper. This graphic card spec is as follows.
Please refer to full specs.(https://www.nvidia.com/en-us/geforce/products/10series/geforce-gtx-1080-ti/#specs)

You need to check the compute capability version to install correct CUDA SDK version.
Please refer to https://en.wikipedia.org/wiki/CUDA#Supported_GPUs and find correct CUDA SDK version.

In my case, I should install CUDA SDK 8.0 version. CUDA compute capabilities >= 6.1
According to CUDA SDK 8.0 version, I used cuDNN 6.0 version.

Requirements: Software

The prerequisites are as follows.

Installation

To install Nvidia driver, CUDA and cuDNN, you need to sign-in to Nvidia web site.
If you didn't sign-up, please do sign-up and try to download them.

Install Ubuntu 14.04.5 LTS (Trusty Tahr)

Install GPU Driver

sudo sh NVIDIA-Linux-x86_64-390.87.run

Install CUDA SDK

sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb
sudo apt-get update
sudo apt-get install cuda
sudo reboot
export PATH=/usr/local/cuda-8.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH

Install cuDNN

tar -xzvf cudnn-8.0-linux-x64-v6.0.tgz
cd cuda
sudo cp lib64/* /usr/local/cuda/lib64
sudo cp include/cudnn.h /usr/local/cuda/include

Install Caffe

sudo apt-get install libprotobuf-dev libleveldb-dev libsnappy-dev libopencv-dev libhdf5-serial-dev protobuf-compiler
sudo apt-get install --no-install-recommends libboost-all-dev
sudo apt-get install libatlas-base-dev
sudo apt-get install libopenblas-dev
sudo apt-get install python-dev
sudo apt-get install libgflags-dev libgoogle-glog-dev liblmdb-dev
git clone https://github.com/asyncbridge/tsinghua-tencent-100k.git

You can see below folder structure.

    |__ code
        |__ caffe
            |__ ...					
        |__ model
            |__ snapshots
            |__ model.caffemodel
            |__ model.prototxt
            |__ solver.prototxt
            |__ train_val.prototxt
        |__ python		
            |__ my-data-show.ipynb	
            |__ my-deployer.ipynb
            |__ my-eval-graph.ipynb
            |__ my-eval.ipynb			
            |__ my-eval-loss-graph.ipynb						
            |__ ...						
        |__ results
            |__ ours_result_annos.json
            |__ ...			
        |__ script			
            |__ 1_convert_lmdb.sh
            |__ 2_calc_img_mean.sh
            |__ clean.sh
            |__ compile.sh
            |__ config.sh
            |__ prepare.sh
            |__ train.sh
            |__ TT100K_TRAIN_90000.log

Next, please build Caffe and pycaffe.

cd code/script
./compile.sh

Install Jupyter Notebook

If you have Python 2 installed:

python -m pip install --upgrade pip
python -m pip install jupyter

Data Preparation

cd TT100k
wget http://cg.cs.tsinghua.edu.cn/traffic-sign/data_model_code/data.zip
unzip data.zip
mkdir -p ../../data/lmdb
./prepare.sh

Training and Evaluation

Training

After doing data preparation, we can start the training process.

cd code/script
./train.sh

The train.sh shell file is described as follows. You can also get the training log file.

../caffe/build/tools/caffe train --solver ../model/solver.prototxt --gpu 0 2>&1 | tee tt100k_training_01.log

Evaluation

sudo pip install opencv-python
sudo pip install matplotlib
...

How to observe TT100K data sample

Please run my-data-show.ipynb on Jupyter Notebook.(See my-data-show.ipynb)

How to deploy the training result of TT100K annotation JSON file

After training the dataset, the deployer creates annotation JSON file using with .caffemodel file.
Please run my-deployer.ipynb on Jupyter Notebook.(See my-deployer.ipynb)

How to evaluate the annotation JSON file

Please run my-eval.ipynb or my-eval-graph.ipynb on Jupyter Notebook.(See my-eval.ipynb, my-eval-graph.ipynb)
You can evaluate the pre-created annotation JSON file.

    |__ code				
        |__ results
            |__ ours_result_annos.json
            |__ ...			

How to observe TT100K train/test loss graph

  1. Please run capturing the caffe training log file.
../caffe/build/tools/caffe train --solver ../model/solver.prototxt 2>&1 | tee TT100K_TRAIN_90000.log
  1. Please run my-eval-loss-graph.ipynb on Jupyter Notebook.(See my-eval-loss-graph.ipynb)
  2. Set the log file path and run the Jupyter Notebook file as above.
def main():
    files = ['../script/TT100K_TRAIN_90000.log']
...

Alt text

License and Citation

It is cited from:

@InProceedings{Zhe_2016_CVPR,
author = {Zhu, Zhe and Liang, Dun and Zhang, Songhai and Huang, Xiaolei and Li, Baoli and Hu, Shimin},
title = {Traffic-Sign Detection and Classification in the Wild},
booktitle = {The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2016}
}

References