Search code examples
machine-learningtensorflowdeep-learningobject-detectionpredict

Predicting single image in tensorflow object detection


I have trained a model for object detection using tensorflow object detection repository.

Now while evaluating the default way is to read from a record file using tf.contrib.slim.parallel_reader

I want to read the images directly using file system and get the prediction for the image. How do I do that?


Solution

  • have a look on this https://github.com/tensorflow/models/blob/master/object_detection/object_detection_tutorial.ipynb, here a frozen model is used, but you can use normal ckpt with minor changed logic to use image instead of tfrecord.

    step1: Load the model using ckpt file

    step2: get the model end points to run predictions; similar to the link above except removing the :0

    step3: use placeholder to feed the numpy array (your images)

    Apart from this you can convert the trained model into a frozen model convert to frozen modeland follow the same step as described in the above link.