Skip to Content
Python Machine Learning Cookbook
book

Python Machine Learning Cookbook

by Prateek Joshi, Vahid Mirjalili
June 2016
Beginner to intermediate
304 pages
6h 24m
English
Packt Publishing
Content preview from Python Machine Learning Cookbook

Building an object recognizer

Now that we trained an ERF model, let's go ahead and build an object recognizer that can recognize the content of unknown images.

How to do it…

  1. 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 
  2. 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", ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Machine Learning Cookbook - Second Edition

Python Machine Learning Cookbook - Second Edition

Giuseppe Ciaburro, Prateek Joshi
Python: Real World Machine Learning

Python: Real World Machine Learning

Prateek Joshi, John Hearty, Bastiaan Sjardin, Luca Massaron, Alberto Boschetti

Publisher Resources

ISBN: 9781786464477Supplemental Content