[FFmpeg-devel] [PATCH V2] dnn_backend_tf.c: add option sess_config for tf backend

Guo, Yejun yejun.guo at intel.com
Fri Oct 16 16:20:49 EEST 2020



> -----Original Message-----
> From: Guo, Yejun <yejun.guo at intel.com>
> Sent: 2020年10月15日 21:17
> To: ffmpeg-devel at ffmpeg.org
> Cc: Guo, Yejun <yejun.guo at intel.com>
> Subject: [PATCH V2] dnn_backend_tf.c: add option sess_config for tf backend
> 
> TensorFlow C library accepts config for session options to set different
> parameters for the inference. This patch exports this interface.
> 
> The config is a serialized tensorflow.ConfigProto proto, so we need two steps to
> use it:
> 1. generate the serialized proto with python (see script example below) the
> output looks like: 0xab...cd where 0xcd is the least significant byte and 0xab is
> the most significant byte.
> 
> 2. pass the python script output into ffmpeg with
> dnn_processing=options=sess_config=0xab...cd
> 
> The following script is an example to specify one GPU. If the system contains
> 3 GPU cards, the visible_device_list could be '0', '1', '2', '0,1' etc.
> '0' does not mean physical GPU card 0, we need to try and see.
> And we can also add more opitions here to generate more serialized proto.
> 
> script example to generate serialized proto which specifies one GPU:
> import tensorflow as tf
> gpu_options = tf.GPUOptions(visible_device_list='0')
> config = tf.ConfigProto(gpu_options=gpu_options)
> s = config.SerializeToString()
> b = ''.join("%02x" % int(ord(b)) for b in s[::-1]) print('0x%s' % b)
> 
> Signed-off-by: Guo, Yejun <yejun.guo at intel.com>
> ---
> v2: add the script example as comment within the code
> 
>  libavfilter/dnn/dnn_backend_tf.c | 94 ++++++++++++++++++++++++++++++--
>  1 file changed, 88 insertions(+), 6 deletions(-)
will push next Monday if no other comment, thanks.


More information about the ffmpeg-devel mailing list