Skip to content

masopust/RoadSignRecognition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

94 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RoadSignRecognition

Description

There are four different models of CNN network. We all used keras library to train our database, but we chose different approaches to build convolution network and sometimes use different data augmentation. Each model was evaluated and the best one was used to prepare program which recognise input picture and return name of the road sing.

Dataset

Data is taken from: BelgiumTS Dataset. There are two sets: Training and Testing. Our data-sets contains 62 class of different road signs. To get realistic learning curve, the training data was split to smaller training file and validation set. The validation set do not take part in training process. It is only used to made an evaluation during learning. The Testing data-set is used to evaluate data after training. To split data use script: split_set.py or use function 'split_dataset_into_test_and_train_sets', defined here. Below are shown histograms of numerosity of each class.

Data was loaded using very handy method implemented in keras named flow_from_directory. It takes data from file and prepare labels for each classes based on names of subdirectories.

Keras

Library which helps not only to implement constitutional neural network, but also preprocess data is named: Keras: The Python Deep Learning library. The main idea of Keras approach is to implement model in easy way as a sequence of neural layers with all needed parameters able to set. Types of layer in CNN:

Defining layers, which are connecting neurons, the the activation function should be pointed. Here is a description of the available activation functions in Keras.

When the model is designed, it must be compiled. There the optimizer and statistical metrics should be defined.

Here is nice tutorial about CNN concept.

Keras allows to make the image augementation, for examaple by rotating them, to increase effectiveness of learning. By setting the number of batches, the data is taken in smaller packages, so memory is seved. In that case there are to ways of setting nr of samples per epoch. First way: nr of training items/nr of batches, second way: nr_of_training_items - default. The second approach takes more time, but gives better results.

Something about evaluation

  • Learning curve - shows how goes learning in each epoch. On y-axis are shown statistical metrics defined while compiling the model.
  • Confusion Matrix - helps notice which examples was properly classified and how many was wrong classified, indicating false negative and false positive ones.
  • Accuracy - describes difference between a result and a "true" value
  • Top-n accuracy - indicates if in n numbers of results with highest probability is at least one equal to "true" value.
  • Loss - error of matching, commonly used: mean squared error

Comparison of different models

name Masopust's model Riva's model Gierlach's model Torcu's model
nr of epochs 15 30 20 30
opimizer adam sgd nadam rmsprop
diagram NA

Evaluation of our models

name Masopust's model Riva's model Gierlach's model Torcu's model
Test accuracy 92.6% 96% 92% 98%
Steps per epoch nr of items in training set nr of items in training set 110 NA
Learning curve Accuracy NA
Learning curve Loss NA
Learning curve Top 5 Accuracy NA

Confusion matrix

  • Masopust's model

  • Gierlach's model

Script to classifying the road sign - recognize.py

Simple app to classifing road sign from picture input.

Prerequisites

You need to Python 3.6, Keras and NumPy have installed. Download a model from this repository.

Running

''' python recognize.py picture_file.jpg -m model.h5 '''

Usage

recognize.py [-h] [-m [MODEL]] file

Road sign recognition (classification) based on model created by Keras library.

Obligatory arguments:

file the name of the image file with road sign

Optional arguments:

-h, --help show this help message and exit
-m [MODEL], --model [MODEL] the name of the h5 file with the model, default value is classifier.h5

Detection of road signs

Original idea was to build also second part of project, detecting of road signs on the photo or video by YOLO library.
But finally it is not a part of our project, we want to try it on summer holiday.

Authors

About

Python final project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •