Added model_replay and fixed some bugs in camera_replay (#2679)
* Added model_replay and fixed some bugs in camera_replay * Unpack capnp logs on device * add sync to device * GPU now also works on PC * update model ref * update refs * dont change this one * Use pipeline calib instead of rlog calib * remove that * update refs Co-authored-by: Willem Melching <willem.melching@gmail.com> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>pull/2725/head
parent
c6d68d5552
commit
bbe9accd4d
5 changed files with 68 additions and 18 deletions
@ -0,0 +1,30 @@ |
||||
#!/usr/bin/env python3 |
||||
import os |
||||
import numpy as np |
||||
|
||||
from tools.lib.logreader import LogReader |
||||
from tools.lib.framereader import FrameReader |
||||
from tools.lib.cache import cache_path_for_file_path |
||||
from selfdrive.test.process_replay.camera_replay import camera_replay |
||||
|
||||
|
||||
if __name__ == "__main__": |
||||
lr = LogReader(os.path.expanduser('~/rlog.bz2')) |
||||
fr = FrameReader(os.path.expanduser('~/fcamera.hevc')) |
||||
desire = np.load(os.path.expanduser('~/desire.npy')) |
||||
calib = np.load(os.path.expanduser('~/calib.npy')) |
||||
|
||||
try: |
||||
msgs = camera_replay(list(lr), fr, desire=desire, calib=calib) |
||||
finally: |
||||
cache_path = cache_path_for_file_path(os.path.expanduser('~/fcamera.hevc')) |
||||
if os.path.isfile(cache_path): |
||||
os.remove(cache_path) |
||||
|
||||
output_size = len(np.frombuffer(msgs[0].model.rawPred, dtype=np.float32)) |
||||
output_data = np.zeros((len(msgs), output_size), dtype=np.float32) |
||||
for i, msg in enumerate(msgs): |
||||
output_data[i] = np.frombuffer(msg.model.rawPred, dtype=np.float32) |
||||
np.save(os.path.expanduser('~/modeldata.npy'), output_data) |
||||
|
||||
print("Finished replay") |
@ -1 +1 @@ |
||||
0d5ecd64a10debf2f62e27fc23738ccce9d1cdb3 |
||||
f040d87da71d8d9b29000b0eeea43d4f932137dd |
Loading…
Reference in new issue