MCPcopy Create free account
hub / github.com/FeiYull/TensorRT-Alpha / Init

Function Init

examples/python_with_dll/c_files/pch.cpp:28–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

26// c++ code
27
28void* Init(
29 const char* trt_file_path,
30 int src_w,
31 int src_h,
32 float conf_thresh,
33 float iou_thresh,
34 int num_class
35)
36
37{
38 // parameters
39 utils::InitParameter param;
40
41 param.input_output_names = { "images", "output0" };
42 param.batch_size = 1;
43 param.src_h = src_h;
44 param.src_w = src_w;
45 param.dst_h = 640;
46 param.dst_w = 640;
47 param.iou_thresh = iou_thresh;
48 param.conf_thresh = conf_thresh;
49 param.num_class = num_class;
50
51 YOLOV8* yolov8 = new YOLOV8(param);
52
53 std::vector<unsigned char> trt_file = utils::loadModel(trt_file_path);
54 if (trt_file.empty())
55 {
56 sample::gLogError << "trt_file is empty!" << std::endl;
57 return nullptr;
58 }
59
60 if (!yolov8->init(trt_file))
61 {
62 sample::gLogError << "initEngine() ocur errors!" << std::endl;
63 return nullptr;
64 }
65 yolov8->check();
66 return yolov8;
67}
68
69
70// 2. img inference

Callers

nothing calls this directly

Calls 2

initMethod · 0.45
checkMethod · 0.45

Tested by

no test coverage detected