From efc1f6378e2f53ca719b821765ab29e59f3ec04f Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Mon, 30 Dec 2024 20:44:58 +0100 Subject: [PATCH] Update input handling logic in modeld.py Refactored the assignment to `self.numpy_inputs` to ensure only specific keys from `inputs` are copied, excluding 'desire'. This improves accuracy and prevents unintended data overwrites in the model pipeline. --- selfdrive/modeld/modeld.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/selfdrive/modeld/modeld.py b/selfdrive/modeld/modeld.py index f793e5f4f5..487523c9fd 100755 --- a/selfdrive/modeld/modeld.py +++ b/selfdrive/modeld/modeld.py @@ -79,7 +79,10 @@ class ModelState: self.desire_20Hz[-1] = new_desire self.numpy_inputs['desire'][:] = self.desire_20Hz.reshape(self.desire_reshape_dims).max(axis=2) - self.numpy_inputs['traffic_convention'][:] = inputs['traffic_convention'] + for key in self.numpy_inputs: + if key in inputs and key not in ['desire']: + self.numpy_inputs[key][:] = inputs[key] + imgs_cl = {'input_imgs': self.frames['input_imgs'].prepare(buf, transform.flatten()), 'big_input_imgs': self.frames['big_input_imgs'].prepare(wbuf, transform_wide.flatten())}