Questions about Tflite-model-maker

Hi, I have tried to replace my old TF2 training notebook with Tflite-model-maker. And I would like to question some of the limitations I found in this process.

  1. Does the model maker’s object_detector API not yet support the moblenet_v2 model?

    According to model_spec, It only supports efficientdet-lite models right now. Is there any way to use resNet or mobileNetV2 manually?

  2. How can I use DataLoader by uploading my Record files directly to Google Colab?

    I tried several times with reference to this guide, but I actually failed to load the data. Are there any examples for me?

  3. The object_detector cannot be exported to TFJS format?

    Unlike text_classifier, the object_detector doesn’t support ExportFormat.TFJS. Is it right? Or Are there any options to export it?

this is the Colab notebook that I’ve tried to train a model with #tflite-model-maker

Hi dusskapark,

did you found the solution for using the Tflite-model-maker with mobinet_v2?

In the API documentation it is shown (API spec) :slightly_smiling_face:

But if i tried in the example colab notebook i get an error.
I tried this way: "spec = model_spec.get(‘mobilenet_v2’)"
And get that error:

AttributeError                            Traceback (most recent call last)
<ipython-input-9-291bcc3f9a2a> in <module>()
----> 1 model = object_detector.create(train_data, model_spec=spec, epochs = 50, batch_size=8, train_whole_model=True, validation_data=validation_data)

/usr/local/lib/python3.7/dist-packages/tensorflow_examples/lite/model_maker/core/task/object_detector.py in create(cls, train_data, model_spec, validation_data, epochs, batch_size, train_whole_model, do_train)
    245     model_spec = ms.get(model_spec)
    246     if epochs is not None:
--> 247       model_spec.config.num_epochs = epochs
    248     if batch_size is not None:
    249       model_spec.config.batch_size = batch_size

AttributeError: 'ImageModelSpec' object has no attribute 'config'

I tried also to use model from TFhub, but i think i did it on wrong way. :sweat_smile:

"spec = object_detector.mobilnet_v2(model_name=‘mobilenet_v2’, uri=‘TensorFlow Hub’, hparams={‘max_instances_per_image’: 8000})"

My someone can help?

Ok… i found the fault… did a mistake while reading the API documentation for the model.spec.

There is no option for the object detection to use mobilnet_v2 it`s only for image classification. :sweat:

But learned again a lot during the research in the github Files :yum:

1 Like