Platform: Google Colab
Tensorflow version: 2.8.0
I tried to write metadata into my custom tflite object detection model using this code from this documentation:
from tflite_support.metadata_writers import object_detector
from tflite_support.metadata_writers import writer_utils
from tflite_support import metadata
ObjectDetectorWriter = object_detector.MetadataWriter
label_txt = "labelmap.txt"
writer = ObjectDetectorWriter.create_for_inference(
writer_utils.load_file(tflite_model),
[127.5],
[127.5],
[label_txt] # <-- Error Here
)
writer_utils.save_file(writer.populate(), tflite_model)
But this error occur:
TypeError Traceback (most recent call last)
<ipython-input-26-ec01babab0ee> in <module>()
6 label_txt = "labelmap.txt"
7
----> 8 writer = ObjectDetectorWriter.create_for_inference(writer_utils.load_file(tflite_model), [127.5], [127.5], [label_txt])
9 writer_utils.save_file(writer.populate(), tflite_model)
6 frames
/usr/local/lib/python3.7/dist-packages/tensorflow_lite_support/metadata/metadata_schema_py_generated.py in Pack(self, builder)
1306 for i in reversed(range(len(self.mean))):
1307 builder.PrependFloat32(self.mean[i])
-> 1308 mean = builder.EndVector(len(self.mean))
1309 if self.std is not None:
1310 if np is not None and type(self.std) is np.ndarray:
TypeError: EndVector() takes 1 positional argument but 2 were given