Skip to content

About this article

  • Audience: Operators, integrators, partners, and agency reviewers with docs-hub access who need the full RF-DETR / TrOCR and Ghost Protocol ML Pipeline story—not only the short precomp contract
  • Goal: After reading, you can explain RF-DETR and TrOCR architecture, licenses, classes, datasets, retrain paths, .dlc specs, deploy/eval on Shadow 1 / Shadow 2 / host VMS, and name every Ghost Protocol custom model artifact (including Gemma 4)
  • Type: Concept + Reference (flagship)

Summary

Ghost Protocol runs RF-DETR (Receptive Field Detection Transformer) as the on-device vision backbone for Phantom Vision / COTA Shadow fleets. Detection is sovereign: inference runs on the Qualcomm Hexagon DSP inside each Shadow camera. Person and threat metrics from precomp are authoritative—no LLM, including our custom Gemma 4 reasoner, may override counts.

On Shadow 2, Ghost Protocol cascades signage detections into TrOCR (encoder + decoder QNN DLCs) for license-plate and sign text. TrOCR is a secondary cascade, not a precomp authority—boxes still come from RF-DETR.

This page is the hub entry for:

  • High-level RF-DETR concept, Apache 2.0 licensing, and multi-vendor stack
  • TrOCR requirements, classes (cascade triggers), DLC specs, and retrain via the ML Pipeline
  • Exact .dlc / package specs for production bake and custom QCS8550 builds
  • Class taxonomies (production precomp, Omni 15-class, weapons ontology)
  • Datasets, snapshots/thumbnails, and training methods
  • The Ghost Protocol ML Pipeline offering — two tracks: Track V (vision/edge) and Track L (language/host Specter)
  • A full prep walkthrough and turnaround guidance for quick reuse of the same vendor platforms
  • How models are tested, evaluated, and deployed to S1, S2, and the host VMS
  • Exact artifact names per endpoint (edge DLCs + host Specter / Gemma options)

Models are USA-made, USA-trained, and USA-hosted under Ghost Protocol control (Texas HQ; US-region cloud jobs; on-premise edge inference). This docs hub is password-protected for authorized operators and partners—not an open public scrape surface.

For the short safety contract only (person c=0, conf ≥ 0.35), see the RF-DETR model card.

Prerequisites


USA made, trained, and hosted

Ghost Protocol treats model sovereignty as a product requirement, not a slogan.

PillarPractice
MadeFirmware, packaging, ontology, and fine-tune recipes authored by the Ghost Protocol team (Texas HQ) for Shadow / QCS8550 fleets
TrainedFine-tunes run on Ghost Protocol–controlled Google Cloud Vertex AI / Colab Enterprise jobs with US regions preferred for GPU and data residency
Hosted (training data & weights)Datasets and checkpoints live in Ghost Protocol–controlled GCS project storage (US); compiled DLCs staged in operator-controlled deploy trees
Hosted (inference)Live detection runs on the camera (Hexagon DSP)—no foreign cloud required for person/threat counts
EscalationOptional cloud video understanding is proxy-owned, justified-clip only, and never replaces precomp

Procurement-facing posture: edge video and detection stay under customer control; training and compilation for Ghost Protocol models are executed under US-jurisdiction cloud accounts when cloud GPUs are used. See also the sovereign RFP language on the marketing docs hub when writing RFPs.


What RF-DETR is

RF-DETR (Receptive Field Detection Transformer) is a transformer-based object detector designed for efficient edge execution. Compared with full global self-attention at every layer, RF-DETR uses receptive-field-aware attention so the model keeps strong detection quality while fitting Hexagon DSP / QNN memory and latency budgets on Qualcomm QCS8550 (Shadow 1 and Shadow 2).

In Ghost Protocol:

  • RF-DETR is the vision backbone for bounding boxes, class IDs, and confidences
  • Host-side tracking (IoU / OpenCV) may assign track_id when device ObjectTracker is unavailable on SNPE
  • Downstream systems (MQTT, MCP, ONVIF, Hermes, A2A) consume precomp metrics first
  • Natural-language layers (Gemma 4, or proxy cloud models) describe and reason—they do not invent counts

Licenses and compliance

ComponentLicense / agreementNotes
RF-DETR model code / rfdetr packageApache License 2.0Commercial modification and redistribution of the framework allowed under Apache terms
Edge AI pipelineApache License 2.0Camera pipeline and oakapp integration
Qualcomm QNN / AI Hub / .dlc runtimeQualcomm AI Hub Software License AgreementCompiled Deep Learning Containers and QNN libraries; commercial use on authorized Snapdragon/QCS silicon
Ghost Protocol fine-tuned weightsProprietary product weightsTrained by Ghost Protocol for customer fleets; distribution controlled by contract
Third-party datasets (Roboflow, Kaggle, HF, customer video)Source-specificMust be honored when ingesting external labels
AdaFace (optional S2 face gallery path)MITHost FR path; see NIST compliance

Compliance hooks for Govern / Map / Measure / Manage: NIST AI RMF page. Precomp immutability is the primary Measure control for safety counts.


RF-DETR model specs (.dlc format)

Ghost Protocol ships detection as Qualcomm QNN Deep Learning Containers (.dlc), usually wrapped for fleet install. Two related packages appear in production and custom paths—do not assume they share the same class ID map.

Custom Ghost Protocol QCS8550 package (ML Pipeline / AI Hub)

Primary path for Ghost Protocol–trained Omni / weapons fine-tunes compiled for the fleet:

SpecValue
Deploy packagerf_detr_oak4.tar (~104–109 MB typical staged size)
Inner model filerf_detr_qcs8550.dlc (~104 MB typical)
QAI Hub graph namerf_detr_qcs8550
Architecture familyRF-DETR Nano (RFDETRNano training entrypoint)
Target SoCQualcomm QCS8550 (Shadow)
Target runtimeQNN DLC (--target_runtime qnn_dlc)
Compile input_specsimages: [1, 3, 544, 544] (NCHW: batch × channels × height × width)
Context graphs optioncontext_enable_graphs=rf_detr_qcs8550
Edge backend config"backend": "snpe", "runtime": "dsp", "performance_profile": "high_performance"
Tar contentsrf_detr_qcs8550.dlc (+ config.json when packaged with backend metadata)
Intermediate exportONNX (best.onnx / inference_model.onnx) — not the fleet load format
Optional side artifact.tflite may appear in staging trees; fleet deploy format is .dlc inside the tar

Production precomp bake (ghost_core contract)

Primary path for authoritative safety counts documented in the model card:

SpecValue
Artifactrfdetr_small_inference_model_fixed.dlc (~135 MB float16 cited)
Deploy aliasghost_protocol_transit.dlc (pushed under device model dirs)
Runtime substream640×640 NHWC BGR888i into the NN node
Class head (parser)23-class lineage (NUM_CLS=23 parse path)
Person gateClass c=0, confidence ≥ 0.35
Weapon class IDs (contract){10, 11, 12, 13} — gun, knife, rifle, shotgun (see model card)
Stride~10 Hz (RF_DETR_STRIDE_FPS, layer env)
BackendHexagon DSP via SNPE

Resolution map (read carefully)

PathSpatial sizeNotes
QAI Hub compile (current ML Pipeline script)544×544Static input_specs for rf_detr_qcs8550
ghost_core production substream640×640Precomp bake / model-card path
Some Omni export recipes672×672Lifecycle training notes; only valid if export + compile match

Rule: train export shape, compile input_specs, and runtime preprocess must match the package you inject. Mismatched shapes cause silent accuracy loss or load failure.

Config snippet (package metadata)

json
{
  "model": "rf_detr_qcs8550.dlc",
  "backend": "snpe",
  "backend_properties": {
    "runtime": "dsp",
    "performance_profile": "high_performance"
  }
}

Architecture

Dual-stream edge (every Shadow)

LayerRole
ghost_coreOwns camera graph, encoder, RF-DETR NN, FIFO handoff
ghost_agent_v2Precomp fusion, recording, MQTT, status files
PrecompImmutable safety metrics before any LLM or cloud
Phantom proxyHost VMS BFF, tools, justified pull, cloud escalation
Hermes / A2AFleet mesh and conversational surfaces that read precomp

Full ML lifecycle (train → fleet)

S1 vs S2 responsibilities (same RF-DETR package)

Shadow 1 (Macro Sentry)Shadow 2 (Precision Sentry)
RF-DETR packagerf_detr_oak4.tar / rf_detr_qcs8550.dlcSame
Typical AI focusCrowd density, cleanliness, QR (host), broad countingFace crop, plate/sign OCR cascade, finer behavior
TrOCR DLCNot required on macro pathtrocr_encoder_qcs8550.dlc + trocr_decoder_qcs8550.dlc
Stereo / nist_frNo stereo depth pathOptional FATE-style depth PAD + host FR (see NIST page)
Gemma 4 artifactOptional same filenameOptional same filename

Classes supported

Critical: two class ID spaces

TaxonomyPerson IDUse when
Production precomp contract0ghost_core bake, model card, ONVIF person events, soak harness person gates
Omni-Detector 15-class (custom train)8Ghost Protocol Omni fine-tune / handoff taxonomy

Deploying Omni weights without remapping labels and agent gates will break person counting. Always version the class list with the DLC.

A) Production precomp (safety contract)

IDLabel (best-effort harness map)Role
0personAuthoritative count if p ≥ 0.35
1–9bicycle, car, bus, train, truck, backpack, handbag, suitcase, cell_phoneContext / transit-adjacent
10–13gun, knife, rifle, shotgunWeapon set in model-card / harness
14–22(additional head slots in 23-class parse)Do not invent labels without bake notes

Full operational contract: model card.

B) Omni-Detector 15-class (Ghost Protocol custom taxonomy)

IDClass nameGroup
0handgunWeapons (CRITICAL_THREAT)
1rifleWeapons
2knifeWeapons
3carTransit (TRANSIT_LOG)
4busTransit
5truckTransit
6motorcycleTransit
7bicycleTransit
8personPeople (TRACKING)
9facePeople
10license_plateSignage → TrOCR on S2
11signSignage → TrOCR on S2
12qr_codeSignage → host QR on S1
13trash_pileCleanliness
14debrisCleanliness

C) Weapons ontology builder (Casper / Edge Builder path)

Default fine-tune ontology used by the Phantom Vision builder when specializing weapons/bags:

IDClass
0handgun
1rifle
2knife
3backpack

Customers add classes through the builder ontology compile step before training.


Training tech stack

LayerTechnology
Model familyRF-DETR, package RFDETRNano (Apache 2.0)
Training frameworkPyTorch (Lightning where the rfdetr train stack uses it)
AcceleratorsNVIDIA A100, L4, or T4 on Vertex; local CUDA; Apple MPS for light local runs
Dataset formatsYOLO detection labels, COCO (convertible), Roboflow YOLOv8 export
Ontologyontology_config.json → compiled labels.json
Cloud trainingGoogle Cloud Vertex AI / Colab Enterprise
Object storageGCS under Ghost Protocol–controlled buckets (US)
ExportONNX fixed spatial size matching compile target
CompileQualcomm AI Hub (qai_hub), QNN DLC, graph rf_detr_qcs8550
Edge runtimeGhost Protocol Edge AI pipeline + SNPE/QNN on Hexagon DSP
Product UI / APIPhantom Vision Edge Builder (phantom-vision-builder + builder API)
EvalHost ONNX soak, live MCP harness, orchestrator soaks, vision-verify

Default builder train knobs (API): epochs (e.g. 25), batch_size (e.g. 8), gpu_type (e.g. NVIDIA_TESLA_T4). Omni recipes may use higher epoch counts (e.g. 50) and larger batches on bigger GPUs.


Dataset types you can train on

Accepted formats

FormatHow Ghost Protocol uses it
YOLO detectionPrimary train path (.txt labels + images + data.yaml / class names)
COCO JSONSupported via conversion into the unified YOLO-style train tree
Roboflow exportCommon ingest (YOLOv8 download) with per-source class remaps
GCS treesBuilder gcs_dataset path for Vertex jobs
RGB + LWIR pairsOptional corridor multimodal sets when available (lifecycle design)

Domains already mapped in Ghost Protocol recipes

  • Weapons and threat objects
  • Transit vehicles and corridor context
  • People and faces
  • Signage (plates, signs, QR)
  • Cleanliness / maintenance (trash, debris)
  • Customer custom classes via ontology (agency-specific equipment, PPE, etc.)

Quality bar (required for production-grade fine-tunes)

  • Sequence-aware splits — frames from one continuous clip stay in the same train/val/test split (prevents leakage)
  • Typical 80 / 10 / 10 train / val / test when building full corridors
  • Stratify rare classes so val/test still see knives, plates, debris, etc.
  • Clamp boxes to valid normalized coordinates
  • Stable class names before remap into global ontology IDs
  • Prefer high-resolution sources; the train pipeline resizes to the model input

Snapshots and thumbnails

Snapshots and thumbnails are first-class inputs for the ML Pipeline—not afterthoughts.

AssetBest use
Fleet snapshotsCapture stills from live preview, justified clip frames, or periodic sampling on S1/S2
ThumbnailsFast human review for class discovery, hard negatives, and false-positive audits
Justified ~60 s clipsRicher temporal context; export stills or short segments for labeling

Recommended loop

  1. Pull stills or short clips via Phantom proxy (playback-ready / pull-recording) or host preview
  2. Produce thumbnails for review boards (accept/reject class candidates)
  3. Label accepted frames in YOLO/COCO (Roboflow or internal tool)
  4. Upload to GCS → Edge Builder dataset compile → train

Snapshots excel at class discovery and hard-negative mining. For tracking-sensitive classes (loitering, multi-frame behavior), also keep short video sequences, not only isolated stills.


Training methods

Ghost Protocol fine-tunes RF-DETR rather than training giant detectors from scratch on every job.

MethodDescription
Ontology-driven fine-tuneCompile class list → remap multi-source labels → train RFDETRNano
Multi-source mergePull weapons / traffic / construction / LPR-style datasets, remap into one taxonomy
Vertex jobRemote GPU train with GCS dataset URI, epochs, batch, GPU type
Local / MPS prototypeShort epoch smoke trains before paying for large Vertex runs
ONNX exportFixed 1×3×H×W for AI Hub
QAI Hub compileQCS8550 QNN DLC → package rf_detr_oak4.tar
Fleet injectOverlay or /data/models deploy + layer env enable

Ghost Protocol ML Pipeline (how we offer further training)

The Ghost Protocol ML Pipeline is the productized path to train, package, and deploy Ghost Protocol–owned models. It is one offering with two tracks that share the same USA residency story (Vertex/Colab Enterprise, GCS) but different compile/deploy ends:

TrackModelsTrainPackageDeploy
V — Vision (edge)RF-DETR, TrOCRVertex / Colab EnterpriseQualcomm AI Hub.dlc / tarS1 / S2 DSP
L — Language (host)Gemma 4 host / Specter optionVertex / Colab + Unsloth QLoRA (when Path A)Ollama / MLX / adapterPhantom Vision VMS host Hermes/Specter

Quick turnaround value: operators already know the Track V walkthrough (data → Vertex → package → deploy → soak). Track L reuses the same operational muscle (US GCS, Vertex jobs, model cards, soak/eval gates) without inventing a second company process — it does not send language models through Qualcomm AI Hub.

Track V — Vision (RF-DETR / TrOCR) — production today

Edge Builder stages (operator UI) — Track V

StepWhat you doBackend surface
1 OntologyAdd/remove classes; compile labelsGET/POST/DELETE /api/ontology…, POST /api/ontology/compile
2 DatasetPoint at GCS dataset; compileDataset status + GCS path
3 TrainingEpochs, batch, GPU; launch jobPOST /api/pipeline/launch
4 Compile DLCSubmit Qualcomm compilePOST /api/pipeline/compile
5 DeployMark/deploy to fleetDeploy status + camera inject scripts

Builder clients: Phantom Vision Edge Builder panel (VMS Infrastructure) and the embeddable phantom-vision-builder package. Jobs poll until TRAINING_COMPLETE, COMPILE_COMPLETE, DEPLOYED, or FAILED.

Track L — Language (Specter / Gemma on VMS host)

Host Specter Agent experience uses Hermes CLI + skills + Hindsight + gbrain/wiki. Models are host-only (never Hermes/LLM on S1/S2). Precomp remains count authority.

Stage (mirrors Track V ops)Track L actionIn-repo surface
1 Curriculum / ontologyProduct SOP domains (specter, precomp, guardrail, vms…)Playbooks + skills allowlist
2 DatasetFactory gather → clean → train/val/test/evalML Pipeline/gp-gemma4/scripts/dataset_factory.py
3 TrainPath B (default): no LoRA — stock gemma4:26b MoE + skills/memory. Path A: Unsloth QLoRA on Vertex/Colab when justifiedRecipes under ML Pipeline/gp-gemma4/recipes/ (Path A)
4 PackageOllama tag / adapter + model cardMODEL_CARD.md; not QAI Hub
5 DeployHermes env on VMS hostHERMES_SPECTER_* on vms-proxy
6 Eval / promoteLive Specter bench + fleet-gate; default stays Grok until gateML Pipeline/gp-gemma4/eval/; docs/specter/PATH_B_IMPRESSIONS.md

Path B (impressions, near-term): skills + Hindsight + gbrain + LLM wiki + optional Hermes MOA + stock large Gemma MoE on host. Path A (company SFT): only after corpus release audit floors + measured gap vs stock Gemma. Do not train on un-audited dumps.

DoDon't
Reuse Vertex/Colab US region + GCS prefixes for Path ASend Gemma through Qualcomm AI Hub / .dlc
Serve Specter via Hermes on hostInstall Hermes on cameras
Keep precomp as count authorityLet LLM invent person counts
Cite dataset release on model cardMix tenant Plane A into product SFT

What Ghost Protocol offers customers

  • New detection classes for agency-specific objects (Track V)
  • Domain fine-tunes (transit corridor, depot, platform, weapons focus) (Track V)
  • Compile for QCS8550 and package as rf_detr_oak4.tar (Track V)
  • Deploy to Shadow 1, Shadow 2, and verify through host VMS (Track V)
  • Optional cascade models (TrOCR on S2) when signage OCR is in scope (Track V)
  • Evaluation harness and soak gates before production promote (both tracks)
  • Specter Agent language path on the host VMS: product curriculum, optional company Gemma SFT, Hermes/MOA orchestration (Track L)
  • Same USA-made / USA-trained / USA-hosted posture across vision and language training data

Prep walkthrough: getting ready to use the ML Pipeline

Use this as a readiness runbook before spending GPU or AI Hub minutes.

Phase 0 — Decide scope

  1. Classes: Reuse Omni 15-class, weapons ontology, or a custom list?
  2. Endpoints: S1 only, S2 only, both, or host-VMS evaluation first?
  3. Success metrics: val mAP, person-count stability vs current precomp, weapon recall, plate crop rate, false-positive budget
  4. Class ID strategy: If you replace the production precomp bake, plan agent/ONVIF gate updates before fleet promote

Phase 1 — Prerequisites checklist

  • [ ] Final class list written down (names + IDs)
  • [ ] Labeled data ready or labeling sprint scheduled
  • [ ] US-region GCS + Vertex project access for Ghost Protocol (or customer) account
  • [ ] Qualcomm AI Hub account/token for compile
  • [ ] Edge Builder API reachable on operator network
  • [ ] Target cameras unlocked; oak-agent healthy
  • [ ] Free storage for model inject on device
  • [ ] Post-deploy soak window booked
  • [ ] Rollback artifact identified (previous tar or pure-encode layer)

Phase 2 — Data prep

  1. Collect snapshots, thumbnails, and short clips from fleet or lab
  2. Label in YOLO or COCO; remaps into global ontology
  3. Apply sequence-aware train/val/test split
  4. Upload to GCS; record the exact gcs_dataset URI for the builder
  5. Spot-check thumbnails for mislabels and class imbalance

Phase 3 — Train

  1. Set epochs / batch / GPU in Edge Builder or Vertex submitter
  2. Launch job; poll status
  3. On success, export ONNX and verify spatial size matches the compile target (e.g. 544 for current QAI script)
  4. Archive checkpoint path + class list + date

Phase 4 — Compile and package

  1. Submit ONNX to Qualcomm AI Hub (QCS8550, QNN DLC, graph rf_detr_qcs8550)
  2. Download rf_detr_qcs8550.dlc
  3. Package rf_detr_oak4.tar (+ config.json)
  4. Tag the package (version, ontology hash, train job id)

Phase 5 — Evaluate

  1. Host static / ONNX soak where available
  2. Single-device lab deploy first (prefer non-production role)
  3. Probe get_rfdetr_status / get_latest_dets via $PHANTOM_PROXY
  4. Run mass-transit harness scenarios that exercise precomp authority
  5. Run soak (thermals, storage, encode independence)
  6. Compare against success metrics from Phase 0

Phase 6 — Deploy and promote

  1. Inject package to S1 and/or S2
  2. Confirm layer env: AI enabled (DEPTHAI_V3_ENCODE_ONLY=0), model paths set
  3. Confirm host VMS surfaces (MQTT dets, proxy tools)
  4. Keep pure-encode rollback path documented
  5. Only then promote to full fleet

Operational considerations

TopicGuidance
ThermalEnabling DSP NN on both cameras raises die temp; schedule soaks and respect AI suspend thresholds
Pure encode vs AI layerH.265 archival can run encode-only; AI is a layered profile—do not confuse the two
Class remapOmni person 8 ≠ precomp person 0
Gemma 4 / SpecterHost NL path (Track L); never overrides RF-DETR counts; edge NPU Gemma is historical inventory only
Track reuseTrack L reuses Vertex/GCS/eval discipline from this walkthrough — not QAI Hub or oakapp inject
PrivacyKeep training media under US residency policies; strip unnecessary PII before cloud train
StorageModel + TrOCR DLCs are large; prune overlays before inject

Turnaround

Guidance for planning—not a contractual SLA unless your SOW says otherwise.

StageTypical duration
Ontology + labeling plan0.5–2 days (if classes already agreed)
Labeling / dataset build1–15+ days (long pole when new video is required)
Snapshot/thumbnail review HITLParallel with labeling
Vertex fine-tune (25–50 epochs, modern GPU)~4–24 hours wall-clock per run
Qualcomm AI Hub compile + package~1–6 hours
Lab deploy + smoke probesSame day once DLC ready
Soak / harness before promote30 minutes–24 hours depending on gate
End-to-end when labeled data is ready~3–10 business days typical
End-to-end when new field data + labeling required2–6+ weeks typical

Faster iterations (class tweak, small data add) compress toward the low end. Full corridor ontologies with rare classes sit at the high end.


How models are tested, evaluated, and deployed

Test and evaluate

GateWhat it proves
Host static / ONNXParsers, tensor shapes, local latency without claiming device USB
Host soakSustained RF-DETR (+ optional TrOCR) latency on workstation path
Live MCP harnessPrecomp authority, A2A/MCP tools, scenario library (mass transit safety)
Orchestrator / soakThermals, H.265 independence, storage health, encode fail streak
Vision-verifyPerson-vs-nonperson quality gates complementing—not overriding—precomp
NIST FR path (S2)Optional face quality / gallery—orthogonal to RF-DETR counts

Always assert: responses that touch safety counts set or honor rf_detr_precomputed / precomp-first fusion. LLMs may be offline; counts remain valid.

Deploy to Shadow 1 and Shadow 2

High-level operator flow (credentials and tunnels are environment-specific):

  1. Stage rf_detr_oak4.tar (and S2 TrOCR DLCs if used)
  2. Ensure AI layer env on device (model path vars, encode-only off)
  3. Inject into oakapp writable overlay or durable /data/models per your deploy script
  4. Restart / re-apply layer; confirm NN load in app logs
  5. Probe via proxy:
bash
curl -s -X POST "$PHANTOM_PROXY/tools/call?target=<device-ip>" \
  -H "Content-Type: application/json" \
  -d '{"tool":"get_rfdetr_status","arguments":{}}'
bash
curl -s -X POST "$PHANTOM_PROXY/tools/call?target=<device-ip>" \
  -H "Content-Type: application/json" \
  -d '{"tool":"get_latest_dets","arguments":{}}'

Symmetric RF-DETR package for both cameras; S2-only extras are TrOCR DLCs and stereo-assisted paths.

Deploy / run on the host VMS

ModeWhat runs where
Production VMSHost Phantom proxy consumes MQTT/MCP precomp from cameras; operators never need the DLC on the laptop
Edge BuilderOntology/train/compile orchestration on operator network
Host-in-loop cascadeOptional workstation path with staged rf_detr_oak4.tar + TrOCR DLCs for lab visualization (does not replace ghost_core archival)
Local ONNX evalbest.onnx / inference_model.onnx for offline metrics before compile

H.265 justified recording remains independent of AI when pure-encode profiles are used—see recording contract.


TrOCR cascade (signage OCR)

TrOCR (Transformer OCR, Microsoft trocr-small-stage1 lineage) turns RF-DETR signage crops into text on the Precision Sentry path. Ghost Protocol packages it as a two-DLC encoder/decoder pair for QCS8550, driven host-in-the-loop over the Edge AI XLink path (or host ONNX for lab).

Why TrOCR sits after RF-DETR

ConcernOwner
Where is the box?RF-DETR only (precomp authority unchanged)
What does the text say?TrOCR (S2) or QR host decode (S1)
May OCR override person counts?Never

Classes / cascade triggers

Omni-Detector IDs that route to OCR paths:

Omni IDClassCascade
10license_plateS2 TrOCR encoder → decoder
11signS2 TrOCR encoder → decoder
12qr_codeS1 host cv2.QRCodeDetector (not TrOCR)
otherweapons / transit / person / cleanlinessNo TrOCR

On production precomp taxonomies without Omni IDs, treat plate/sign classes as signage routing only when the deployed labels include them—do not invent OCR for person/weapon IDs.

TrOCR model specs (.dlc format)

SpecEncoderDecoder
Exact artifacttrocr_encoder_qcs8550.dlctrocr_decoder_qcs8550.dlc
ONNX intermediatetrocr_encoder.onnx (~88 MB staged)trocr_decoder.onnx (~147 MB staged)
Staged DLC size (typical)~88 MB~146 MB
Target SoCQualcomm QCS8550 (Shadow)Same
RuntimeQNN DLC / SNPE on HexagonAutoregressive steps with static KV cache
Base familyMicrosoft TrOCR small stage1 (TrOCRProcessor.from_pretrained("microsoft/trocr-small-stage1") for host decode)Same lineage
Crop preprocessBGR → RGB → 384×384 float [0,1] NCHW batch pixel_values (not 320—breaks DeiT pos embeds)
Encoder input (host)[1, 3, 384, 384] float32
Max sequenceMAX_SEQ_LEN = 20 tokens
Token IDsSTART=2, EOS=2, PAD=1
Decoder layers6 (NUM_DECODER_LAYERS)
Attn heads / dim8 heads × 32 embeddings/head
Self-attn KV (static)(1, 8, 19, 32) in; 20 out then shift-pad back to 19
Cross-attn KV (from encoder)(1, 8, 578, 32) per layer key/val (×6)Consumed each decode step
Compile toolchainQualcomm AI Hub + qai_hub_models.models.trocr, QAIRT 2.45.x, float QNN DLC, device QCS8550 (Proxy)Split encoder/decoder jobs—not monolithic
Primary fleet roleShadow 2 Precision Sentry (PHANTOM_DEVICE_ID contains shadow2)Shadow 2
S1Models may be staged; runtime plate/sign OCR is S2-gated (S1 uses host QR)Same

Known hardware note: some Shadow DLC loads report TROCR_DLC_FW_CRASH when encoder/decoder graphs are not SNPE/container-compatible. Fleet soaks may mark device_xlink PARTIAL with RF-DETR OK and TrOCR steps disabled. Treat full-cascade PASS as a recompile/repackage gate, not a silent ignore.

Requirements to run TrOCR

RequirementDetail
DetectorWorking RF-DETR package producing plate/sign boxes
HardwareShadow 2 (S2) preferred for on-device cascade; host ONNX path for lab
Storage~250 MB+ for both DLCs on device/staging
EnvTROCR_ENCODER_MODEL / TROCR_DECODER_MODEL (or defaults under model dir); PHANTOM_DEVICE_ID=shadow2 for S2 routing
AI layerDEPTHAI_V3_ENCODE_ONLY=0 when sharing the camera with NN work
USB claimFull XLink cascade needs exclusive device claim (or host ONNX offline)
Host decodetransformers TrOCRProcessor for final batch_decode (host only)

Retrain / recompile TrOCR via Ghost Protocol ML Pipeline

TrOCR is not the same train graph as RF-DETR Nano, but it rides the same pipeline stages Ghost Protocol uses for edge models: data → train/export ONNX → Qualcomm AI Hub → package → deploy → soak.

StageWhat Ghost Protocol does
1. DataHarvest justified stills / thumbnails of license_plate and sign crops from S2 (RF-DETR boxes). Prefer multi-angle, night, glare, motion blur.
2. OntologyKeep detector classes stable (license_plate, sign). OCR training labels are strings, not new detector IDs.
3. Train / source weightsDefault path: pretrained Microsoft TrOCR small + QAI Hub Models trocr package. Optional domain fine-tune (agency plates/signs) on US-region GPU when partners supply labeled crops—still export at 384×384 / 20-token edge limits.
4. ExportProduce trocr_encoder.onnx + trocr_decoder.onnx (opset ~17) with fixed shapes: encoder (1,3,384,384); decoder self-KV (1,8,19,32); cross-KV (1,8,578,32) ×6.
5. CompileQualcomm AI Hub split jobs → trocr_encoder_qcs8550.dlc + trocr_decoder_qcs8550.dlc (qnn_dlc, float, --compute_unit npu, QCS8550 Proxy). Never compile as one fused graph for this fleet path.
6. Package / stagePlace beside rf_detr_oak4.tar in the deploy tree; set env paths on S2.
7. EvaluateHost ONNX decode smoke → single-device XLink probe → dual-shadow soak. Fail closed on TROCR_DLC_FW_CRASH.
8. PromoteOnly after RF-DETR precomp still authoritative and OCR quality meets partner metric (CER/WER on holdout plates).

Edge Builder note: the Phantom Vision Edge Builder today is optimized for RF-DETR detector ontology → train → DLC. TrOCR retrain uses the same vendor platforms and operator runbook (GCS/Vertex/QAI Hub/deploy); treat TrOCR as a second pipeline track in the builder until a dedicated TrOCR job type is exposed. Operators still request “retrain OCR” through Ghost Protocol ML Pipeline services.

TrOCR turnaround (typical)

StageDuration
Crop harvest + labeling2–10 business days (data-dependent)
Fine-tune + ONNX export~4–48 hours wall-clock
Dual DLC compile~2–12 hours
Lab + soak (incl. FW crash gate)1–3 days
End-to-end when labeled OCR data ready~1–2 weeks typical

Exact Ghost Protocol custom model names

Use these exact filenames in runbooks, inventory, and change tickets.

Exact nameKindRole
rf_detr_oak4.tarDeploy tarballFleet package for S1 and S2 AI layer
rf_detr_qcs8550.dlcQNN DLCInner model; graph name rf_detr_qcs8550
rfdetr_small_inference_model_fixed.dlcQNN DLCProduction precomp bake (model card)
ghost_protocol_transit.dlcQNN DLCDeploy alias for transit precomp path
casper1_rfdetr_nTrain run nameWeapons/ontology fine-tune job family
casper1_rfdetr_n.dlcQNN DLCCasper1 compiled artifact name in staging
best.onnx / inference_model.onnxONNXRF-DETR train export intermediate
trocr_encoder_qcs8550.dlcQNN DLCTrOCR encoder (S2 cascade)
trocr_decoder_qcs8550.dlcQNN DLCTrOCR decoder AR (S2 cascade)
trocr_encoder.onnx / trocr_decoder.onnxONNXTrOCR export intermediate / host path
config.jsonMetadataSNPE DSP high_performance binding for package

Shadow 1 endpoints

RoleExact name(s)
Primary detector packagerf_detr_oak4.tarrf_detr_qcs8550.dlc
Common env keysRF_DETR_MODEL_PATH, RF_DETR_OAK4_MODEL (device model dir)
Production precomp aliases (when on precomp bake)rfdetr_small_inference_model_fixed.dlc, ghost_protocol_transit.dlc
Reasoning model (custom-trained)ghost_protocol_gemma4_e2b.litertlm

Shadow 2 endpoints

RoleExact name(s)
Primary detector packageSame rf_detr_oak4.tar / rf_detr_qcs8550.dlc
TrOCR encodertrocr_encoder_qcs8550.dlc
TrOCR decodertrocr_decoder_qcs8550.dlc
Production precomp aliasesrfdetr_small_inference_model_fixed.dlc, ghost_protocol_transit.dlc
Reasoning model (custom-trained)ghost_protocol_gemma4_e2b.litertlm

Host Phantom Vision VMS

RoleExact name / surface
Live detection sourceCamera precomp via MQTT / MCP (get_rfdetr_status, get_latest_dets)
Staged cascade modelsrf_detr_oak4.tar, trocr_encoder_qcs8550.dlc, trocr_decoder_qcs8550.dlc
Train export (Track V)best.onnx, inference_model.onnx
Builder control planeEdge Builder API (ontology + pipeline jobs)
Specter brain (Track L)Hermes CLI + Kanban; HERMES_SPECTER_MODEL / HERMES_SPECTER_PROVIDER
Specter default modelgrok-4.5 (xai-oauth)
Specter local MoE optionOllama gemma4:26b (Gemma 4 26B-A4B class)
Company SFT optiongp-gemma4-26b-a4b-specter-rN after Path A train gate
Corpus factoryML Pipeline/gp-gemma4/datasets/releases/
Operator Path BSkill allowlist + Hindsight + gbrain + LLM wiki (no LoRA required)

Gemma 4 — reasoning models (host primary; edge historical)

FieldExact value
Host role (current)Specter / operator NL on Phantom Vision VMS host — consumer of precomp, never count authority
Default agentHermes + grok-4.5; skills + Hindsight always
Stock large host optionGemma 4 26B-A4B MoE / 31B via Ollama (gemma4:26b / gemma4:31b)
Company SFT naminggp-gemma4-{size}-{domain}-{rev} (e.g. gp-gemma4-26b-a4b-specter-r1)
Train path (Path A)Unsloth QLoRA on Vertex/Colab Enterprise after dataset factory release audit — not Qualcomm AI Hub
Edge historical artifactghost_protocol_gemma4_e2b.litertlm (LiteRT-NPU) — keep in inventories; not production primary NL
Edge production postureOn-device NPU Gemma path retired/constrained; RF-DETR precomp stays live on cameras
Relationship to RF-DETRConsumer of precomp only

See historical notes for the NPU primary-path pivot. For Specter impressions without company SFT, use the Path B runbook in the firmware monorepo (docs/specter/PATH_B_IMPRESSIONS.md).


References and citations

External

ResourceWhy it matters
Qualcomm AI HubDLC compile for QCS8550
Qualcomm AI Hub Software LicenseQNN/DLC commercial terms
Google Cloud Vertex AIGPU fine-tune jobs
Edge AI architectureShadow vision pipeline runtime
NIST AI RMFRisk framework mapping
Apache License 2.0RF-DETR and Edge AI pipeline licensing

Internal (this hub)

PageTopic
Model cardPrecomp person/weapon contract
Edge AI architectureDual-stream + FIFO
ONVIFPerson events from precomp
NIST complianceRMF + FR hooks
Video understandingCloud after justified clips
Deploy guideoakapp layers and models
Soaks and automationGates before promote
External refs mapVendor link index

Next steps

  • Model card — print the short safety contract for reviewers
  • Firmware deploy — push models and layers to Shadows
  • A2A / Hermes — conversational surfaces that read precomp
  • NIST compliance — map this pipeline into RMF language
  • Track V: retrain / recompile detection via Edge Builder + this prep walkthrough
  • Track L: Specter host language path — monorepo ML Pipeline/gp-gemma4/ + docs/specter/PATH_B_IMPRESSIONS.md
  • Contact Ghost Protocol for a custom-class SOW (ontology + data + turnaround) or Specter/host language SOW (curriculum + optional company Gemma SFT)

Operator depth

Live fleet CIDs, bake SHAs, soak tables, and session chronology live in private operator handoff (not published) (private). This page documents contracts and pipeline design—not live telemetry.