Arulkumar03/Wheat_HEAD_Detection_Counting_ComputerVision_Model
0
1#!/bin/bash2# Copyright (c) Facebook, Inc. and its affiliates.3 4# A shell script that parses metrics from the log file.5# Make it easier for developers to track performance of models.6 7LOG="$1"8 9if [[ -z "$LOG" ]]; then10 echo "Usage: $0 /path/to/log/file"11 exit 112fi13 14# [12/15 11:47:32] trainer INFO: Total training time: 12:15:04.446477 (0.4900 s / it)15# [12/15 11:49:03] inference INFO: Total inference time: 0:01:25.326167 (0.13652186737060548 s / img per device, on 8 devices)16# [12/15 11:49:03] inference INFO: Total inference pure compute time: .....17 18# training time19trainspeed=$(grep -o 'Overall training.*' "$LOG" | grep -Eo '\(.*\)' | grep -o '[0-9\.]*')20echo "Training speed: $trainspeed s/it"21 22# inference time: there could be multiple inference during training23inferencespeed=$(grep -o 'Total inference pure.*' "$LOG" | tail -n1 | grep -Eo '\(.*\)' | grep -o '[0-9\.]*' | head -n1)24echo "Inference speed: $inferencespeed s/it"25 26# [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: 416127memory=$(grep -o 'max[_ ]mem: [0-9]*' "$LOG" | tail -n1 | grep -o '[0-9]*')28echo "Training memory: $memory MB"29 30echo "Easy to copypaste:"31echo "$trainspeed","$inferencespeed","$memory"32 33echo "------------------------------"34 35# [12/26 17:26:32] engine.coco_evaluation: copypaste: Task: bbox36# [12/26 17:26:32] engine.coco_evaluation: copypaste: AP,AP50,AP75,APs,APm,APl37# [12/26 17:26:32] engine.coco_evaluation: copypaste: 0.0017,0.0024,0.0017,0.0005,0.0019,0.001138# [12/26 17:26:32] engine.coco_evaluation: copypaste: Task: segm39# [12/26 17:26:32] engine.coco_evaluation: copypaste: AP,AP50,AP75,APs,APm,APl40# [12/26 17:26:32] engine.coco_evaluation: copypaste: 0.0014,0.0021,0.0016,0.0005,0.0016,0.001141 42echo "COCO Results:"43num_tasks=$(grep -o 'copypaste:.*Task.*' "$LOG" | sort -u | wc -l)44# each task has 3 lines45grep -o 'copypaste:.*' "$LOG" | cut -d ' ' -f 2- | tail -n $((num_tasks * 3))46 