From 65b87bb340227173e5025dcd6fdb38020da93914 Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Fri, 27 Nov 2026 21:26:51 +0200 Subject: [PATCH] intermediate commit --- lib/App/common/dataBinder_structures.h | 5 ++++- lib/App/common/kernelEventFilterYOLO.cpp | 18 ++++++++++++++++++ lib/App/common/kernelEventFilterYOLO.h | 19 +++++++++++++------ 3 files changed, 35 insertions(+), 7 deletions(-) diff --git a/lib/App/common/dataBinder_structures.h b/lib/App/common/dataBinder_structures.h index 93849f68..8adb36d4 100644 --- a/lib/App/common/dataBinder_structures.h +++ b/lib/App/common/dataBinder_structures.h @@ -704,7 +704,10 @@ typedef struct S_DBC_MODEM_DATA } DBC_MODEM_DATA; typedef struct S_YOLO_FILTER_DATA{ - + char config_path[MAX_PATH]; + char weights_path[MAX_PATH]; + uint8_t batch; + uint8_t clear; } YOLO_FILTER_DATA; typedef struct S_DBC_3DLRF_WSTAT diff --git a/lib/App/common/kernelEventFilterYOLO.cpp b/lib/App/common/kernelEventFilterYOLO.cpp index b4fa73c2..980164a2 100644 --- a/lib/App/common/kernelEventFilterYOLO.cpp +++ b/lib/App/common/kernelEventFilterYOLO.cpp @@ -20,10 +20,14 @@ basicThread() m_pLog = basicLogCollection::getInstance(); // validate() compares it with the database copy: must start defined memset(&m_sYOLOFilterData, 0, sizeof(YOLO_FILTER_DATA)); + m_pNET = NULL; } kernelEventFilterYOLO::~kernelEventFilterYOLO() { + if ( m_pNET ){ + free_network_ptr( m_pNET ); + }; } bool kernelEventFilterYOLO::validate() @@ -42,14 +46,28 @@ bool kernelEventFilterYOLO::validate() }; return false; } + bool kernelEventFilterYOLO::validateTarget(uint32_t DevID, TARGET_DATA * ptr){ (void) DevID; // ToDo: YOLO filtering (void) ptr; return false; } + bool kernelEventFilterYOLO::initFilter(){ + if ( !fileExist( m_sYOLOFilterData.config_path ) ) return false; + if ( !fileExist( m_sYOLOFilterData.weights_path ) ) return false; + if ( m_sYOLOFilterData.batch ) { + m_pNET = load_network_custom( m_sYOLOFilterData.config_path, m_sYOLOFilterData.weights_path, m_sYOLOFilterData.clear, m_sYOLOFilterData.batch ); + } else { + m_pNET = load_network( m_sYOLOFilterData.config_path, m_sYOLOFilterData.weights_path, m_sYOLOFilterData.clear ); + }; + if ( m_pNET ){ + darknet_network_dimensions( m_pNET, &m_nW, &m_nH, &m_nC ); + return true; + } return false; } + bool kernelEventFilterYOLO::stopFilter(){ return false; } diff --git a/lib/App/common/kernelEventFilterYOLO.h b/lib/App/common/kernelEventFilterYOLO.h index d5b17db3..ec3d8120 100644 --- a/lib/App/common/kernelEventFilterYOLO.h +++ b/lib/App/common/kernelEventFilterYOLO.h @@ -6,14 +6,21 @@ #include "kernelEventFilter.h" #include "kernelPrototype.h" +//#include "../../data/darknet/darknetWraper.h" +//#include +#include + class kernelEventFilterYOLO : public kernelEventFilter, public basicEventHandler, public basicThread { private: - basicLogCollection * m_pLog; - YOLO_FILTER_DATA m_sYOLOFilterData; - basicMutex m_mStateProtector; - basicMutex m_mDataProtector; - - + basicLogCollection * m_pLog; + YOLO_FILTER_DATA m_sYOLOFilterData; + basicMutex m_mStateProtector; + basicMutex m_mDataProtector; + //darknetWraper * m_pDarkNet; + DarknetNetworkPtr * m_pNET; + int m_nW; + int m_nH; + int m_nC; protected: virtual void m_fThreadProc(void);