Skip to content

Latest commit

 

History

History
34 lines (33 loc) · 1.54 KB

File metadata and controls

34 lines (33 loc) · 1.54 KB

Preparing model:

  • Install bazel ( check tensorflow's github for more info ) Ubuntu: - Requirements: sudo add-apt-repository ppa:webupd8team/java sudo apt-get update sudo apt-get install oracle-java8-installer - Download bazel, ( https://github.com/bazelbuild/bazel/releases ) tested on: https://github.com/bazelbuild/bazel/releases/download/0.2.0/bazel-0.2.0-jdk7-installer-linux-x86_64.sh - chmod +x PATH_TO_INSTALL.SH - ./PATH_TO_INSTALL.SH --user - Place bazel onto path ( exact path to store shown in the output)
  • For retraining, prepare folder structure as
    • root_folder_name
      • class 1
        • file1
        • file2
      • class 2
        • file1
        • file2
  • 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. ** For testing through bazel, bazel build tensorflow/examples/label_image:label_image &&
    bazel-bin/tensorflow/examples/label_image/label_image
    --graph=/path/output_graph.pb --labels=/path/output_labels.txt
    --output_layer=final_result
    --image=/path/to/test/image

For testing through python, change and run the python code classify.py python classify.py testimages/abandoned.jpg models/bag_detection.pb labels/bag_detection.txt