Skip to content

Commit d6886b2

Browse files
committed
Big Model
Big Model Big Model Big Model bigmodel commaai/openpilot#23684 bigmodel - missing kernels bigmodel commaai/openpilot#23684 bigmodel - missing kernels
1 parent f4c0b46 commit d6886b2

27 files changed

+809
-272
lines changed

.gitignore

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,4 @@ models/*.thneed
8282
build/
8383

8484
!**/.gitkeep
85-
.vs/slnx.sqlite
86-
.vs/VSWorkspaceState.json
87-
*.sqlite
88-
.vs/moodkiller/v17/.suo
8985
.vs/

models/big_supercombo.dlc

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

models/big_supercombo.onnx

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

release/files_common

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

6060
models/supercombo.dlc
61+
models/big_supercombo.dlc
6162
models/dmonitoring_model_q.dlc
6263

6364
release/*

selfdrive/controls/lib/lane_planner.py

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,24 @@
88
from common.params import Params
99

1010

11-
TRAJECTORY_SIZE = 33
12-
# camera offset is meters from center car to camera
13-
1411
# Get offset from param file
1512
params = Params()
1613
CameraOffset = float(params.get("CameraOffset", encoding='utf8'))
1714
# print("User defined Camera Offset value in CM is:", CameraOffset)
1815

16+
TRAJECTORY_SIZE = 33
17+
# camera offset is meters from center car to camera
18+
# model path is in the frame of the camera. Empirically
19+
# the model knows the difference between TICI and EON
20+
# so a path offset is not needed
21+
PATH_OFFSET = 0.00 + CameraOffset / 100
22+
1923
if EON:
20-
CAMERA_OFFSET = 0.06 + CameraOffset / 100
21-
PATH_OFFSET = 0.0 + CameraOffset / 100
24+
CAMERA_OFFSET = -0.06 + CameraOffset / 100
2225
elif TICI:
23-
CAMERA_OFFSET = -0.04 + CameraOffset / 100
24-
PATH_OFFSET = -0.04 + CameraOffset / 100
26+
CAMERA_OFFSET = 0.04 + CameraOffset / 100
2527
else:
2628
CAMERA_OFFSET = 0.0 + CameraOffset / 100
27-
PATH_OFFSET = 0.0 + CameraOffset / 100
2829

2930
# print("New CAMERA_OFFSET value in M is:", CAMERA_OFFSET)
3031

@@ -51,26 +52,15 @@ def __init__(self, wide_camera=False):
5152
self.camera_offset = -CAMERA_OFFSET if wide_camera else CAMERA_OFFSET
5253
self.path_offset = -PATH_OFFSET if wide_camera else PATH_OFFSET
5354

54-
# self.CameraOffset = None
55-
# self.CameraOffset = None
56-
57-
# def update_sunny_set_offsets(self, camera_offset, path_offset):
58-
# if self.CameraOffset != camera_offset:
59-
# self.CameraOffset = camera_offset
60-
# self.camera_offset = camera_offset / 100
61-
62-
# if self.CameraOffset != path_offset:
63-
# self.CameraOffset = path_offset
64-
# self.path_offset = path_offset / 100
6555

6656
def parse_model(self, md):
6757
if len(md.laneLines) == 4 and len(md.laneLines[0].t) == TRAJECTORY_SIZE:
6858
self.ll_t = (np.array(md.laneLines[1].t) + np.array(md.laneLines[2].t))/2
6959
# left and right ll x is the same
7060
self.ll_x = md.laneLines[1].x
7161
# only offset left and right lane lines; offsetting path does not make sense
72-
self.lll_y = np.array(md.laneLines[1].y) - self.camera_offset
73-
self.rll_y = np.array(md.laneLines[2].y) - self.camera_offset
62+
self.lll_y = np.array(md.laneLines[1].y) + self.camera_offset
63+
self.rll_y = np.array(md.laneLines[2].y) + self.camera_offset
7464
self.lll_prob = md.laneLineProbs[1]
7565
self.rll_prob = md.laneLineProbs[2]
7666
self.lll_std = md.laneLineStds[1]
@@ -83,7 +73,7 @@ def parse_model(self, md):
8373
def get_d_path(self, v_ego, path_t, path_xyz):
8474
# Reduce reliance on lanelines that are too far apart or
8575
# will be in a few seconds
86-
path_xyz[:, 1] -= self.path_offset
76+
path_xyz[:, 1] += self.path_offset
8777
l_prob, r_prob = self.lll_prob, self.rll_prob
8878
width_pts = self.rll_y - self.lll_y
8979
prob_mods = []

selfdrive/modeld/SConscript

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import os
2+
13
Import('env', 'arch', 'cereal', 'messaging', 'common', 'gpucommon', 'visionipc')
24
lenv = env.Clone()
35

@@ -28,6 +30,9 @@ thneed_src = [
2830

2931
use_thneed = not GetOption('no_thneed')
3032

33+
use_extra = True # arch == "larch64"
34+
lenv['CXXFLAGS'].append('-DUSE_EXTRA=true' if use_extra else '-DUSE_EXTRA=false')
35+
3136
if arch == "aarch64" or arch == "larch64":
3237
libs += ['gsl', 'CB']
3338
libs += ['gnustl_shared'] if arch == "aarch64" else ['pthread', 'dl']
@@ -62,12 +67,16 @@ common_model = lenv.Object(common_src)
6267

6368
# build thneed model
6469
if use_thneed and arch in ("aarch64", "larch64"):
70+
fn = "../../models/big_supercombo" if use_extra else "../../models/supercombo"
6571
compiler = lenv.Program('thneed/compile', ["thneed/compile.cc"]+common_model, LIBS=libs)
66-
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} ../../models/supercombo.dlc ../../models/supercombo.thneed --binary"
72+
cmd = f"cd {Dir('.').abspath} && {compiler[0].abspath} {fn}.dlc {fn}.thneed --binary"
6773

6874
lib_paths = ':'.join(Dir(p).abspath for p in lenv["LIBPATH"])
69-
cenv = Environment(ENV={'LD_LIBRARY_PATH': f"{lib_paths}:{lenv['ENV']['LD_LIBRARY_PATH']}"})
70-
cenv.Command("../../models/supercombo.thneed", ["../../models/supercombo.dlc", compiler], cmd)
75+
kernel_path = os.path.join(Dir('.').abspath, "thneed", "kernels")
76+
cenv = Environment(ENV={'LD_LIBRARY_PATH': f"{lib_paths}:{lenv['ENV']['LD_LIBRARY_PATH']}", 'KERNEL_PATH': kernel_path})
77+
78+
kernels = [os.path.join(kernel_path, x) for x in os.listdir(kernel_path) if x.endswith(".cl")]
79+
cenv.Command(fn + ".thneed", [fn + ".dlc", kernels, compiler], cmd)
7180

7281
lenv.Program('_dmonitoringmodeld', [
7382
"dmonitoringmodeld.cc",

0 commit comments

Comments
 (0)