lishengyin hace 3 años
padre
commit
369a3d1adf

+ 35 - 35
CMakeLists.txt

@@ -4,7 +4,7 @@ cmake_minimum_required(VERSION 3.5)
 set(CMAKE_CXX_STANDARD 11)
 
 # 项目信息
-project(Demo C CXX)
+project(MIVA C CXX)
 
 # 设置为调试版本
 set(CMAKE_BUILD_TYPE Debug)
@@ -14,7 +14,7 @@ set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/source/bin/)
 
 # ---[ Options
 option(build_inference "build module inference" ON)
-option(build_decoder "build module decoder" ON)
+option(build_decoder "build module decoder" OFF)
 option(build_inifile "build module inifile" ON)
 option(build_dataType "build module dataType" ON)
 option(build_HttpClient "build module HttpClient" ON)
@@ -27,7 +27,7 @@ option(build_monitor "build modele monitor" ON)
 option(build_deviceState "build modele deviceState" ON)
 option(build_Manager "build modele Manager" ON)
 option(build_Shell "build modele Shell" ON)
-option(WITH_FFMPEG "with ffmpeg" ON) 
+option(WITH_FFMPEG "with ffmpeg" OFF) 
 option(WITH_OPENCV "with opencv" ON)
 option(WITH_ZLMediaKit "with ZLMediaKit" OFF)
 
@@ -96,38 +96,38 @@ endif()
 
 
 #FFmpeg
-if(WITH_FFMPEG)
-  if(CMAKE_TOOLCHAIN_FILE)
-    if(EXISTS ${PROJECT_SOURCE_DIR}/include/libavcodec)
-      set(FFMPEG_LIBRARIES avformat avcodec avutil swscale swresample)
-      if (WITH_FFMPEG_AVDEVICE)
-        list(APPEND FFMPEG_LIBRARIES avdevice)
-      endif ()
-      set(HAVE_FFMPEG true)
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_FFMPEG")
-      message(STATUS "HAVE_FFMPEG enabled")
-      message(STATUS "ffmpeg libraries: ${FFMPEG_LIBRARIES}")
-    else()
-      set (HAVE_FFMPEG false)
-    endif()
-  else()
-    set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
-    find_package(FFmpeg REQUIRED)
-    if (FFMPEG_FOUND)
-      include_directories(${FFMPEG_INCLUDE_DIR})
-      set(HAVE_FFMPEG true)
-      set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_FFMPEG")
-      message(STATUS "HAVE_FFMPEG enabled")
-      message(STATUS "ffmpeg include: ${FFMPEG_INCLUDE_DIR}")
-      message(STATUS "ffmpeg libraries: ${FFMPEG_LIBRARIES}")
-    else ()
-      message(FATAL_ERROR "Can't find FFmpeg libs!")
-      set (HAVE_FFMPEG false)
-    endif ()
-  endif()
-else()
-  set (HAVE_FFMPEG false)
-endif()
+# if(WITH_FFMPEG)
+#   if(CMAKE_TOOLCHAIN_FILE)
+#     if(EXISTS ${PROJECT_SOURCE_DIR}/include/libavcodec)
+#       set(FFMPEG_LIBRARIES avformat avcodec avutil swscale swresample)
+#       if (WITH_FFMPEG_AVDEVICE)
+#         list(APPEND FFMPEG_LIBRARIES avdevice)
+#       endif ()
+#       set(HAVE_FFMPEG true)
+#       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_FFMPEG")
+#       message(STATUS "HAVE_FFMPEG enabled")
+#       message(STATUS "ffmpeg libraries: ${FFMPEG_LIBRARIES}")
+#     else()
+#       set (HAVE_FFMPEG false)
+#     endif()
+#   else()
+#     set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
+#     find_package(FFmpeg REQUIRED)
+#     if (FFMPEG_FOUND)
+#       include_directories(${FFMPEG_INCLUDE_DIR})
+#       set(HAVE_FFMPEG true)
+#       set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DHAVE_FFMPEG")
+#       message(STATUS "HAVE_FFMPEG enabled")
+#       message(STATUS "ffmpeg include: ${FFMPEG_INCLUDE_DIR}")
+#       message(STATUS "ffmpeg libraries: ${FFMPEG_LIBRARIES}")
+#     else ()
+#       message(FATAL_ERROR "Can't find FFmpeg libs!")
+#       set (HAVE_FFMPEG false)
+#     endif ()
+#   endif()
+# else()
+#   set (HAVE_FFMPEG false)
+# endif()
 
 # -- ZLMediaKit
 if(WITH_ZLMediaKit)

+ 3 - 1
README.md

@@ -1,6 +1,7 @@
 # MVIA
 地铁车厢客流智能分析系统,硬件采用Jetson Xavier NX,应用于地铁车厢的客流分析。
 
+
 ## 目录结构
 ```shell
 📁MIVA
@@ -42,9 +43,10 @@
 ## Release Notes
 本章介绍MIVA各个版本的新增功能、功能变更。
 
-### MIVA 2022-1-13(Version 1.4.2)
+### MIVA 2022-1-18(Version 1.4.2)
 #### 新增功能及功能变更
 - 新增看门狗脚本,自动检查系统是否正常
+- 新增超时监控机制,避免deepstream内部卡死
 
 ### MIVA 2022-1-13(Version 1.4.1)
 #### 新增功能及功能变更

+ 1 - 0
data/state/fdState

@@ -0,0 +1 @@
+0

BIN
docker/3rdparty/ZLToolKit.tar.gz


BIN
docker/3rdparty/opencv.tar.gz


+ 0 - 0
docker/Dockerfile


+ 41 - 0
docker/Dockerfile.infer

@@ -0,0 +1,41 @@
+# 配置miva推理镜像
+
+# Use L4T base docker
+FROM nvcr.io/nvidia/deepstream-l4t:5.0.1-20.09-samples
+
+# install基础依赖
+RUN apt-get update && \
+      DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends libgstreamer-plugins-base1.0-dev libgstreamer1.0-dev libgstrtspserver-1.0-dev libx11-dev \
+      build-essential \ 
+      cmake \ 
+      libmysqlclient-dev \
+      libssl-dev 
+
+# 拷贝文件
+COPY ./3rdparty/ZLToolKit.tar.gz /root
+COPY ./3rdparty/opencv.tar.gz /root
+
+# COPY lib
+COPY ./lib/* /usr/local/lib/ 
+
+# install zltoolkit
+RUN cd /root/ && tar -zxvf ZLToolKit.tar.gz 
+RUN cp -rf /root/ZLToolKit/lib/* /usr/local/lib/
+RUN cp -rf /root/ZLToolKit/include/* /usr/local/include/
+
+# install opencv
+RUN cd /root/ && tar -zxvf opencv.tar.gz
+RUN cp -rf /root/opencv/lib/* /usr/local/lib/
+RUN cp -rf /root/opencv/include/* /usr/local/include/
+
+# 清除缓冲
+# RUN rm ${HOME}/.cache/gstreamer-1.0/registry.*
+
+
+
+
+
+
+
+
+

BIN
docker/lib/libflv.a


BIN
docker/lib/libmk_api.so


BIN
docker/lib/libmodules.so


BIN
docker/lib/libmov.a


BIN
docker/lib/libmpeg.a


BIN
docker/lib/libmyplugins.so


BIN
docker/lib/libnvdsinfer_custom_impl_Yolo.so


BIN
docker/lib/libzlmediakit.a


BIN
docker/lib/libzltoolkit.a


BIN
lib/libmodules.so


BIN
lib/libmyplugins.so


+ 4 - 4
modules/CMakeLists.txt

@@ -7,10 +7,10 @@ if(build_inference)
   list(APPEND module_list inference)
   install(DIRECTORY inference/include/ DESTINATION include)
 endif()
-if(build_decoder)
-  list(APPEND module_list decoder)
-  install(DIRECTORY decoder/include/ DESTINATION include)
-endif()
+# if(build_decoder)
+#   list(APPEND module_list decoder)
+#   install(DIRECTORY decoder/include/ DESTINATION include)
+# endif()
 if(build_inifile)
   list(APPEND module_list inifile)
   install(DIRECTORY inifile/include/ DESTINATION include)

+ 30 - 1
modules/Manager/include/Manager.h

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-11 11:47:37
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-13 15:16:09
+ * @LastEditTime: 2022-01-18 09:58:52
  */
 #pragma once
 
@@ -49,6 +49,7 @@ namespace MIVA{
         int FdThreshold;
         int ResetThreshold = 100;
         bool ResetSwitch = false;
+        int TimeoutThreshold = 3;
     private:
 
         /**
@@ -86,6 +87,13 @@ namespace MIVA{
          */        
         bool decideResetResult();
 
+        /**
+         * @description: 获取超时的判定结果
+         * @param {*}
+         * @return {*}
+         */        
+        bool decideTimeoutResult();
+
     public:
         Manager();
         ~Manager();
@@ -133,6 +141,27 @@ namespace MIVA{
         void setResetSwitch(bool resetSwitch);
 
         /**
+         * @description: 设置超时阈值
+         * @param {int} timeoutThreshold
+         * @return {*}
+         */        
+        void setTimeoutThreshold(int timeoutThreshold);
+
+        /**
+         * @description: 纪律超时
+         * @param {*}
+         * @return {*}
+         */        
+        void recordTimeOut();
+
+        /**
+         * @description: 清除超时
+         * @param {*}
+         * @return {*}
+         */        
+        void clearRecordTimeOut();
+
+        /**
          * @description: 获取启动资格
          * @param {*}
          * @return {*}

+ 51 - 9
modules/Manager/src/Manager.cpp

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-11 11:47:46
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-13 14:30:38
+ * @LastEditTime: 2022-02-08 12:31:32
  */
 #include "Manager.h"
 
@@ -13,7 +13,7 @@ namespace MIVA{
 
     std::shared_ptr<Manager> m_manager = nullptr;
     bool setFdEble = false;
-
+    int TimeOutCount = 0;
     Manager::Manager(){
     }
 
@@ -74,6 +74,33 @@ namespace MIVA{
     void Manager::setResetSwitch(bool resetSwitch){
         this->ResetSwitch = resetSwitch;
     }
+    
+    /**
+     * @description: 设置超时阈值
+     * @param {int} timeoutThreshold
+     * @return {*}
+     */    
+    void Manager::setTimeoutThreshold(int timeoutThreshold){
+        this->TimeoutThreshold = timeoutThreshold;
+    }
+
+    /**
+     * @description: 超时纪律
+     * @param {*}
+     * @return {*}
+     */    
+    void Manager::recordTimeOut(){
+        TimeOutCount++;
+    }
+
+    /**
+     * @description: 
+     * @param {*}
+     * @return {*}
+     */    
+    void Manager::clearRecordTimeOut(){
+        TimeOutCount = 0;
+    }
 
     /**
      * @description: 获得启动资格
@@ -87,7 +114,7 @@ namespace MIVA{
         if(Infer == nullptr) return result;
         // if(m_deviceState->getDeviceState() != OK) return result;
         // 从内存、温度、fd、播放是否停止一起来判定是否可以启动
-        if(decideMemoryResult() && decideTempResult() && decideFdResult() && decidePlayResult()) result = OK;
+        if(decideMemoryResult() && decideTempResult()  && decidePlayResult()) result = OK;
         return result;
     }
     
@@ -154,12 +181,12 @@ namespace MIVA{
     }
 
     /**
-     * @description: 获取充值的资格
+     * @description: 获取重置的资格
      * @param {*}
      * @return {*}
      */    
     int32_t Manager::getResetPower(){
-        return (decideResetResult() && decidePlayResult()) ? OK : ERR;
+        return ((decideResetResult() && decidePlayResult()) || decideTimeoutResult()) ? OK : ERR;
     }
 
     /**
@@ -168,11 +195,16 @@ namespace MIVA{
      * @return {*}
      */    
     bool Manager::decideFdResult(){
+        static int num = 0;
         if(!setFdEble) return true;
         std::shared_ptr<deviceState> m_deviceState = deviceState::CreateNew();
         if(m_deviceState->FdUsage >= this->FdThreshold){
            int fd = m_deviceState->FdUsage - this->FdThreshold;
-           if(fd > 2) return false; 
+           if(fd > 2){
+               num++;
+               if(num > 5) return false;  // 添加5次容忍
+           } 
+           else num = 0;
         }
         return true;
     }
@@ -220,14 +252,24 @@ namespace MIVA{
     }
 
     /**
+     * @description: 获取超时的判定结果
+     * @param {*}
+     * @return {*}
+     */    
+    bool Manager::decideTimeoutResult(){
+        if(TimeOutCount >= this->TimeoutThreshold) return true;
+        return false;
+    }
+
+    /**
      * @description: 重启 
      * @param {*}
      * @return {*}
      */    
     void Manager::Reset(){
-        string shell = "killall main";
-        vector<string> results;
-        CShell::exeShellCmd(shell, results);
+        // string shell = "killall main";
+        // vector<string> results;
+        // CShell::exeShellCmd(shell, results);
     }   
 }
 

+ 2 - 2
modules/deviceState/src/deviceState.cpp

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2022-01-11 10:45:05
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-12 17:14:50
+ * @LastEditTime: 2022-02-21 16:22:42
  */
 #include "deviceState.h"
 
@@ -49,7 +49,7 @@ namespace MIVA
         // this->AUXTemp = m_monitor->getAUXTemp();
         // this->A0Temp = m_monitor->getA0Temp();
         // this->ThermalTemp = m_monitor->getThermalTemp();
-        this->FdUsage = m_monitor->getFdUsage();
+        // this->FdUsage = m_monitor->getFdUsage();
         
         return 0;
     }

+ 1 - 1
modules/inference/include/inference.h

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2021-10-13 09:37:51
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-13 14:12:18
+ * @LastEditTime: 2022-02-17 17:23:27
  */
 #pragma once
 #include <iostream>

+ 14 - 28
modules/inference/src/inference.cpp

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2021-10-13 09:35:37
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-13 13:58:03
+ * @LastEditTime: 2022-02-21 08:57:57
  */
 #include "inference.h"
 
@@ -20,7 +20,7 @@
 #define OSD_PROCESS_MODE 0
 
 /* By default, OSD will not display text. To display text, change this to 1 */
-#define OSD_DISPLAY_TEXT 1
+#define OSD_DISPLAY_TEXT 0
 
 /* The muxer output resolution must be set if the input streams will be of
  * different resolution. The muxer will scale all the input frames to this
@@ -67,14 +67,9 @@ namespace MIVA{
         DebugL << "Returned, stopping playback" << endl;
         // GstState state;
         GstStateChangeReturn state_return;
-        // gst_element_get_state(this->pipeline,&state,NULL, GST_CLOCK_TIME_NONE);
-        // if(state == GST_STATE_PLAYING){
-        //     DebugL << "pipeline状态设置为暂停" << endl;
-        //     state_return = gst_element_set_state(this->pipeline, GST_STATE_PAUSED);
-        //     StateResulit(state_return);
-        // } 
         g_main_loop_quit (this->loop);
         state_return = gst_element_set_state(this->pipeline, GST_STATE_NULL);
+
         StateResulit(state_return);
         DebugL << "Deleting pipeline";
         
@@ -85,7 +80,7 @@ namespace MIVA{
 
         this->m_InferInfo = NULL;
     } 
-
+    
     /**
      * @description: 创建实例
      * @param {*}
@@ -108,7 +103,7 @@ namespace MIVA{
         // init
         this->loop = g_main_loop_new (NULL, FALSE);
         // 创建管道
-        this->pipeline = gst_pipeline_new("dstest3-pipeline");
+        this->pipeline = gst_pipeline_new("miva-pipeline");
 
         // 创建批处理器
         this->streammux = gst_element_factory_make ("nvstreammux", "stream-muxer");
@@ -145,8 +140,6 @@ namespace MIVA{
         this->queue2 = gst_element_factory_make ("queue", "queue2");
         this->queue3 = gst_element_factory_make ("queue", "queue3");
         this->queue4 = gst_element_factory_make ("queue", "queue4");
-        // this->queue5 = gst_element_factory_make ("queue", "queue5");
-
 
         /* Use nvtiler to composite the batched frames into a 2D tiled array based
          * on the source of the frames. */
@@ -157,10 +150,6 @@ namespace MIVA{
 
         this->nvosd = gst_element_factory_make ("nvdsosd", "nv-onscreendisplay");
 
-        // #ifdef PLATFORM_TEGRA
-        //     this->transform = gst_element_factory_make ("nvegltransform", "nvegl-transform");
-        // #endif
-
         this->sink = gst_element_factory_make ("fakesink", "nvvideo-renderer");
         
         if (!this->pgie || !this->nvvidconv || !this->nvosd || !this->sink) {
@@ -168,13 +157,6 @@ namespace MIVA{
             return -1;
         }
 
-        // #ifdef PLATFORM_TEGRA
-        //     if(!this->transform) {
-        //         ErrorL << "One tegra element could not be created. Exiting.";
-        //         return -1;
-        //     }
-        // #endif
-   
         g_object_set(G_OBJECT(streammux), "batch-size", g_num_sources, NULL);
 
         g_object_set(G_OBJECT(streammux), "live-source", 1, NULL);
@@ -204,6 +186,8 @@ namespace MIVA{
         g_object_set (G_OBJECT (this->nvosd), "process-mode", OSD_PROCESS_MODE,
             "display-text", OSD_DISPLAY_TEXT, NULL);
         g_object_set (G_OBJECT (this->nvosd), "display-bbox", 0, NULL);
+        // g_object_set (G_OBJECT (this->nvosd), "display-mask", 0, NULL);
+        
         g_object_set (G_OBJECT (this->sink), "qos", 0, NULL);
 
         this->bus = gst_pipeline_get_bus (GST_PIPELINE (this->pipeline));
@@ -218,9 +202,10 @@ namespace MIVA{
             ErrorL << "Elements could not be linked. Exiting.";
             return -1;
         }
+
         // this->tiler, this->queue4,
         // this->nvosd, this->queue4,
-        
+    
         this->tiler_sink_pad = gst_element_get_static_pad (this->nvvidconv, "src");
         gst_pad_add_probe (this->tiler_sink_pad, GST_PAD_PROBE_TYPE_BUFFER,
                 tiler_sink_pad_buffer_probe, NULL, NULL);
@@ -275,15 +260,16 @@ namespace MIVA{
     {
         GstStateChangeReturn state_return;
         std::vector<DataSource>::iterator iter;
-        // gst_element_set_state(this->pipeline, GST_STATE_PAUSED);
+
         for (iter = this->m_InferInfo->DataSources.begin(); iter != this->m_InferInfo->DataSources.end(); iter++){
             if(iter->source_bin != NULL){
                 state_return = gst_element_set_state(iter->source_bin, GST_STATE_NULL);
                 StateResulit(state_return);
             }
         }
-        // state_return = gst_element_set_state(this->streammux, GST_STATE_NULL);
-        // StateResulit(state_return);
+        state_return = gst_element_set_state(this->streammux, GST_STATE_NULL);
+        StateResulit(state_return);
+        
         if(m_recorder != nullptr){
             m_recorder->Finish();
         }
@@ -409,7 +395,6 @@ namespace MIVA{
                     if (obj_meta->class_id == 0) {
                         NvDsComp_BboxInfo boxInfo;
                         boxInfo = obj_meta->detector_bbox_info;
-                
                         NvBbox_Coords box_Coord;
                         box_Coord = boxInfo.org_bbox_coords;
                         Point p;
@@ -493,6 +478,7 @@ namespace MIVA{
                         cv::rectangle(*frame, top_left, bottom_right, color, 3);
                     }
                 }
+                
                 if(inferRange.jsonToObject(json)){
                     if(inferRange.m_points.size() > 0){
                         for(int i = 0; i < (int)(inferRange.m_points.size()); i++)

+ 33 - 23
modules/userApp/src/user_app.cpp

@@ -4,7 +4,7 @@
  * @Autor: lishengyin
  * @Date: 2021-10-13 09:35:42
  * @LastEditors: lishengyin
- * @LastEditTime: 2022-01-14 14:14:27
+ * @LastEditTime: 2022-02-17 17:23:30
  */
 #include "user_app.h"
 
@@ -100,7 +100,7 @@ namespace MIVA
         this->m_manager = Manager::CreateNew();
         this->m_deviceState->getDeviceState();
         // 查询基础配置
-        SqlWriter sqlSelectConfig("SELECT account,outType,outPath,outEnable,ClearType,recordMax,validTime,MemoryThreshold,TempThreshold,FdThreshold,ResetThreshold,ResetSwitch FROM MIVA_DB.`MivaConfig`");
+        SqlWriter sqlSelectConfig("SELECT account,outType,outPath,outEnable,ClearType,recordMax,validTime,MemoryThreshold,TempThreshold,FdThreshold,ResetThreshold,ResetSwitch,TimeoutThreshold FROM MIVA_DB.`MivaConfig`");
         sqlSelectConfig << sqlRet;
         for(auto &line : sqlRet)
         {
@@ -116,6 +116,7 @@ namespace MIVA
             this->m_manager->setFdThreshold(std::atoi(line[9].c_str()));
             this->m_manager->setResetThreshold(std::atoi(line[10].c_str()));
             this->m_manager->setResetSwitch(std::atoi(line[11].c_str()) ? true : false);
+            this->m_manager->setTimeoutThreshold(std::atoi(line[12].c_str()));
         }
 
         // 链接Netty后端
@@ -241,13 +242,28 @@ namespace MIVA
             this->ListenPISData(buf, addr);
         });
 
-        // 定时检查连接状态
-        this->m_timer0 = std::make_shared<Timer>(5.0f,[&](){
-            if(!m_tcpClient->alive()){
-                this->ConnectNetty();
-            }
-            return true;
-        }, nullptr);
+        #if defined(UNDEBUG)
+            // 定时检查连接状态
+            this->m_timer0 = std::make_shared<Timer>(5.0f,[&](){
+                if(!m_tcpClient->alive()){
+                    this->ConnectNetty();
+                }
+                return true;
+            }, nullptr);
+
+            // 定时获取数据
+            this->m_timer3 = std::make_shared<Timer>(3.0f,[&](){
+                if(this->m_httpClient->alive()){
+                    // 获取数据
+                    if(this->m_manager->getHostDataPower() == OK) this->GetNettyDatas();
+                }else{  // 未获取到Token
+                    if(this->m_httpClient->LoginNetty() != OK){
+                        ErrorL << "登录Netty失败" << endl;
+                    }
+                }
+                return true;
+            }, nullptr);
+        #endif
 
         // 定时上报数据
         this->m_timer1 = std::make_shared<Timer>(1.0f,[&](){
@@ -255,19 +271,6 @@ namespace MIVA
             return true;
         }, nullptr);
 
-        // 定时获取数据
-        this->m_timer3 = std::make_shared<Timer>(3.0f,[&](){
-            if(this->m_httpClient->alive()){
-                // 获取数据
-                if(this->m_manager->getHostDataPower() == OK) this->GetNettyDatas();
-            }else{  // 未获取到Token
-                if(this->m_httpClient->LoginNetty() != OK){
-                    ErrorL << "登录Netty失败" << endl;
-                }
-            }
-            return true;
-        }, nullptr);
-
         // 定时监控数据变化
         this->m_timer4 = std::make_shared<Timer>(3.0f,[&](){
             // 监听数据
@@ -595,7 +598,7 @@ namespace MIVA
         getDataTime(ctime);
         std::string Ctime = ctime;
  
-        SqlWriter sqlSelectConfig("SELECT account,outType,outPath,outEnable,ClearType,recordMax,validTime,MemoryThreshold,TempThreshold,FdThreshold,ResetThreshold,ResetSwitch FROM MIVA_DB.`MivaConfig`");
+        SqlWriter sqlSelectConfig("SELECT account,outType,outPath,outEnable,ClearType,recordMax,validTime,MemoryThreshold,TempThreshold,FdThreshold,ResetThreshold,ResetSwitch,TimeoutThreshold FROM MIVA_DB.`MivaConfig`");
         sqlSelectConfig << sqlRet;
         for(auto &line : sqlRet)
         {
@@ -613,6 +616,7 @@ namespace MIVA
             this->m_manager->setFdThreshold(std::atoi(line[9].c_str()));
             this->m_manager->setResetThreshold(std::atoi(line[10].c_str()));
             this->m_manager->setResetSwitch(std::atoi(line[11].c_str()) ? true : false);
+            this->m_manager->setTimeoutThreshold(std::atoi(line[12].c_str()));
         }
         
         if(this->m_Infer->enable == false || this->m_InferInfo->DataSources.empty()){
@@ -742,7 +746,13 @@ namespace MIVA
                 if(this->m_manager->getClearPower() == OK){
                     if(this->m_Infer->Play) this->ListenInferPer();
                     this->m_Infer->CheckTask();
+                    this->m_manager->recordTimeOut();
                     WarnL << "此次推理时间过长" << endl;
+                    // if(this->m_manager->getResetPower() == OK){
+                    //     this->m_manager->Reset();
+                    // }
+                }else{
+                    this->m_manager->clearRecordTimeOut();
                 }
                 return false;
             },nullptr);

+ 0 - 15
source/bin/MIVA.log

@@ -1,15 +0,0 @@
-2022-01-13 15:10:27 MIVA重启任务
-2022-01-13 15:10:29 MIVA重启任务
-2022-01-13 15:12:17 MIVA重启任务
-2022-01-13 15:22:18 MIVA重启任务
-2022-01-13 15:22:53 MIVA重启任务
-2022-01-13 15:23:19 MIVA重启任务
-2022-01-13 15:24:46 MIVA重启任务
-2022-01-13 15:25:20 MIVA重启任务
-2022-01-13 15:27:07 MIVA重启任务
-2022-01-13 15:27:13 MIVA重启任务
-2022-01-13 15:29:08 MIVA重启任务
-2022-01-13 15:29:10 MIVA重启任务
-2022-01-13 15:29:58 MIVA重启任务
-2022-01-13 15:42:52 MIVA重启任务
-2022-01-13 16:03:49 MIVA重启任务

BIN
source/bin/main


BIN
source/config/INT8/yolov5s.engine


+ 1 - 1
source/config/config_infer_primary_yoloV5.txt

@@ -58,7 +58,7 @@ output-blob-names=prob
 interval=0
 maintain-aspect-ratio=1
 parse-bbox-func-name=NvDsInferParseCustomYoloV5
-custom-lib-path=/home/lcfc/work/MIVA/lib/libnvdsinfer_custom_impl_Yolo.so
+custom-lib-path=../../lib/libnvdsinfer_custom_impl_Yolo.so
 engine-create-func-name=NvDsInferYoloCudaEngineGet
 #scaling-filter=0
 #scaling-compute-hw=0

+ 11 - 9
start.sh

@@ -1,15 +1,17 @@
 #!/bin/bash
 
 # 开启fd监控
-cd ./tooks/
-nohup  watch -n 1 ./cheack_fd.sh &
-cd ../
+# cd ./tooks/
+# nohup  watch -n 1 ./cheack_fd.sh &
+# cd ../
+rm ${HOME}/.cache/gstreamer-1.0/registry.*
+
 cd ./source/bin/
 
-while true
-do
+#while true
+# do
     LD_PRELOAD=../../lib/libmyplugins.so ./main
-    sleep 1
-    date="`date '+%Y-%m-%d %H:%M:%S'`"
-    echo "$date MIVA重启任务" >> MIVA.log
-done
+    # sleep 1
+    # date="`date '+%Y-%m-%d %H:%M:%S'`"
+    # echo "$date MIVA重启任务" >> MIVA.log
+#done

+ 1 - 0
tooks/VERSION

@@ -0,0 +1 @@
+1.4.2

+ 8 - 0
tooks/build.sh

@@ -0,0 +1,8 @@
+USERNAME=192.168.31.174
+IMAGE=mivainfer
+
+cp ../lib/* ../docker/lib/
+
+cd ../docker/
+
+docker build -t $USERNAME/$IMAGE:latest -f ./Dockerfile.infer . 

+ 4 - 4
tooks/clear.sh

@@ -1,6 +1,6 @@
 #!/bin/bash
 
-rm -rf ../data/video/*
-rm -rf ../source/bin/log/*
-rm -rf ../build/*
-rm ../source/bin/core
+sudo  rm -rf ../data/video/*
+sudo  rm -rf ../source/bin/log/*
+sudo  rm -rf ../build/*
+sudo  rm ../source/bin/core

+ 42 - 0
tooks/release.sh

@@ -0,0 +1,42 @@
+#!/bin/bash
+
+VERSION=`cat VERSION`
+
+echo "version: $VERSION"
+
+# SET THE FOLLOWING VARIABLES
+# docker hub username
+USERNAME=192.168.31.174
+IMAGE=mivainfer
+
+cp ../source/bin/main ../../../deploy/MIVA/source/bin/
+cp ../lib/* ../../../deploy/MIVA/lib
+# cp -rf ../source/config/* ../../../deploy/MIVA/source/config/
+echo "version: $VERSION" > ../../../deploy/MIVA/version
+
+./clear.sh
+
+# run build
+./build.sh
+
+# tag source
+cd ../
+git add -A 
+git commit -m "version $version"
+git tag -a "$version" -m "version $version"
+git push
+git push --tags
+
+# tag deploy
+cd ../../deploy/MIVA
+git add -A 
+git commit -m "version $version"
+git tag -a "$version" -m "version $version"
+git push
+git push --tags
+
+docker tag $USERNAME/$IMAGE:latest $USERNAME/$IMAGE:$version
+
+# push it
+# docker push $USERNAME/$IMAGE:latest
+# docker push $USERNAME/$IMAGE:$version