#pragma once
|
#include "NvInfer.h"
|
|
#include <cuda_runtime.h>
|
#include <device_launch_parameters.h>
|
#include <assert.h>
|
#include <fstream>
|
#include <string>
|
#include <opencv2/opencv.hpp>
|
#include "../utils.hpp"
|
|
using namespace nvinfer1;
|
|
class BELT {
|
|
public:
|
|
~BELT();
|
bool isLoad = false;//是否加载
|
//leftarea�й�������,rightarea�й�������,beltareaƤ������˳ʱ�봫��4�����xy���꣬x1,y1,x2,y2,x3,y3,x4,y4,��8��ֵ
|
bool initConfig(const char* enginefile, int* leftarea, int* rightarea, int* beltarea,
|
float bigcoal_threshold = 0.4, float beltdeviation_threshold = 0.3, float confThreshold = 0.5);
|
int detect(cv::Mat& image, std::vector<Box>& boxes);
|
|
|
private:
|
IRuntime* runtime{ nullptr };
|
ICudaEngine* engine{ nullptr };
|
IExecutionContext* context{ nullptr };
|
|
int input_batch = 1;
|
int input_channel = 3;
|
int input_height = 640;
|
int input_width = 640;
|
int input_numel;
|
|
int num_classes = 1;
|
int output_numbox;
|
int output_numprob;
|
int output_numel;
|
|
cudaStream_t stream = nullptr;
|
|
float threshold = 0.2;//��ú��ֱ����ֵ����ֵΪú��ռƤ��������ȵı���
|
float threshold_ = 0.05;//Ƥ����ƫ��ֵ,��ֵΪƤ��ƫ����ռƤ��������ȵı���
|
float confThreshold_ = 0.5;//������ֵ
|
float nmsThreshold_ = 0.45;
|
|
float* input_data_host = nullptr;
|
float* output_data_host = nullptr;
|
|
float* input_data_device = nullptr;
|
float* output_data_device = nullptr;
|
|
std::vector<point> leftarea_;//�й�������㼯(˳ʱ��)
|
std::vector<point> rightarea_;//�й�������㼯(˳ʱ��)
|
std::vector<point> beltarea_;//Ƥ������㼯(˳ʱ��)
|
float belt_top_cy, belt_bottom_cy;//Ƥ���������±��е��y
|
float belt_top_length, belt_bottom_length;//Ƥ���������±ߵ����س���
|
float k;//����/���ض���y���صı任��б��
|
//float belt_length=1;//Ƥ���������(����)
|
//k = (belt_length / belt_top_length - belt_length / belt_bottom_length)/(belt_top_cy- belt_bottom_cy);
|
//lpx =k * (y- belt_top_cy) + belt_length / belt_top_length;//����ÿ��yλ�ö�Ӧ���صĺ���
|
};
|