cyrusbehr / YOLOv8-TensorRT-CPP

YOLOv8 TensorRT C++ Implementation
MIT License
568 stars 70 forks source link

I have a question about this example #49

Closed YangSangWan closed 8 months ago

YangSangWan commented 9 months ago

I create example
-> if i push button run detect for 11times for same image.

Detection time left_1_Img = "0.5520" sec Detection time left_1_Img = "0.0840" sec Detection time left_1_Img = "0.0200" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0200" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0200" sec Detection time left_1_Img = "0.0190" sec

After a 1minutes.... I push button Detection time left_1_Img = "0.2110" sec Detection time left_1_Img = "0.1330" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0200" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0180" sec Detection time left_1_Img = "0.0200" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0200" sec Detection time left_1_Img = "0.0190" sec

After a 1minutes.... I push button Detection time left_1_Img = "0.2120" sec Detection time left_1_Img = "0.0210" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0200" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0200" sec Detection time left_1_Img = "0.0190" sec Detection time left_1_Img = "0.0200" sec

Is this tensorRT feature???

can i use option??

cyrusbehr commented 9 months ago

What exactly do you mean by “push button”?

YangSangWan commented 9 months ago

What exactly do you mean by “push button”?

sorry... it's my application's button

this is my application source code!!

This is main Thread - push button

void MainWindow::on_pushButton_2_clicked() { tesorRTThread->analysis(); }

This is TensorRTThread

void TesorRTThread::analysis(){ this->m_isLoad = true; }

void TesorRTThread::run(){ YoloV8Config config; std::string onnxModelPath = "~~.onnx";
std::string inputImage = "abcde.jpg"; YoloV8 yoloV8(onnxModelPath, config); //warm up! for(int a=0; a<30; a++){ yoloV8.detectObjects(img); } while(this->m_isLoad){ auto img = cv::imread(inputImage); for(int i =0; i < 11; i++){ end = clock(); const auto objects = yoloV8.detectObjects(img); start = clock(); qDebug() << "Detection time left_1_Img = " << QString::number( float(end - start)/CLOCKS_PER_SEC,'f',4) << " sec"; } m_isLoad = false; } }

menahemKerem commented 8 months ago

After 1 minute of inactivity, your GPU cools down, you need to rerun the warm up.