mirror of
https://github.com/azaion/autopilot.git
synced 2026-04-22 21:56:35 +00:00
be59a02f9b
Save bmp images of inference results to /tmp as bmp files. BMP was chosen to reduce encoding time. Saving is fully threaded. It can be enable with qmake CONFIG+=save_images option Also: - use antialised fonts in RKNN inference - moved class strings to inference base class - fixed silly segfault in ONNX inference - prevent writing results if class if exceeds valid values Issue: https://denyspopov.atlassian.net/browse/AZ-38 Type: Improvement
51 lines
985 B
C++
51 lines
985 B
C++
#pragma once
|
|
|
|
#include <QObject>
|
|
#include <QString>
|
|
#include <QVector>
|
|
#include <opencv2/core.hpp>
|
|
#include <opencv2/imgproc.hpp>
|
|
#include "aienginedefinitions.h"
|
|
|
|
|
|
const int INFERENCE_SQUARE_WIDTH = 640;
|
|
const int INFERENCE_SQUARE_HEIGHT = 640;
|
|
|
|
|
|
class AiEngineObject {
|
|
public:
|
|
AiEngineRectangle rectangle;
|
|
float propability;
|
|
int classId;
|
|
QString classStr;
|
|
};
|
|
|
|
|
|
class AiEngineInferenceResult {
|
|
public:
|
|
cv::Mat frame;
|
|
QVector<AiEngineObject> objects;
|
|
};
|
|
|
|
|
|
class AiEngineInference : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit AiEngineInference(QString modelPath, QObject *parent = nullptr);
|
|
bool isActive(void);
|
|
|
|
protected:
|
|
cv::Mat resizeAndPad(const cv::Mat& src);
|
|
QString mModelPath;
|
|
bool mActive;
|
|
int mNumber;
|
|
QVector<QString> mClassNames;
|
|
|
|
public slots:
|
|
virtual void performInferenceSlot(cv::Mat frame) = 0;
|
|
virtual void initialize(int number) = 0;
|
|
signals:
|
|
void resultsReady(AiEngineInferenceResult results);
|
|
};
|