MyCaffe
1.12.2.41
Deep learning software for Windows C# programmers.
|
The DeepDraw class implements both deep drawing and deep dream as originally introduced by Google. More...
Public Member Functions | |
DeepDraw (CancelEvent evtCancel, Net< T > net, DataTransformer< T > transformer, string strSrcBlobName="data") | |
The constructor. More... | |
void | Dispose () |
Releases all resources used by DeepDraw. More... | |
void | Add (string strLayer, int nIterations, double dfStartSigma, double dfEndSigma, double dfStartStep, double dfEndStep, bool bSaveFile=false, double dfPctDetailsToApply=0.25) |
Adds a new Octave to run the deep drawing over. More... | |
void | Add (Octaves octaves) |
Add a new Octaves to the collection of Octaves to run. More... | |
IEnumerator< Octaves > | GetEnumerator () |
Returns the Octave enumerator. More... | |
Bitmap | CreateRandomImage (Color clrBack, int nW=-1, int nH=-1, double dfScale=16.0) |
Creates an image with random noise. More... | |
bool | Render (Bitmap bmpInput, int nFocusLabel=-1, double dfDetailPercentageToOutput=0.25, string strOutputDir=null, bool bVisualizeEachStep=false, float[] rgDirectInputs=null) |
Renders the deep draw image(s) depending on the Octave's installed. More... | |
Static Public Member Functions | |
static Bitmap | CreateRandomImageEx (Color clrBack, int nW, int nH, double dfScale=16.0) |
Creates an image with random noise. More... | |
static Bitmap | AdjustContrast (Image bmp, float fBrightness=1.0f, float fContrast=1.0f, float fGamma=1.0f) |
The AdjustContrast function adjusts the brightness, contrast and gamma of the image and returns the newly adjusted image. More... | |
static string | CreateConfigurationString (int nWd, int nHt, double dfOutputDetailPct, OctavesCollection colOctaves, string strSrcBlobName, double dfRandomImageScale) |
The CreateConfigurationString function packs all deep draw settings into a configuration string. More... | |
static OctavesCollection | ParseConfigurationString (string strConfig, out int nWd, out int nHt, out double dfOutputDetailPct, out string strSrcBlobName, out double dfRandomImageScale) |
The ParseConfigurationString method parses a deep draw configuration string into the actual settings. More... | |
Properties | |
int | Count [get] |
Returns the numberof Octaves installed. More... | |
The DeepDraw class implements both deep drawing and deep dream as originally introduced by Google.
T | Specifies the base type float or double. Using float is recommended to conserve GPU memory. |
Definition at line 29 of file DeepDraw.cs.
MyCaffe.extras.DeepDraw< T >.DeepDraw | ( | CancelEvent | evtCancel, |
Net< T > | net, | ||
DataTransformer< T > | transformer, | ||
string | strSrcBlobName = "data" |
||
) |
The constructor.
evtCancel | Specifies the cancel event used to cancel the drawing operation. |
net | Specifies the Net to use for the drawing operation. |
transformer | Specifies the DataTransformer to use when preprocessing input images. |
strSrcBlobName | Specifies the the name of the Blob containing the data source. |
Definition at line 50 of file DeepDraw.cs.
void MyCaffe.extras.DeepDraw< T >.Add | ( | Octaves | octaves | ) |
Add a new Octaves to the collection of Octaves to run.
octaves | Specifies the Octaves to add. |
Definition at line 124 of file DeepDraw.cs.
void MyCaffe.extras.DeepDraw< T >.Add | ( | string | strLayer, |
int | nIterations, | ||
double | dfStartSigma, | ||
double | dfEndSigma, | ||
double | dfStartStep, | ||
double | dfEndStep, | ||
bool | bSaveFile = false , |
||
double | dfPctDetailsToApply = 0.25 |
||
) |
Adds a new Octave to run the deep drawing over.
strLayer | Specifies the name of the target 'end' layer in the network. |
nIterations | Specifies the number of iterations to run over the Octave. |
dfStartSigma | Specifies the starting sigma used when performing the gaussian bluring, on each iteration this value moves toward the end sigma. |
dfEndSigma | Specifies the ending sigma to use whenp performing the gaussian bluring. |
dfStartStep | Specifis the starting step, this value moves towards the end step on each iteration. |
dfEndStep | Specifies the ending step. |
bSaveFile | Specifies whether or not to save the final image for the octave to disk. |
dfPctDetailsToApply | Specifies the percentage of the details from the previous octave run to apply to the source for this Octave - this value must be 1.0 when only using one Octave. |
Definition at line 115 of file DeepDraw.cs.
|
static |
The AdjustContrast function adjusts the brightness, contrast and gamma of the image and returns the newly adjusted image.
bmp | Specifies the image to adjust. |
fBrightness | Specifies the brightness to apply. |
fContrast | Specifies the contrast to apply. |
fGamma | Specifies the gamma to apply. |
Definition at line 445 of file DeepDraw.cs.
|
static |
The CreateConfigurationString function packs all deep draw settings into a configuration string.
nWd | Specifies the input width. |
nHt | Specifies the input height. |
dfOutputDetailPct | Specifies the percentage of detail to apply to the final output. |
colOctaves | Specifies the collection of Octaves to run. |
strSrcBlobName | Specifies the name of the source blob. |
dfRandomImageScale | Specifies the random image scale to use, a number in the range [0,50] used to create varying degrees of gray in the random input image. A value of 0 removes the variation and uses a consistent image. |
Definition at line 461 of file DeepDraw.cs.
Bitmap MyCaffe.extras.DeepDraw< T >.CreateRandomImage | ( | Color | clrBack, |
int | nW = -1 , |
||
int | nH = -1 , |
||
double | dfScale = 16.0 |
||
) |
Creates an image with random noise.
clrBack | Specifies the base back color. |
nW | Optionally, specifies the width. When not specified, the width of the source Blob is used instead (recommended). |
nH | Optionally, specifies the height. When not specified, the height of the source Blob is used instead (recommended). |
dfScale | Optionally, specifies the spread of pixels randomized around the base color. For example the default of 16 randomly picks a color value +8 and -8 from the base color. |
Definition at line 155 of file DeepDraw.cs.
|
static |
Creates an image with random noise.
clrBack | Specifies the base back color. |
nW | Specifies the width. |
nH | Specifies the height. |
dfScale | Optionally, specifies the spread of pixels randomized around the base color. For example the default of 16 randomly picks a color value +8 and -8 from the base color. |
Definition at line 174 of file DeepDraw.cs.
void MyCaffe.extras.DeepDraw< T >.Dispose | ( | ) |
Releases all resources used by DeepDraw.
Definition at line 75 of file DeepDraw.cs.
IEnumerator< Octaves > MyCaffe.extras.DeepDraw< T >.GetEnumerator | ( | ) |
Returns the Octave enumerator.
Definition at line 133 of file DeepDraw.cs.
|
static |
The ParseConfigurationString method parses a deep draw configuration string into the actual settings.
strConfig | Specifies the configuration string to parse. |
nWd | Returns the input width. |
nHt | Returns the input height. |
dfOutputDetailPct | Returns the percentage of detail to apply to the final image. |
strSrcBlobName | Returns the source blob name. |
dfRandomImageScale | Returns the random image scale to use, a number in the range [0,50] used to create varying degrees of gray in the random input image. A value of 0 removes the variation and uses a consistent image. The default value is 16. |
Definition at line 492 of file DeepDraw.cs.
bool MyCaffe.extras.DeepDraw< T >.Render | ( | Bitmap | bmpInput, |
int | nFocusLabel = -1 , |
||
double | dfDetailPercentageToOutput = 0.25 , |
||
string | strOutputDir = null , |
||
bool | bVisualizeEachStep = false , |
||
float[] | rgDirectInputs = null |
||
) |
Renders the deep draw image(s) depending on the Octave's installed.
bmpInput | Specifies the input image. |
nFocusLabel | Specifies a label to focus on (use this when running on classifying layers). |
dfDetailPercentageToOutput | Optionally, specifies the amount of detail to apply to the original image when producing the final image (Default = 0.25 for 25%). |
strOutputDir | Optionally, specifies the output directory wheren images are to be output. When null, no images are output, but are instead set in each Octave. |
bVisualizeEachStep | Optionally, specifies to create an image at each step of the process which can be useful when making a video of the evolution (default = false). |
rgDirectInputs | Optionally, specifies the direct inputs used to set each output. When not null the direct inputs are used instead of the nFocusLabel whereby the network outputs are set to the direct input values and the nFocusLabel is used to index the image and should therefore be unique for each set of direct inputs. By default, this value is set to null. |
Definition at line 213 of file DeepDraw.cs.
|
get |
Returns the numberof Octaves installed.
Definition at line 99 of file DeepDraw.cs.