Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -93,53 +93,6 @@ public void GenerateOutput()
Utils.AddProjectsToSolution(modelprojectDir, modelProjectName, consoleAppProjectDir, consoleAppProjectName, solutionPath);
}

public void GenerateAzureRemoteImageOutput()
{
// Get Namespace
var namespaceValue = Utils.Normalize(_settings.OutputName);
var labelType = _columnInferenceResult.TextLoaderOptions.Columns.Where(t => t.Name == _settings.LabelName).First().DataKind;
Type labelTypeCsharp = Utils.GetCSharpType(labelType);

// Generate Model Project
var modelProjectContents = GenerateAzureAttachImageModelProjectContents(namespaceValue);

var modelProjectDir = Path.Combine(_settings.OutputBaseDir, $"{_settings.OutputName}.Model");
var modelProjectName = $"{_settings.OutputName}.Model.csproj";

// Get Normalize Mapping
var normalizeContent = new NormalizeMapping()
{
Namespace = namespaceValue,
Target = _settings.Target,
}.TransformText();
normalizeContent = Utils.FormatCode(normalizeContent);

// Write files to disk
Utils.WriteOutputToFiles(modelProjectContents.ModelInputCSFileContent, "ModelInput.cs", modelProjectDir);
Utils.WriteOutputToFiles(modelProjectContents.ModelOutputCSFileContent, "ModelOutput.cs", modelProjectDir);
Utils.WriteOutputToFiles(modelProjectContents.ConsumeModelCSFileContent, "ConsumeModel.cs", modelProjectDir);
Utils.WriteOutputToFiles(modelProjectContents.ModelProjectFileContent, modelProjectName, modelProjectDir);
Utils.WriteOutputToFiles(normalizeContent, "NormalizeMapping.cs", modelProjectDir);

// Generate ConsoleApp Project
var consoleAppProjectContents = GenerateConsoleAppProjectContents(namespaceValue, labelTypeCsharp,
false, false, false, true, false, false, true, true);

// Write files to disk.
var consoleAppProjectDir = Path.Combine(_settings.OutputBaseDir, $"{_settings.OutputName}.ConsoleApp");
var consoleAppProjectName = $"{_settings.OutputName}.ConsoleApp.csproj";

Utils.WriteOutputToFiles(consoleAppProjectContents.ConsoleAppProgramCSFileContent, "Program.cs", consoleAppProjectDir);
Utils.WriteOutputToFiles(consoleAppProjectContents.modelBuilderCSFileContent, "ModelBuilder.cs", consoleAppProjectDir);
Utils.WriteOutputToFiles(consoleAppProjectContents.ConsoleAppProjectFileContent, consoleAppProjectName, consoleAppProjectDir);

// New solution file.
Utils.CreateSolutionFile(_settings.OutputName, _settings.OutputBaseDir);

// Add projects to solution
var solutionPath = Path.Combine(_settings.OutputBaseDir, $"{_settings.OutputName}.sln");
Utils.AddProjectsToSolution(modelProjectDir, modelProjectName, consoleAppProjectDir, consoleAppProjectName, solutionPath);
}
private void SetRequiredNugetPackages(IEnumerable<PipelineNode> trainerNodes, ref bool includeLightGbmPackage,
ref bool includeMklComponentsPackage, ref bool includeFastTreePackage,
ref bool includeImageTransformerPackage, ref bool includeImageClassificationPackage, ref bool includeRecommenderPackage)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@ public virtual string TransformText()
this.Write(" <PackageReference Include=\"Microsoft.ML.ImageAnalytics\" Version=\"");
this.Write(this.ToStringHelper.ToStringWithCulture(StablePackageVersion));
this.Write("\" />\r\n");
}
if (IncludeOnnxModel){
this.Write(" <PackageReference Include=\"Microsoft.ML.OnnxTransformer\" Version=\"");
this.Write(this.ToStringHelper.ToStringWithCulture(StablePackageVersion));
this.Write("\" />\r\n");
}
if (IncludeImageClassificationPackage){
this.Write(" <PackageReference Include=\"Microsoft.ML.Vision\" Version=\"");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@
<# if (IncludeImageTransformerPackage){ #>
<PackageReference Include="Microsoft.ML.ImageAnalytics" Version="<#= StablePackageVersion #>" />
<#}#>
<# if (IncludeOnnxModel){ #>
<PackageReference Include="Microsoft.ML.OnnxTransformer" Version="<#= StablePackageVersion #>" />
<#}#>
<# if (IncludeImageClassificationPackage){ #>
<PackageReference Include="Microsoft.ML.Vision" Version="<#= StablePackageVersion #>" />
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="1.14.0" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.ML" Version="StablePackageVersion" />
<PackageReference Include="Microsoft.ML.OnnxTransformer" Version="StablePackageVersion" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.ML" Version="stableversion" />
<PackageReference Include="Microsoft.ML.ImageAnalytics" Version="stableversion" />
<PackageReference Include="Microsoft.ML.OnnxTransformer" Version="stableversion" />
</ItemGroup>

<ItemGroup>
Expand Down