ffmpeg/doc
Guo, Yejun 37d24a6c8f vf_dnn_processing: add support for more formats gray8 and grayf32
The following is a python script to halve the value of the gray
image. It demos how to setup and execute dnn model with python+tensorflow.
It also generates .pb file which will be used by ffmpeg.

import tensorflow as tf
import numpy as np
from skimage import color
from skimage import io
in_img = io.imread('input.jpg')
in_img = color.rgb2gray(in_img)
io.imsave('ori_gray.jpg', np.squeeze(in_img))
in_data = np.expand_dims(in_img, axis=0)
in_data = np.expand_dims(in_data, axis=3)
filter_data = np.array([0.5]).reshape(1,1,1,1).astype(np.float32)
filter = tf.Variable(filter_data)
x = tf.placeholder(tf.float32, shape=[1, None, None, 1], name='dnn_in')
y = tf.nn.conv2d(x, filter, strides=[1, 1, 1, 1], padding='VALID', name='dnn_out')
sess=tf.Session()
sess.run(tf.global_variables_initializer())
graph_def = tf.graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])
tf.train.write_graph(graph_def, '.', 'halve_gray_float.pb', as_text=False)
print("halve_gray_float.pb generated, please use \
path_to_ffmpeg/tools/python/convert.py to generate halve_gray_float.model\n")
output = sess.run(y, feed_dict={x: in_data})
output = output * 255.0
output = output.astype(np.uint8)
io.imsave("out.jpg", np.squeeze(output))

To do the same thing with ffmpeg:
- generate halve_gray_float.pb with the above script
- generate halve_gray_float.model with tools/python/convert.py
- try with following commands
  ./ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.model:input=dnn_in:output=dnn_out:dnn_backend=native out.native.png
  ./ffmpeg -i input.jpg -vf format=grayf32,dnn_processing=model=halve_gray_float.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow out.tf.png

Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
2020-01-07 10:51:38 -03:00
..
doxy
examples doc/examples/muxing: fix underflow in duration of encoded streams 2019-09-29 20:41:29 +02:00
.gitignore
APIchanges avutil/eval: Add av_expr_count_func() similar to av_expr_count_vars() 2019-12-28 11:20:48 +01:00
Doxyfile
Makefile
authors.texi
bitstream_filters.texi doc/bitstream_filters: Fix copy an paste typo 2019-11-05 21:21:32 +01:00
bootstrap.min.css
build_system.txt tools: add a fuzzer tool for bitstream filters 2019-12-05 20:49:15 -03:00
codecs.texi doc/codecs: Update documentation for flags/flags2 2019-10-06 17:33:00 +08:00
decoders.texi Add options for spatial layers. 2019-11-28 10:21:20 -03:00
default.css
demuxers.texi avformat/hls: correct grammatical errors of m3u8_hold_counters option 2019-11-27 19:04:00 +08:00
developer.texi
devices.texi
doxy-wrapper.sh
encoders.texi avcodec/libx265: add a qp option and apply the relevant global AVCodecContext settings to the encoder context 2020-01-01 13:48:02 -03:00
errno.txt
faq.texi doc/faq: update macOS and URLs 2019-02-11 10:13:31 +05:30
fate.texi doc/fate: Document how to request samples upload access 2019-08-09 01:33:49 +02:00
fate_config.sh.template
ffmpeg-bitstream-filters.texi
ffmpeg-codecs.texi
ffmpeg-devices.texi
ffmpeg-filters.texi
ffmpeg-formats.texi
ffmpeg-protocols.texi
ffmpeg-resampler.texi
ffmpeg-scaler.texi
ffmpeg-utils.texi
ffmpeg.texi doc/ffmpeg: document value source for -force_key_frames 2020-01-05 10:53:46 +05:30
ffmpeg.txt
ffplay.texi ffplay: added option always on top for video window 2019-05-20 17:51:43 -03:00
ffprobe.texi doc/ffprobe: fix typo and update URL in man 2019-02-09 20:01:18 +01:00
ffprobe.xsd fftools/ffprobe: Add S12M Timecode output as side data (such as SEI TC) 2019-05-27 00:28:34 +02:00
fftools-common-opts.texi doc/fftools-common-opts: document ffmpeg -h bsf=bitstream_filter_name 2019-06-14 13:19:26 +08:00
filter_design.txt
filters.texi vf_dnn_processing: add support for more formats gray8 and grayf32 2020-01-07 10:51:38 -03:00
formats.texi avformat: Add max_probe_packets option 2019-11-03 11:52:32 +01:00
general.texi avcodec: Add librav1e encoder 2019-11-10 13:55:39 +00:00
git-howto.texi
indevs.texi avdevice/decklink: deprecate the -list_devices option 2020-01-03 18:13:22 +01:00
issue_tracker.txt
lexicon
libav-merge.txt doc/libav-merge: add a line about the previous skipped merge 2019-02-20 13:51:19 -03:00
libavcodec.texi
libavdevice.texi
libavfilter.texi
libavformat.texi
libavutil.texi
libswresample.texi
libswscale.texi
mailing-list-faq.texi doc/mailing-list-faq: auto unsubscribe due to DMARC 2019-04-20 13:55:39 -08:00
metadata.texi doc/metadata: fix error in timebase description 2018-12-14 12:57:34 +01:00
mips.txt
multithreading.txt
muxers.texi doc/muxers: fix order of options and examples for image2 muxer 2020-01-03 11:23:55 +01:00
nut.texi
optimization.txt
outdevs.texi avdevice/decklink: deprecate the -list_devices option 2020-01-03 18:13:22 +01:00
patchwork
platform.texi
print_options.c
protocols.texi lavf/libsrt: enable other encryption parameters 2019-12-11 14:23:26 +08:00
rate_distortion.txt
resampler.texi
scaler.texi doc/swscaler: explain default Lanczos parameter 2019-05-27 21:32:33 +05:30
snow.txt doc/snow: fix typos 2019-02-10 16:46:56 +01:00
style.min.css
swresample.txt
swscale.txt
t2h.init
t2h.pm
tablegen.txt
texi2pod.pl
texidep.pl
undefined.txt
utils.texi doc/utils: add hexadecagonal channel layout 2019-10-19 13:00:36 +05:30
writing_filters.txt doc/writing_filters: Use ff_filter_get_nb_threads() get number of threads 2019-05-22 17:43:41 +08:00