Quality of life changes for Benchmarking script (#11216)
Co-authored-by: UltralyticsAssistant <web@ultralytics.com> Co-authored-by: Glenn Jocher <glenn.jocher@ultralytics.com>
This commit is contained in:
parent
fd1521a1d9
commit
299797ff9e
2 changed files with 8 additions and 3 deletions
4
.gitignore
vendored
4
.gitignore
vendored
|
|
@ -160,7 +160,11 @@ weights/
|
||||||
*_web_model/
|
*_web_model/
|
||||||
*_openvino_model/
|
*_openvino_model/
|
||||||
*_paddle_model/
|
*_paddle_model/
|
||||||
|
*_ncnn_model/
|
||||||
pnnx*
|
pnnx*
|
||||||
|
|
||||||
# Autogenerated files for tests
|
# Autogenerated files for tests
|
||||||
/ultralytics/assets/
|
/ultralytics/assets/
|
||||||
|
|
||||||
|
# calibration image
|
||||||
|
calibration_*.npy
|
||||||
|
|
|
||||||
|
|
@ -132,16 +132,17 @@ def benchmark(
|
||||||
data=data, batch=1, imgsz=imgsz, plots=False, device=device, half=half, int8=int8, verbose=False
|
data=data, batch=1, imgsz=imgsz, plots=False, device=device, half=half, int8=int8, verbose=False
|
||||||
)
|
)
|
||||||
metric, speed = results.results_dict[key], results.speed["inference"]
|
metric, speed = results.results_dict[key], results.speed["inference"]
|
||||||
y.append([name, "✅", round(file_size(filename), 1), round(metric, 4), round(speed, 2)])
|
fps = round((1000 / speed), 2) # frames per second
|
||||||
|
y.append([name, "✅", round(file_size(filename), 1), round(metric, 4), round(speed, 2), fps])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
if verbose:
|
if verbose:
|
||||||
assert type(e) is AssertionError, f"Benchmark failure for {name}: {e}"
|
assert type(e) is AssertionError, f"Benchmark failure for {name}: {e}"
|
||||||
LOGGER.warning(f"ERROR ❌️ Benchmark failure for {name}: {e}")
|
LOGGER.warning(f"ERROR ❌️ Benchmark failure for {name}: {e}")
|
||||||
y.append([name, emoji, round(file_size(filename), 1), None, None]) # mAP, t_inference
|
y.append([name, emoji, round(file_size(filename), 1), None, None, None]) # mAP, t_inference
|
||||||
|
|
||||||
# Print results
|
# Print results
|
||||||
check_yolo(device=device) # print system info
|
check_yolo(device=device) # print system info
|
||||||
df = pd.DataFrame(y, columns=["Format", "Status❔", "Size (MB)", key, "Inference time (ms/im)"])
|
df = pd.DataFrame(y, columns=["Format", "Status❔", "Size (MB)", key, "Inference time (ms/im)", "FPS"])
|
||||||
|
|
||||||
name = Path(model.ckpt_path).name
|
name = Path(model.ckpt_path).name
|
||||||
s = f"\nBenchmarks complete for {name} on {data} at imgsz={imgsz} ({time.time() - t0:.2f}s)\n{df}\n"
|
s = f"\nBenchmarks complete for {name} on {data} at imgsz={imgsz} ({time.time() - t0:.2f}s)\n{df}\n"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue