Skip to content

josefmonje/tf-imagematch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Instructions...

Prepare model:

  • Install bazel (check tensorflow's github for more info)
  • Prepare folders and files for retraining
  • Clone tensorflow
  • Go to root of tensorflow
  • bazel build tensorflow/examples/image_retraining:retrain
  • bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir /path/to/root_folder_name --output_graph /path/output_graph.pb -- output_labels /path/output_labels.txt -- bottleneck_dir /path/bottleneck

** Training done. **

Outputs: output_graph.pb output_labels.txt

Use those outputs in this code as SOURCE_GRAPH and SOURCE_LABELS.

Usage

Uses optional keyword arguments when provided

im = ImageMatch(limit=10, source_graph='output_graph.pb', source_labels='output_labels.txt')

Uses local_settings when instantiated without arguments

from local_settings import SOURCE_GRAPH, SOURCE_LABELS

Uses default training output directory as default /tmp/

im = ImageMatch()

Match an Image

im.match('test.jpg')

Labels and test image for flower retraining tutorial included

  • test.jpg
  • output_labels.txt

Graph is missing

  • output_graph.pb

Output

Matches:
dandelion (0.9902)
sunflowers (0.0042)
tulips (0.0033)
daisy (0.0014)
roses (0.0009)

About

Image matching using TensorFlow

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages