![]() |
MyCaffe
1.12.2.41
Deep learning software for Windows C# programmers.
|
The NeuralStyleTransfer object uses the GramLayer, TVLossLayer and LBFGSSolver to perform the neural style transfer algorithm. More...
Public Member Functions | |
| NeuralStyleTransfer (CudaDnn< T > cuda, Log log, CancelEvent evtCancel, string strModelType, string strModel, byte[] rgWeights, bool bCaffeModel, SolverParameter.SolverType solverType=SolverParameter.SolverType.LBFGS, double dfLearningRate=1.5, int nLBFGSCorrections=100, double dfDataScale=1.0, Net< T > netShare=null) | |
| The constructor. More... | |
| NeuralStyleTransfer (CudaDnn< T > cuda, Log log, CancelEvent evtCancel, Dictionary< string, Tuple< double, double > > rgLayers, string strModelDesc, byte[] rgWeights, bool bCaffeModel, SolverParameter.SolverType solverType=SolverParameter.SolverType.LBFGS, double dfLearningRate=1.0, int nMaxImageSize=840, int nLBFGSCorrections=100, double dfDataScale=1.0, Net< T > netShare=null) | |
| The constructor. More... | |
| void | Dispose () |
| Release all resources used. More... | |
| void | SetupHalfSize (bool bAllowHs, bool bAllowOnGram, bool bAllowOnEvent, bool bAllowOnLoss, bool bAllowOnScalar) |
| Setup which layers are allowed to use half-sized memory when their convolution counterparts use it. More... | |
| Bitmap | Process (Bitmap bmpStyle, Bitmap bmpContent, int nIterations, int nIntermediateOutput=-1, double dfTvLoss=0, int nMaxSize=-1, bool bEnablePartialSolution=false) |
| Process the content image by applying the style to it that was learned from the style image. More... | |
| Bitmap | ProcessNext (out Bitmap bmpIntermediate, out int nIntermediateIdx) |
| Process the next partial part of the solution. This function is only valid after calling Process with bEnablePartialSolution = true. More... | |
Static Public Member Functions | |
| static string | CreateConfigurationString (string strSolver, double dfLearningRate, int nMaxImageSize, int nIterations, int nIntermediateIterations, Dictionary< string, Tuple< double, double > > rgWts, List< int > rgGpuID, int nLBFGSCorrections, double dfDataScale, bool bAllowHs, bool bAllowHsGram, bool bAllowHsEvent, bool bAllowHsScalar, bool bAllowHsLoss) |
| The CreateConfigurationString function packs all deep draw settings into a configuration string. More... | |
| static Dictionary< string, Tuple< double, double > > | ParseConfigurationString (string strConfig, out string strSolver, out double dfLearningRate, out int nMaxImageSize, out int nIterations, out int nIntermediateIterations, out List< int > rgGpuID, out int nLBFGSCorrections, out double dfDataScale, out bool bAllowHs, out bool bAllowHsGram, out bool bAllowHsEvent, out bool bAllowHsScalar, out bool bAllowHsLoss) |
| The ParseConfigurationString method parses a deep draw configuration string into the actual settings. More... | |
Events | |
| EventHandler< NeuralStyleIntermediateOutputArgs > | OnIntermediateOutput |
| Specifies the event fired after producing intermediate output (e.g. when m_nIntermediateOutput > 0) More... | |
The NeuralStyleTransfer object uses the GramLayer, TVLossLayer and LBFGSSolver to perform the neural style transfer algorithm.
Definition at line 30 of file NeuralStyleTransfer.cs.
| MyCaffe.extras.NeuralStyleTransfer< T >.NeuralStyleTransfer | ( | CudaDnn< T > | cuda, |
| Log | log, | ||
| CancelEvent | evtCancel, | ||
| string | strModelType, | ||
| string | strModel, | ||
| byte[] | rgWeights, | ||
| bool | bCaffeModel, | ||
| SolverParameter.SolverType | solverType = SolverParameter.SolverType.LBFGS, |
||
| double | dfLearningRate = 1.5, |
||
| int | nLBFGSCorrections = 100, |
||
| double | dfDataScale = 1.0, |
||
| Net< T > | netShare = null |
||
| ) |
The constructor.
| cuda | Specifies the instance of CudaDnn to use. |
| log | Specifies the output log. |
| evtCancel | Specifies the cancel event used to abort processing. |
| strModelType | Specifies the model type: 'vgg19', 'vgg16' |
| strModel | Specifies the network model to use. |
| rgWeights | Optionally, specifies the weights to use (or null to ignore). |
| bCaffeModel | Specifies whether or not the weights are in the caffe (true) or mycaffe (false) format. |
| solverType | Optionally, specifies the solver type to use (default = LBFGS). |
| dfLearningRate | Optionally, specifies the solver learning rate (default = 1.0). |
| nLBFGSCorrections | Optionally, specifies the number of LBFGS corrections to use (default = 100, only applies when using LBFGS solver). |
| dfDataScale | Optionally, specifies the data scaling factor (default = 1.0). |
| netShare | Optionally, specifies a net to share. |
Definition at line 89 of file NeuralStyleTransfer.cs.
| MyCaffe.extras.NeuralStyleTransfer< T >.NeuralStyleTransfer | ( | CudaDnn< T > | cuda, |
| Log | log, | ||
| CancelEvent | evtCancel, | ||
| Dictionary< string, Tuple< double, double > > | rgLayers, | ||
| string | strModelDesc, | ||
| byte[] | rgWeights, | ||
| bool | bCaffeModel, | ||
| SolverParameter.SolverType | solverType = SolverParameter.SolverType.LBFGS, |
||
| double | dfLearningRate = 1.0, |
||
| int | nMaxImageSize = 840, |
||
| int | nLBFGSCorrections = 100, |
||
| double | dfDataScale = 1.0, |
||
| Net< T > | netShare = null |
||
| ) |
The constructor.
| cuda | Specifies the instance of CudaDnn to use. |
| log | Specifies the output log. |
| evtCancel | Specifies the cancel event used to abort processing. |
| rgLayers | Specifies the layers along with their style and content weights. |
| strModelDesc | Specifies the network model descriptor to use. |
| rgWeights | Optionally, specifies the weights to use (or null to ignore). |
| bCaffeModel | Specifies whether or not the weights are in the caffe (true) or mycaffe (false) format. |
| solverType | Optionally, specifies the solver type to use (default = LBFGS). |
| dfLearningRate | Optionally, specifies the solver learning rate (default = 1.0). |
| nMaxImageSize | Optionally, specifies the default maximum image size (default = 840). |
| nLBFGSCorrections | Optionally, specifies the LBFGS Corrections (only used when using the LBFGS solver, default = 100). |
| dfDataScale | Optionally, specifies the data scaling factor (default = 1.0). |
| netShare | Optionally, specifies a net to share. |
Definition at line 137 of file NeuralStyleTransfer.cs.
|
static |
The CreateConfigurationString function packs all deep draw settings into a configuration string.
| strSolver | Specifies the type of solver to use. |
| dfLearningRate | Specifies the learning rate to use with the solver. |
| nMaxImageSize | Specifies the maximum image size to use. |
| nIterations | Specifies the number of iterations to run. |
| nIntermediateIterations | Specifies how often to output intermediate images if any (a value of 0 disables intermediate output). |
| rgWts | Specifies the layers to use and their weights for style and content. |
| rgGpuID | Specifies the GPUIDs on which to run the Neural Style. |
| nLBFGSCorrections | Specifies the LBFGS corrections to use, only applies when using the LBFGS Solver. |
| dfDataScale | Specifies the data scale (default = 1.0). |
| bAllowHs | Specivies to allow half sized memory. |
| bAllowHsGram | Specifies to allow half sized memory on gram layers. |
| bAllowHsEvent | Specifies to allow half sized memory on event layers. |
| bAllowHsScalar | Specifies to allow half sized memory on scalar layers. |
| bAllowHsLoss | Specifies to allow half sized memory on loss layers. |
Definition at line 1024 of file NeuralStyleTransfer.cs.
| void MyCaffe.extras.NeuralStyleTransfer< T >.Dispose | ( | ) |
Release all resources used.
Definition at line 183 of file NeuralStyleTransfer.cs.
|
static |
The ParseConfigurationString method parses a deep draw configuration string into the actual settings.
| strConfig | Specifies the configuration string to parse. |
| strSolver | Returns the solver to use. |
| dfLearningRate | Returns the learning rate to use with the solver. |
| nMaxImageSize | Returns the maximum image size. |
| nIterations | Returns the number of iterations to run. |
| nIntermediateIterations | Returns how often to output intermediate images if any (a value of 0 disables intermediate output). |
| rgGpuID | Returns the list of GPUIDs on which to run the Neural Style. |
| nLBFGSCorrections | Returns the LBFGS corrections to use, only applies when using the LBFGS Solver. |
| dfDataScale | Returns the data scale to use, default = 1.0. |
| bAllowHs | Returns whether or not half size memory is allowed. |
| bAllowHsGram | Returns whether or not to allow half size memory in the gram layers. |
| bAllowHsEvent | Returns whether or not to allow half size memory in the event layers. |
| bAllowHsScalar | Returns whether or not to allow half size memory in the scalar layers. |
| bAllowHsLoss | Returns whether or not to allow half size memory in the loss layers. |
Definition at line 1085 of file NeuralStyleTransfer.cs.
| Bitmap MyCaffe.extras.NeuralStyleTransfer< T >.Process | ( | Bitmap | bmpStyle, |
| Bitmap | bmpContent, | ||
| int | nIterations, | ||
| int | nIntermediateOutput = -1, |
||
| double | dfTvLoss = 0, |
||
| int | nMaxSize = -1, |
||
| bool | bEnablePartialSolution = false |
||
| ) |
Process the content image by applying the style to it that was learned from the style image.
| bmpStyle | Specifies the image used to train the what style to apply to the content. |
| bmpContent | Specifies the content image to which the style is to be applied. |
| nIterations | Specifies the number of training iterations. |
| nIntermediateOutput | Optionally, specifies how often to output an intermediate image. |
| dfTvLoss | Optionally, specifies the TV-Loss weight for smoothing (default = 0, which disables this loss). |
| nMaxSize | Optionally, specifies a maximum image size override (default = -1, which uses the default). |
| bEnablePartialSolution | Optionally, specifies to run the process only up through the next intermediate image. Subsequent calls to ProcessNext moves to the next intermediate image until completed. |
Definition at line 530 of file NeuralStyleTransfer.cs.
| Bitmap MyCaffe.extras.NeuralStyleTransfer< T >.ProcessNext | ( | out Bitmap | bmpIntermediate, |
| out int | nIntermediateIdx | ||
| ) |
Process the next partial part of the solution. This function is only valid after calling Process with bEnablePartialSolution = true.
| bmpIntermediate | Returns the intermediate image, if one was created. |
| nIntermediateIdx | Returns the intermediate index for the image. |
Definition at line 920 of file NeuralStyleTransfer.cs.
| void MyCaffe.extras.NeuralStyleTransfer< T >.SetupHalfSize | ( | bool | bAllowHs, |
| bool | bAllowOnGram, | ||
| bool | bAllowOnEvent, | ||
| bool | bAllowOnLoss, | ||
| bool | bAllowOnScalar | ||
| ) |
Setup which layers are allowed to use half-sized memory when their convolution counterparts use it.
| bAllowHs | Allow half-size memory. |
| bAllowOnGram | Allow half-size on the gram layers. |
| bAllowOnEvent | Allow half-size on the event layers. |
| bAllowOnLoss | Allow half-size on the loss layers. |
| bAllowOnScalar | Allow half-size on the scalar layers. |
Definition at line 215 of file NeuralStyleTransfer.cs.
| EventHandler<NeuralStyleIntermediateOutputArgs> MyCaffe.extras.NeuralStyleTransfer< T >.OnIntermediateOutput |
Specifies the event fired after producing intermediate output (e.g. when m_nIntermediateOutput > 0)
Definition at line 72 of file NeuralStyleTransfer.cs.