January 2018
Intermediate to advanced
268 pages
6h 20m
English
To implement our ANN classifier, we will need to reuse the method of the FeatureExtractor class from the create_feature.py file in Chapter 9, Object Recognition, which will allow us to calculate the feature vectors from the images we want to evaluate:
class FeatureExtractor(object): def get_feature_vector(self, img, kmeans, centroids): return Quantizer().get_feature_vector(img, kmeans, centroids)
Consider the inclusion of the create_feature file in the same folder. Now, we are ready to implement the classifier:
################ classify_data.py###############import argparse import _pickle as pickle import cv2 import numpy as np import create_features as cf # Classifying an image class ImageClassifier(object): def __init__(self, ...
Read now
Unlock full access