Skip to content

Commit c8991d4

Browse files
committed
added ConfigUtil empty file.
1 parent ae94424 commit c8991d4

6 files changed

Lines changed: 78 additions & 4 deletions

File tree

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Tensorflow.Contrib.Train
6+
{
7+
/// <summary>
8+
/// Class to hold a set of hyperparameters as name-value pairs.
9+
/// </summary>
10+
public class HParams
11+
{
12+
public bool load_pretrained { get; set; }
13+
14+
public HParams(bool load_pretrained)
15+
{
16+
this.load_pretrained = load_pretrained;
17+
}
18+
}
19+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Tensorflow.Train
6+
{
7+
public class SessionRunContext
8+
{
9+
public SessionRunContext(Session session)
10+
{
11+
12+
}
13+
}
14+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Tensorflow.Train
6+
{
7+
internal class _MonitoredSession
8+
{
9+
}
10+
}

src/TensorFlowNET.Models/ObjectDetection/ModelLib.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,18 @@
44
using static Tensorflow.Binding;
55
using Tensorflow.Estimators;
66
using System.Linq;
7+
using Tensorflow.Contrib.Train;
78

89
namespace Tensorflow.Models.ObjectDetection
910
{
1011
public class ModelLib
1112
{
1213
public TrainAndEvalDict create_estimator_and_inputs(RunConfig run_config,
13-
int train_steps = 1)
14+
HParams hparams = null,
15+
string pipeline_config_path = null,
16+
int train_steps = 0,
17+
int sample_1_of_n_eval_examples = 0,
18+
int sample_1_of_n_eval_on_train_examples = 1)
1419
{
1520
var estimator = tf.estimator.Estimator(config: run_config);
1621

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
5+
namespace Tensorflow.Models.ObjectDetection.Utils
6+
{
7+
public class ConfigUtil
8+
{
9+
public object get_configs_from_pipeline_file(string pipeline_config_path)
10+
{
11+
throw new NotImplementedException("");
12+
}
13+
}
14+
}

test/TensorFlowNET.Examples/ImageProcessing/ObjectDetection/Main.cs

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using System.IO;
44
using System.Text;
55
using Tensorflow;
6+
using Tensorflow.Contrib.Train;
67
using Tensorflow.Estimators;
78
using Tensorflow.Models.ObjectDetection;
89
using static Tensorflow.Binding;
@@ -18,12 +19,23 @@ public class Main : IExample
1819

1920
ModelLib model_lib = new ModelLib();
2021

22+
string model_dir = "D:/Projects/PythonLab/tf-models/research/object_detection/models/model";
23+
string pipeline_config_path = "D:/Projects/PythonLab/tf-models/research/object_detection/models/model/faster_rcnn_resnet101_voc07.config";
24+
int num_train_steps = 1;
25+
int sample_1_of_n_eval_examples = 1;
26+
int sample_1_of_n_eval_on_train_examples = 5;
27+
2128
public bool Run()
2229
{
23-
string model_dir = "D:/Projects/PythonLab/tf-models/research/object_detection/models/model";
24-
2530
var config = tf.estimator.RunConfig(model_dir: model_dir);
26-
var train_and_eval_dict = model_lib.create_estimator_and_inputs(run_config: config);
31+
32+
var train_and_eval_dict = model_lib.create_estimator_and_inputs(run_config: config,
33+
hparams: new HParams(true),
34+
pipeline_config_path: pipeline_config_path,
35+
train_steps: num_train_steps,
36+
sample_1_of_n_eval_examples: sample_1_of_n_eval_examples,
37+
sample_1_of_n_eval_on_train_examples: sample_1_of_n_eval_on_train_examples);
38+
2739
var estimator = train_and_eval_dict.estimator;
2840
var train_input_fn = train_and_eval_dict.train_input_fn;
2941
var eval_input_fns = train_and_eval_dict.eval_input_fns;

0 commit comments

Comments
 (0)