Downloading model as tflite with class labels

Hello,

I’m trying to download my Edge Impulse model as a TensorFlow Lite (.tflite) file for use on a device that doesn’t support C++ libraries. While I’m able to download the model from the Deployment page as a .tflite file, it doesn’t include any labels or metadata for the model’s output classes. Also the provided numpy files for “image training labels” doesnt provide any strings for the class names
Screen Shot 2025-08-22 at 2.55.14 PM

My model is a binary classifier, and I need to know which index corresponds to which class. However, the downloaded .tflite file doesn’t come with a labels.txt or equivalent file, and the accompanying numpy files don’t seem to include the actual class names either.

However when exporting as a C++ library on the Deployment page, the labels are included in model-parameters/model_variables.h. That works well for embedded C++ projects, but it’s not compatible with my deployment setup.

Is there a way to download the .tflite model along with a simple labels.txt file ?
for example something easy like this would be great when downloading model:

/model/
  model.tflite
  labels.txt

Any advice would be greatly appreciated
thank you

Hello @will_wildlife.ai first of all welcome to the Edge Impulse community!

If i’m not wrong, at Edge Impulse, the class mappings are known in the Studio and in the SDKs, but the plain .tflite export is just the model. That’s why you don’t see the labels.txt when you export the model.

There are different options to get the labels with you. Here are some ideas:

  • export the labels manually from the Studio (from the Output block → Classification). However this is a manual solution and you will need to copy and paste the labels in the file in your local computer.
  • Build the model as Custom Block and it will download the deployment_metadata.json among other files in a zip file. Parse this file as it contains the labels and you can generate automatically the labels.txt file.
"classes": [
        "label1",
        "label2",
        "label3"
    ],

Let us know if that works or you need more help!