Now that we trained an ERF model, let's go ahead and build an object recognizer that can recognize the content of unknown images.
Create a new Python file, and import the following packages:
import argparse import cPickle as pickle import cv2 import numpy as np import build_features as bf from trainer import ERFTrainer
Define the argument parser:
def build_arg_parser(): parser = argparse.ArgumentParser(description='Extracts features \ from each line and classifies the data') parser.add_argument("--input-image", dest="input_image", required=True, help="Input image to be classified") parser.add_argument("--model-file", dest="model_file", required=True, help="Input file containing the trained model") parser.add_argument("--codebook-file", dest="codebook_file", required=True, help="Input file containing the codebook") return parser
Define a class to handle the image tag extraction functions:
class ImageTagExtractor(object): def...