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.

Utils.cs 724 B

123456789101112131415161718192021222324252627
  1. using NumSharp;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using System.Linq;
  6. using System.Text;
  7. namespace TensorFlowNET.Examples.ImageProcessing.YOLO
  8. {
  9. class Utils
  10. {
  11. public static Dictionary<int, string> read_class_names(string file)
  12. {
  13. var classes = new Dictionary<int, string>();
  14. foreach (var line in File.ReadAllLines(file))
  15. classes[classes.Count] = line;
  16. return classes;
  17. }
  18. public static NDArray get_anchors(string file)
  19. {
  20. return np.array(File.ReadAllText(file).Split(',')
  21. .Select(x => float.Parse(x))
  22. .ToArray()).reshape(3, 3, 2);
  23. }
  24. }
  25. }