Skip to content

feat: upgrade to MobileCLIP-S2 (FP32 vision + 12L text) + multi-crop letterbox vision - #7

Merged
saariuslystoned merged 1 commit into
mainfrom
feat/mobileclip-s2-and-multicrop-vision
Dec 2, 2026
Merged

saariuslystoned merged 1 commit into
mainfrom
feat/mobileclip-s2-and-multicrop-vision

Conversation

@saariuslystoned

Copy link
Copy Markdown
Contributor

Summary

Upgrades Recall's visual-semantic retrieval accuracy for everyday camera photos and off-center subjects:

  1. MobileCLIP-S2 Encoder (+9.4% ImageNet zero-shot over S0, SHA-256 pinned):
    • Replaces MobileCLIP-S0 (11M vision / 4L text) with MobileCLIP-S2 (35.7M FP32 vision d28b92d7... + 12L INT8 text f8aaa97c..., bit-identical CLIP BPE tokenizer and 512-d embedding space).
    • Cleans up legacy mobileclip_s0_* cached ONNX files from app-private storage on upgrade.
  2. Multi-Crop + Neutral-Gray Full-Frame Letterbox Vision Encoding:
    • For non-square images (aspect > 1.15), MobileClipOnnxEncoder.runVisionTower() runs both the 256x256 center-crop pass and a 256x256 aspect-preserving full-frame letterbox pass (neutral mid-gray RGB(128,128,128) padding, zero extra Canvas/Bitmap allocation), blending L2-normalized embeddings 0.60 * center + 0.40 * fullFrame so tall/wide phone photos and screenshots never clip off-center subjects.
    • Near-square images stay single-pass.
  3. DB v9 Auto-Reindex & Unit Coverage:
    • Bumps RecallDatabase to DB_VERSION = 9 so existing libraries automatically re-index with MobileCLIP-S2 + multi-crop embeddings.
    • Adds letterboxPreprocessorPreservesFullFrameWithNeutralGrayBars unit test (21/21 unit tests pass).

Verification

  • ./gradlew --no-daemon testDebugUnitTest assembleDebug bundleDebug bundleRelease — PASS (21/21 unit tests, app-release.aab = 191 MB).
  • ./scripts/check-zero-permissions.sh — PASS (0 platform permissions across debug/release merged manifests and APK).
  • ./scripts/check-16k-alignment.sh — PASS (PT_LOAD 0x4000 on all 4 native .sos + zipalign -P 16).
  • ./scripts/clean-room-audit.sh — PASS (59 files, 0 errors).
  • Live install & re-index verified on retail Android 17 Pixel hardware (MobileCLIP-S2 initialized cleanly, norm > 0, 0 zero-vectors, 0 crashes).

@saariuslystoned
saariuslystoned merged commit b27a4e6 into main Dec 2, 2026
3 of 4 checks passed
@saariuslystoned
saariuslystoned deleted the feat/mobileclip-s2-and-multicrop-vision branch December 2, 2026 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant