@@ -13,13 +13,26 @@ namespace TensorFlowNET.Examples.ImageProcessing.YOLO
1313 /// </summary>
1414 public class Main : IExample
1515 {
16- public bool Enabled { get ; set ; } = true ;
16+ public bool Enabled { get ; set ; } = false ;
1717 public bool IsImportingGraph { get ; set ; } = false ;
18-
1918 public string Name => "YOLOv3" ;
2019
20+ #region args
2121 Dictionary < int , string > classes ;
22- Config config ;
22+ int num_classes ;
23+ float learn_rate_init ;
24+ float learn_rate_end ;
25+ int first_stage_epochs ;
26+ int second_stage_epochs ;
27+ int warmup_periods ;
28+ string time ;
29+ float moving_ave_decay ;
30+ int max_bbox_per_scale ;
31+ int steps_per_period ;
32+
33+ Dataset trainset , testset ;
34+
35+ Config cfg ;
2336
2437 Tensor input_data ;
2538 Tensor label_sbbox ;
@@ -28,7 +41,8 @@ public class Main : IExample
2841 Tensor true_sbboxes ;
2942 Tensor true_mbboxes ;
3043 Tensor true_lbboxes ;
31- Tensor trainable ;
44+ Tensor trainable ;
45+ #endregion
3246
3347 public bool Run ( )
3448 {
@@ -90,14 +104,28 @@ public void Predict(Session sess)
90104
91105 public void PrepareData ( )
92106 {
93- config = new Config ( Name ) ;
107+ cfg = new Config ( Name ) ;
94108
95109 string dataDir = Path . Combine ( Name , "data" ) ;
96110 Directory . CreateDirectory ( dataDir ) ;
97111
98112 classes = new Dictionary < int , string > ( ) ;
99- foreach ( var line in File . ReadAllLines ( config . CLASSES ) )
113+ foreach ( var line in File . ReadAllLines ( cfg . YOLO . CLASSES ) )
100114 classes [ classes . Count ] = line ;
115+ num_classes = classes . Count ;
116+
117+ learn_rate_init = cfg . TRAIN . LEARN_RATE_INIT ;
118+ learn_rate_end = cfg . TRAIN . LEARN_RATE_END ;
119+ first_stage_epochs = cfg . TRAIN . FISRT_STAGE_EPOCHS ;
120+ second_stage_epochs = cfg . TRAIN . SECOND_STAGE_EPOCHS ;
121+ warmup_periods = cfg . TRAIN . WARMUP_EPOCHS ;
122+ DateTime now = DateTime . Now ;
123+ time = $ "{ now . Year } -{ now . Month } -{ now . Day } -{ now . Hour } -{ now . Minute } -{ now . Minute } ";
124+ moving_ave_decay = cfg . YOLO . MOVING_AVE_DECAY ;
125+ max_bbox_per_scale = 150 ;
126+ trainset = new Dataset ( "train" , cfg ) ;
127+ testset = new Dataset ( "test" , cfg ) ;
128+ steps_per_period = trainset . Length ;
101129 }
102130 }
103131}
0 commit comments