You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

parse_results.sh 2.1 kB

3 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/bash
  2. # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
  3. # A shell script that parses metrics from the log file.
  4. # Make it easier for developers to track performance of models.
  5. LOG="$1"
  6. if [[ -z "$LOG" ]]; then
  7. echo "Usage: $0 /path/to/log/file"
  8. exit 1
  9. fi
  10. # [12/15 11:47:32] trainer INFO: Total training time: 12:15:04.446477 (0.4900 s / it)
  11. # [12/15 11:49:03] inference INFO: Total inference time: 0:01:25.326167 (0.13652186737060548 s / img per device, on 8 devices)
  12. # training time
  13. trainspeed=$(grep -o 'Overall training.*' "$LOG" | grep -Eo '\(.*\)' | grep -o '[0-9\.]*')
  14. echo "Training speed: $trainspeed s/it"
  15. # inference time: there could be multiple inference during training
  16. inferencespeed=$(grep -o 'Total inference.*' "$LOG" | tail -n1 | grep -Eo '\(.*\)' | grep -o '[0-9\.]*' | head -n1)
  17. echo "Inference speed: $inferencespeed s/it"
  18. # [12/15 11:47:18] trainer INFO: eta: 0:00:00 iter: 90000 loss: 0.5407 (0.7256) loss_classifier: 0.1744 (0.2446) loss_box_reg: 0.0838 (0.1160) loss_mask: 0.2159 (0.2722) loss_objectness: 0.0244 (0.0429) loss_rpn_box_reg: 0.0279 (0.0500) time: 0.4487 (0.4899) data: 0.0076 (0.0975) lr: 0.000200 max mem: 4161
  19. memory=$(grep -o 'max[_ ]mem: [0-9]*' "$LOG" | tail -n1 | grep -o '[0-9]*')
  20. echo "Training memory: $memory MB"
  21. echo "Easy to copypaste:"
  22. echo "$trainspeed","$inferencespeed","$memory"
  23. echo "------------------------------"
  24. # [12/26 17:26:32] engine.coco_evaluation: copypaste: Task: bbox
  25. # [12/26 17:26:32] engine.coco_evaluation: copypaste: AP,AP50,AP75,APs,APm,APl
  26. # [12/26 17:26:32] engine.coco_evaluation: copypaste: 0.0017,0.0024,0.0017,0.0005,0.0019,0.0011
  27. # [12/26 17:26:32] engine.coco_evaluation: copypaste: Task: segm
  28. # [12/26 17:26:32] engine.coco_evaluation: copypaste: AP,AP50,AP75,APs,APm,APl
  29. # [12/26 17:26:32] engine.coco_evaluation: copypaste: 0.0014,0.0021,0.0016,0.0005,0.0016,0.0011
  30. echo "COCO Results:"
  31. num_tasks=$(grep -o 'copypaste:.*Task.*' "$LOG" | sort -u | wc -l)
  32. # each task has 3 lines
  33. grep -o 'copypaste:.*' "$LOG" | cut -d ' ' -f 2- | tail -n $((num_tasks * 3))

No Description