Grapevine_Disease_Detection/VinEye
Yanis c5d59fc092 fix(ml): align input shape to 224x224 + pass ArrayBuffer to fast-tflite
The .tflite reports inputs[0].shape == [1, 224, 224, 3] but the
preprocessing was producing 256x256x3 buffers, so 196608 floats were
written into a tensor sized for 150528. Inference still completed
(no allocator check on the JS side) but ran on shifted, decadred
data — predictions were effectively random.

Also: the v3 react-native-fast-tflite binding rejects raw TypedArray
views with "TfliteModel.runSync(...): Object \"<element dump>\"" and
only accepts the underlying ArrayBuffer. We now pass `input.buffer`
as the primary path and keep the TypedArray as a fallback.

Bonus:
- Read input dtype from the model and dispatch preprocess accordingly
  (float32, uint8, int8) instead of hard-coding float32. Future-proof
  for a quantized re-export.
- Dequantize uint8/int8 outputs to floats so argmax stays consistent.
- Log model.inputs and model.outputs at load time — invaluable when
  re-exporting the .tflite and discovering shape mismatches.

Validated on device (Samsung S23): preprocess 700ms + inference 39ms,
no fallback chain. Still ~25% accuracy because the model itself is
overfit (see docs/audit_report.md), but the inference plumbing is
finally honest.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-01 13:14:12 +02:00
..
.claude chore(ml,android): retire react-native-fast-tflite + nitro, mock JS only 2026-04-30 21:14:38 +02:00
assets feat(mobile): UI overhaul + ML pipeline + Android build fixes 2026-04-30 21:00:03 +02:00
plugins chore(android): propagate CMake fix to native subprojects 2026-05-01 11:30:55 +02:00
src fix(ml): align input shape to 224x224 + pass ArrayBuffer to fast-tflite 2026-05-01 13:14:12 +02:00
.gitignore add VinEye frontend app + fix hardcoded paths + gitignore 2026-04-02 10:30:05 +02:00
.npmrc chore(deps,infra): pnpm hoisted mode + dependency cleanup for Map rebuild 2026-04-30 12:31:39 +02:00
app.json feat(scanner,ml): real TFLite inference + preload + flip camera + analyzing skeleton 2026-05-01 11:31:17 +02:00
App.tsx feat(auth): onboarding flow + local auth (no backend) 2026-05-01 09:33:27 +02:00
babel.config.js add VinEye frontend app + fix hardcoded paths + gitignore 2026-04-02 10:30:05 +02:00
CLAUDE.md chore(android): propagate CMake fix to native subprojects 2026-05-01 11:30:55 +02:00
components.json add VinEye frontend app + fix hardcoded paths + gitignore 2026-04-02 10:30:05 +02:00
global.css add VinEye frontend app + fix hardcoded paths + gitignore 2026-04-02 10:30:05 +02:00
index.ts add VinEye frontend app + fix hardcoded paths + gitignore 2026-04-02 10:30:05 +02:00
metro.config.js feat(mobile): UI overhaul + ML pipeline + Android build fixes 2026-04-30 21:00:03 +02:00
nativewind-env.d.ts add VinEye frontend app + fix hardcoded paths + gitignore 2026-04-02 10:30:05 +02:00
package.json feat(mobile): backend sync auth + ban handling + scan push 2026-05-01 12:11:11 +02:00
pnpm-lock.yaml feat(mobile): backend sync auth + ban handling + scan push 2026-05-01 12:11:11 +02:00
tailwind.config.js add VinEye frontend app + fix hardcoded paths + gitignore 2026-04-02 10:30:05 +02:00
tsconfig.json add VinEye frontend app + fix hardcoded paths + gitignore 2026-04-02 10:30:05 +02:00