Skip to content

Running a pretrained classifier

Ivan Krasin edited this page Nov 4, 2016 · 5 revisions

In order to run the pretrained Inception v3 classifier, the following steps are required:

  1. Install TensorFlow and make sure Python knows how to find it. For example, if Virtualenv is used, the terminal session needs to be activated with it.

  2. Download the checkpoint:

$ tools/download_data.sh
  1. (optional) Download a cat image.
$ wget -O /tmp/cat.jpg \
https://farm4.staticflickr.com/3155/2685721394_e74c0f4eb0_z_d.jpg

Cat

Mitzi Kitty by SanGatiche used under CC BY 2.0

  1. Run the inference script on an image:
$ tools/classify.py /tmp/cat.jpg
3473: /m/04rky - mammal (score = 0.89)
3981: /m/068hy - pet (score = 0.87)
1261: /m/01yrx - cat (score = 0.87)
5723: /m/0jbk - animal (score = 0.83)
4605: /m/09686 - vertebrate (score = 0.81)
841: /m/01l7qd - whiskers (score = 0.68)
2430: /m/0307l - cat-like mammal (score = 0.68)
4349: /m/07k6w8 - small to medium-sized cats (score = 0.67)
5643: /m/0hjzp - kitten (score = 0.30)
50: /m/012c9l - domestic short-haired cat (score = 0.17)

More options are available, see classify.py.

Clone this wiki locally