Browse Source

reorganize image class.

tags/v0.12
Oceania2018 6 years ago
parent
commit
f004ab6f69
4 changed files with 77 additions and 5 deletions
  1. +47
    -0
      src/TensorFlowNET.Core/APIs/tf.image.cs
  2. +0
    -2
      src/TensorFlowNET.Core/APIs/tf.io.cs
  3. +3
    -3
      src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs
  4. +27
    -0
      src/TensorFlowNET.Core/Operations/image_ops_impl.cs

+ 47
- 0
src/TensorFlowNET.Core/APIs/tf.image.cs View File

@@ -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);
}
}
}

+ 0
- 2
src/TensorFlowNET.Core/APIs/tf.io.cs View File

@@ -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<string, Tensor> input_map = null,
string[] return_elements = null,


+ 3
- 3
src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs View File

@@ -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())
{


+ 27
- 0
src/TensorFlowNET.Core/Operations/image_ops_impl.cs View File

@@ -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
{

}
}

Loading…
Cancel
Save