diff options
author | Guo, Yejun <yejun.guo@intel.com> | 2019-11-22 15:50:04 +0800 |
---|---|---|
committer | Pedro Arthur <bygrandao@gmail.com> | 2019-12-13 11:41:10 -0300 |
commit | e52070e89c755bffe08ecb9d9ea6be73ca1509cd (patch) | |
tree | 846bc6310ce3a45c2b72e388ef52a36076401d28 | |
parent | ed9fc2e3c576703d0bb904a93d4e654c1239f4da (diff) | |
download | ffmpeg-e52070e89c755bffe08ecb9d9ea6be73ca1509cd.tar.gz |
convert_from_tensorflow.py: add support when kernel size is 1*1 with one input/output channel (gray image)
Signed-off-by: Guo, Yejun <yejun.guo@intel.com>
Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
-rw-r--r-- | tools/python/convert_from_tensorflow.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/python/convert_from_tensorflow.py b/tools/python/convert_from_tensorflow.py index 605158a32e..5e87e227ea 100644 --- a/tools/python/convert_from_tensorflow.py +++ b/tools/python/convert_from_tensorflow.py @@ -193,7 +193,10 @@ class TFConverter: filter_width = ktensor.tensor_shape.dim[1].size in_channels = ktensor.tensor_shape.dim[2].size out_channels = ktensor.tensor_shape.dim[3].size - kernel = np.frombuffer(ktensor.tensor_content, dtype=np.float32) + if filter_height * filter_width * in_channels * out_channels == 1: + kernel = np.float32(ktensor.float_val[0]) + else: + kernel = np.frombuffer(ktensor.tensor_content, dtype=np.float32) kernel = kernel.reshape(filter_height, filter_width, in_channels, out_channels) kernel = np.transpose(kernel, [3, 0, 1, 2]) |