Commit Graph
4 Commits
Author SHA1 Message Date
nghianguyenandClaude Opus 5.5 0baca1b20d feat(ANSODEngine): run Darknet/YOLO exports ("darknet" family) in ONNXYOLO and RTYOLO
A Darknet/YOLO model exported by hank-ai's darknet_onnx_export (v5.1+) has
two outputs: confs [B,N,nc], already objectness x class probability, and
boxes [B,N,1,4], corners x1,y1,x2,y2 normalized to the input. It trains and
predicts on a stretched square and has no NMS in the graph. ONNXYOLO took
the 4-D boxes tensor for segmentation proto masks and letterboxed the input,
so such a model decoded as garbage; a sealed package named as YOLOV4 went to
YOLOOD, which cannot open an .ansmodel at all.

- ONNXYOLO / RTYOLO: recognise the layout once at load (package family
  "darknet", output names confs/boxes, or their shapes), before the seg
  check; stretch-resize the input (single, batch, and RTYOLO's NV12 path);
  new postprocessDarknet: best class per candidate, threshold, stretch map
  to the original image, clip, class-aware NMS.
- dllmain: a sealed package passed as modelType 1 (YOLOV4) is routed as
  detection (3), i.e. to RTYOLO on NVIDIA and ONNXYOLO elsewhere, in
  CreateANSODHandle, CreateANSODHandleEx and OptimizeModelStr.
- Every other model is unchanged: all new branches are gated on the layout.

Verified on macOS only: ANSONNXYOLO.cpp passes a syntax check, and the new
decode functions, extracted into a standalone harness running the model
through onnxruntime, reproduce Darknet's own detections on dog.jpg. NOT yet
built on Windows, and the TensorRT path has not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 18:43:13 +10:00
nghianguyenandClaude Opus 5 cd99fcf6d9 feat(ANSODEngine): run a sealed model on TensorRT without unsealing it
A .ansmodel reaching the GPU path went to ModelOptimizer, which knows one
way to open a model — unzip it — and failed on the first byte. Even past
that, the TensorRT engine only ever parsed an ONNX file, so the one thing
the format exists to prevent, a decrypted model on disk, was the only way
it could have run.

The builder now takes its bytes from memory when it has them. The path it
is given still names the plan that gets cached beside it, because a plan
is a built artefact and carries no model: the second run loads it and
never needs the ONNX at all. For a package the plan lands in the folder
the zip flow used, so a model converted from a zip reuses the plan that
zip already built.

OptimizeModelStr recognises a package and skips the unzip-and-optimise
leg entirely: the handle below it opens the package in memory and builds
the plan from the decrypted bytes, which is the same work by a shorter
road.

Still on the file path: the other TensorRT handlers (segmentation, pose,
classification). Only the YOLO detector reads a package today.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-13 09:38:45 +10:00
nghianguyen e134ebdf15 Use software decoder by default 2026-04-04 20:19:54 +11:00
nghianguyen 8a2e721058 Refactor project structure 2026-03-28 19:56:39 +11:00