traffic_sign_detection
traffic_sign_detection copied to clipboard
Zalo aI 2020: Traffic sign detection using Retinanet and image tiling
traffic sign detection 
Solution for Zalo AI traffic signs detection.
Original implementation of RetinaNet by Srihari Humbarwadi
Dataset
https://www.kaggle.com/phhasian0710/za-traffic-2020/download
Method
After taking a quick look at the dataset, we can see that there are many small signs. Which makes the model hard to detect them. One of the possible methods in this scenario is Image Tiling
In detail, I will crop the image into a few parts with some overlaps, predict each part and the original image. Then combine the result using non-max suppression.
1. Image cropping

2. Predict on each part (the color looks strange because the images are pre-processed)

3. Predict on the whole image

3. Combine the results

Data augmentation
Data augmentation used for trainning includes:
- Random brightness adjustment (p=50%)
- Random contrast adjustment (p=50%)
- Auto crop a region contains at least 1 bouding box (p=50%)
- Random horizontal flipping (p=50%)
- Random gaussian blur or motion blur (p=50%)
Trainning
python3 train.py --input {image_dir}\
--backbone resnet50\
--batch-size 4\
--checkpoint-dir /content/weights
Inference
python3 prediction.py --input {image_dir}\
--output submission.json\
--weight weights/weight_resnet50.h5\ # weight file should has format weight_{backbone}.h5
--save-dir /content/inference_images # or "" if you dont want to save images
--scales 896,1024 # Separated by comma
--tiling # Apply tiling if provided, useful for small objects
Inference result

NOTE
This project is running on Google Colaboratory environment, so it may contain some issues when running on local machine, please don't hesitate to create a new issue