| | |
| | | |
| | | #include "plugin_factory.h" |
| | | #include "trt_utils.h" |
| | | |
| | | #include "calibrator.h" |
| | | #include "NvInfer.h" |
| | | #include "NvInferPlugin.h" |
| | | #include "NvInferRuntimeCommon.h" |
| | |
| | | #include "../utils/time_util.h" |
| | | #include "../config.h" |
| | | #include "opencv2/opencv.hpp" |
| | | #include <numeric> |
| | | |
| | | struct NetworkInfo |
| | | { |
| | |
| | | const std::string m_DeviceType; |
| | | const std::string m_InputBlobName; |
| | | std::vector<TensorInfo> m_OutputTensors; |
| | | std::vector<std::map<std::string, std::string>> m_configBlocks; |
| | | uint32_t m_InputH; |
| | | uint32_t m_InputW; |
| | | uint32_t m_InputC; |
| | |
| | | 22, 23, 24, 25, 27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, |
| | | 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, |
| | | 67, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90}; |
| | | uint32_t m_BatchSize = 10; |
| | | uint32_t m_BatchSize = 1; |
| | | nvinfer1::INetworkDefinition* m_Network; |
| | | nvinfer1::IBuilder* m_Builder ; |
| | | nvinfer1::IHostMemory* m_ModelStream; |
| | |
| | | void setOutput(int type); |
| | | private: |
| | | Logger m_Logger; |
| | | void createYOLOEngine(const nvinfer1::DataType dataType = nvinfer1::DataType::kFLOAT, |
| | | Int8EntropyCalibrator* calibrator = nullptr); |
| | | void writePlanFileToDisk(); |
| | | std::vector<std::map<std::string, std::string>> parseConfigFile(const std::string cfgFilePath); |
| | | void parseConfigBlocks(); |
| | | void allocateBuffers(); |
| | | bool verifyEngine(); |
| | | void destroyNetworkUtils(std::vector<nvinfer1::Weights>& trtWeights); |
| | | protected: |
| | | const std::string m_NetworkType; |
| | | std::unique_ptr<YoloTinyMaxpoolPaddingFormula> m_TinyMaxpoolPaddingFormula; |
| | | |
| | | private: |
| | | Timer _timer; |
| | | int _n_yolo_ind = 0; |
| | | }; |
| | | |
| | | #endif |