To run our app, we will need to execute the main function routine (in chapter6.py
). It loads the data, trains the classifier, evaluates its performance, and visualizes the result.
But first, we need to import all the relevant modules and set up a main function:
import numpy as np import matplotlib.pyplot as plt from datasets import gtsrb from classifiers import MultiClassSVM def main():
Then, the goal is to compare classification performance across settings and feature extraction methods. This includes running the task with both classification strategies, one-vs-all and one-vs-one, as well as preprocessing the data with a list of different feature extraction approaches:
strategies = ['one-vs-one', 'one-vs-all']features = [None, 'gray', 'rgb', 'hsv', 'surf', 'hog']
For each of these settings, we need to collect three performance metrics—accuracy, precision, and recall:
accuracy = np.zeros((2,len(features))) precision = np.zeros((2,len(features)))...