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

1234567891011121314151617181920212223242526272829303132333435
  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 = "shasta-daisy.jpg";
  17. Tensor contents;
  18. [TestInitialize]
  19. public void Initialize()
  20. {
  21. imgPath = Path.GetFullPath(imgPath);
  22. contents = tf.read_file(imgPath);
  23. }
  24. [Ignore("")]
  25. [TestMethod]
  26. public void decode_image()
  27. {
  28. var img = tf.image.decode_image(contents);
  29. Assert.AreEqual(img.name, "decode_image/cond_jpeg/Merge:0");
  30. }
  31. }
  32. }