mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-02-18 20:03:53 +08:00
modeld: remove support for small model (#23803)
* modeld: remove support for small model
* use extra
old-commit-hash: 8a19d9892e
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ba3fe3e61853cc1434e3e220f40c8e9d1f1b9bab8458196ba3bea6a10b82c6ed
|
||||
size 72718099
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:bda57c1a66944f5a633ecd739a24d62702c717a234f2fdcc499dfa1d61c3c19e
|
||||
size 73147489
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:209e9544e456dbc2a7d60490da65154e129bc84830909d8d931f97b3df93949b
|
||||
size 56684955
|
||||
oid sha256:ba3fe3e61853cc1434e3e220f40c8e9d1f1b9bab8458196ba3bea6a10b82c6ed
|
||||
size 72718099
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:2365bae967cce21ce68707c30bf2981bb7081ee5c3e6a3dff793e660f23ff622
|
||||
size 57554657
|
||||
oid sha256:bda57c1a66944f5a633ecd739a24d62702c717a234f2fdcc499dfa1d61c3c19e
|
||||
size 73147489
|
||||
|
||||
@@ -58,7 +58,6 @@ common/transformations/transformations.pyx
|
||||
common/api/__init__.py
|
||||
|
||||
models/supercombo.dlc
|
||||
models/big_supercombo.dlc
|
||||
models/dmonitoring_model_q.dlc
|
||||
|
||||
release/*
|
||||
|
||||
@@ -31,9 +31,6 @@ thneed_src = [
|
||||
|
||||
use_thneed = not GetOption('no_thneed')
|
||||
|
||||
use_extra = True # arch == "larch64"
|
||||
lenv['CXXFLAGS'].append('-DUSE_EXTRA=true' if use_extra else '-DUSE_EXTRA=false')
|
||||
|
||||
if arch == "aarch64" or arch == "larch64":
|
||||
libs += ['gsl', 'CB']
|
||||
libs += ['gnustl_shared'] if arch == "aarch64" else ['pthread', 'dl']
|
||||
@@ -68,7 +65,7 @@ common_model = lenv.Object(common_src)
|
||||
|
||||
# build thneed model
|
||||
if use_thneed and arch in ("aarch64", "larch64"):
|
||||
fn = "../../models/big_supercombo" if use_extra else "../../models/supercombo"
|
||||
fn = File("#models/supercombo").abspath
|
||||
compiler = lenv.Program('thneed/compile', ["thneed/compile.cc"]+common_model, LIBS=libs)
|
||||
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} {fn}.dlc {fn}.thneed --binary"
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ mat3 update_calibration(Eigen::Matrix<float, 3, 4> &extrinsics, bool wide_camera
|
||||
return matmul3(yuv_transform, transform);
|
||||
}
|
||||
|
||||
void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcClient &vipc_client_extra, bool main_wide_camera, bool use_extra, bool use_extra_client) {
|
||||
void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcClient &vipc_client_extra, bool main_wide_camera, bool use_extra_client) {
|
||||
// messaging
|
||||
PubMaster pm({"modelV2", "cameraOdometry"});
|
||||
SubMaster sm({"lateralPlan", "roadCameraState", "liveCalibration"});
|
||||
@@ -134,9 +134,7 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
|
||||
}
|
||||
|
||||
model_transform_main = update_calibration(extrinsic_matrix_eigen, main_wide_camera, false);
|
||||
if (use_extra) {
|
||||
model_transform_extra = update_calibration(extrinsic_matrix_eigen, Hardware::TICI(), true);
|
||||
}
|
||||
model_transform_extra = update_calibration(extrinsic_matrix_eigen, Hardware::TICI(), true);
|
||||
live_calib_seen = true;
|
||||
}
|
||||
|
||||
@@ -181,8 +179,7 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
|
||||
bool main_wide_camera = Hardware::TICI() ? Params().getBool("EnableWideCamera") : false;
|
||||
bool use_extra = USE_EXTRA;
|
||||
bool use_extra_client = Hardware::TICI() && use_extra && !main_wide_camera;
|
||||
bool use_extra_client = Hardware::TICI() && !main_wide_camera;
|
||||
|
||||
// cl init
|
||||
cl_device_id device_id = cl_get_device_id(CL_DEVICE_TYPE_DEFAULT);
|
||||
@@ -190,7 +187,7 @@ int main(int argc, char **argv) {
|
||||
|
||||
// init the models
|
||||
ModelState model;
|
||||
model_init(&model, device_id, context, use_extra);
|
||||
model_init(&model, device_id, context);
|
||||
LOGW("models loaded, modeld starting");
|
||||
|
||||
VisionIpcClient vipc_client_main = VisionIpcClient("camerad", main_wide_camera ? VISION_STREAM_WIDE_ROAD : VISION_STREAM_ROAD, true, device_id, context);
|
||||
@@ -215,7 +212,7 @@ int main(int argc, char **argv) {
|
||||
LOGW("connected extra cam with buffer size: %d (%d x %d)", wb->len, wb->width, wb->height);
|
||||
}
|
||||
|
||||
run_model(model, vipc_client_main, vipc_client_extra, main_wide_camera, use_extra, use_extra_client);
|
||||
run_model(model, vipc_client_main, vipc_client_extra, main_wide_camera, use_extra_client);
|
||||
}
|
||||
|
||||
model_free(&model);
|
||||
|
||||
@@ -26,20 +26,18 @@ constexpr const kj::ArrayPtr<const T> to_kj_array_ptr(const std::array<T, size>
|
||||
return kj::ArrayPtr(arr.data(), arr.size());
|
||||
}
|
||||
|
||||
void model_init(ModelState* s, cl_device_id device_id, cl_context context, bool use_extra) {
|
||||
void model_init(ModelState* s, cl_device_id device_id, cl_context context) {
|
||||
s->frame = new ModelFrame(device_id, context);
|
||||
s->wide_frame = new ModelFrame(device_id, context);
|
||||
|
||||
#ifdef USE_THNEED
|
||||
s->m = std::make_unique<ThneedModel>(use_extra ? "../../models/big_supercombo.thneed" : "../../models/supercombo.thneed",
|
||||
&s->output[0], NET_OUTPUT_SIZE, USE_GPU_RUNTIME, use_extra);
|
||||
s->m = std::make_unique<ThneedModel>("../../models/supercombo.thneed",
|
||||
#elif USE_ONNX_MODEL
|
||||
s->m = std::make_unique<ONNXModel>(use_extra ? "../../models/big_supercombo.onnx" : "../../models/supercombo.onnx",
|
||||
&s->output[0], NET_OUTPUT_SIZE, USE_GPU_RUNTIME, use_extra);
|
||||
s->m = std::make_unique<ONNXModel>("../../models/supercombo.onnx",
|
||||
#else
|
||||
s->m = std::make_unique<SNPEModel>(use_extra ? "../../models/big_supercombo.dlc" : "../../models/supercombo.dlc",
|
||||
&s->output[0], NET_OUTPUT_SIZE, USE_GPU_RUNTIME, use_extra);
|
||||
s->m = std::make_unique<SNPEModel>("../../models/supercombo.dlc",
|
||||
#endif
|
||||
&s->output[0], NET_OUTPUT_SIZE, USE_GPU_RUNTIME, true);
|
||||
|
||||
#ifdef TEMPORAL
|
||||
s->m->addRecurrent(&s->output[OUTPUT_SIZE], TEMPORAL_SIZE);
|
||||
|
||||
@@ -266,7 +266,7 @@ struct ModelState {
|
||||
#endif
|
||||
};
|
||||
|
||||
void model_init(ModelState* s, cl_device_id device_id, cl_context context, bool use_extra);
|
||||
void model_init(ModelState* s, cl_device_id device_id, cl_context context);
|
||||
ModelOutput *model_eval_frame(ModelState* s, VisionBuf* buf, VisionBuf* buf_wide,
|
||||
const mat3 &transform, const mat3 &transform_wide, float *desire_in);
|
||||
void model_free(ModelState* s);
|
||||
|
||||
@@ -13,7 +13,7 @@ int main(int argc, char* argv[]) {
|
||||
#define OUTPUT_SIZE 0x10000
|
||||
|
||||
float *output = (float*)calloc(OUTPUT_SIZE, sizeof(float));
|
||||
SNPEModel mdl(argv[1], output, 0, USE_GPU_RUNTIME, USE_EXTRA);
|
||||
SNPEModel mdl(argv[1], output, 0, USE_GPU_RUNTIME, true);
|
||||
|
||||
float state[TEMPORAL_SIZE] = {0};
|
||||
float desire[DESIRE_LEN] = {0};
|
||||
@@ -25,9 +25,7 @@ int main(int argc, char* argv[]) {
|
||||
mdl.addDesire(desire, DESIRE_LEN);
|
||||
mdl.addTrafficConvention(traffic_convention, TRAFFIC_CONVENTION_LEN);
|
||||
mdl.addImage(input, 0);
|
||||
if (USE_EXTRA) {
|
||||
mdl.addExtra(extra, 0);
|
||||
}
|
||||
mdl.addExtra(extra, 0);
|
||||
|
||||
// first run
|
||||
printf("************** execute 1 **************\n");
|
||||
|
||||
Reference in New Issue
Block a user