IQ.Pilot Release Commit @ 0012d8f
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
## Installation
|
## Installation
|
||||||
#### Installing Via Installer URL:
|
#### Installing Via Installer URL:
|
||||||
#### Enter the following into your device custom URL box to install IQ.Pilot:
|
#### Enter the following into your device custom URL box to install IQ.Pilot:
|
||||||
`IQLvbs/release`
|
`iqinc/release`
|
||||||
#### Having Trouble? If your device is currently running AGNOS 13.1 or older, you should install latest stock openpilot, then install IQ.Pilot, or try one of the alternative methods listed below!
|
#### Having Trouble? If your device is currently running AGNOS 13.1 or older, you should install latest stock openpilot, then install IQ.Pilot, or try one of the alternative methods listed below!
|
||||||
|
|
||||||
|
|
||||||
@@ -27,11 +27,11 @@
|
|||||||
|
|
||||||
#### Installing Via SSH:
|
#### Installing Via SSH:
|
||||||
#### Once you are connected to your device via SSH, you can paste the following command below to install IQ.Pilot:
|
#### Once you are connected to your device via SSH, you can paste the following command below to install IQ.Pilot:
|
||||||
`cd .. && rm -rf openpilot && git clone https://github.com/IQLvbs/openpilot.git -b release && cd openpilot && sudo reboot`
|
`cd .. && rm -rf openpilot && git clone https://github.com/iqinc/openpilot.git -b release && cd openpilot && sudo reboot`
|
||||||
#### If you'd like to backup your previous installation as well, paste the following command below to install IQ.Pilot:
|
#### If you'd like to backup your previous installation as well, paste the following command below to install IQ.Pilot:
|
||||||
`cd .. && mv openpilot openpilot_backup_X && git clone https://github.com/IQLvbs/openpilot.git -b release && cd openpilot && sudo reboot`
|
`cd .. && mv openpilot openpilot_backup_X && git clone https://github.com/iqinc/openpilot.git -b release && cd openpilot && sudo reboot`
|
||||||
#### Alternatively, you can use your existing fork's built in tools to switch your branch as well:
|
#### Alternatively, you can use your existing fork's built in tools to switch your branch as well:
|
||||||
`git remote add iqpilot https://github.com/IQLvbs/openpilot.git && op switch iqpilot release`
|
`git remote add iqpilot https://github.com/iqinc/openpilot.git && op switch iqpilot release`
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|||||||
@@ -9,12 +9,14 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
class ParamKeyFlag(IntFlag):
|
class ParamKeyFlag(IntFlag):
|
||||||
PERSISTENT = 1
|
# must stay in lockstep with enum ParamKeyFlag in common/params.h
|
||||||
CLEAR_ON_MANAGER_START = 2
|
PERSISTENT = 0x02
|
||||||
CLEAR_ON_ONROAD_TRANSITION = 4
|
CLEAR_ON_MANAGER_START = 0x04
|
||||||
CLEAR_ON_OFFROAD_TRANSITION = 8
|
CLEAR_ON_ONROAD_TRANSITION = 0x08
|
||||||
DONT_LOG = 16
|
CLEAR_ON_OFFROAD_TRANSITION = 0x10
|
||||||
DEVELOPMENT_ONLY = 32
|
DONT_LOG = 0x20
|
||||||
|
DEVELOPMENT_ONLY = 0x40
|
||||||
|
CLEAR_ON_IGNITION_ON = 0x80
|
||||||
ALL = 0xFFFFFFFF
|
ALL = 0xFFFFFFFF
|
||||||
|
|
||||||
class ParamKeyType(IntEnum):
|
class ParamKeyType(IntEnum):
|
||||||
|
|||||||
@@ -72,7 +72,10 @@ for model_name in ['dmonitoring_model']:
|
|||||||
# inputs (onnx + tinygrad_repo + flags + metadata script) and output hashes; if it matches, skip
|
# inputs (onnx + tinygrad_repo + flags + metadata script) and output hashes; if it matches, skip
|
||||||
# declaring the targets entirely. Any mismatch falls back to a normal on-device compile.
|
# declaring the targets entirely. Any mismatch falls back to a normal on-device compile.
|
||||||
if arch == "larch64":
|
if arch == "larch64":
|
||||||
from openpilot.selfdrive.modeld.prebuilt_models import verify_prebuilt, outputs_match
|
from openpilot.selfdrive.modeld.prebuilt_models import packaged_prebuilt_matches, verify_prebuilt, outputs_match
|
||||||
|
if packaged_prebuilt_matches(model_name):
|
||||||
|
print(lenv.PrettyNote('SKIP', f"{model_name} — packaged prebuilt pkl"))
|
||||||
|
continue
|
||||||
if verify_prebuilt(model_name, flags):
|
if verify_prebuilt(model_name, flags):
|
||||||
print(lenv.PrettyNote('SKIP', f"{model_name} — prebuilt pkl"))
|
print(lenv.PrettyNote('SKIP', f"{model_name} — prebuilt pkl"))
|
||||||
continue
|
continue
|
||||||
|
|||||||
@@ -77,7 +77,13 @@ def outputs_match(model_name: str) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
def packaged_prebuilt_matches(model_name: str) -> bool:
|
||||||
|
return not (MODELS_DIR / f'{model_name}.onnx').is_file() and outputs_match(model_name)
|
||||||
|
|
||||||
|
|
||||||
def verify_prebuilt(model_name: str, flags: str) -> bool:
|
def verify_prebuilt(model_name: str, flags: str) -> bool:
|
||||||
|
if not (MODELS_DIR / f'{model_name}.onnx').is_file():
|
||||||
|
return False
|
||||||
data = _load_checks().get(model_name, {})
|
data = _load_checks().get(model_name, {})
|
||||||
if data.get('signature') != compute_signature(model_name, flags):
|
if data.get('signature') != compute_signature(model_name, flags):
|
||||||
return False
|
return False
|
||||||
|
|||||||
51
selfdrive/modeld/test_prebuilt_models.py
Normal file
51
selfdrive/modeld/test_prebuilt_models.py
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
import hashlib
|
||||||
|
import json
|
||||||
|
|
||||||
|
from openpilot.selfdrive.modeld import prebuilt_models
|
||||||
|
|
||||||
|
|
||||||
|
def write_outputs(models_dir, check_path):
|
||||||
|
outputs = {}
|
||||||
|
for name, contents in {
|
||||||
|
'dmonitoring_model_tinygrad.pkl': b'tinygrad',
|
||||||
|
'dmonitoring_model_metadata.pkl': b'metadata',
|
||||||
|
}.items():
|
||||||
|
(models_dir / name).write_bytes(contents)
|
||||||
|
outputs[name] = hashlib.sha256(contents).hexdigest()
|
||||||
|
check_path.write_text(json.dumps({'dmonitoring_model': {'outputs': outputs}}))
|
||||||
|
|
||||||
|
|
||||||
|
def test_packaged_prebuilt_without_onnx(tmp_path, monkeypatch):
|
||||||
|
models_dir = tmp_path / 'models'
|
||||||
|
models_dir.mkdir()
|
||||||
|
check_path = models_dir / 'prebuilt_check.json'
|
||||||
|
write_outputs(models_dir, check_path)
|
||||||
|
monkeypatch.setattr(prebuilt_models, 'MODELS_DIR', models_dir)
|
||||||
|
monkeypatch.setattr(prebuilt_models, 'CHECK_PATH', check_path)
|
||||||
|
|
||||||
|
assert prebuilt_models.packaged_prebuilt_matches('dmonitoring_model')
|
||||||
|
assert not prebuilt_models.verify_prebuilt('dmonitoring_model', 'flags')
|
||||||
|
|
||||||
|
|
||||||
|
def test_packaged_prebuilt_rejects_corrupt_output(tmp_path, monkeypatch):
|
||||||
|
models_dir = tmp_path / 'models'
|
||||||
|
models_dir.mkdir()
|
||||||
|
check_path = models_dir / 'prebuilt_check.json'
|
||||||
|
write_outputs(models_dir, check_path)
|
||||||
|
(models_dir / 'dmonitoring_model_tinygrad.pkl').write_bytes(b'corrupt')
|
||||||
|
monkeypatch.setattr(prebuilt_models, 'MODELS_DIR', models_dir)
|
||||||
|
monkeypatch.setattr(prebuilt_models, 'CHECK_PATH', check_path)
|
||||||
|
|
||||||
|
assert not prebuilt_models.packaged_prebuilt_matches('dmonitoring_model')
|
||||||
|
|
||||||
|
|
||||||
|
def test_source_checkout_is_not_packaged_prebuilt(tmp_path, monkeypatch):
|
||||||
|
models_dir = tmp_path / 'models'
|
||||||
|
models_dir.mkdir()
|
||||||
|
check_path = models_dir / 'prebuilt_check.json'
|
||||||
|
write_outputs(models_dir, check_path)
|
||||||
|
(models_dir / 'dmonitoring_model.onnx').write_bytes(b'onnx')
|
||||||
|
monkeypatch.setattr(prebuilt_models, 'MODELS_DIR', models_dir)
|
||||||
|
monkeypatch.setattr(prebuilt_models, 'CHECK_PATH', check_path)
|
||||||
|
|
||||||
|
assert not prebuilt_models.packaged_prebuilt_matches('dmonitoring_model')
|
||||||
@@ -43,10 +43,7 @@ struct EncoderSettings {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static EncoderSettings QcamEncoderSettings() {
|
static EncoderSettings QcamEncoderSettings() {
|
||||||
// qcamera.ts is the small "dashcam" copy uploaded to konn3kt. Stock 256kbps @ 526x330 is potato;
|
int _qcam_bitrate = getenv("QCAM_BITRATE") ? atoi(getenv("QCAM_BITRATE")) : 3'200'000;
|
||||||
// bump the bitrate to match the higher resolution below. Still H264/.ts (web/HLS compatible) and
|
|
||||||
// ~1/4 the bitrate of fcamera.hevc, so the file stays small. Override with QCAM_BITRATE if needed.
|
|
||||||
int _qcam_bitrate = getenv("QCAM_BITRATE") ? atoi(getenv("QCAM_BITRATE")) : 1'600'000;
|
|
||||||
return EncoderSettings{.encode_type = cereal::EncodeIndex::Type::QCAMERA_H264, .bitrate = _qcam_bitrate, .gop_size = 15};
|
return EncoderSettings{.encode_type = cereal::EncodeIndex::Type::QCAMERA_H264, .bitrate = _qcam_bitrate, .gop_size = 15};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,8 +137,8 @@ const EncoderInfo qcam_encoder_info = {
|
|||||||
.filename = "qcamera.ts",
|
.filename = "qcamera.ts",
|
||||||
.cbr = true, // enforce the bitrate so upload size stays predictable (no VBR overshoot)
|
.cbr = true, // enforce the bitrate so upload size stays predictable (no VBR overshoot)
|
||||||
.get_settings = [](int){return EncoderSettings::QcamEncoderSettings();},
|
.get_settings = [](int){return EncoderSettings::QcamEncoderSettings();},
|
||||||
.frame_width = 1052, // 2x the stock 526x330, same road-cam aspect ratio
|
.frame_width = 1578, // 3x the stock 526x330, same road-cam aspect ratio
|
||||||
.frame_height = 660,
|
.frame_height = 990,
|
||||||
.include_audio = Params().getBool("RecordAudio"),
|
.include_audio = Params().getBool("RecordAudio"),
|
||||||
INIT_ENCODE_FUNCTIONS(QRoadEncode),
|
INIT_ENCODE_FUNCTIONS(QRoadEncode),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user