#pragma once
|
#include "NvInfer.h"
|
#include <cuda_runtime.h>
|
#include <assert.h>
|
#include <fstream>
|
#include <string>
|
#include <opencv2/opencv.hpp>
|
#include "utils.hpp"
|
|
using namespace nvinfer1;
|
|
class DMJC{
|
|
public:
|
//~DMJC();
|
bool isLoad = false;//是否加载
|
bool initConfig(const char* enginefile,int* beltregion);
|
float detect(cv::Mat& image);
|
float detect_pic(cv::Mat& image, cv::Mat& image_pic);
|
|
//堆煤检测的图片测试类
|
//std::string DMJC_Test_Image();
|
//堆煤检测的视频测试类
|
//std::string DMJC_Test_Video();
|
|
private:
|
IExecutionContext* context{ nullptr };
|
IRuntime* runtime{ nullptr };
|
ICudaEngine* engine{ nullptr };
|
|
cudaStream_t stream = nullptr;
|
|
int input_batch = 1;
|
int input_channel = 3;
|
int input_height = 480;
|
int input_width = 480;
|
int input_numel;
|
|
int num_classes = 2;
|
int output_height;
|
int output_width;
|
int output_numel;
|
|
float beltarea = 1;
|
|
float* input_data_host = nullptr;
|
float* output_data_host = nullptr;
|
|
float* input_data_device = nullptr;
|
float* output_data_device = nullptr;
|
|
std::vector<cv::Point> pts_;
|
bool panduandm(std::vector<cv::Point>& pts, point p);
|
|
};
|