Browse Source

intermediate commit

pull/17/head
Evgeny Gagua 3 hours ago
parent
commit
65b87bb340
  1. 5
      lib/App/common/dataBinder_structures.h
  2. 18
      lib/App/common/kernelEventFilterYOLO.cpp
  3. 19
      lib/App/common/kernelEventFilterYOLO.h

5
lib/App/common/dataBinder_structures.h

@ -704,7 +704,10 @@ typedef struct S_DBC_MODEM_DATA
} DBC_MODEM_DATA; } DBC_MODEM_DATA;
typedef struct S_YOLO_FILTER_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; } YOLO_FILTER_DATA;
typedef struct S_DBC_3DLRF_WSTAT typedef struct S_DBC_3DLRF_WSTAT

18
lib/App/common/kernelEventFilterYOLO.cpp

@ -20,10 +20,14 @@ basicThread()
m_pLog = basicLogCollection::getInstance(); m_pLog = basicLogCollection::getInstance();
// validate() compares it with the database copy: must start defined // validate() compares it with the database copy: must start defined
memset(&m_sYOLOFilterData, 0, sizeof(YOLO_FILTER_DATA)); memset(&m_sYOLOFilterData, 0, sizeof(YOLO_FILTER_DATA));
m_pNET = NULL;
} }
kernelEventFilterYOLO::~kernelEventFilterYOLO() kernelEventFilterYOLO::~kernelEventFilterYOLO()
{ {
if ( m_pNET ){
free_network_ptr( m_pNET );
};
} }
bool kernelEventFilterYOLO::validate() bool kernelEventFilterYOLO::validate()
@ -42,14 +46,28 @@ bool kernelEventFilterYOLO::validate()
}; };
return false; return false;
} }
bool kernelEventFilterYOLO::validateTarget(uint32_t DevID, TARGET_DATA * ptr){ bool kernelEventFilterYOLO::validateTarget(uint32_t DevID, TARGET_DATA * ptr){
(void) DevID; // ToDo: YOLO filtering (void) DevID; // ToDo: YOLO filtering
(void) ptr; (void) ptr;
return false; return false;
} }
bool kernelEventFilterYOLO::initFilter(){ 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; return false;
} }
bool kernelEventFilterYOLO::stopFilter(){ bool kernelEventFilterYOLO::stopFilter(){
return false; return false;
} }

19
lib/App/common/kernelEventFilterYOLO.h

@ -6,14 +6,21 @@
#include "kernelEventFilter.h" #include "kernelEventFilter.h"
#include "kernelPrototype.h" #include "kernelPrototype.h"
//#include "../../data/darknet/darknetWraper.h"
//#include <darknet/darknet.hpp>
#include <darknet/darknet.h>
class kernelEventFilterYOLO : public kernelEventFilter, public basicEventHandler, public basicThread { class kernelEventFilterYOLO : public kernelEventFilter, public basicEventHandler, public basicThread {
private: 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: protected:
virtual void m_fThreadProc(void); virtual void m_fThreadProc(void);

Loading…
Cancel
Save