1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-02-04 06:08:26 +02:00
FFmpeg/libavfilter
Mingyu Yin 9fbdd5454b dnn_backend_native_layer_mathunary: add ceil support
It can be tested with the model generated with below python script:

import tensorflow as tf
import os
import numpy as np
import imageio
from tensorflow.python.framework import graph_util
name = 'ceil'

pb_file_path = os.getcwd()
if not os.path.exists(pb_file_path+'/{}_savemodel/'.format(name)):
    os.mkdir(pb_file_path+'/{}_savemodel/'.format(name))

with tf.Session(graph=tf.Graph()) as sess:
    in_img = imageio.imread('detection.jpg')
    in_img = in_img.astype(np.float32)
    in_data = in_img[np.newaxis, :]
    input_x = tf.placeholder(tf.float32, shape=[1, None, None, 3], name='dnn_in')
    y = tf.math.ceil( input_x, name='dnn_out')
    sess.run(tf.global_variables_initializer())
    constant_graph = graph_util.convert_variables_to_constants(sess, sess.graph_def, ['dnn_out'])

    with tf.gfile.FastGFile(pb_file_path+'/{}_savemodel/model.pb'.format(name), mode='wb') as f:
        f.write(constant_graph.SerializeToString())

    print("model.pb generated, please in ffmpeg path use\n \n \
    python tools/python/convert.py ceil_savemodel/model.pb --outdir=ceil_savemodel/ \n \n \
    to generate model.model\n")

    output = sess.run(y, feed_dict={ input_x: in_data})
    imageio.imsave("out.jpg", np.squeeze(output))

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model=ceil_savemodel/model.pb:input=dnn_in:output=dnn_out:dnn_backend=tensorflow -f framemd5 ceil_savemodel/tensorflow_out.md5\n \n \
    to generate output result of tensorflow model\n")

    print("To verify, please ffmpeg path use\n \n \
    ./ffmpeg -i detection.jpg -vf format=rgb24,dnn_processing=model=ceil_savemodel/model.model:input=dnn_in:output=dnn_out:dnn_backend=native -f framemd5 ceil_savemodel/native_out.md5\n \n \
    to generate output result of native model\n")

Signed-off-by: Mingyu Yin <mingyu.yin@intel.com>
Reviewed-by: Guo, Yejun <yejun.guo@intel.com>
2020-08-04 19:56:54 +08:00
..
2020-02-14 09:59:27 +01:00
2020-05-23 15:50:20 +02:00
2019-10-01 14:55:43 +02:00
2020-05-30 19:02:34 +08:00
2016-12-01 09:53:38 +01:00
2019-05-14 15:17:14 +02:00
2020-04-30 12:18:36 +02:00
2019-12-10 16:09:14 +01:00
2017-11-26 14:05:25 +01:00
2020-03-17 22:46:36 +01:00
2020-02-07 17:07:30 +01:00
2020-03-17 22:46:36 +01:00
2018-11-15 14:44:24 +01:00
2018-06-21 00:31:42 +01:00
2018-05-05 21:50:22 +02:00
2020-03-17 22:46:36 +01:00
2020-05-23 15:50:20 +02:00
2017-01-12 10:22:52 +01:00
2016-01-28 19:49:48 -08:00
2017-07-08 11:49:54 +02:00
2020-07-08 15:23:43 +02:00
2020-02-14 21:49:47 +01:00
2016-01-31 15:44:11 -08:00
2016-01-28 19:49:48 -08:00
2019-10-23 12:37:46 +02:00
2019-09-30 16:39:39 +02:00
2020-03-17 22:46:36 +01:00
2020-02-04 18:28:04 +01:00
2020-07-08 15:23:43 +02:00
2019-07-28 22:34:33 +01:00
2018-06-21 00:31:42 +01:00
2020-02-29 22:31:01 +01:00
2019-10-01 14:55:43 +02:00
2020-05-30 18:04:14 +02:00
2020-03-17 22:46:36 +01:00
2019-09-26 08:10:31 +08:00
2020-03-17 22:46:36 +01:00
2020-03-17 22:46:36 +01:00
2019-04-20 00:20:07 +02:00
2020-03-17 22:46:36 +01:00
2019-10-18 21:57:20 +02:00
2020-03-17 22:46:36 +01:00
2020-03-17 22:46:36 +01:00
2020-03-17 22:46:36 +01:00
2015-01-09 17:26:31 +01:00
2020-02-04 18:28:04 +01:00
2019-10-20 18:06:26 +02:00
2020-05-23 15:52:27 +02:00
2020-03-17 22:46:36 +01:00
2020-04-18 12:34:49 +02:00
2017-12-23 10:48:14 +01:00
2020-03-17 22:46:36 +01:00
2020-03-17 22:46:36 +01:00