Advertisement
antifa-chad

Untitled

Jul 22nd, 2024
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. In [39]: lines[9]
  2. Out[39]: 't0:1721420698.512 tF:1721420932.338: fasterrcnn_resnet50_fpn/torchreid: total_fps: 15.6, track_fps: 47.67934158624061, max_id: 30\n'
  3.  
  4. In [40]: %cpaste
  5. Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
  6. :import re
  7.  
  8. SPLIT_RE = re.compile("[:,]? |[:,]") # evan is silly and didn't make it easy to parse
  9.  
  10. def split_fields(line):
  11.     fs = SPLIT_RE.split(line.strip())
  12.  
  13.     kind = fs.pop(4)
  14.  
  15.     return kind, {k: float(v) for (k, v) in zip(fs[::2], fs[1:::2])}
  16.  
  17. ::::::::::
  18. :--
  19.  
  20. In [41]:
  21.  
  22. In [41]: split_fields(lines[9])
  23. Out[41]:
  24. ('fasterrcnn_resnet50_fpn/torchreid',
  25.  {'t0': 1721420698.512,
  26.   'tF': 1721420932.338,
  27.   'total_fps': 15.6,
  28.   'track_fps': 47.67934158624061,
  29.   'max_id': 30.0})
  30.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement