You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

ImageTest.cs 966 B

5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637
  1. using Microsoft.VisualStudio.TestTools.UnitTesting;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Reflection;
  6. using System.Text;
  7. using Tensorflow;
  8. using Tensorflow.UnitTest;
  9. using static Tensorflow.Binding;
  10. namespace TensorFlowNET.UnitTest.Basics
  11. {
  12. /// <summary>
  13. /// Find more examples in https://www.programcreek.com/python/example/90444/tensorflow.read_file
  14. /// </summary>
  15. [TestClass]
  16. public class ImageTest
  17. {
  18. string imgPath = "shasta-daisy.jpg";
  19. Tensor contents;
  20. [TestInitialize]
  21. public void Initialize()
  22. {
  23. imgPath = TestHelper.GetFullPathFromDataDir(imgPath);
  24. contents = tf.io.read_file(imgPath);
  25. }
  26. [Ignore]
  27. [TestMethod]
  28. public void decode_image()
  29. {
  30. var img = tf.image.decode_image(contents);
  31. Assert.AreEqual(img.name, "decode_image/cond_jpeg/Merge:0");
  32. }
  33. }
  34. }