This is a Flutter-based real-time object detection app using TensorFlow Lite.
It processes live camera frames, provides real-time guidance to the user, and captures an image when the object is correctly positioned.
βοΈ Real-time Object Detection using TensorFlow Lite
βοΈ Live User Guidance ("Move Closer", "Move Farther", "Object in Position")
βοΈ Automatic Image Capture when object is positioned correctly
βοΈ Stores Image Metadata (date, time, object type)
βοΈ GetX State Management for smooth UI updates
βοΈ Performance Optimization by limiting frame processing
git clone <your-repo-url>
cd <your-project-folder>flutter pub getflutter runπ Important:
- This app requires a physical device as it uses the camera for object detection.
- Ensure you have TensorFlow Lite models in
assets/models/.
The following dependencies are used in this project (pubspec.yaml):
| Package Name | Version | Purpose |
|---|---|---|
flutter |
latest | Core Flutter framework |
get |
^4.6.5 | State management & navigation |
camera |
^0.10.5+2 | Accessing device camera |
tflite_flutter |
^0.11.0 | Running TensorFlow Lite models |
image |
^4.0.17 | Image processing utilities |
path_provider |
^2.0.15 | File system access |
image_picker |
^1.0.0 | Selecting or capturing images |
exif |
^3.1.4 | Extracting metadata from images |
intl |
^0.19.0 | Formatting date/time |
- Continuous processing of camera frames caused the device to overheat and reduced performance.
- Introduced frame skipping mechanism to reduce CPU/GPU workload.
- Added:
int frameCounter = 0; // Used to limit FPS processing
- Optimized Image Processing: Frames are only processed every 5th frame, significantly improving performance.
- The TensorFlow Lite model sometimes misclassifies objects or fails to detect them accurately.
- Inconsistent detection caused early or late object positioning messages.
- Adjusted Confidence Threshold:
We fine-tuned the model threshold (confidence = 0.5) to improve detection accuracy.
- The TensorFlow Lite model runs in a separate isolate to avoid blocking the UI.
- However, sending camera frames from the main thread to the isolate caused serialization issues.
- CameraImage objects cannot be sent directly across isolates.
- We used Background Isolate Channels to register the root isolate before running background operations.
- Implemented a Command-Based Messaging System:
- The Main Isolate sends "detect" commands to the detector isolate.
- The Detector Isolate processes the image and sends back "result" commands.
- Captured Image Handling uses a capture lock (
_isCapturing = true) to prevent multiple captures.
πͺ This resolved the issue, allowing real-time image processing without UI lag!
Want to improve the model accuracy or enhance the UI?
Feel free to fork the repo and submit a pull request!
git clone <your-repo-url>
git checkout -b feature-branch
git commit -m "Added new feature"
git push origin feature-branchThis project is licensed under the MIT License.
π― Your project now has a structured README.md with all required details! π
Let me know if you need any changes! ππ‘