title: Convert SSD MobileNetV2 custom model to edgetpu model?
body: <p>I'm trying to convert the mobilenetv2(ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8 ) model to EdgeTPU model for object detection. And ı'm using TF2.</p>
  <p>I tried many solution but still have &quot;cpu operations&quot; when i convert tflite model to edge tpu. how can i convert whole mobilenet model?</p>
  <p>Here my steps;</p>
  <ol>
  <li>Download pretrained model(mobilenetv2), prepate dataset(spesific class from coco) and train your model.</li>
  <li>Export checkpoints ./exporter_main_v2.py and now i have &quot;saved_model.pb , assest, checkpoints&quot; under saved_models files.</li>
  <li>Turn step2, install tf-nightly 2.5.0.dev20210218  and &quot;export_tflite_graph_tf2.py&quot; and export model now.</li>
  <li>This step, trying to quantize model for edgetpu(8bits) and converting to .tflite files. Scripts like these ;</li>
  </ol>
  <pre><code>  def representative_dataset_gen():
      for data in raw_test_data.take(10):
        image = data['image'].numpy()
        image = tf.image.resize(image, (320, 320))
        image = image[np.newaxis,:,:,:]
        image = image - 127.5
        image = image * 0.007843
        yield [image]
    
    raw_test_data, info = tfds.load(name=&quot;coco/2017&quot;, with_info=True, split=&quot;test&quot;, data_dir=&quot;/TFDS&quot;, download=False)
  
    converter =  tf.lite.TFLiteConverter.from_saved_model('~/saved_model')
    converter.optimizations = [tf.lite.Optimize.DEFAULT]
    converter.target_spec.supported_ops = [tf.lite.OpsSet.TFLITE_BUILTINS_INT8, tf.lite.OpsSet.SELECT_TF_OPS]
    converter.inference_input_type = tf.int8
    converter.inference_output_type = tf.int8
    converter.allow_custom_ops = True
    converter.representative_dataset = representative_dataset_gen
    tflite_model = converter.convert()
    
    with open('{}/model_full_integer_quant.tflite'.format('/saved_model'), 'wb') as w:
  
    w.write(tflite_model)
  </code></pre>
  <ol start="5">
  <li><p>After quantization visualize from netron and model properties like these ;
  <a href="https://i.stack.imgur.com/CiPhm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CiPhm.png" alt="enter image description here" /></a></p>
  </li>
  <li><p>And i convert .tflite model to edgetpu model with &quot;edgetpu_compiler&quot; and my final models ;
  <a href="https://i.stack.imgur.com/l4sLk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/l4sLk.png" alt="have 7 CPU operations " /></a>
  <a href="https://i.stack.imgur.com/ljjJa.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ljjJa.png" alt="enter image description here" /></a></p>
  </li>
  </ol>