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.

TextClassificationWithMovieReviews.cs 848 B

123456789101112131415161718192021222324252627282930313233
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. using Tensorflow;
  6. namespace TensorFlowNET.Examples
  7. {
  8. public class TextClassificationWithMovieReviews : Python, IExample
  9. {
  10. string dir = "text_classification_with_movie_reviews";
  11. public void Run()
  12. {
  13. PrepareData();
  14. }
  15. private void PrepareData()
  16. {
  17. Directory.CreateDirectory(dir);
  18. // get model file
  19. string url = "https://storage.googleapis.com/download.tensorflow.org/models/inception_v3_2016_08_28_frozen.pb.tar.gz";
  20. string zipFile = Path.Join(dir, $"imdb.zip");
  21. Utility.Web.Download(url, zipFile);
  22. if (!File.Exists(Path.Join(dir, zipFile)))
  23. Utility.Compress.ExtractTGZ(zipFile, dir);
  24. }
  25. }
  26. }

tensorflow框架的.NET版本,提供了丰富的特性和API,可以借此很方便地在.NET平台下搭建深度学习训练与推理流程。