#pragma once
|
|
#include "NvInfer.h"
|
#include <cuda_runtime.h>
|
#include<device_launch_parameters.h>
|
|
#include <fstream>
|
|
#include <opencv2/opencv.hpp>
|
#include"utils.hpp"
|
|
|
using namespace nvinfer1;
|
|
class clasification {
|
|
public:
|
~clasification();
|
bool initConfig(const char* modelpath);
|
int detect(cv::Mat& image);
|
|
|
private:
|
IRuntime* runtime{ nullptr };
|
ICudaEngine* engine{ nullptr };
|
IExecutionContext* context{ nullptr };
|
|
int input_batch = 1;
|
int input_channel = 3;
|
int input_height = 224;
|
int input_width = 224;
|
int input_numel;
|
|
int num_classes = 2;
|
int output_classs = 1;
|
int output_numel;
|
|
int image_area = 1;
|
|
cudaStream_t stream = nullptr;
|
|
float* input_data_host = nullptr;
|
float* output_data_host = nullptr;
|
|
float* input_data_device = nullptr;
|
float* output_data_device = nullptr;
|
|
};
|
|