Skip to content

Commit 9c6d95a

Browse files
author
junwenwu
authored
Fix plugin bug in object detection demo (#3951)
1 parent 72484bd commit 9c6d95a

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

demos/common/python/model_zoo/model_api/pipelines/async_pipeline.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,23 +66,24 @@ def get_user_config(flags_d: str, flags_nstreams: str, flags_nthreads: int)-> Di
6666
if device == 'CPU': # CPU supports a few special performance-oriented keys
6767
# limit threading for CPU portion of inference
6868
if flags_nthreads:
69-
config[device]['CPU_THREADS_NUM'] = str(flags_nthreads)
69+
config['CPU_THREADS_NUM'] = str(flags_nthreads)
7070

71-
config[device]['ENABLE_CPU_PINNING'] = 'NO'
71+
config['ENABLE_CPU_PINNING'] = 'NO'
7272
if "CPU_THROUGHPUT_STREAMS" in supported_properties:
7373
# for CPU execution, more throughput-oriented execution via streams
74-
config[device]['CPU_THROUGHPUT_STREAMS'] = str(device_nstreams.get(device, 'CPU_THROUGHPUT_AUTO'))
74+
config['CPU_THROUGHPUT_STREAMS'] = str(device_nstreams.get(device, 'CPU_THROUGHPUT_AUTO'))
7575
else:
76-
config[device]["NUM_STREAMS"] = str(device_nstreams.get(device, -1))
76+
config["NUM_STREAMS"] = str(device_nstreams.get(device, -1))
7777
elif device == 'GPU':
7878
if "GPU_THROUGHPUT_STREAMS" in supported_properties:
79-
config[device]['GPU_THROUGHPUT_STREAMS'] = str(device_nstreams.get(device, 'GPU_THROUGHPUT_AUTO'))
79+
config['GPU_THROUGHPUT_STREAMS'] = str(device_nstreams.get(device, 'GPU_THROUGHPUT_AUTO'))
8080
else:
81-
config[device]["NUM_STREAMS"] = str(device_nstreams.get(device, -1))
82-
if 'MULTI' in flags_d and 'CPU' in devices:
81+
config["NUM_STREAMS"] = str(device_nstreams.get(device, -1))
82+
if ('MULTI' in flags_d or 'HETERO' in flags_d) and 'CPU' in devices:
8383
# multi-device execution with the CPU + GPU performs best with GPU throttling hint,
8484
# which releases another CPU thread (that is otherwise used by the GPU driver for active polling)
85-
config[device]['GPU_PLUGIN_THROTTLE'] = '1'
85+
config['GPU_PLUGIN_THROTTLE'] = '1'
86+
8687
return config
8788

8889

0 commit comments

Comments
 (0)