modeld: remove support for small model (#23803)

* modeld: remove support for small model

* use extra
pull/23881/head
Adeeb Shihadeh 2022-02-28 10:32:39 -08:00 committed by GitHub
parent 1f66bc46b3
commit 8a19d9892e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 18 additions and 35 deletions

BIN
models/big_supercombo.dlc (Stored with Git LFS)

Binary file not shown.

BIN
models/big_supercombo.onnx (Stored with Git LFS)

Binary file not shown.

BIN
models/supercombo.dlc (Stored with Git LFS)

Binary file not shown.

BIN
models/supercombo.onnx (Stored with Git LFS)

Binary file not shown.

View File

@ -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/*

View File

@ -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"

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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");