Files
ANSCustomModels/tests/FireNSmokeDetection/CMakeLists.txt
T
nghianguyenandClaude Fable 5.1 e893be4a75 ANSCustomFireNSmokeDetection: the ANSVIS custom model is judged by ANSMIND's Fire & Smoke verifier
The DLL used to find a detection in one section of the frame, latch a crop
round it and vote on tracked boxes inside that crop. Measured on the field
recordings that was itself the main false-alarm source (the detector needs
context: a floodlight is fake_fire on the whole frame and fire on a tight
crop of the same lamp), and a PTZ tour broke the latch. ANSMIND's native
vision.fire_smoke node replaced it with a whole-frame-first verifier whose
cues are box-relative and carried by global motion, fire-only native zoom
re-checks, a look-alike filter and a ladder of gates measured on real and
false recordings.

The DLL now feeds that verifier, vendored verbatim from ANSMINDCORE dba11ac
(vendor/engine/fire_smoke.hpp, pure C++): ANSLIB runs the package's
detector on the whole frame at a low floor with class-agnostic NMS, the COCO
filter when there is a candidate to explain, and the detector again on the
few native crops the verifier plans; only confirmed tracks come back, as
fire/smoke CustomObjects with fs_seconds/fs_track/evidence in extraInfo.
Parameters: Sensitivity (slider onto low/balanced/high), SmokeSeconds,
DetectFire/DetectSmoke, ZoomChecks, MaxFps (6: evidence is per second of
scene), CandidateScore, MinObjectSize (49a53c3's knob, kept: a candidate
under that fraction of the frame is noise), ExclusiveROIs. Engines load
inside Initialize: a lazily loaded one faulted in ANSLIB's inference entry
on the first frame.

FireNSmokeDetection_Run replays a recording on the video's clock (parity
harness with firesmoke-run). Measured, same package, TensorRT:
  15.9.9.0_9.51_real_smoke   63 alarms, first at 3.0 s (node: 56, 3.0 s)
  15.9.9.51.10.51_real_smoke 113 alarms, first at 3.0 s (node: 126, 3.0 s)
  8 KA false_* clips          0 alarms (node: 0)
Unit tests updated for the new parameter schema; 9/9 pass. The headless
checker from 49a53c3 builds unchanged against the new class.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
2026-11-01 12:15:33 +11:00

117 lines
4.1 KiB
CMake

project(FireNSmokeDetection_Tests LANGUAGES CXX)
# ============================================================================
# Common settings shared by both targets
# ============================================================================
set(COMMON_INCLUDES
${TEST_COMMON_DIR}
${ANSLIB_INCLUDE_DIR}
${OPENCV_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}/ANSCustomFireNSmokeDetection
)
set(COMMON_DEFS
WIN32_LEAN_AND_MEAN
NOMINMAX
$<$<CONFIG:Debug>:_DEBUG>
$<$<CONFIG:Release>:NDEBUG>
)
# All runtime DLLs (ANSLIB, ANSODEngine, ANSLicensingSystem, ANSMOT, OpenCV, etc.)
# live in C:\ProgramData\ANSCENTER\Shared — same directory as the .lib files.
# Windows resolves them via the standard DLL search order.
# ============================================================================
# 1. Google Test unit/integration test executable
# ============================================================================
add_executable(${PROJECT_NAME}
FireNSmokeDetectionTest.cpp
)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17)
target_compile_definitions(${PROJECT_NAME} PRIVATE ${COMMON_DEFS})
target_include_directories(${PROJECT_NAME} PRIVATE ${COMMON_INCLUDES})
target_link_directories(${PROJECT_NAME} PRIVATE
${ANSLIB_LIB_DIR}
${OPENCV_LIB_DIR}
)
target_link_libraries(${PROJECT_NAME} PRIVATE
gtest
gtest_main
ANSLIB
opencv_world4130
ANSCustomFireNSmokeDetection
)
if(MSVC)
target_compile_options(${PROJECT_NAME} PRIVATE /W3 /sdl /permissive-)
endif()
include(GoogleTest)
gtest_discover_tests(${PROJECT_NAME} DISCOVERY_MODE PRE_TEST)
# ============================================================================
# 2. Interactive video demo executable (visual verification with OpenCV window)
# ============================================================================
add_executable(FireNSmokeDetection_Demo
main.cpp
)
target_compile_features(FireNSmokeDetection_Demo PRIVATE cxx_std_17)
target_compile_definitions(FireNSmokeDetection_Demo PRIVATE ${COMMON_DEFS})
target_include_directories(FireNSmokeDetection_Demo PRIVATE ${COMMON_INCLUDES})
target_link_directories(FireNSmokeDetection_Demo PRIVATE
${ANSLIB_LIB_DIR}
${OPENCV_LIB_DIR}
)
target_link_libraries(FireNSmokeDetection_Demo PRIVATE
ANSLIB
opencv_world4130
ANSCustomFireNSmokeDetection
)
if(MSVC)
target_compile_options(FireNSmokeDetection_Demo PRIVATE /W3 /sdl /permissive-)
endif()
# ============================================================================
# 3. Headless detection checker (no GUI) — for verification / MinObjectSize tuning
# ============================================================================
add_executable(FireNSmokeDetection_HeadlessCheck
headless_check.cpp
)
target_compile_features(FireNSmokeDetection_HeadlessCheck PRIVATE cxx_std_17)
target_compile_definitions(FireNSmokeDetection_HeadlessCheck PRIVATE ${COMMON_DEFS})
target_include_directories(FireNSmokeDetection_HeadlessCheck PRIVATE ${COMMON_INCLUDES})
target_link_directories(FireNSmokeDetection_HeadlessCheck PRIVATE
${ANSLIB_LIB_DIR}
${OPENCV_LIB_DIR}
)
target_link_libraries(FireNSmokeDetection_HeadlessCheck PRIVATE
ANSLIB
opencv_world4130
ANSCustomFireNSmokeDetection
)
if(MSVC)
target_compile_options(FireNSmokeDetection_HeadlessCheck PRIVATE /W3 /sdl /permissive-)
endif()
# ============================================================================
# 4. Headless replay harness on the video's clock (parity with ANSMIND's firesmoke-run)
# ============================================================================
add_executable(FireNSmokeDetection_Run
run_main.cpp
)
target_compile_features(FireNSmokeDetection_Run PRIVATE cxx_std_17)
target_compile_definitions(FireNSmokeDetection_Run PRIVATE ${COMMON_DEFS})
target_include_directories(FireNSmokeDetection_Run PRIVATE ${COMMON_INCLUDES})
target_link_directories(FireNSmokeDetection_Run PRIVATE ${ANSLIB_LIB_DIR} ${OPENCV_LIB_DIR})
target_link_libraries(FireNSmokeDetection_Run PRIVATE ANSLIB opencv_world4130 ANSCustomFireNSmokeDetection)
if(MSVC)
target_compile_options(FireNSmokeDetection_Run PRIVATE /W3 /sdl /permissive-)
endif()