animal_detection
On-device animal detection, species classification, and body pose estimation using LiteRT (formerly TensorFlow Lite).
3.0.1
2.1K downloads/mo
#402 most downloaded on pub.dev
hugocornellier/animal_detection
What this package is like to depend on
Last release 11 days ago
12 Aug 2026
Ships on a steady schedule
a new release about every 2 weeks
Nearly every release is documented
notes for 36 of 36 stable releases
Nothing withdrawn
no release was ever pulled
5 months old
36 releases · first in 2026
36 releases in the last 12 months
see the full history below
Release timeline
36 releases · Mar 2026 to Aug 2026Releases
latest 36-
3.0.112 Aug 2026Release notes
Open source →- Ship the
detectFromCameraFrame()anddetectFromCameraImage()APIs that were described in the 3.0.0 changelog but landed immediately after that release. Camera pixel conversion, rotation, downscaling, and inference stay in the detector worker isolate. - Add live-camera, still-image, and smoothed video-file flows to the native example, including the required platform permissions and registrations. Normalize live-camera behavior and cover the new paths with camera-frame parity, widget, and metrics tests.
- Ship the
-
3.0.009 Aug 2026Release notes
Open source →- Add the same public, opt-in CompiledModel configuration used by object, face,
pose, and hand detection.
AnimalDetector.initialize()and the newAnimalDetector.create()acceptuseCompiledModel,accelerators, andprecision; Interpreter remains the default. - Move the inference pipeline into a reusable
AnimalDetectorCoreand makeAnimalDetectorown one background worker isolate. Cat and dog detection can reuse the core inside their existing workers without nesting isolates. - Verify every requested CompiledModel against a plain-CPU Interpreter before use. An unsafe GPU graph retries on CompiledModel CPU; if CPU also fails, only that stage falls back to Interpreter instead of returning corrupted output.
- Preserve
initializeFromBuffers,compiledForceCpu, and the existing result APIs for source compatibility while routing them through the worker.
- Add the same public, opt-in CompiledModel configuration used by object, face,
pose, and hand detection.
-
2.1.008 Aug 2026Release notes
Open source →-
Default precision is now
Precision.fp32instead offp16. This changes numeric output.flutter_litert3.8.0 changed its own default for the same reason: across 29 published detection models measured on five GPUs, fp16 matched a plain-CPU reference for only about a fifth of them, while fp32 matched every model that compiled. These graphs emit pixel-space coordinates and landmark positions, and fp16 carries about three decimal digits of mantissa, so the error lands directly on output geometry. The cost is real and worth stating plainly: fp32 is a median 29.9% slower on GPU across those five GPUs, with Apple M4 the lone exception at 6.5% faster. Passprecision: Precision.fp16explicitly to restore the previous behaviour, ideally per model and validated on your target GPU. -
Pin
flutter_litertto^3.8.0. Adds an optional LiteRT NextCompiledModelbackend, off by default, and pinsflutter_litertto ^3.8.0. -
New
useCompiledModeloninitializeFromBuffers. When true, every stage is initialized ontoCompiledModelinstead ofInterpreter. Off by default, matching the same opt-in in face_detection_tflite, pose_detection and hand_detection.compiledForceCpuis accepted alongside it. -
The CompiledModel backend is CPU-only, deliberately. Each stage requests
{Accelerator.cpu}rather than the permissive{gpu, cpu}set. This is a correctness requirement, not a performance preference: LiteRT miscomputes two of this package's own models once the GPU accelerator is in the set, by 42.3% of the output range for the species classifier and 53.8% for the pose model, while still reporting success. Do not widen the accelerator set without measuring against a bare-CPU reference first; flutter_litert 3.7.0 shipsverifyCompiledModelfor exactly that check. -
Whether CompiledModel is faster is per-platform and per-model. Its CPU accelerator beats the Interpreter's XNNPACK path on Apple Silicon macOS but is roughly 2x slower on iOS, so measure before enabling it.
-
SSD output shapes are now derived rather than assumed, so the body detector works under both backends.
-
Requires
flutter_litert^3.8.0, which fixes a 3x macOS CPU slowdown affecting every stage of this pipeline (ruy multithreading was inert in the previously bundled macOS dylib).
-
-
2.0.027 Jul 2026Release notes
Open source →-
Replace the boxed nested input and output tensors in every model class with reused flat
Float32Lists handed to TFLite asByteBuffers, matching the approach in face_detection_tflite, pose_detection and hand_detection. Measured end to end on the cat_detection pipeline over a 3264x2448 photo in profile mode withPerformanceMode.auto, the full pipeline drops from 438 ms/frame to 109 ms/frame and poseOnly from about 44 ms to 15 ms. Model outputs are unchanged.The two new helpers
ImageUtils.matToFloat32SimdandmatToFloat32ImageNetSimduse OpenCV's vectorized path and accept an optional caller buffer. Both are asserted equal to the per-pixel loops they replace: worst deviation 5.96e-8 (one float32 ULP) for the plain path, 7.15e-7 for the ImageNet affine.ImageUtils.matToFloat32andmatToFloat32ImageNetare retained. -
Fix
ImageUtils.cropAndResizereturningCropMetadatabuilt from pre-truncation floats while cropping an integral region. Callers mapped normalized coordinates against an origin up to 1px from where the crop actually began, and against a slightly too-large extent. Measured over the 311-image CatFLW holdout with real localizer boxes, this placed landmarks +0.61px right and +0.52px down of ground truth and cost 0.255 NME_IOD, rising to 1.14 at the 95th percentile, with 72% of images improved by the fix. The Python training pipelines normalize against the integer crop, so this also aligns inference with how the models were trained.This changes returned landmark coordinates. Downstream packages should bump their own pipeline version so cached detections re-evaluate.
-
Fix
ModelDownloader.modelHrnet, which requestedsuperanimal_hrnet_w32_256_float16.tflitewhile the release publishessuperanimal_hrnet_w32_float16.tflite.AnimalPoseModel.hrnettherefore failed with an HTTP 404 on first use and had never worked. The private filename constant now derives from the public one so the two cannot drift. -
Reject a configured input size that disagrees with the bundled model, via the new internal
assertSquareInputSize.Interpreter.resizeInputTensoraccepts a shape the model was not trained for without reporting an error, and inference then returns finite but meaningless values: feeding a 256px landmark model at 384px measured NME_IOD 67.3 against a correct 3.5 while every output stayed in range. All six model classes now validate againstgetInputTensor(0).shapeat initialization. -
Stop tracking
.DS_Storefiles, which were included in the published archive.
-
-
1.4.024 Jul 2026Release notes
Open source →- SSD anchors are now generated at runtime instead of shipping as a literal
table.
lib/src/models/ssd_anchors.dartwas 12,944 lines, of which 12,936 were a single float literal each; the values are the deterministic output of TF OD API'screate_ssd_anchors, whichflutter_litertalready exports asgenerateAnchors. The library drops from 15,222 to 2,355 lines and the compiled binary shrinks by about 32 KB. - Detection output is unchanged. Verified against the real SSDLite320 model over 9 images at 100 runs each: identical detection counts, bit-identical scores, and a worst-case box coordinate delta of 9.3e-05 px, which comes from the previous table having been rounded to 6 decimals while the generator is full float64. End-to-end timing is unchanged.
- Anchors are now stored in centre form (
cx, cy, w, h), which is whatgenerateAnchorsemits and what the box decoder consumes, removing a corner round-trip that ran on every anchor of every frame. - The exported anchor table is retained under
test/fixtures/as the equivalence reference.test/ssd_anchors_test.dartregenerates the anchors and diffs all 3,234 against it on every run, so a change to the generator or its configuration fails immediately. - Update flutter_litert -> 3.6.0.
- SSD anchors are now generated at runtime instead of shipping as a literal
table.
-
1.3.311 Jul 2026 -
1.3.209 Jul 2026 -
1.3.105 Jul 2026 -
1.3.028 Jun 2026Release notes
Open source →- Update flutter_litert -> 3.2.0
- Import native-only flutter_litert APIs via
package:flutter_litert/native.dartso they resolve under static analysis (flutter_litert 3.2.0 movedInterpreterPoolandInterpreterFactorybehind the native conditional export). No runtime or API change.
-
1.2.315 Jun 2026 -
1.2.215 Jun 2026 -
1.2.107 Jun 2026 -
1.2.030 May 2026Release notes
Open source →- Update flutter_litert -> 2.8.0
- Complete Swift Package Manager migration: example apps build via SPM without CocoaPods
-
1.1.125 May 2026Release notes
Open source →- Remove unused Darwin podspecs for Dart-only iOS/macOS plugin registration.
-
1.1.025 May 2026 -
1.0.1223 May 2026 -
1.0.1122 May 2026 -
1.0.1019 May 2026 -
1.0.905 May 2026 -
1.0.828 Apr 2026 -
1.0.728 Apr 2026 -
1.0.624 Apr 2026 -
1.0.524 Apr 2026 -
1.0.421 Apr 2026 -
1.0.317 Apr 2026 -
1.0.215 Apr 2026 -
1.0.114 Apr 2026 -
1.0.004 Apr 2026Release notes
Open source →- First stable release. On-device animal detection, species/breed classification, and 24-point body pose estimation using TensorFlow Lite. Supports Android, iOS, macOS, Windows, and Linux with automatic hardware acceleration.
-
0.0.830 Mar 2026 -
0.0.729 Mar 2026 -
0.0.629 Mar 2026Release notes
Open source →- Enable auto hardware acceleration by default (XNNPACK on all native platforms, Metal GPU on iOS)
- Update flutter_litert 2.0.6 -> 2.0.8
-
0.0.522 Mar 2026 -
0.0.417 Mar 2026 -
0.0.314 Mar 2026 -
0.0.213 Mar 2026 -
0.0.113 Mar 2026Release notes
Open source →- Initial release: SSD body detection, species classification, and SuperAnimal pose estimation.