mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-19 08:12:07 +08:00
e8a8e37185
* update cereal * run but not use * log distraction type * regression scaling * clean up naming * add calib buf * add to header * fake model * no calib model * adjust threshs * 018a305f * fix bn * tweak1 * tweak2 * 0ff2/666 * tweak3 * t4 * t5 * fix out of bound * skip when replaying old segments * update ref * fix onnxmodel * get calib * update model replay refs * up ref old-commit-hash: de4031c98eac2d7151bb99b787e5d68193eee1b3
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
#pragma once
|
|
|
|
#include <cstdlib>
|
|
|
|
#include "selfdrive/modeld/runners/runmodel.h"
|
|
|
|
class ONNXModel : public RunModel {
|
|
public:
|
|
ONNXModel(const char *path, float *output, size_t output_size, int runtime, bool use_extra = false);
|
|
~ONNXModel();
|
|
void addRecurrent(float *state, int state_size);
|
|
void addDesire(float *state, int state_size);
|
|
void addTrafficConvention(float *state, int state_size);
|
|
void addCalib(float *state, int state_size);
|
|
void addImage(float *image_buf, int buf_size);
|
|
void addExtra(float *image_buf, int buf_size);
|
|
void execute();
|
|
private:
|
|
int proc_pid;
|
|
|
|
float *output;
|
|
size_t output_size;
|
|
|
|
float *rnn_input_buf = NULL;
|
|
int rnn_state_size;
|
|
float *desire_input_buf = NULL;
|
|
int desire_state_size;
|
|
float *traffic_convention_input_buf = NULL;
|
|
int traffic_convention_size;
|
|
float *calib_input_buf = NULL;
|
|
int calib_size;
|
|
float *image_input_buf = NULL;
|
|
int image_buf_size;
|
|
float *extra_input_buf = NULL;
|
|
int extra_buf_size;
|
|
bool use_extra;
|
|
|
|
// pipe to communicate to keras subprocess
|
|
void pread(float *buf, int size);
|
|
void pwrite(float *buf, int size);
|
|
int pipein[2];
|
|
int pipeout[2];
|
|
};
|
|
|