To train a custom TensorFlow Lite (now LiteRT) object detection model, you no longer need the TensorFlow toolchain: the fastest path to on-device detection is labeling your dataset in Roboflow, fine-tuning RF-DETR Nano from a COCO checkpoint in the browser, and deploying offline to a Jetson with Roboflow Inference.
If you want to train a custom TensorFlow Lite object detection model, what you really need is a detection model that runs fast on your own hardware, whether that is a phone, or another edge device, without a network round-trip for every inference. This guide delivers that outcome end to end in the browser.
You will label a dataset, train RF-DETR (Roboflow's transformer-based detection model, which is fast to fine-tune, accurate, and licensed for commercial use), evaluate it, and deploy it to run on-device with Roboflow Inference.
What Is TensorFlow Lite?
TensorFlow Lite is Google's framework for on-device inference: it takes a trained TensorFlow model and converts it into a compact .tflite file that runs on Android, iOS, and embedded Linux devices. In 2024 Google renamed it LiteRT within Google AI Edge, and the runtime continues to power on-device inference for mobile applications.
TensorFlow Lite is a deployment format, not a training framework. The classic workflow trains a lightweight architecture such as MobileNet SSD or EfficientDet-Lite in TensorFlow, then runs the converter to produce the .tflite file. That two-stage pipeline is where most projects stall: the training side depends on the TensorFlow Object Detection API or the Model Maker library, both of which require careful version pinning and are no longer actively developed for this task.
Where TensorFlow Lite Fits Today
The reason to reach for TensorFlow Lite has always been the deployment target, not the format itself. You want real-time detection on constrained hardware, offline operation, and data that stays on the device. Those requirements no longer require the TensorFlow toolchain.
RF-DETR ships in sizes down to Nano, built for exactly this class of hardware, and Roboflow Inference runs it on an NVIDIA Jetson, or any machine with Docker or Python, fully offline once the model is cached. You get the on-device outcome the .tflite file was for, with a training path that takes an afternoon in the browser.
So that is the path this tutorial takes: train a custom detection model in Roboflow, then deploy it to the same devices a TensorFlow Lite project targets.
How to Use LiteRT
If you already have a .tflite model, or your deployment target requires one, LiteRT is the runtime that executes it. Install the Python package and run inference with the Interpreter API:
pip install ai-edge-litertfrom ai_edge_litert.interpreter import Interpreter
import numpy as np
interpreter = Interpreter(model_path="model.tflite")
interpreter.allocate_tensors()
input_details = interpreter.get_input_details()
output_details = interpreter.get_output_details()
# Preprocess your image to the model's input shape and dtype,
# e.g., (1, 320, 320, 3) uint8 for an EfficientDet-Lite0 model.
interpreter.set_tensor(input_details[0]["index"], input_data)
interpreter.invoke()
boxes = interpreter.get_tensor(output_details[0]["index"])A detection model's outputs are raw tensors (boxes, class indices, and scores) that you decode and threshold yourself. LiteRT also ships a newer CompiledModel API with streamlined hardware acceleration for NPUs and GPUs.
The catch is upstream of the runtime: LiteRT runs .tflite files but does not produce them. You still need a trained model from somewhere, either a pretrained checkpoint like EfficientDet-Lite or a TensorFlow model you convert yourself, and the custom training tooling for that path is no longer actively developed. That is the gap the rest of this tutorial closes with a maintained path: train RF-DETR on your custom data, then deploy on-device with Roboflow Inference.
Train and Deploy a Custom Detection Model
What you need: A free Roboflow account, a browser, and images of the objects you want to detect. Around 50 labeled images is enough to see first results; a few hundred gets you to production quality for many tasks. If you do not have images yet, Roboflow Universe hosts over 200,000 open datasets you can fork, including the BCCD blood cell dataset. Python is optional and only needed for the inference step at the end.
Step 1: Create a project
Sign in to Roboflow and create a new project. Choose Object Detection as the project type and name the classes you plan to detect. For the blood cell example these are RBC, WBC, and Platelets. Settle the class list before labeling starts; renaming classes mid-project is possible, but deciding up front is faster.
Step 2: Upload your images
Drag and drop your images into the project. Roboflow accepts raw images as well as data already labeled in another tool, and it converts between annotation formats automatically, so a dataset labeled elsewhere in VOC XML or COCO JSON imports cleanly.
To skip data collection entirely, fork the BCCD dataset from Universe into your workspace. The fork copies images and annotations, and you can proceed straight to generating a version.
Step 3: Annotate your images
If your images are unlabeled, Roboflow Annotate is where the work happens, and two AI-assisted features carry most of it. Auto Label uses foundation models to draft annotations across your whole dataset from a text description of each class, so your job becomes review and correction rather than drawing every box. Label Assist suggests boxes image by image as you work.
A few labeling rules pay off downstream: draw boxes tight around the full object, label occluded objects as if they were fully visible, and label every instance in every image. Inconsistent labels cap model accuracy no matter how long you train.
Step 4: Generate a dataset version
A version is a frozen snapshot of your dataset with preprocessing and augmentation applied, and it is what the trainer consumes. In the Versions tab, keep the default preprocessing (auto-orient and resize) and add modest augmentations that match variation your model will see in production: flips, small rotations, and brightness shifts are safe defaults. Roboflow splits the data into train, validation, and test sets automatically.
Augmentation multiplies your effective dataset size without more labeling, which matters most when you are starting from a small image set.
Step 5: Train your model
Click Custom Train on your new version and select RF-DETR. Choose a checkpoint to start from: training from the COCO checkpoint applies transfer learning, so the model arrives already understanding edges, shapes, and textures, and needs far fewer images and epochs to learn your classes.
Since the deployment target is edge hardware, pick a smaller RF-DETR size such as Nano or Small. Smaller sizes trade a little accuracy for a lot of speed on constrained devices, the same tradeoff a MobileNet SSD makes, with better accuracy per parameter. Hosted training runs on Roboflow's GPUs, shows an estimated completion time, and emails you when the model is ready. There is nothing to install and no notebook to babysit.
Step 6: Evaluate your model
When training completes, Roboflow reports mean average precision (mAP), precision, and recall on the held-out validation set, with a per-class breakdown. Read the per-class numbers first: a strong overall mAP can hide one weak class, and in the blood cell example, platelets (the smallest and rarest class) are where problems show up.
Test the model visually in the browser against held-out images. If a class underperforms, the fix is usually more labeled examples of that class or more consistent labels, not more training epochs. Add images, regenerate a version, and retrain; this loop is the actual work of building a production model.
Step 7: Run inference
Every trained model gets a Serverless Hosted API endpoint immediately, which is the fastest way to test from code:
pip install inference-sdk supervision
import os
import cv2
import supervision as sv
from inference_sdk import InferenceHTTPClient
client = InferenceHTTPClient(
api_url="https://serverless.roboflow.com",
api_key=os.getenv("ROBOFLOW_API_KEY"),
)
# Custom model: model_id is "project-name/version" (e.g., "bccd/1").
# COCO-pretrained RF-DETR sanity check: model_id="rfdetr-base".
result = client.infer("image.jpg", model_id="your-project/1")
image = cv2.imread("image.jpg")
detections = sv.Detections.from_inference(result)
box_annotator = sv.BoxAnnotator()
label_annotator = sv.LabelAnnotator()
annotated = box_annotator.annotate(scene=image.copy(), detections=detections)
annotated = label_annotator.annotate(scene=annotated, detections=detections)
cv2.imwrite("annotated.png", annotated)
Set your API key in the ROBOFLOW_API_KEY environment variable. The supervision library draws the boxes and labels on the output image.
Step 8: Deploy on-device
This is the step the TensorFlow Lite workflow existed for, and it is where Roboflow Inference takes over. Inference is an open source engine that runs your trained model on your own hardware: an NVIDIA Jetson, an on-prem server, or a laptop. Point the same client at a local Inference server (api_url set to http://localhost:9001) and detections run entirely on the device, offline, with no per-frame cloud cost.
For a complete application rather than raw detections, Roboflow Workflows chains your model with logic blocks (tracking, counting, alerts, visualizations) in a low-code builder, and the whole workflow deploys through Inference the same way. And if you build with coding agents, the Roboflow MCP server connects your workspace to tools like Claude Code and Cursor so an agent can query your models and datasets directly.
On mobile, the deployment story depends on the format. A .tflite model runs on Android through the Task Library ObjectDetector API, which handles preprocessing and returns decoded boxes, labels, and scores, and LiteRT.js runs models client-side in the browser.
A Roboflow-trained model reaches mobile apps through the Serverless Hosted API with the same client shown above, which keeps the model updatable without shipping a new app build. For guidance on picking an architecture for phone-class hardware, see our guide to the best mobile object detection models.
Why RF-DETR for Custom Object Detection?
RF-DETR is a real-time detection transformer that outperforms lightweight CNN architectures at comparable latency, comes in sizes from Nano up, and is released under a commercial-friendly license, so a model you train is yours to ship in a product. Fine-tuning from a pretrained checkpoint converges in a fraction of the epochs of from-scratch training, and the entire train-evaluate-deploy loop lives in one platform, which removes the conversion and version-pinning steps where multi-stage pipelines typically break. For a deeper look at the architecture and benchmarks, see the RF-DETR model page.
Can I still train a TensorFlow Lite object detection model?
Yes. The LiteRT toolchain remains available, and the classic path (train EfficientDet-Lite or MobileNet SSD, convert to .tflite) still functions for teams committed to it. The tradeoff is maintaining a training pipeline built on libraries that are no longer actively developed for detection.
How many images do I need to train a custom detection model?
Around 50 labeled images per class is enough for a first working model, and a few hundred images gets many tasks to production quality. Transfer learning from the COCO checkpoint is what makes small datasets viable, and augmentation stretches them further.
What if my dataset is already labeled in TFRecord or VOC format?
Upload it as-is. Roboflow converts between 26+ annotation formats on import and export, so datasets labeled for a TensorFlow pipeline carry over without rework.
What is the difference between TensorFlow Lite and LiteRT?
They are the same technology under two names. Google renamed TensorFlow Lite to LiteRT in 2024 as part of Google AI Edge. The .tflite model format, the Interpreter API, and existing models all continue to work unchanged; LiteRT adds newer capabilities like the CompiledModel API for hardware acceleration on NPUs and GPUs, and LiteRT.js for running models in the browser.
Get Started
Create a free Roboflow account, fork a dataset from Universe or upload your own images, and you can have a custom detection model running on your own hardware today. Learn more about TensorFlow.
Cite this Post
Use the following entry to cite this post in your research:
Erik Kokalj. (Mar 5, 2026). How to Train a Custom TensorFlow Lite (Now LiteRT) Object Detection Model. Roboflow Blog: https://blog.roboflow.com/how-to-train-a-tensorflow-lite-object-detection-model/