MyCaffe  1.12.2.41
Deep learning software for Windows C# programmers.
MyCaffeDataPreprocessor.cs
1using System;
2using System.Collections.Generic;
4using System.Diagnostics;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Threading.Tasks;
9using MyCaffe.basecode;
10using MyCaffe.common;
11using MyCaffe.db.stream;
12
17{
24 {
25 MgrPreprocessor<T> m_mgrPreprocessor = null;
26
31 {
32 InitializeComponent();
33 }
34
39 public MyCaffeDataPreprocessor(IContainer container)
40 {
41 container.Add(this);
42
43 InitializeComponent();
44 }
45
46 private void dispose()
47 {
48 Shutdown();
49 }
50
58 public void Initialize(IXMyCaffe<T> imycaffe, IXStreamDatabase idb, string strPreProcessorDLLPath, PropertySet properties)
59 {
60 m_mgrPreprocessor = new MgrPreprocessor<T>(imycaffe, idb);
61
62 int nFields = properties.GetPropertyAsInt("Fields", 0);
63 int nDepth = properties.GetPropertyAsInt("Depth", 0);
64
65 if (nFields == 0)
66 throw new Exception("You must specify the 'Fields' property with a value greater than 0.");
67
68 if (nDepth == 0)
69 throw new Exception("You must specify the 'Depth' property with a value greater than 0.");
70
71 m_mgrPreprocessor.Initialize(strPreProcessorDLLPath, nFields, nDepth);
72 }
73
79 public Tuple<Bitmap, SimpleDatum> Render(SimpleDatum sd)
80 {
81 throw new NotImplementedException();
82 }
83
88 public void Reset(int nStartOffset = 0)
89 {
90 m_mgrPreprocessor.Reset(nStartOffset);
91 }
92
96 public void Shutdown()
97 {
98 if (m_mgrPreprocessor != null)
99 {
100 m_mgrPreprocessor.Dispose();
101 m_mgrPreprocessor = null;
102 }
103 }
104
111 public Tuple<Blob<T>, SimpleDatum> Step(bool bGetSimpleDatum, int nWait = 1000)
112 {
113 return m_mgrPreprocessor.Step(bGetSimpleDatum, nWait);
114 }
115 }
116}
Specifies a key-value pair of properties.
Definition: PropertySet.cs:16
int GetPropertyAsInt(string strName, int nDefault=0)
Returns a property as an integer value.
Definition: PropertySet.cs:287
The SimpleDatum class holds a data input within host memory.
Definition: SimpleDatum.cs:161
The MgrPreprocessor manages the operations of the data pre-processor.
The MyCaffeDataPreprocessor handles adding data from a streaming database to the GPU and then pre-pro...
Tuple< Bitmap, SimpleDatum > Render(SimpleDatum sd)
Create and return the visualization data.
MyCaffeDataPreprocessor(IContainer container)
The constructor.
Tuple< Blob< T >, SimpleDatum > Step(bool bGetSimpleDatum, int nWait=1000)
Step to the next data in the streaming database and process it.
void Reset(int nStartOffset=0)
Reset to the start of the data set, or to an offset from the start.
void Initialize(IXMyCaffe< T > imycaffe, IXStreamDatabase idb, string strPreProcessorDLLPath, PropertySet properties)
Initialize the Data Processor.
The Component class is a standard Microsoft.NET class that implements the IComponent interface and is...
Definition: Component.cs:18
The IXMyCaffe interface contains functions used to perform MyCaffe operations that work with the MyCa...
Definition: Interfaces.cs:410
The IXStreamDatabase interface is the main interface to the MyCaffe Streaing Database.
Definition: Interfaces.cs:52
The IXPreprocessor interface is used to query pre-processed data from a streaming database.
Definition: Interfaces.cs:19
The MyCaffe.basecode contains all generic types used throughout MyCaffe.
Definition: Annotation.cs:12
The MyCaffe.common namespace contains common MyCaffe classes.
Definition: BatchInput.cs:8
The MyCaffe.db.stream namespace contains all data streaming related classes.
The MyCaffe.preprocessor namespace contains all classes of the data preprocessors supported by MyCaff...
Definition: Extension.cs:9
The MyCaffe namespace contains the main body of MyCaffe code that closesly tracks the C++ Caffe open-...
Definition: Annotation.cs:12