Home

Awesome

Realtime iOS Object Detection with TensorFlow

This Repository contains all the file to build a YOLO based object detection app except the tensorflow frozon model file, you can download the model file here.

This app is derived from Google's TensorFlow iOS Camera Example. Thanks to the YOLO_tensorflow project by gliese581gg, I took the tiny model implementation and do some like modification, mainly about merge as much as possible operation to the graph of tensorflow, include the proprocessing (resize the image and normalize each pixel) and result interpreting. Then froze the checkpoint data from glese581gg with the GraphDef to the pb file, and use it in the app.

Build

##Disclame

Despite I have already use YOLO tiny model, at runtime it still require around 850M memory, so only iPhone 6s or later which get no smaller than 2GB of memory can make it running, otherwise it will be killed immediately when loading the model.

##Froze the model by yourself

from YOLO_tiny_tf import YOLO_TF

yolo=YOLO_TF()
with open("weights/tiny_model.pb","wb") as f:
    f.write(yolo.sess.graph_def.SerializeToString())
python -m tensorflow.python.tools.freeze_graph \
--input_graph=tiny_model.pb\ 
--input_checkpoint=YOLO_tiny.ckpt\
--output_graph=frozen_tiny.pb\
--output_node_names=classes_prob,classes_arg,boxes\ --input_binary=1

the output of frozen_tiny.pb then you can use it in the app.