Skip to content

Changed "face_recognition_demo" - fixing the device argument to accept AUTO: GPU,CPU style inputs for flexibility#4039

Open
InfoSage05 wants to merge 2 commits into
openvinotoolkit:masterfrom
InfoSage05:auto-plugin-debug
Open

Changed "face_recognition_demo" - fixing the device argument to accept AUTO: GPU,CPU style inputs for flexibility#4039
InfoSage05 wants to merge 2 commits into
openvinotoolkit:masterfrom
InfoSage05:auto-plugin-debug

Conversation

@InfoSage05
Copy link
Copy Markdown

Summary

  • I have removed choices=DEVICE_KINDS restriction from -d_fd, -d_lm, and -d_reid
    arguments in face_recognition_demo.py
  • The old code only accepted bare device names (CPU, GPU, AUTO, HETERO) and
    rejected valid OpenVINO compound strings like AUTO:GPU,CPU or HETERO:GPU,CPU
    with an argparse error so I have added them in the argument.
  • I have also updated help text for all three arguments to document the correct compound format

Root Cause

OpenVINO supports compound device strings as a standard way to configure
the AUTO and HETERO plugins. For example:

  • AUTO:GPU,CPU — automatically selects the best device, and it prefers GPU
    and falls back to CPU
  • HETERO:GPU,CPU — splits model layers across GPU and CPU

These strings are not standalone device names and they carry a priority list
after the colon. However, the demo used Python's argparse with
choices=DEVICE_KINDS where:

 DEVICE_KINDS = ['CPU', 'GPU', 'NPU', 'AUTO', 'HETERO'] 

 argparse choices= performs exact string matching against the list.
 So when a user passed -d_fd AUTO:GPU,CPU, argparse compared AUTO:GPU,CPU
 against each entry in the list, found no exact match, and immediately raised
 an error:

 error: argument -d_fd: invalid choice: 'AUTO:GPU,CPU'
 (choose from CPU, GPU, NPU, AUTO, HETERO)

 This means the AUTO plugin could never be used to its full potential from
 the command line  and users were silently limited to just the AUTO feature with no device
 priority control.

 Solution

 Removed the choices=DEVICE_KINDS restriction from the three device
 arguments -d_fd, -d_lm, and -d_reid. The arguments now accept any
 string, which allows all valid OpenVINO device specifiers including compound
 ones. The help text for each argument was also updated to explicitly document
 the AUTO:<dev1>,<dev2> and HETERO:<dev1>,<dev2> formats so users know
 what is supported.  

How to Test

python face_recognition_demo.py -i <input> -m_fd <model> -m_lm <model> \
  -m_reid <model> -fg <gallery> -d_fd AUTO:GPU,CPU

…le inputs

Previously, the -d_fd, -d_lm, and -d_reid arguments only accepted bare
device names like CPU, GPU, AUTO. This blocked users from passing compound
OpenVINO device strings like AUTO:GPU,CPU or HETERO:GPU,CPU which are
needed to use the AUTO plugin properly. Removed the choices restriction
and updated the help text to show the correct format.
@workflow-lab
Copy link
Copy Markdown

Can one of the admins verify this patch?

…lidation

Pass THROUGHPUT performance hint to compile_model when AUTO device is used
so OpenVINO can optimise for streaming workloads instead of using the
default latency mode.

Also add a runtime check that rejects bare HETERO without sub-devices and
prints a clear message telling the user the correct format (HETERO:GPU,CPU),
instead of failing deep inside OpenVINO with a confusing error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants