tflite_plus 1.0.4
tflite_plus: ^1.0.4 copied to clipboard
A comprehensive Flutter plugin for Google AI's LiteRT (TensorFlow Lite) with advanced machine learning capabilities for both Android and iOS platforms.
1.0.4 #
Static Analysis & Example App Fixes ๐งน #
flutter analyze Clean-up
- 324 โ 0 issues: Resolved every warning/error reported by
flutter analyzeacross the plugin and all 14 bundled example apps - Plugin lints: Removed the unnecessary named
librarydirective and escaped a strayList<dynamic>doc-comment that was being parsed as HTML - Deprecated API usage: Replaced
Color.withOpacity()withColor.withValues(alpha: ...)across 11 example apps - Missing type annotations: Added explicit parameter types in the
reinforcement_learningexample
Example App Fixes
- Broken dependency:
object_detection_ssd_mobilenet_v2pointed at a nonexistenttflite_plus: ^0.10.4on pub.dev; switched to a localpathdependency like every other example - Version conflict:
digit_classificationpinnedimage: 4.0.17, which conflicted with the plugin's ownimage: ^4.1.7requirement and blockedpub getentirely .gitignorebug: the negation patterns meant to keep placeholderassets/models/.gitkeepandREADME.mdfiles tracked were missing their!prefix, so those directories could never actually ship; fixed the patterns and added the missing placeholders
Dependencies
- Bumped
ffigendev dependency to^21.0.0
1.0.3 #
Enhanced Documentation & Examples ๐ #
Documentation Improvements
- Comprehensive Examples README: Complete rewrite of
example/README.mdwith detailed documentation- โ 15+ Example Showcase: Comprehensive catalog of all available ML examples
- โ Feature Matrix: Detailed comparison of capabilities across Computer Vision, Audio, NLP, and Advanced AI
- โ Platform Support: Clear platform compatibility matrix for all examples
- โ Quick Start Guide: Step-by-step setup instructions with code examples
- โ
Live Code Samples: Ready-to-use code snippets for:
- Image Classification with MobileNet
- Real-time Object Detection with camera streams
- Audio Classification with microphone input
- Text Classification and sentiment analysis
- Proper resource management and error handling
Examples Coverage
- Computer Vision: 10 examples (Image Classification, Object Detection, Pose Estimation, Segmentation, Style Transfer, etc.)
- Audio Processing: YAMNet audio classification with live stream support
- Natural Language Processing: Text classification and BERT Q&A examples
- Advanced AI: Reinforcement learning and gesture recognition demos
Developer Experience
- Setup Instructions: Detailed platform-specific configuration guides
- Troubleshooting Section: Common issues and solutions
- Best Practices: Performance optimization and resource management tips
- Contributing Guidelines: Clear instructions for adding new examples
- Learning Resources: Educational content for ML concepts and implementation patterns
Technical Details
- Cross-Platform Support: Updated compatibility information for Android, iOS, and Desktop platforms
- Hardware Acceleration: Documented GPU, NNAPI, Metal, and CoreML delegate usage
- Model Management: Guidelines for downloading and managing TensorFlow Lite models
- Performance Optimization: Memory usage and inference speed optimization techniques
1.0.2 #
Major API Overhaul - FFI Implementation ๐ #
Breaking Changes
- Complete API Rewrite: Migrated from high-level method channel API to low-level FFI-based
InterpreterAPI - Removed Legacy API: All
TflitePlus.*static methods have been removed:- โ
TflitePlus.loadModel() - โ
TflitePlus.runModelOnImage() - โ
TflitePlus.detectObjectOnImage() - โ
TflitePlus.runPoseNetOnImage() - โ
TflitePlus.getAvailableDelegates() - โ
TflitePlus.close()
- โ
New Features
- FFI Interpreter API: Direct FFI bindings to TensorFlow Lite C++ library
- โ
Interpreter.fromAsset()- Load models from Flutter assets - โ
Interpreter.fromFile()- Load models from file system - โ
Interpreter.fromBuffer()- Load models from memory buffer - โ
interpreter.run()- Single input/output inference - โ
interpreter.runForMultipleInputs()- Multi-input/output inference - โ
interpreter.invoke()- Raw inference execution
- โ
- Hardware Delegates: Platform-specific acceleration
- โ
GpuDelegate(Android) - โ
MetalDelegate(iOS) - โ
XNNPackDelegate(Cross-platform) - โ
CoreMLDelegate(iOS)
- โ
- InterpreterOptions: Configuration for threads, delegates, and optimization
- Direct Tensor Access: Low-level tensor manipulation with
Tensorclass - Model Management:
Modelclass for advanced model operations
Migration Guide
// Old API (v1.0.0)
await TflitePlus.loadModel(model: 'model.tflite');
final results = await TflitePlus.runModelOnImage(path: imagePath);
// New API (v1.0.1+)
final interpreter = await Interpreter.fromAsset('model.tflite');
final input = Float32List(inputSize);
final output = List.filled(outputSize, 0.0);
interpreter.run(input, output);
interpreter.close();
Improvements
- Performance: Direct FFI calls eliminate method channel overhead
- Memory Management: Explicit resource control with
close()method - Type Safety: Strongly typed tensor operations
- Lower-level Access: Full control over inference pipeline
- Cross-platform: Unified API across Android and iOS
Developer Experience
- Updated Documentation: All examples updated to new Interpreter API
- Complete Examples: Real-world image classification and batch processing samples
- Migration Support: Clear migration path from legacy API
- Error Handling: Improved exception handling with specific error types
1.0.0 #
Initial Release ๐ #
Features
- Image Classification: Complete support for image classification using TensorFlow Lite models
- Object Detection: Comprehensive object detection with bounding boxes and confidence scores
- Pose Estimation: Human pose estimation using PoseNet models
- Semantic Segmentation: Pixel-level image segmentation capabilities
- Multi-Platform Support: Full Android and iOS compatibility
- Hardware Acceleration:
- Android: GPU delegate, NNAPI delegate
- iOS: Metal delegate, CoreML delegate
- Flexible Input Methods: Support for both file paths and binary data
- Asynchronous Operations: Non-blocking inference with proper async/await support
- Model Management: Load, close, and query model information
- Comprehensive API: All major TensorFlow Lite operations covered
Platform Support
- Android: API level 21+ with LiteRT 2.0.2
- iOS: iOS 12.0+ with TensorFlow Lite Swift
Dependencies
- Google AI Edge LiteRT 2.0.2
- TensorFlow Lite Task Vision/Text libraries
- GPU acceleration libraries for both platforms
Documentation
- Comprehensive README with examples
- API documentation for all methods
- Performance optimization guides
- Troubleshooting section
- Example app with practical demonstrations
Developer Experience
- Type-safe Dart APIs
- Comprehensive error handling
- Detailed logging and debugging support
- Easy integration with existing Flutter apps
- Extensive customization options