Advanced Parameters & Tuning

Kernel-level tuning, buffer pool sizing, and thread configuration

1. Unified 5-Backend CLI Standard Matrix

termux-vision strictly adheres to the uno-km ecosystem 5-backend standard (auto, gpu, vulkan, opencl, cpu):

Backend Choice Convenience Flag Target Microarchitecture Technical Mechanics
auto (Default)NoneAll Android SoCsProbes GPU Vulkan support; if available routes to Vulkan GPU, otherwise falls back to NEON CPU.
gpu / vulkan--gpuAdreno 830, Mali-G78/G68100% End-to-End Vulkan SPIR-V Compute shaders (3-pass VRAM pipeline barrier for CV, -ngl 99 for VLM).
opencl--openclQualcomm Adreno 600 (S20)Adreno OpenCL 2.0 kernel acceleration, avoiding SPIR-V float subnormal quirks.
cpu--cpu8-Core ARM64 (big.LITTLE)High-efficiency ARM64 NEON SIMD kernels without trigonometric atan2f; strict 0.00 MiB GPU VRAM.

2. Subcommand Parameter Matrix

A. Multimodal VLM Inference (termux-vision vlm)

Flag Aliases Default Description
-i, --image--image-pathRequiredPath to input image file (PNG, JPG, WebP)
-p, --promptNone"Describe this image"Multimodal query or instruction prompt
-m, --modelNonesmolvlm-500mLanguage model GGUF path or catalog preset ID
--mmprojNoneAuto-pairedVision projector GGUF model path (mmproj-*.gguf)
-b, --backend-d, --deviceautoBackend acceleration: auto, gpu, vulkan, opencl, cpu
--gpu / --cpu / --openclNoneNoneConvenience shorthand flags for backend selection
-n, --max-tokens--n-predict150Maximum number of output tokens
-c, --ctx-size--ctx2048Context window size
-t, --threadsNoneautoNumber of CPU execution threads (affinity-aware)
--image-sizeNoneNoneExplicit resolution scaling (e.g. 224x224, 384x384)
-q, --qualityNoneoptimal4-tier preset: fast (384px), optimal (768px), high (1280px), original (1:1)
--tune-maliNoneFalseEnable ARM Mali GPU MMVQ optimization (GGML_VK_FORCE_MMVQ=1)
--jsonNoneFalseOutput structured machine-readable JSON metrics
-v, --verboseNoneFalsePrint detailed GPU layer offload logs

B. Classical Canny Edge Detection (termux-vision canny)

Flag Aliases Default Description
-i, --imagePositionalRequiredPath to input image file
-o, --outputNone"output_edges.png"Path to save output binary edge image
--lowNone40Low hysteresis threshold (0-255)
--highNone120High hysteresis threshold (0-255)
-b, --backend-d, --deviceautoExecution backend: auto, gpu, vulkan, cpu
--gpu / --cpuNoneNoneShorthand for 100% Vulkan GPU (0.23ms) vs NEON CPU (3.02ms)

C. Prebuilt Idempotent Installer (termux-vision install)

Flag Default Description
--forceFalseForce download & reinstallation even if valid binaries exist
--from-sourceFalseForce compiling native C++ engines locally via clang++
--dry-runFalseInspect install status, missing components and verify prebuilt hash without changes
--asset-urlOfficial GitHub ReleasesCustom download URL for the prebuilt native archive

D. Neural Face Detection (termux-vision detect-face)

Flag Aliases Default Description
image_pathPositionalRequiredPath to input image file (JPEG, PNG, WebP)
-o, --outputNone"face_crop.jpg"Path to save primary face crop image
--backendNoneautoDetection engine: auto (Neural SSD), neural, haar
--score-thresholdNone0.70Minimum neural confidence score threshold (0.0 to 1.0)
--jsonNoneFalseOutput structured detection bounding boxes and confidence scores in JSON

3. Zero-Deception Fail-Fast Diagnostics

Error Code Condition Cause Fail-Fast Resolution
E014_VLM_MODEL_CORRUPTEDGGUF < 10 MB or truncated headerCorrupted or incomplete downloadAuto-rejects broken files and prompts re-downloading model
E015_LLAMA_CLI_NO_MMPROJllama-cli missing --mmprojText-only binary used for VLMBlocks execution; guides running termux-vision install
E016_VULKAN_ICD_UNREACHABLE--backend gpu on unsupported deviceNo Vulkan 1.1+ ICD driverStrict error with GPU diagnosis; refuses silent fake execution
E017_MISSING_MMPROJVLM execution without mmprojMissing vision projector weightsDisplays required mmproj download link and file path