1 write to _options
Microsoft.ML.Vision (1)
ImageClassificationTrainer.cs (1)
568
_options
= options;
70 references to _options
Microsoft.ML.Vision (70)
ImageClassificationTrainer.cs (70)
553
options.TrainSetBottleneckCachedValuesFileName =
_options
.TrainSetBottleneckCachedValuesFileName;
559
options.ValidationSetBottleneckCachedValuesFileName =
_options
.ValidationSetBottleneckCachedValuesFileName;
569
_useLRScheduling =
_options
.LearningRateScheduler != null;
570
_checkpointPath = Path.Combine(
_options
.WorkspacePath,
_options
.FinalModelPrefix +
571
ModelFileName[
_options
.Arch]);
572
_sizeFile = Path.Combine(
_options
.WorkspacePath, "TrainingSetSize.txt");
575
var arch =
_options
.Arch;
600
var labelColumn = input.Schema.GetColumnOrNull(
_options
.LabelColumnName).Value;
609
var msg = $"Only one class found in the {
_options
.LabelColumnName} column. To build a multiclass classification model, the number of classes needs to be 2 or greater";
613
var imageSize = ImagePreprocessingSize[
_options
.Arch];
614
_session = LoadTensorFlowSessionFromMetaGraph(Host,
_options
.Arch).Session;
621
AddTransferLearningLayer(
_options
.LabelColumnName,
_options
.ScoreColumnName,
_options
.LearningRate,
634
bool success = inputSchema.TryFindColumn(
_options
.LabelColumnName, out _);
642
new SchemaShape.Column(
_options
.ScoreColumnName, SchemaShape.Column.VectorKind.Vector,
644
new SchemaShape.Column(
_options
.PredictedLabelColumnName, SchemaShape.Column.VectorKind.Scalar,
652
FeatureColumn.Name, LabelColumn.Name,
_options
.ScoreColumnName,
_options
.PredictedLabelColumnName);
659
if (!Directory.Exists(
_options
.WorkspacePath))
661
Directory.CreateDirectory(
_options
.WorkspacePath);
665
CheckTrainingParameters(
_options
);
666
var validationSet = trainContext.ValidationSet?.Data ??
_options
.ValidationSet;
668
string trainSetBottleneckCachedValuesFilePath = Path.Combine(
_options
.WorkspacePath,
669
_options
.TrainSetBottleneckCachedValuesFileName);
671
string validationSetBottleneckCachedValuesFilePath = Path.Combine(
_options
.WorkspacePath,
672
_options
.ValidationSetBottleneckCachedValuesFileName);
674
bool needValidationSet =
_options
.EarlyStoppingCriteria != null ||
_options
.MetricsCallback != null;
675
bool validationSetPresent =
_options
.ReuseValidationSetBottleneckCachedValues &&
681
if (generateValidationSet &&
_options
.ValidationSet != null)
683
CacheFeaturizedImagesToDisk(validationSet,
_options
.LabelColumnName,
684
_options
.FeatureColumnName, imageProcessor, _inputTensorName, _bottleneckTensor.name,
686
ImageClassificationMetrics.Dataset.Validation,
_options
.MetricsCallback);
692
if (!
_options
.ReuseTrainSetBottleneckCachedValues ||
696
CacheFeaturizedImagesToDisk(trainContext.TrainingSet.Data,
_options
.LabelColumnName,
697
_options
.FeatureColumnName, imageProcessor,
699
ImageClassificationMetrics.Dataset.Train,
_options
.MetricsCallback,
700
generateValidationSet ?
_options
.ValidationSetFraction : null);
703
(generateValidationSet &&
_options
.ValidationSetFraction.HasValue);
708
if (generateValidationSet &&
_options
.ReuseTrainSetBottleneckCachedValues &&
709
!
_options
.ReuseValidationSetBottleneckCachedValues)
717
validationSetPresent && (
_options
.EarlyStoppingCriteria != null ||
_options
.MetricsCallback != null) ?
872
Path.Combine(
_options
.WorkspacePath,
_options
.ValidationSetBottleneckCachedValuesFileName),
927
Contracts.Assert(
_options
.EarlyStoppingCriteria == null || validationNeeded);
938
int batchSize =
_options
.BatchSize;
939
int epochs =
_options
.Epoch;
940
float learningRate =
_options
.LearningRate;
941
Action<ImageClassificationMetrics> statisticsCallback =
_options
.MetricsCallback;
948
if (
_options
.LearningRateScheduler != null)
951
if (statisticsCallback != null &&
_options
.TestOnTrainSet)
970
trainWriter = tf.summary.FileWriter(Path.Combine(
_options
.WorkspacePath, "train"),
997
BatchSize =
_options
.BatchSize,
998
BatchesPerEpoch = trainingExamples /
_options
.BatchSize
1009
_options
.LearningRateScheduler, trainState, runner, featureBufferPtr, labelBufferPtr,
1012
if (
_options
.TestOnTrainSet && statisticsCallback != null)
1023
if (
_options
.TestOnTrainSet && statisticsCallback != null)
1061
if (
_options
.EarlyStoppingCriteria != null)
1063
if (
_options
.EarlyStoppingCriteria.ShouldStop(metrics.Train))
1150
if (_cleanupWorkspace && Directory.Exists(
_options
.WorkspacePath))
1154
Directory.Delete(
_options
.WorkspacePath, true);
1165
var evalGraph = LoadMetaGraph(Path.Combine(_resourcePath, ModelFileName[
_options
.Arch]));
1171
var (_, _, groundTruthInput, finalTensor) = AddFinalRetrainOps(classCount,
_options
.LabelColumnName,
1172
_options
.ScoreColumnName, bottleneckTensor, false, (
_options
.LearningRateScheduler == null ? false : true),
_options
.LearningRate);
1175
var imageSize = ImagePreprocessingSize[
_options
.Arch];