Training an image classifier using Extremely Random Forests
We will use Extremely Random Forests (ERFs) to train our image classifier. An object recognition system uses an image classifier to classify the images into known categories. ERFs are very popular in the field of machine learning because of their speed and accuracy. We basically construct a bunch of decision trees that are based on our image signatures, and then train the forest to make the right decision. You can learn more about random forests at https://www.stat.berkeley.edu/~breiman/RandomForests/cc_home.htm. You can learn about ERFs at http://www.montefiore.ulg.ac.be/~ernst/uploads/news/id63/extremely-randomized-trees.pdf.
How to do it…
Create a new Python file, and import the following packages:
import argparse import cPickle as pickle import numpy as np from sklearn.ensemble import ExtraTreesClassifier from sklearn import preprocessing
Define an argument parser:
def build_arg_parser(): parser = argparse.ArgumentParser...