Browse Source

create_estimator_and_inputs

tags/v0.12
Oceania2018 6 years ago
parent
commit
de3ecc8556
6 changed files with 14 additions and 10 deletions
  1. +2
    -2
      src/TensorFlowNET.Core/APIs/tf.estimator.cs
  2. +1
    -1
      src/TensorFlowNET.Core/Estimators/Estimator.cs
  3. +3
    -3
      src/TensorFlowNET.Core/TensorFlowNET.Core.csproj
  4. +5
    -3
      src/TensorFlowNET.Models/ObjectDetection/ModelLib.cs
  5. +0
    -1
      test/TensorFlowNET.UnitTest/Estimators/RunConfigTest.cs
  6. +3
    -0
      test/TensorFlowNET.UnitTest/MultithreadingTests.cs

+ 2
- 2
src/TensorFlowNET.Core/APIs/tf.estimator.cs View File

@@ -26,8 +26,8 @@ namespace Tensorflow


public class Estimator_Internal public class Estimator_Internal
{ {
public Estimator Estimator(RunConfig config)
=> new Estimator(config: config);
public Estimator Estimator(Action model_fn, RunConfig config)
=> new Estimator(model_fn: model_fn, config: config);


public RunConfig RunConfig(string model_dir) public RunConfig RunConfig(string model_dir)
=> new RunConfig(model_dir: model_dir); => new RunConfig(model_dir: model_dir);


+ 1
- 1
src/TensorFlowNET.Core/Estimators/Estimator.cs View File

@@ -18,7 +18,7 @@ namespace Tensorflow.Estimators


string _model_dir; string _model_dir;


public Estimator(RunConfig config)
public Estimator(Action model_fn, RunConfig config)
{ {
_config = config; _config = config;
_model_dir = _config.model_dir; _model_dir = _config.model_dir;


+ 3
- 3
src/TensorFlowNET.Core/TensorFlowNET.Core.csproj View File

@@ -5,7 +5,7 @@
<AssemblyName>TensorFlow.NET</AssemblyName> <AssemblyName>TensorFlow.NET</AssemblyName>
<RootNamespace>Tensorflow</RootNamespace> <RootNamespace>Tensorflow</RootNamespace>
<TargetTensorFlow>1.14.0</TargetTensorFlow> <TargetTensorFlow>1.14.0</TargetTensorFlow>
<Version>0.11.3</Version>
<Version>0.11.4</Version>
<Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors> <Authors>Haiping Chen, Meinrad Recheis, Eli Belash</Authors>
<Company>SciSharp STACK</Company> <Company>SciSharp STACK</Company>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild> <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
@@ -17,7 +17,7 @@
<PackageTags>TensorFlow, NumSharp, SciSharp, MachineLearning, TensorFlow.NET, C#</PackageTags> <PackageTags>TensorFlow, NumSharp, SciSharp, MachineLearning, TensorFlow.NET, C#</PackageTags>
<Description>Google's TensorFlow full binding in .NET Standard. <Description>Google's TensorFlow full binding in .NET Standard.
Docs: https://tensorflownet.readthedocs.io</Description> Docs: https://tensorflownet.readthedocs.io</Description>
<AssemblyVersion>0.11.3.0</AssemblyVersion>
<AssemblyVersion>0.11.4.0</AssemblyVersion>
<PackageReleaseNotes>Changes since v0.10.0: <PackageReleaseNotes>Changes since v0.10.0:
1. Upgrade NumSharp to v0.20. 1. Upgrade NumSharp to v0.20.
2. Add DisposableObject class to manage object lifetime. 2. Add DisposableObject class to manage object lifetime.
@@ -30,7 +30,7 @@ Docs: https://tensorflownet.readthedocs.io</Description>
9. MultiThread is safe. 9. MultiThread is safe.
10. Support n-dim indexing for tensor.</PackageReleaseNotes> 10. Support n-dim indexing for tensor.</PackageReleaseNotes>
<LangVersion>7.3</LangVersion> <LangVersion>7.3</LangVersion>
<FileVersion>0.11.3.0</FileVersion>
<FileVersion>0.11.4.0</FileVersion>
<PackageLicenseFile>LICENSE</PackageLicenseFile> <PackageLicenseFile>LICENSE</PackageLicenseFile>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<SignAssembly>true</SignAssembly> <SignAssembly>true</SignAssembly>


+ 5
- 3
src/TensorFlowNET.Models/ObjectDetection/ModelLib.cs View File

@@ -18,18 +18,20 @@ namespace Tensorflow.Models.ObjectDetection
int sample_1_of_n_eval_examples = 0, int sample_1_of_n_eval_examples = 0,
int sample_1_of_n_eval_on_train_examples = 1) int sample_1_of_n_eval_on_train_examples = 1)
{ {
var estimator = tf.estimator.Estimator(config: run_config);

var config = ConfigUtil.get_configs_from_pipeline_file(pipeline_config_path); var config = ConfigUtil.get_configs_from_pipeline_file(pipeline_config_path);
var eval_input_configs = config.EvalInputReader; var eval_input_configs = config.EvalInputReader;


var eval_input_fns = new Action[eval_input_configs.Count]; var eval_input_fns = new Action[eval_input_configs.Count];
var eval_input_names = eval_input_configs.Select(eval_input_config => eval_input_config.Name).ToArray();
Action model_fn = () => { };
var estimator = tf.estimator.Estimator(model_fn: model_fn, config: run_config);


return new TrainAndEvalDict return new TrainAndEvalDict
{ {
estimator = estimator, estimator = estimator,
train_steps = train_steps, train_steps = train_steps,
eval_input_fns = eval_input_fns
eval_input_fns = eval_input_fns,
eval_input_names = eval_input_names
}; };
} }




+ 0
- 1
test/TensorFlowNET.UnitTest/Estimators/RunConfigTest.cs View File

@@ -53,7 +53,6 @@ namespace TensorFlowNET.UnitTest.Estimators
Assert.IsNull(config.tf_random_seed); Assert.IsNull(config.tf_random_seed);
Assert.AreEqual(100, config.save_summary_steps); Assert.AreEqual(100, config.save_summary_steps);
Assert.AreEqual(600, config.save_checkpoints_secs); Assert.AreEqual(600, config.save_checkpoints_secs);
Assert.IsNull(config.save_checkpoints_steps);
Assert.AreEqual(5, config.keep_checkpoint_max); Assert.AreEqual(5, config.keep_checkpoint_max);
Assert.AreEqual(10000, config.keep_checkpoint_every_n_hours); Assert.AreEqual(10000, config.keep_checkpoint_every_n_hours);
Assert.IsNull(config.service); Assert.IsNull(config.service);


+ 3
- 0
test/TensorFlowNET.UnitTest/MultithreadingTests.cs View File

@@ -289,6 +289,9 @@ namespace TensorFlowNET.UnitTest
[TestMethod] [TestMethod]
public void TF_GraphOperationByName_FromModel() public void TF_GraphOperationByName_FromModel()
{ {
if (!Directory.Exists(modelPath))
return;

MultiThreadedUnitTestExecuter.Run(8, Core); MultiThreadedUnitTestExecuter.Run(8, Core);


//the core method //the core method


Loading…
Cancel
Save