Skip to content

Commit 8a19d98

Browse files
modeld: remove support for small model (commaai#23803)
* modeld: remove support for small model * use extra
1 parent 1f66bc4 commit 8a19d98

File tree

10 files changed

+18
-35
lines changed

10 files changed

+18
-35
lines changed

models/big_supercombo.dlc

Lines changed: 0 additions & 3 deletions
This file was deleted.

models/big_supercombo.onnx

Lines changed: 0 additions & 3 deletions
This file was deleted.

models/supercombo.dlc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:209e9544e456dbc2a7d60490da65154e129bc84830909d8d931f97b3df93949b
3-
size 56684955
2+
oid sha256:ba3fe3e61853cc1434e3e220f40c8e9d1f1b9bab8458196ba3bea6a10b82c6ed
3+
size 72718099

models/supercombo.onnx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
version https://git-lfs.github.com/spec/v1
2-
oid sha256:2365bae967cce21ce68707c30bf2981bb7081ee5c3e6a3dff793e660f23ff622
3-
size 57554657
2+
oid sha256:bda57c1a66944f5a633ecd739a24d62702c717a234f2fdcc499dfa1d61c3c19e
3+
size 73147489

release/files_common

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ common/transformations/transformations.pyx
5858
common/api/__init__.py
5959

6060
models/supercombo.dlc
61-
models/big_supercombo.dlc
6261
models/dmonitoring_model_q.dlc
6362

6463
release/*

selfdrive/modeld/SConscript

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@ thneed_src = [
3131

3232
use_thneed = not GetOption('no_thneed')
3333

34-
use_extra = True # arch == "larch64"
35-
lenv['CXXFLAGS'].append('-DUSE_EXTRA=true' if use_extra else '-DUSE_EXTRA=false')
36-
3734
if arch == "aarch64" or arch == "larch64":
3835
libs += ['gsl', 'CB']
3936
libs += ['gnustl_shared'] if arch == "aarch64" else ['pthread', 'dl']
@@ -68,7 +65,7 @@ common_model = lenv.Object(common_src)
6865

6966
# build thneed model
7067
if use_thneed and arch in ("aarch64", "larch64"):
71-
fn = "../../models/big_supercombo" if use_extra else "../../models/supercombo"
68+
fn = File("#models/supercombo").abspath
7269
compiler = lenv.Program('thneed/compile', ["thneed/compile.cc"]+common_model, LIBS=libs)
7370
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} {fn}.dlc {fn}.thneed --binary"
7471

selfdrive/modeld/modeld.cc

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ mat3 update_calibration(Eigen::Matrix<float, 3, 4> &extrinsics, bool wide_camera
5151
return matmul3(yuv_transform, transform);
5252
}
5353

54-
void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcClient &vipc_client_extra, bool main_wide_camera, bool use_extra, bool use_extra_client) {
54+
void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcClient &vipc_client_extra, bool main_wide_camera, bool use_extra_client) {
5555
// messaging
5656
PubMaster pm({"modelV2", "cameraOdometry"});
5757
SubMaster sm({"lateralPlan", "roadCameraState", "liveCalibration"});
@@ -134,9 +134,7 @@ void run_model(ModelState &model, VisionIpcClient &vipc_client_main, VisionIpcCl
134134
}
135135

136136
model_transform_main = update_calibration(extrinsic_matrix_eigen, main_wide_camera, false);
137-
if (use_extra) {
138-
model_transform_extra = update_calibration(extrinsic_matrix_eigen, Hardware::TICI(), true);
139-
}
137+
model_transform_extra = update_calibration(extrinsic_matrix_eigen, Hardware::TICI(), true);
140138
live_calib_seen = true;
141139
}
142140

@@ -181,16 +179,15 @@ int main(int argc, char **argv) {
181179
}
182180

183181
bool main_wide_camera = Hardware::TICI() ? Params().getBool("EnableWideCamera") : false;
184-
bool use_extra = USE_EXTRA;
185-
bool use_extra_client = Hardware::TICI() && use_extra && !main_wide_camera;
182+
bool use_extra_client = Hardware::TICI() && !main_wide_camera;
186183

187184
// cl init
188185
cl_device_id device_id = cl_get_device_id(CL_DEVICE_TYPE_DEFAULT);
189186
cl_context context = CL_CHECK_ERR(clCreateContext(NULL, 1, &device_id, NULL, NULL, &err));
190187

191188
// init the models
192189
ModelState model;
193-
model_init(&model, device_id, context, use_extra);
190+
model_init(&model, device_id, context);
194191
LOGW("models loaded, modeld starting");
195192

196193
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) {
215212
LOGW("connected extra cam with buffer size: %d (%d x %d)", wb->len, wb->width, wb->height);
216213
}
217214

218-
run_model(model, vipc_client_main, vipc_client_extra, main_wide_camera, use_extra, use_extra_client);
215+
run_model(model, vipc_client_main, vipc_client_extra, main_wide_camera, use_extra_client);
219216
}
220217

221218
model_free(&model);

selfdrive/modeld/models/driving.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,20 +26,18 @@ constexpr const kj::ArrayPtr<const T> to_kj_array_ptr(const std::array<T, size>
2626
return kj::ArrayPtr(arr.data(), arr.size());
2727
}
2828

29-
void model_init(ModelState* s, cl_device_id device_id, cl_context context, bool use_extra) {
29+
void model_init(ModelState* s, cl_device_id device_id, cl_context context) {
3030
s->frame = new ModelFrame(device_id, context);
3131
s->wide_frame = new ModelFrame(device_id, context);
3232

3333
#ifdef USE_THNEED
34-
s->m = std::make_unique<ThneedModel>(use_extra ? "../../models/big_supercombo.thneed" : "../../models/supercombo.thneed",
35-
&s->output[0], NET_OUTPUT_SIZE, USE_GPU_RUNTIME, use_extra);
34+
s->m = std::make_unique<ThneedModel>("../../models/supercombo.thneed",
3635
#elif USE_ONNX_MODEL
37-
s->m = std::make_unique<ONNXModel>(use_extra ? "../../models/big_supercombo.onnx" : "../../models/supercombo.onnx",
38-
&s->output[0], NET_OUTPUT_SIZE, USE_GPU_RUNTIME, use_extra);
36+
s->m = std::make_unique<ONNXModel>("../../models/supercombo.onnx",
3937
#else
40-
s->m = std::make_unique<SNPEModel>(use_extra ? "../../models/big_supercombo.dlc" : "../../models/supercombo.dlc",
41-
&s->output[0], NET_OUTPUT_SIZE, USE_GPU_RUNTIME, use_extra);
38+
s->m = std::make_unique<SNPEModel>("../../models/supercombo.dlc",
4239
#endif
40+
&s->output[0], NET_OUTPUT_SIZE, USE_GPU_RUNTIME, true);
4341

4442
#ifdef TEMPORAL
4543
s->m->addRecurrent(&s->output[OUTPUT_SIZE], TEMPORAL_SIZE);

selfdrive/modeld/models/driving.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ struct ModelState {
266266
#endif
267267
};
268268

269-
void model_init(ModelState* s, cl_device_id device_id, cl_context context, bool use_extra);
269+
void model_init(ModelState* s, cl_device_id device_id, cl_context context);
270270
ModelOutput *model_eval_frame(ModelState* s, VisionBuf* buf, VisionBuf* buf_wide,
271271
const mat3 &transform, const mat3 &transform_wide, float *desire_in);
272272
void model_free(ModelState* s);

selfdrive/modeld/thneed/compile.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ int main(int argc, char* argv[]) {
1313
#define OUTPUT_SIZE 0x10000
1414

1515
float *output = (float*)calloc(OUTPUT_SIZE, sizeof(float));
16-
SNPEModel mdl(argv[1], output, 0, USE_GPU_RUNTIME, USE_EXTRA);
16+
SNPEModel mdl(argv[1], output, 0, USE_GPU_RUNTIME, true);
1717

1818
float state[TEMPORAL_SIZE] = {0};
1919
float desire[DESIRE_LEN] = {0};
@@ -25,9 +25,7 @@ int main(int argc, char* argv[]) {
2525
mdl.addDesire(desire, DESIRE_LEN);
2626
mdl.addTrafficConvention(traffic_convention, TRAFFIC_CONVENTION_LEN);
2727
mdl.addImage(input, 0);
28-
if (USE_EXTRA) {
29-
mdl.addExtra(extra, 0);
30-
}
28+
mdl.addExtra(extra, 0);
3129

3230
// first run
3331
printf("************** execute 1 **************\n");

0 commit comments

Comments
 (0)