Scraping ksnn logs

Is there any method in python to scrape the logs generated during ksnn inference (when level=2)?

Example: For the below log, I’d wish to capture all the displayed metrics as key-value pairs in json

|--- KSNN Version: v1.0 +---|
Start init neural network ...
#productname=VIPNano-QI, pid=0x88
Create Neural Network: 78ms or 78626us
Done.
Get input data ...
Done.
Start inference ...
Start run graph [1] times...
generate command buffer, total device count=1, core count per-device: 1,
current device id=0, AXI SRAM base address=0xff000000
---------------------------Begin VerifyTiling -------------------------
AXI-SRAM = 1048576 Bytes VIP-SRAM = 522240 Bytes SWTILING_PHASE_FEATURES[1, 1, 0]
  0 NBG [(   0    0    0 0,        0, 0x(nil)(0x(nil), 0x0x7f00000000) ->    0    0    0 0,        0, 0x(nil)(0x(nil), 0x0x2e00000000)) k(0 0    0,        0) pad(0 0) pool(0 0, 0 0)]

 id IN [ x  y  w   h ]   OUT  [ x  y  w  h ] (tx, ty, kpc) (ic, kc, kc/ks, ks/eks, kernel_type)
   0 NBG DD 0x(nil) [   0    0        0        0] -> DD 0x0x7f00000000 [   0    0        0        0] (  0,   0,   0) (       0,        0, 0.000000%, 0.000000%, NONE)

PreLoadWeightBiases = 1048576  100.000000%
---------------------------End VerifyTiling -------------------------
layer_id: 0 layer name:network_binary_graph operation[0]:unkown operation type target:unkown operation target.
uid: 0
abs_op_id: 0
execution time:             20852 us
[     1] TOTAL_READ_BANDWIDTH  (MByte): 67.832045
[     2] TOTAL_WRITE_BANDWIDTH (MByte): 18.235330
[     3] AXI_READ_BANDWIDTH  (MByte): 30.711409
[     4] AXI_WRITE_BANDWIDTH (MByte): 15.229667
[     5] DDR_READ_BANDWIDTH (MByte): 37.120636
[     6] DDR_WRITE_BANDWIDTH (MByte): 3.005663
[     7] GPUTOTALCYCLES: 52226510
[     8] GPUIDLECYCLES: 35755909
VPC_ELAPSETIME: 65559
*********
Run the 1 time: 66.00ms or 66001.00us
vxProcessGraph execution time:
Total   66.00ms or 66048.00us
Average 66.05ms or 66048.00us
Done. inference :  0.06871485710144043
----- Show Top5 +-----
     2: 0.93457
   795: 0.00328
   408: 0.00158
   974: 0.00148
   393: 0.00093

@johndoe Not currently, you can write python code yourself, capture this log and convert it to json

@johndoe But this is a good idea, I have included it in the update plan, and may update this feature in the next version

I’m working on it currently. Will create a PR if I finish off before you guys :smiley:

1 Like