vision_ai_models 0.1.1
vision_ai_models: ^0.1.1 copied to clipboard
Bundled hand-gesture and face-emotion ML models for the vision_ai plugin. Copies them to app storage and returns runtime paths.
vision_ai_models #
Bundled hand-gesture and face-emotion ML models for the
vision_ai plugin.
As of vision_ai 0.3.0 the core plugin bundles no models — it loads each
model from a file path supplied at runtime. This keeps an app's footprint to
only the models it actually uses. vision_ai_models carries the hand/face
models, copies them into app storage on first use, and hands back the resolved
paths as a ModelPaths.
Add it whenever you use HandConfig or FaceConfig(detectEmotion: true). If you
only do animal detection, you don't need this package — use
vision_ai_animals instead.
Installation #
dependencies:
vision_ai: ^0.4.0
vision_ai_models: ^0.1.0
Usage #
import 'package:vision_ai/vision_ai.dart';
import 'package:vision_ai_models/vision_ai_models.dart';
// Copy bundled models to app storage once and get their paths.
final models = await VisionAiModels.ensureLoaded();
final vision = VisionAi(
hand: const HandConfig(),
face: const FaceConfig(detectEmotion: true),
models: models,
);
final textureId = await vision.start();
ensureLoaded() is safe to call on every launch — it skips the copy when a
file of the matching size already exists.
What it bundles #
| Model | File | Used by |
|---|---|---|
| Hand gesture recognizer | gesture_recognizer.task |
HandConfig |
| Face emotion classifier | emotion_classifier.tflite |
FaceConfig(detectEmotion: true) |
Both are MediaPipe/TFLite models loaded by the core engine. The copy targets
getApplicationSupportDirectory()/vision_ai_models/ and works on Android + iOS.
For animal models, see vision_ai_animals.
To supply your own model paths without this package, build a ModelPaths directly.
License #
Apache License 2.0. The bundled models are distributed by Google under the Apache 2.0 license.