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.

config.cs 3.3 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. using System;
  2. using System.Collections.Generic;
  3. using System.IO;
  4. using System.Text;
  5. namespace TensorFlowNET.Examples.ImageProcessing.YOLO
  6. {
  7. public class Config
  8. {
  9. public YoloConfig YOLO;
  10. public TrainConfig TRAIN;
  11. public TestConfig TEST;
  12. public Config(string root)
  13. {
  14. YOLO = new YoloConfig(root);
  15. TRAIN = new TrainConfig(root);
  16. TEST = new TestConfig(root);
  17. }
  18. public class YoloConfig
  19. {
  20. string _root;
  21. public string CLASSES;
  22. public string ANCHORS;
  23. public float MOVING_AVE_DECAY = 0.9995f;
  24. public int[] STRIDES = new int[] { 8, 16, 32 };
  25. public int ANCHOR_PER_SCALE = 3;
  26. public float IOU_LOSS_THRESH = 0.5f;
  27. public string UPSAMPLE_METHOD = "resize";
  28. public string ORIGINAL_WEIGHT;
  29. public string DEMO_WEIGHT;
  30. public YoloConfig(string root)
  31. {
  32. _root = root;
  33. CLASSES = Path.Combine(_root, "data", "classes", "coco.names");
  34. ANCHORS = Path.Combine(_root, "data", "anchors", "basline_anchors.txt");
  35. ORIGINAL_WEIGHT = Path.Combine(_root, "checkpoint", "yolov3_coco.ckpt");
  36. DEMO_WEIGHT = Path.Combine(_root, "checkpoint", "yolov3_coco_demo.ckpt");
  37. }
  38. }
  39. public class TrainConfig
  40. {
  41. string _root;
  42. public int BATCH_SIZE = 6;
  43. public int[] INPUT_SIZE = new int[] { 320, 352, 384, 416, 448, 480, 512, 544, 576, 608 };
  44. public bool DATA_AUG = true;
  45. public float LEARN_RATE_INIT = 1e-4f;
  46. public float LEARN_RATE_END = 1e-6f;
  47. public int WARMUP_EPOCHS = 2;
  48. public int FISRT_STAGE_EPOCHS = 20;
  49. public int SECOND_STAGE_EPOCHS = 30;
  50. public string INITIAL_WEIGHT;
  51. public string ANNOT_PATH;
  52. public TrainConfig(string root)
  53. {
  54. _root = root;
  55. INITIAL_WEIGHT = Path.Combine(_root, "checkpoint", "yolov3_coco_demo.ckpt");
  56. ANNOT_PATH = Path.Combine(_root, "data", "dataset", "voc_train.txt");
  57. }
  58. }
  59. public class TestConfig
  60. {
  61. string _root;
  62. public int BATCH_SIZE = 2;
  63. public int[] INPUT_SIZE = new int[] { 544 };
  64. public bool DATA_AUG = false;
  65. public bool WRITE_IMAGE = true;
  66. public string WRITE_IMAGE_PATH;
  67. public string WEIGHT_FILE;
  68. public bool WRITE_IMAGE_SHOW_LABEL = true;
  69. public bool SHOW_LABEL = true;
  70. public int SECOND_STAGE_EPOCHS = 30;
  71. public float SCORE_THRESHOLD = 0.3f;
  72. public float IOU_THRESHOLD = 0.45f;
  73. public string ANNOT_PATH;
  74. public TestConfig(string root)
  75. {
  76. _root = root;
  77. ANNOT_PATH = Path.Combine(_root, "data", "dataset", "voc_test.txt");
  78. WRITE_IMAGE_PATH = Path.Combine(_root, "data", "detection");
  79. WEIGHT_FILE = Path.Combine(_root, "checkpoint", "yolov3_test_loss=9.2099.ckpt-5");
  80. }
  81. }
  82. }
  83. }