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 859 B

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