diff --git a/ai_controller/src-ncnn/aiengineinferencencnn.cpp b/ai_controller/src-ncnn/aiengineinferencencnn.cpp index edd303a..b113fe9 100644 --- a/ai_controller/src-ncnn/aiengineinferencencnn.cpp +++ b/ai_controller/src-ncnn/aiengineinferencencnn.cpp @@ -1,6 +1,5 @@ #include #include -#include #include #include "aiengineinferencencnn.h" @@ -23,7 +22,7 @@ char* getCharPointerCopy(const QString& modelPath) { AiEngineInferencevNcnn::AiEngineInferencevNcnn(QString modelPath, QObject *parent) : AiEngineInference{modelPath, parent} { - qDebug() << "TUOMAS AiEngineInferencevNcnn() mModelPath=" << mModelPath; + qDebug() << "AiEngineInferencevNcnn() mModelPath=" << mModelPath; yolov8.opt.num_threads = 4; yolov8.opt.use_vulkan_compute = false; @@ -32,9 +31,6 @@ AiEngineInferencevNcnn::AiEngineInferencevNcnn(QString modelPath, QObject *paren char *model = getCharPointerCopy(modelPath); char *param = getCharPointerCopy(paramPath); - qDebug() << "model:" << model; - qDebug() << "param:" << param; - yolov8.load_param(param); yolov8.load_model(model); } @@ -229,8 +225,6 @@ int AiEngineInferencevNcnn::detect_yolov8(const cv::Mat& bgr, std::vector(end - start); - std::cout << "Time taken: " << duration.count() << " milliseconds" << std::endl; return 0; } @@ -340,8 +331,7 @@ static cv::Mat draw_objects(const cv::Mat& bgr, const std::vector& objec cv::Scalar cc(color[0], color[1], color[2]); - fprintf(stderr, "%d = %.5f at %.2f %.2f %.2f x %.2f\n", obj.label, obj.prob, - obj.rect.x, obj.rect.y, obj.rect.width, obj.rect.height); + //fprintf(stderr, "%d = %.5f at %.2f %.2f %.2f x %.2f\n", obj.label, obj.prob, obj.rect.x, obj.rect.y, obj.rect.width, obj.rect.height); cv::rectangle(image, obj.rect, cc, 2); @@ -378,26 +368,23 @@ void AiEngineInferencevNcnn::performInferenceSlot(cv::Mat frame) std::vector objects; detect_yolov8(scaledImage, objects); - if (objects.empty() == false) { - AiEngineInferenceResult result; - result.frame = draw_objects(scaledImage, objects); + AiEngineInferenceResult result; + result.frame = draw_objects(scaledImage, objects); - for (uint i = 0; i < objects.size(); i++) { - const Object &detection = objects[i]; - AiEngineObject object; - object.classId = detection.label; - object.classStr = mClassNames[detection.label]; - object.propability = detection.prob; - object.rectangle.top = detection.rect.y; - object.rectangle.left = detection.rect.x; - object.rectangle.bottom = detection.rect.y + detection.rect.height; - object.rectangle.right = detection.rect.x + detection.rect.width; - result.objects.append(object); - } - - emit resultsReady(result); + for (uint i = 0; i < objects.size(); i++) { + const Object &detection = objects[i]; + AiEngineObject object; + object.classId = detection.label; + object.classStr = mClassNames[detection.label]; + object.propability = detection.prob; + object.rectangle.top = detection.rect.y; + object.rectangle.left = detection.rect.x; + object.rectangle.bottom = detection.rect.y + detection.rect.height; + object.rectangle.right = detection.rect.x + detection.rect.width; + result.objects.append(object); } + emit resultsReady(result); mActive = false; }