mirror of
https://github.com/THU-MIG/yolov10.git
synced 2025-05-22 21:04:21 +08:00
Fix OpenVINO missing batch-size bug (#9264)
This commit is contained in:
parent
8d31c50856
commit
fc6c66a4a4
@ -202,13 +202,10 @@ class AutoBackend(nn.Module):
|
||||
ov_model = core.read_model(model=str(w), weights=w.with_suffix(".bin"))
|
||||
if ov_model.get_parameters()[0].get_layout().empty:
|
||||
ov_model.get_parameters()[0].set_layout(ov.Layout("NCHW"))
|
||||
batch_dim = ov.get_batch(ov_model)
|
||||
if batch_dim.is_static:
|
||||
batch_size = batch_dim.get_length()
|
||||
|
||||
# OpenVINO inference modes are 'LATENCY', 'THROUGHPUT' (not recommended), or 'CUMULATIVE_THROUGHPUT'
|
||||
inference_mode = "CUMULATIVE_THROUGHPUT" if batch > 1 else "LATENCY"
|
||||
LOGGER.info(f"Using OpenVINO {inference_mode} mode for batch-size={batch_size} inference...")
|
||||
LOGGER.info(f"Using OpenVINO {inference_mode} mode for batch={batch} inference...")
|
||||
ov_compiled_model = core.compile_model(
|
||||
ov_model,
|
||||
device_name="AUTO", # AUTO selects best available device, do not modify
|
||||
|
Loading…
x
Reference in New Issue
Block a user