Commit Graph
71 Commits
Author SHA1 Message Date
nghianguyenandClaude Fable 5 ac4369302a ANSFR: support ANS_FaceRecognizer v1.4 models (AdaFace + ONNX attributes)
- Recognizer: adafacerecognizer.onnx (AdaFace, new default) with automatic
  fallback to ansfacerecognizer.onnx (ArcFace) for pre-v1.4 zips. AdaFace
  consumes BGR: new AdaFace handler in ONNXEngine skips the BGR2RGB swap,
  and the TensorRT paths gate their cvtColor on m_swapRB.
- New C API: SetANSRFRecognizerModel (0=AdaFace, 1=ArcFace),
  GetANSRFRecognizerModel, GetANSRFModelInfo. A live switch reloads the
  recognizer and regenerates all stored embeddings from the enrolled face
  crops; the generating model is persisted in a new SETTINGS table
  (EMBEDDING_MODEL) so upgrading an ArcFace database to the AdaFace
  default migrates automatically on LoadEngine.
- Attributes: prefer agegender.onnx (ViT: gender_logits [male,female] +
  age_pred in years; also handles the single-tensor research export) and
  emotionsrecognition.onnx (YOLOv11-cls, classes from .names) behind new
  IAgeGenderEstimator/IEmotionsClassifier interfaces, falling back to the
  legacy OpenVINO IRs. EP follows hardware: NVIDIA uses TensorRT EP with
  disk-cached engines, AMD DirectML, Intel OpenVINO.
- Emotion JSON mapping: handle the new Fear class and the never-matched
  surprise label (both map to Attentive).
- ANSFR-UnitTest: TestModelSwitchV14 covers default model selection, ONNX
  attribute backends, enrollment, and adaface<->arcface switching.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-26 11:06:10 +10:00
nghianguyenandClaude Opus 5 c9ff9ee2f3 ANSFR-UnitTest: point the harness at the local ANSVIS deployment
Repoints the hardcoded fixtures at the installed ANSVIS Server layout rather
than the old E:/C: DemoAssets trees:

  - classroom.mp4 now read from C:\ProgramData\ANSCENTER\Shared
  - TestCompleteFR1 loads the GPU-specific ServerOptimised zips
    (ANS_FaceRecognizer_v1.1_NVIDIAGeForceRTX4070LaptopGPU.zip) and re-enables
    the InsertUser call ahead of InsertFace
  - main() runs ANSVISTest()

Also comments out the --gpu argument handling in main(), so the harness no
longer sets CUDA_VISIBLE_DEVICES and the single-GPU bisect flag is inert until
that block is restored.

Paths remain machine-specific; this is a developer harness, not a test suite.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-22 19:38:57 +10:00
nghianguyenandClaude Fable 5 ac79e51d17 ANSCV test: camera-dead watchdog with ReconnectRTSP (production parity)
Overnight soak revealed the gap: ANSRTSPClient does not auto-reconnect
by design (the application layer polls staleness and calls
ReconnectRTSP - ANSVIS/LabVIEW does this in production), but the unit
test never did, so when the laptop's Modern Standby killed the TCP
session at ~1 AM the client returned the cached frame until morning.

Poll GetRTSPLastFrameAgeMs each loop; at 20 s without a decoded frame,
call ReconnectRTSP (timestamped console line), retrying at most every
15 s. Threshold sits above the corruption keyframe gate's ~12 s
worst-case hold so a reconnect never preempts an in-flight recovery.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-08 10:42:31 +10:00
nghianguyenandClaude Fable 5 044fedd344 ANSCV test: pump GUI messages while waiting for frames
The empty-frame path slept 1 s without calling cv::waitKey, so the
HighGUI window stopped pumping Windows messages and went "Not
Responding" whenever the RTSP stream stalled for a few seconds.
Wait via cv::waitKey(1000) instead (ESC still exits). Same fix in
all three test loops that shared the pattern.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 21:39:39 +10:00
nghianguyenandClaude Fable 5 005f3bc3d5 ANSCV tests: update RTSP camera address, drop unused ans_imshow include
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 20:23:31 +10:00
nghianguyenandClaude Fable 5 a4ea532f36 Fix multi-GPU inference on Blackwell (dual RTX 5080): four stacked fixes
Verified on dual RTX 5080: 355/355 detections, both GPUs in round-robin,
zero CUDA errors. Requires TensorRT >= 10.16.1 in SharedCore (10.15.1 has
a Myelin l2cm crash when creating a context on a second Blackwell device).

1. blobFromGpuMats: thread_local GpuMat caches (tl_blob/tl_floatImg) were
   device-blind — a pool thread warming GPU[1] then GPU[0] reused device-1
   memory with a device-0 stream, causing an async illegal memory access
   that poisoned every CUDA context (sticky 700). Track owning device and
   rebuild the cache on device switch.

2. runInference: pool round-robin can dispatch to a slot on a different
   GPU than the one the caller prepared inputs on. Detect foreign input
   GpuMats via cudaPointerGetAttributes and migrate them through a pinned
   host staging buffer (two-hop D2H+H2D; direct cross-device cudaMemcpy2D
   is unsupported and GeForce has no P2P).

3. warmUp: now pins its own CUDA device before uploading dummy inputs and
   returns success/failure; loadNetwork rejects engines whose warmup fails
   so broken slots can never join the pool silently.

4. Blackwell builder workaround: setMaxAuxStreams(0) on SM 12.x plus an
   .aux0 engine-cache suffix so pre-workaround caches rebuild.

Also: ANSFR-UnitTest gains --gpu N flag (sets CUDA_VISIBLE_DEVICES) for
single-GPU bisection, and rich diagnostics on input-copy failures.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-06 20:00:19 +10:00
nghianguyen 43ebd25d07 Unitiest 2026-06-23 05:56:06 +10:00
nghianguyenandClaude Opus 4.8 eb29945cb7 ANSCV tests: add ans_imshow include + headless ConsoleTest
Add ConsoleTest.cpp, a headless (no-GUI) smoke test for ANSOPENCV image
ops plus an optional RTSP capture path, built as its own executable
(ANSCV-ConsoleTest) so it does not collide with ANSCV-UnitTest's GUI main.

Make the ans_imshow.hpp include (shipped with ANSMIND, outside the repo)
configurable via the ANSMIND_INCLUDE_DIR cache variable, defaulting to
C:/ProgramData/ANSCENTER/ANSMIND. Warn rather than fail configure when the
header is absent so unrelated targets still build.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 05:51:01 +10:00
nghianguyen b3436a61ee Prevent OOM 2026-06-18 05:55:31 +10:00
nghianguyen ebba70b9d9 Support Get log events 2026-05-24 09:19:24 +10:00
nghianguyen 47b80102a8 Add port to scanning devices 2026-05-24 08:33:34 +10:00
nghianguyen a2fa2c8ceb Support scanning ANSVIS servers device 2026-05-23 18:03:22 +10:00
nghianguyen 214f598e18 Support Generate Presigned URL for S3 2026-05-19 10:37:46 +10:00
nghianguyen 26f9b07ac1 Add adaptive padding to improve tracking 2026-05-14 22:01:07 +10:00
nghianguyen a43a99834a Complete RTMPOSE 2026-05-14 21:16:35 +10:00
nghianguyen 71404affb7 Correct logic in RTMPOSE when using generic model to detect person 2026-05-14 19:33:31 +10:00
nghianguyen 52ec13a8e3 improve pose 2026-05-14 19:17:09 +10:00
nghianguyen 8e4d9a9e5d Add person model into RTMPOSE 2026-05-14 19:05:20 +10:00
nghianguyen a94bf88a5b Fix other ANSCV classes 2026-05-09 16:47:46 +10:00
nghianguyen 75693cadd9 Add jitter buffer 2026-05-07 22:36:27 +10:00
nghianguyen 2e0fee5e3d Fix VideoPlayer from stop after just few frames 2026-05-07 18:17:33 +10:00
nghianguyen a526aa6cdb Fix ALPR order issue 2026-05-06 19:55:52 +10:00
nghianguyen 66c67dff26 Fix onnx runtime loader for custom model 2026-05-05 16:23:01 +10:00
nghianguyen d03c2c1138 disable ALPR checker by default 2026-05-05 04:37:23 +10:00
nghianguyen fa6d95de82 Update test app 2026-05-03 16:30:39 +10:00
nghianguyen 4214507e3b Test ALPR model (v1.3) 2026-05-03 07:16:32 +10:00
nghianguyen cff2a90fad Support multiple GPUs 2026-05-02 12:24:53 +10:00
nghianguyen 8359511895 Update unit test 2026-05-01 20:33:09 +10:00
nghianguyen fc9cf9671b Fix ANSONNXYOLO:
1. core/ANSLicensingSystem/ANSLicense.h:268 — added default initializers to ModelConfig POD members (inpWidth = 0, inpHeight = 0, etc.). This was the actual bug: CreateANSODHandle declares a local ModelConfig and only sets a few fields, leaving inpWidth/inpHeight as indeterminate stack memory. On your machine that memory consistently held ~80, slipping past the <=0 → 640 guard and driving the ORT session at 80×80 — which crashes YOLOv11's /model.12/Concat because 2·ceil(80/32)=6 ≠ ceil(80/16)=5.

2. modules/ANSODEngine/ANSONNXYOLO.h:75 — ONNXYOLO::setInputShape() now snaps width/height up to the next multiple of 32 (with a 64-pixel floor). Defense in depth: even if a future caller hands in a non-stride-32 size, the FPN concat alignment is preserved.

3. modules/ANSODEngine/ANSONNXYOLO.cpp — two diagnostic additions:

WarmUpEngine bails with a clear log line if the warm-up dims aren't a multiple of 32, instead of letting the model.12 error fire and mask the real cause.
transform() logs the input shape, canvas shape, source size, and dynamic flag once per session in DebugView — so any future shape-mismatch crash points at the offending HxW directly.
2026-05-01 20:24:08 +10:00
nghianguyen 1c8abf2a88 Fix AWS MinIO 2026-05-01 11:16:47 +10:00
nghianguyen 91efbb9a8f Fix AMD ALPR_OCR and custom model 2026-05-01 07:53:18 +10:00
nghianguyen e1f37ec767 Add ANSALPR country format 2026-04-28 19:23:46 +10:00
nghianguyen 234f2c68a2 bucket prewarm + batch padding 2026-04-28 17:12:27 +10:00
nghianguyen 4bab357c72 Stress test on multiple streams 2026-04-28 13:49:57 +10:00
nghianguyen dcf974c35c Fix AMD by changing from GetTensorData<T>() to GetTensorMutableData<T>() 2026-04-28 13:25:02 +10:00
nghianguyen 947398483a Unit test before memory leak check 2026-04-26 06:14:44 +10:00
nghianguyen 7a11c9617b Test 2026-04-24 14:48:55 +10:00
nghianguyen 91bdb3f96b Fix play once video player 2026-04-23 08:36:52 +10:00
nghianguyen c625898f61 Fix Video Player that support generate black image when finish playing video (reach the end of video) 2026-04-23 08:08:34 +10:00
nghianguyen a0d5c81814 Update 2026-04-22 16:52:40 +10:00
nghianguyen fc47a42c6a Use yuv and fix FR to use batch 4 2026-04-22 16:01:44 +10:00
nghianguyen 24d6d2e0a5 Use tracker and voting system to correct ALPR 2026-04-22 11:19:42 +10:00
nghianguyen f7f356c044 Before investigate ALPR M misread as N 2026-04-22 10:32:13 +10:00
nghianguyen 0e203eef99 Fix double stops 2026-04-22 10:19:03 +10:00
nghianguyen 57cc8e0a56 Fix double stop in ANSVideoPlayer 2026-04-22 10:10:16 +10:00
nghianguyen 00f6e2f852 Enable log information 2026-04-21 12:09:24 +10:00
nghianguyen 9f0a10a4c8 Improve ANSCV with sotfware decoder:
Thread-local staging Mat (video_player.cpp:1400-1407) — single biggest win. Eliminates the 12 MB per-call malloc/free cycle.
Contiguous get_buffer2 allocator (video_decoder.cpp:35-102) — keeps the 3 bulk memcpys cache-friendly. Would also enable FAST/zero-copy for resolutions where visible_h % 64 == 0.
SW-decoder thread config (video_decoder.cpp:528-540) — thread_count=0, thread_type=FRAME|SLICE. FRAME is downgraded to SLICE-only by AV_CODEC_FLAG_LOW_DELAY, but decode throughput is sufficient for your input rate.
SetTargetFPS(100) delivery throttle (already there) — caps onVideoFrame post-decode work at 10 FPS. Keeps the caller path warm-cached.
Instrumentation — [MEDIA_DecInit] / [MEDIA_Convert] / [MEDIA_SWDec] / [MEDIA_Timing] / [MEDIA_JpegTiming] — always-on regression detector, zero cost when ANSCORE_DEBUGVIEW=OFF.
2026-04-20 12:18:43 +10:00
nghianguyen 3418090042 - Remove ALPR_OD Tracker and voting system.
- Disable debugview
2026-04-19 23:15:50 +10:00
nghianguyen 247c91db50 Fix ANSAWS3 multiple instance creation 2026-04-18 20:33:44 +10:00
nghianguyen a47ea25e8b Fix Image management (BMP, BMPtoJPEG) and remove debug info from AWS Upload 2026-04-17 20:59:21 +10:00