Understanding the GTSRB dataset

The GTSRB dataset contains more than 50,000 images of traffic signs belonging to 43 classes.

This dataset was used by professionals in a classification challenge during the International Joint Conference on Neural Networks (IJCNN) in 2011. The GTSRB dataset is perfect for our purposes because it is large, organized, open source, and annotated.

Although the actual traffic sign is not necessarily a square or is in the center of each image, the dataset comes with an annotation file that specifies the bounding boxes for each sign.

A good idea before doing any sort of machine learning is usually to get a feel of the dataset, its qualities, and its challenges. Some good ideas include manually going through the data and understanding what are some characteristics of it, reading a data description—if it's available on the page—to understand which models might work best, and so on.

Here, we present a snippet from data/gtsrb.py that loads and then plots a random-15 sample of the training dataset, and does that 100 times, so you can paginate through the data:

if __name__ == '__main__':
train_data, train_labels = load_training_data(labels=None)
np.random.seed(75)
for _ in range(100):
indices = np.arange(len(train_data))
np.random.shuffle(indices)
for r in range(3):
for c in range(5):
i = 5 * r + c
ax = plt.subplot(3, 5, 1 + i)
sample = train_data[indices[i]]
ax.imshow(cv2.resize(sample, (32, 32)), cmap=cm.Greys_r)
ax.axis('off')
plt.tight_layout()
plt.show()
np.random.seed(np.random.randint(len(indices)))

Another good strategy would be to plot 15 samples from each of the 43 classes and see how images change for the given class. The following screenshot shows some examples of this dataset:

Even from this small data sample, it is immediately clear that this is a challenging dataset for any sort of classifier. The appearance of the signs changes drastically based on viewing angle (orientation), viewing distance (blurriness), and lighting conditions (shadows and bright spots).

For some of these signs—such as the second sign of the third row—it is difficult, even for humans (at least for me), to tell the correct class label right away. It's a good thing we are aspiring experts in machine learning!

Let's now learn to parse the dataset in order to convert to a format suitable for the SVM to use for training.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.134.79.121