| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 683aeed commit 5e43f4d
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -31,6 +31,9 @@ public Optimizer GradientDescentOptimizer(float learning_rate) | |||
| 31 | 31 | public Optimizer AdamOptimizer(float learning_rate, string name = "Adam") | |
| 32 | 32 | => new AdamOptimizer(learning_rate, name: name); | |
| 33 | 33 | ||
| 34 | + public object ExponentialMovingAverage(float decay) | ||
| 35 | + => new ExponentialMovingAverage(decay); | ||
| 36 | + | ||
| 34 | 37 | public Saver Saver(VariableV1[] var_list = null) => new Saver(var_list: var_list); | |
| 35 | 38 | ||
| 36 | 39 | public string write_graph(Graph graph, string logdir, string name, bool as_text = true) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -17,10 +17,10 @@ | |||
| 17 | 17 | <PackageTags>TensorFlow, NumSharp, SciSharp, MachineLearning, TensorFlow.NET, C#</PackageTags> | |
| 18 | 18 | <Description>Google's TensorFlow full binding in .NET Standard. | |
| 19 | 19 | Docs: https://tensorflownet.readthedocs.io</Description> | |
| 20 | - <AssemblyVersion>0.11.10.0</AssemblyVersion> | ||
| 20 | + <AssemblyVersion>0.11.0.0</AssemblyVersion> | ||
| 21 | 21 | <PackageReleaseNotes>Changes since v0.10.0:</PackageReleaseNotes> | |
| 22 | 22 | <LangVersion>7.3</LangVersion> | |
| 23 | - <FileVersion>0.11.10.0</FileVersion> | ||
| 23 | + <FileVersion>0.11.0.0</FileVersion> | ||
| 24 | 24 | <PackageLicenseFile>LICENSE</PackageLicenseFile> | |
| 25 | 25 | <PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance> | |
| 26 | 26 | <SignAssembly>true</SignAssembly> | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,36 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + | ||
| 5 | + namespace Tensorflow.Train | ||
| 6 | + { | ||
| 7 | + public class ExponentialMovingAverage | ||
| 8 | + { | ||
| 9 | + float _decay; | ||
| 10 | + int? _num_updates; | ||
| 11 | + bool _zero_debias; | ||
| 12 | + string _name; | ||
| 13 | + public string name => _name; | ||
| 14 | + | ||
| 15 | + public ExponentialMovingAverage(float decay, int? num_updates = null, bool zero_debias = false, | ||
| 16 | + string name = "ExponentialMovingAverage") | ||
| 17 | + { | ||
| 18 | + _decay = decay; | ||
| 19 | + _num_updates = num_updates; | ||
| 20 | + _zero_debias = zero_debias; | ||
| 21 | + _name = name; | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + /// <summary> | ||
| 25 | + /// Maintains moving averages of variables. | ||
| 26 | + /// </summary> | ||
| 27 | + /// <param name="var_list"></param> | ||
| 28 | + /// <returns></returns> | ||
| 29 | + public Operation apply(VariableV1[] var_list = null) | ||
| 30 | + { | ||
| 31 | + throw new NotImplementedException(""); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + | ||
| 35 | + } | ||
| 36 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,103 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.IO; | ||
| 4 | + using System.Text; | ||
| 5 | + using Tensorflow; | ||
| 6 | + using static Tensorflow.Binding; | ||
| 7 | + | ||
| 8 | + namespace TensorFlowNET.Examples.ImageProcessing.YOLO | ||
| 9 | + { | ||
| 10 | + /// <summary> | ||
| 11 | + /// Implementation of YOLO v3 object detector in Tensorflow | ||
| 12 | + /// https://github.com/YunYang1994/tensorflow-yolov3 | ||
| 13 | + /// </summary> | ||
| 14 | + public class Main : IExample | ||
| 15 | + { | ||
| 16 | + public bool Enabled { get; set; } = true; | ||
| 17 | + public bool IsImportingGraph { get; set; } = false; | ||
| 18 | + | ||
| 19 | + public string Name => "YOLOv3"; | ||
| 20 | + | ||
| 21 | + Dictionary<int, string> classes; | ||
| 22 | + Config config; | ||
| 23 | + | ||
| 24 | + Tensor input_data; | ||
| 25 | + Tensor label_sbbox; | ||
| 26 | + Tensor label_mbbox; | ||
| 27 | + Tensor label_lbbox; | ||
| 28 | + Tensor true_sbboxes; | ||
| 29 | + Tensor true_mbboxes; | ||
| 30 | + Tensor true_lbboxes; | ||
| 31 | + Tensor trainable; | ||
| 32 | + | ||
| 33 | + public bool Run() | ||
| 34 | + { | ||
| 35 | + PrepareData(); | ||
| 36 | + | ||
| 37 | + var graph = IsImportingGraph ? ImportGraph() : BuildGraph(); | ||
| 38 | + | ||
| 39 | + using (var sess = tf.Session(graph)) | ||
| 40 | + { | ||
| 41 | + Train(sess); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + return true; | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + public void Train(Session sess) | ||
| 48 | + { | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + public void Test(Session sess) | ||
| 53 | + { | ||
| 54 | + throw new NotImplementedException(); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + public Graph BuildGraph() | ||
| 58 | + { | ||
| 59 | + var graph = new Graph().as_default(); | ||
| 60 | + | ||
| 61 | + tf_with(tf.name_scope("define_input"), scope => | ||
| 62 | + { | ||
| 63 | + input_data = tf.placeholder(dtype: tf.float32, name: "input_data"); | ||
| 64 | + label_sbbox = tf.placeholder(dtype: tf.float32, name: "label_sbbox"); | ||
| 65 | + label_mbbox = tf.placeholder(dtype: tf.float32, name: "label_mbbox"); | ||
| 66 | + label_lbbox = tf.placeholder(dtype: tf.float32, name: "label_lbbox"); | ||
| 67 | + true_sbboxes = tf.placeholder(dtype: tf.float32, name: "sbboxes"); | ||
| 68 | + true_mbboxes = tf.placeholder(dtype: tf.float32, name: "mbboxes"); | ||
| 69 | + true_lbboxes = tf.placeholder(dtype: tf.float32, name: "lbboxes"); | ||
| 70 | + trainable = tf.placeholder(dtype: tf.@bool, name: "training"); | ||
| 71 | + }); | ||
| 72 | + | ||
| 73 | + tf_with(tf.name_scope("define_loss"), scope => | ||
| 74 | + { | ||
| 75 | + //model = new YOLOv3(input_data, trainable); | ||
| 76 | + }); | ||
| 77 | + | ||
| 78 | + return graph; | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + public Graph ImportGraph() | ||
| 82 | + { | ||
| 83 | + throw new NotImplementedException(); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + public void Predict(Session sess) | ||
| 87 | + { | ||
| 88 | + throw new NotImplementedException(); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + public void PrepareData() | ||
| 92 | + { | ||
| 93 | + config = new Config(Name); | ||
| 94 | + | ||
| 95 | + string dataDir = Path.Combine(Name, "data"); | ||
| 96 | + Directory.CreateDirectory(dataDir); | ||
| 97 | + | ||
| 98 | + classes = new Dictionary<int, string>(); | ||
| 99 | + foreach (var line in File.ReadAllLines(config.CLASSES)) | ||
| 100 | + classes[classes.Count] = line; | ||
| 101 | + } | ||
| 102 | + } | ||
| 103 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,10 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.Text; | ||
| 4 | + | ||
| 5 | + namespace TensorFlowNET.Examples.ImageProcessing.YOLO | ||
| 6 | + { | ||
| 7 | + public class YOLOv3 | ||
| 8 | + { | ||
| 9 | + } | ||
| 10 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,19 @@ | |||
| 1 | + using System; | ||
| 2 | + using System.Collections.Generic; | ||
| 3 | + using System.IO; | ||
| 4 | + using System.Text; | ||
| 5 | + | ||
| 6 | + namespace TensorFlowNET.Examples.ImageProcessing.YOLO | ||
| 7 | + { | ||
| 8 | + public class Config | ||
| 9 | + { | ||
| 10 | + string _root; | ||
| 11 | + public string CLASSES; | ||
| 12 | + | ||
| 13 | + public Config(string root) | ||
| 14 | + { | ||
| 15 | + _root = root; | ||
| 16 | + CLASSES = Path.Combine(_root, "data", "classes", "coco.names"); | ||
| 17 | + } | ||
| 18 | + } | ||
| 19 | + } | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -6,6 +6,10 @@ | |||
| 6 | 6 | <GeneratePackageOnBuild>false</GeneratePackageOnBuild> | |
| 7 | 7 | </PropertyGroup> | |
| 8 | 8 | ||
| 9 | + <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> | ||
| 10 | + <DefineConstants>DEBUG;TRACE</DefineConstants> | ||
| 11 | + </PropertyGroup> | ||
| 12 | + | ||
| 9 | 13 | <ItemGroup> | |
| 10 | 14 | <PackageReference Include="Colorful.Console" Version="1.2.9" /> | |
| 11 | 15 | <PackageReference Include="Newtonsoft.Json" Version="12.0.2" /> | |
| Back | FazBrowse Home | New Git URL |
0 commit comments