Browse Source

Resize images to size using nearest neighbor interpolation.

tags/v0.12
Oceania2018 6 years ago
parent
commit
e9feec45a5
4 changed files with 47 additions and 2 deletions
  1. +15
    -1
      src/TensorFlowNET.Core/APIs/tf.image.cs
  2. +14
    -0
      src/TensorFlowNET.Core/Operations/gen_image_ops.py.cs
  3. +17
    -0
      src/TensorFlowNET.Core/Operations/image_ops_impl.cs
  4. +1
    -1
      src/TensorFlowNET.Core/TensorFlowNET.Core.csproj

+ 15
- 1
src/TensorFlowNET.Core/APIs/tf.image.cs View File

@@ -54,8 +54,22 @@ namespace Tensorflow
/// <param name="contents"></param> /// <param name="contents"></param>
/// <param name="name"></param> /// <param name="name"></param>
/// <returns></returns> /// <returns></returns>
public static Tensor is_jpeg(Tensor contents, string name = null)
public Tensor is_jpeg(Tensor contents, string name = null)
=> image_ops_impl.is_jpeg(contents, name: name); => image_ops_impl.is_jpeg(contents, name: name);

/// <summary>
/// Resize `images` to `size` using nearest neighbor interpolation.
/// </summary>
/// <param name="images"></param>
/// <param name="size"></param>
/// <param name="align_corners"></param>
/// <param name="name"></param>
/// <param name="half_pixel_centers"></param>
/// <returns></returns>
public Tensor resize_nearest_neighbor<Tsize>(Tensor images, Tsize size, bool align_corners = false,
string name = null, bool half_pixel_centers = false)
=> image_ops_impl.resize_nearest_neighbor(images, size, align_corners: align_corners,
name: name, half_pixel_centers: half_pixel_centers);
} }
} }
} }

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

@@ -169,5 +169,19 @@ namespace Tensorflow
return _op.outputs[0]; return _op.outputs[0];
} }
} }

public static Tensor resize_nearest_neighbor<Tsize>(Tensor images, Tsize size, bool align_corners = false,
bool half_pixel_centers = false, string name = null)
{
var op = _op_def_lib._apply_op_helper("ResizeNearestNeighbor", name: name, args: new
{
images,
size,
align_corners,
half_pixel_centers
});

return op.output;
}
} }
} }

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

@@ -128,5 +128,22 @@ namespace Tensorflow


throw new NotImplementedException(""); throw new NotImplementedException("");
} }

/// <summary>
/// Resize `images` to `size` using nearest neighbor interpolation.
/// </summary>
/// <param name="images"></param>
/// <param name="size"></param>
/// <param name="align_corners"></param>
/// <param name="name"></param>
/// <param name="half_pixel_centers"></param>
/// <returns></returns>
public static Tensor resize_nearest_neighbor<Tsize>(Tensor images, Tsize size, bool align_corners = false,
string name = null, bool half_pixel_centers = false)
=> gen_image_ops.resize_nearest_neighbor(images: images,
size: size,
align_corners: align_corners,
half_pixel_centers: half_pixel_centers,
name: name);
} }
} }

+ 1
- 1
src/TensorFlowNET.Core/TensorFlowNET.Core.csproj View File

@@ -26,7 +26,7 @@ Docs: https://tensorflownet.readthedocs.io</Description>
5. Overload session.run(), make syntax simpler. 5. Overload session.run(), make syntax simpler.
6. Add Local Response Normalization. 6. Add Local Response Normalization.
7. Add tf.image related APIs. 7. Add tf.image related APIs.
8. Add tf.random_normal, tf.constant, tf.pad, tf.shape.
8. Add tf.random_normal, tf.constant, tf.pad, tf.shape, tf.image.resize_nearest_neighbor.
9. MultiThread is safe.</PackageReleaseNotes> 9. MultiThread is safe.</PackageReleaseNotes>
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<FileVersion>0.11.2.0</FileVersion> <FileVersion>0.11.2.0</FileVersion>


Loading…
Cancel
Save