diff --git a/src/TensorFlowNET.Core/APIs/tf.image.cs b/src/TensorFlowNET.Core/APIs/tf.image.cs new file mode 100644 index 00000000..61c91052 --- /dev/null +++ b/src/TensorFlowNET.Core/APIs/tf.image.cs @@ -0,0 +1,47 @@ +/***************************************************************************** + Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + +using System.Collections.Generic; +using Tensorflow.IO; + +namespace Tensorflow +{ + public partial class tensorflow + { + public image_internal image = new image_internal(); + + public class image_internal + { + public Tensor decode_jpeg(Tensor contents, + int channels = 0, + int ratio = 1, + bool fancy_upscaling = true, + bool try_recover_truncated = false, + float acceptable_fraction = 1, + string dct_method = "", + string name = null) + => gen_image_ops.decode_jpeg(contents, channels: channels, ratio: ratio, + fancy_upscaling: fancy_upscaling, try_recover_truncated: try_recover_truncated, + acceptable_fraction: acceptable_fraction, dct_method: dct_method); + + public Tensor resize_bilinear(Tensor images, Tensor size, bool align_corners = false, string name = null) + => gen_image_ops.resize_bilinear(images, size, align_corners: align_corners, name: name); + + public Tensor convert_image_dtype(Tensor image, TF_DataType dtype, bool saturate = false, string name = null) + => gen_image_ops.convert_image_dtype(image, dtype, saturate: saturate, name: name); + } + } +} diff --git a/src/TensorFlowNET.Core/APIs/tf.io.cs b/src/TensorFlowNET.Core/APIs/tf.io.cs index 5980cf81..394357de 100644 --- a/src/TensorFlowNET.Core/APIs/tf.io.cs +++ b/src/TensorFlowNET.Core/APIs/tf.io.cs @@ -24,8 +24,6 @@ namespace Tensorflow public GFile gfile = new GFile(); public Tensor read_file(string filename, string name = null) => gen_io_ops.read_file(filename, name); - public gen_image_ops image => new gen_image_ops(); - public void import_graph_def(GraphDef graph_def, Dictionary input_map = null, string[] return_elements = null, diff --git a/src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs b/src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs index baaf4fbe..3cd1a83e 100644 --- a/src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs +++ b/src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs @@ -23,7 +23,7 @@ namespace Tensorflow { public static OpDefLibrary _op_def_lib = new OpDefLibrary(); - public Tensor convert_image_dtype(Tensor image, TF_DataType dtype, bool saturate = false, string name= null) + public static Tensor convert_image_dtype(Tensor image, TF_DataType dtype, bool saturate = false, string name= null) { if (dtype == image.dtype) return array_ops.identity(image, name: name); @@ -57,7 +57,7 @@ namespace Tensorflow }); } - public Tensor decode_jpeg(Tensor contents, + public static Tensor decode_jpeg(Tensor contents, int channels = 0, int ratio = 1, bool fancy_upscaling = true, @@ -88,7 +88,7 @@ namespace Tensorflow } } - public Tensor resize_bilinear(Tensor images, Tensor size, bool align_corners = false, string name = null) + public static Tensor resize_bilinear(Tensor images, Tensor size, bool align_corners = false, string name = null) { if (tf.context.executing_eagerly()) { diff --git a/src/TensorFlowNET.Core/Operations/image_ops_impl.cs b/src/TensorFlowNET.Core/Operations/image_ops_impl.cs new file mode 100644 index 00000000..d21f6e8d --- /dev/null +++ b/src/TensorFlowNET.Core/Operations/image_ops_impl.cs @@ -0,0 +1,27 @@ +/***************************************************************************** + Copyright 2018 The TensorFlow.NET Authors. All Rights Reserved. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +******************************************************************************/ + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Tensorflow +{ + public class image_ops_impl + { + + } +}