From 9ea70556492d82e31873569fd02f277ad2b46efa Mon Sep 17 00:00:00 2001 From: Claude Date: Fri, 27 Nov 2026 19:31:40 +0000 Subject: [PATCH] la_mojo: make the Darknet (YOLO filter) build and link - kernelEventFilterYOLO.h: * Darknet V3+ (hank-ai) declares load_network(), load_network_custom() and free_network_ptr() only when DARKNET_INCLUDE_ORIGINAL_API is defined before darknet.h ("was not declared in this scope"): define it. * Darknet installs the header as /include/darknet.h, not darknet/darknet.h: include , fall back to , clear #error if neither exists. * m_pNET was DarknetNetworkPtr * (void **) although DarknetNetworkPtr is already void *: "invalid conversion from void* to void**". - makefile / la_mojo.vpj: -ldarknet was only linked in Release86; the build script uses Debug86. Added to Debug86 and Debug (the .vpj too, so a SlickEdit regeneration keeps it). - kernelEventFilterYOLO::initFilter(): load the settings first (validate()); m_sYOLOFilterData was still zero, so fileExist("") made initFilter() always fail. Logs why it fails, frees a previously loaded network, logs the network dimensions. Destructor stops the thread before freeing the network. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_0139veDo3XyavMuVhdnHcN16 --- Projects/la_mojo/la_mojo.vpj | 2 ++ Projects/la_mojo/makefile | 5 ++-- lib/App/common/kernelEventFilterYOLO.cpp | 29 ++++++++++++++++++++++-- lib/App/common/kernelEventFilterYOLO.h | 15 ++++++++++-- 4 files changed, 45 insertions(+), 6 deletions(-) diff --git a/Projects/la_mojo/la_mojo.vpj b/Projects/la_mojo/la_mojo.vpj index 42bd2d84..25499dee 100644 --- a/Projects/la_mojo/la_mojo.vpj +++ b/Projects/la_mojo/la_mojo.vpj @@ -140,6 +140,7 @@ + + -#include + +// Darknet (hank-ai, V3+) declares load_network(), load_network_custom() and free_network_ptr() only +// when DARKNET_INCLUDE_ORIGINAL_API is defined before darknet.h ("was not declared in this scope"). +#define DARKNET_INCLUDE_ORIGINAL_API +// Darknet's CMake installs the header as /include/darknet.h (no darknet/ subdirectory) +#if __has_include() + #include +#elif __has_include() + #include +#else + #error "darknet.h not found: install Darknet (libdarknet.so + darknet.h, e.g. the darknet .deb)" +#endif class kernelEventFilterYOLO : public kernelEventFilter, public basicEventHandler, public basicThread { private: @@ -17,7 +28,7 @@ class kernelEventFilterYOLO : public kernelEventFilter, public basicEventHandler basicMutex m_mStateProtector; basicMutex m_mDataProtector; //darknetWraper * m_pDarkNet; - DarknetNetworkPtr * m_pNET; + DarknetNetworkPtr m_pNET; // DarknetNetworkPtr is already a pointer (void *) int m_nW; int m_nH; int m_nC; -- 2.39.5