12345678910111213141516171819202122232425262728 |
- #ifndef inferencer_hpp
- #define inferencer_hpp
- #ifdef __ANDROID__
- #include "tensorflow/lite/model_builder.h"
- #include "tensorflow/lite/kernels/register.h"
- #else
- #include <c_api.h>
- #endif
- #include <stdio.h>
- class TfliteWrapper {
- private:
- #ifdef __ANDROID__
- std::unique_ptr<tflite::FlatBufferModel> model;
- std::unique_ptr<tflite::Interpreter> interpreter;
- TfLiteDelegate* delegate;
- #else
- TfLiteModel* model;
- TfLiteDelegate* delegate;
- TfLiteInterpreter *interpreter;
- #endif
- public:
- TfliteWrapper(const char *modelPath);
- void Invoke(const void* input_data, size_t input_data_size, void* output_data, size_t output_data_size);
- void getInputShape(uint32_t *shape, size_t size);
- ~TfliteWrapper();
- };
- #endif /* inferencer_hpp */
|