-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmxpredict.h
38 lines (34 loc) · 1.07 KB
/
mxpredict.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#ifndef MXPREDICT_H
#define MXPREDICT_H
#include <QObject>
#include <QVariantList>
#include <mxnet/c_predict_api.h>
#include "bufferfile.h"
#include "DB.h"
class MXPredict : public QObject
{
Q_PROPERTY(QVariantList things READ getData NOTIFY dataChanged)
Q_OBJECT
public:
explicit MXPredict(QObject *parent = nullptr);
Q_INVOKABLE int predict(QString path);
Q_INVOKABLE bool modelExists();
Q_INVOKABLE void setData(QVariantList list);
Q_INVOKABLE QVariantList getData() const {return list;};
private:
QVariantList list;
std::vector<std::string> LoadSynset(std::string synset_file);
void GetImageFile(QString image_file, mx_float* image_data, const int channels, const int width);
void PrintOutputResult(const std::vector<float>& data, const std::vector<std::string>& synset);
std::vector<std::string> synset;
DB database;
BufferFile param_data;
BufferFile json_data;
bool synset_loaded = false;
bool params_loaded = false;
bool json_loaded = false;
signals:
void dataChanged();
public slots:
};
#endif // MXPREDICT_H