0
votes

I would like to make TF Detect, one of the Tensorflow Android demo apps, recognize only a restricted custom set of objects (say apples, pears, oranges and bananas) in camera frames, drawing boxes around recognized objects.

Following the TensorFlow-for-poets codelab, I have already successfully retrained the mobilenet_v1_0.50_224 model, and I have successfully replaced the original tensorflow_inception_graph.pb model used in TF Classifier, another TensorFlow demo app. It seems to work.

Update: Actually, after a first successful run, I could not run any other retrained model, due to the following exception: *Not a valid TensorFlow Graph serialization: NodeDef mentions attr 'dilations' not in Op output:T; attr=T:type,allowed=[DT_HALF, DT_FLOAT]; attr=strides:list(int); attr=use_cudnn_on_gpu:bool,default=true; attr=padding:string,allowed=["SAME", "VALID"]; attr=data_format:string,default="NHWC",allowed=["NHWC", "NCHW"]>; NodeDef: conv/Conv2D = Conv2D[T=DT_FLOAT, data_format="NHWC", dilations=[1, 1, 1, 1], padding="VALID", strides=[1, 2, 2, 1], use_cudnn_on_gpu=true](Mul, conv/conv2d_params). (Check whether your GraphDef-interpreting binary is up to date with your GraphDef-generating binary.).

This problem has been solved as indicated here*

But when it comes to TF Detect, it turns out that it uses the ssd_mobilenet_v1_android_export.pb model. The graph seems quite different from the one used in TF Classifier (as an example, input and output nodes are different and have fixed names: input is "image_tensor" and outputs are "detection_scores", "detection_boxes", "detection_classes" and "num_detections") and I am not sure if it would be possible to retrain it by transfer learning as done for the model used in TF Classifier.

Is it possible and, if yes, how to proceed?

1

1 Answers

0
votes

You need to train a model by SSD, YOLO or Tensorflow Object Detection API to use the model for TF detect. This model is different from the one used for TF classify (this model can be trained by Keras, but the model of TF detect can not be).