Get in touch
or send us a question?
CONTACT

Traffic sign recognition – 01 – Get data

  1. Download data
    At this tutorial, I will download data from German traffic sign
    https://www.kaggle.com/meowmeowmeowmeowmeow/gtsrb-german-traffic-sign
  2. After download, put it into folder and then split them to multiple classes
data_dir = '/home/silverlight/Projects/signs_dataset'
class_names = ['alert_100', 'alert_120', 'alert_50', 'alert_60', 'alert_70', 'alert_80', 'end_speed']
img_height = 180
img_width = 180

3. Convert data into 2 type of data. 80% for training and 20% for validation

train_ds = tf.keras.preprocessing.image_dataset_from_directory(
         data_dir,
         validation_split=0.2,
         subset='training',
         seed=123,
         image_size=(img_width, img_height),
         batch_size=batch_size
     )
val_ds = tf.keras.preprocessing.image_dataset_from_directory(
         data_dir,
         validation_split=0.2,
         subset="validation",
         seed=123,
         image_size=(img_width, img_height),
         batch_size=batch_size)