Skip to content

Commit 3d4f5fe

Browse files
committed
Merge branch 'master' of https://github.com/dotnet/machinelearning into ImageClassificationVBuf
2 parents 0fbd3d2 + 718a238 commit 3d4f5fe

File tree

9 files changed

+148
-3
lines changed

9 files changed

+148
-3
lines changed

Microsoft.ML.sln

+27
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.ML.AutoML", "Micr
276276
EndProject
277277
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.AutoML.Samples", "docs\samples\Microsoft.ML.AutoML.Samples\Microsoft.ML.AutoML.Samples.csproj", "{A6924919-9E37-4023-8B7F-E85C8E3CC9B3}"
278278
EndProject
279+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.Samples.GPU", "docs\samples\Microsoft.ML.Samples.GPU\Microsoft.ML.Samples.GPU.csproj", "{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}"
280+
EndProject
279281
Global
280282
GlobalSection(SolutionConfigurationPlatforms) = preSolution
281283
Debug|Any CPU = Debug|Any CPU
@@ -1611,6 +1613,30 @@ Global
16111613
{A6924919-9E37-4023-8B7F-E85C8E3CC9B3}.Release-netfx|Any CPU.ActiveCfg = Release-netfx|Any CPU
16121614
{A6924919-9E37-4023-8B7F-E85C8E3CC9B3}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU
16131615
{A6924919-9E37-4023-8B7F-E85C8E3CC9B3}.Release-netfx|x64.ActiveCfg = Release-netfx|Any CPU
1616+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
1617+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug|Any CPU.Build.0 = Debug|Any CPU
1618+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug|x64.ActiveCfg = Debug|Any CPU
1619+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug|x64.Build.0 = Debug|Any CPU
1620+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug-netcoreapp3_0|Any CPU.ActiveCfg = Debug-netcoreapp3_0|Any CPU
1621+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug-netcoreapp3_0|Any CPU.Build.0 = Debug-netcoreapp3_0|Any CPU
1622+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug-netcoreapp3_0|x64.ActiveCfg = Debug-netcoreapp3_0|Any CPU
1623+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug-netcoreapp3_0|x64.Build.0 = Debug-netcoreapp3_0|Any CPU
1624+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug-netfx|Any CPU.ActiveCfg = Debug-netfx|Any CPU
1625+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug-netfx|Any CPU.Build.0 = Debug-netfx|Any CPU
1626+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug-netfx|x64.ActiveCfg = Debug-netfx|Any CPU
1627+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Debug-netfx|x64.Build.0 = Debug-netfx|Any CPU
1628+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release|Any CPU.ActiveCfg = Release|Any CPU
1629+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release|Any CPU.Build.0 = Release|Any CPU
1630+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release|x64.ActiveCfg = Release|Any CPU
1631+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release|x64.Build.0 = Release|Any CPU
1632+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release-netcoreapp3_0|Any CPU.ActiveCfg = Release-netcoreapp3_0|Any CPU
1633+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release-netcoreapp3_0|Any CPU.Build.0 = Release-netcoreapp3_0|Any CPU
1634+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release-netcoreapp3_0|x64.ActiveCfg = Release-netcoreapp3_0|Any CPU
1635+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release-netcoreapp3_0|x64.Build.0 = Release-netcoreapp3_0|Any CPU
1636+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release-netfx|Any CPU.ActiveCfg = Release-netfx|Any CPU
1637+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release-netfx|Any CPU.Build.0 = Release-netfx|Any CPU
1638+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release-netfx|x64.ActiveCfg = Release-netfx|Any CPU
1639+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD}.Release-netfx|x64.Build.0 = Release-netfx|Any CPU
16141640
EndGlobalSection
16151641
GlobalSection(SolutionProperties) = preSolution
16161642
HideSolutionNode = FALSE
@@ -1697,6 +1723,7 @@ Global
16971723
{E48285BF-F49A-4EA3-AED0-1BDDBF77EB80} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
16981724
{F5D11F71-2D61-4AE9-99D7-0F0B54649B15} = {D3D38B03-B557-484D-8348-8BADEE4DF592}
16991725
{A6924919-9E37-4023-8B7F-E85C8E3CC9B3} = {DA452A53-2E94-4433-B08C-041EDEC729E6}
1726+
{3C8F910B-7F23-4D25-B521-6D5AC9570ADD} = {DA452A53-2E94-4433-B08C-041EDEC729E6}
17001727
EndGlobalSection
17011728
GlobalSection(ExtensibilityGlobals) = postSolution
17021729
SolutionGuid = {41165AF1-35BB-4832-A189-73060F82B01D}
+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
## Using TensorFlow based APIs
2+
In order to run any TensorFlow based ML.Net APIs you must first add a NuGet dependency
3+
on the TensorFlow redist library. There are currently two versions you can use. One which is
4+
compiled for GPU support, and one which has CPU support only.
5+
6+
### CPU only
7+
CPU based TensorFlow is currently supported on:
8+
* Linux
9+
* MacOS
10+
* Windows
11+
12+
To get TensorFlow working on the CPU only all that is to take a NuGet dependency on
13+
SciSharp.TensorFlow.Redist v1.14.0
14+
15+
### GPU support
16+
GPU based TensorFlow is currently supported on:
17+
* Windows
18+
19+
#### Prerequisites
20+
You must have at least one CUDA compatible GPU, for a list of compatible GPUs see
21+
[Nvidia's Guide](https://developer.nvidia.com/cuda-gpus).
22+
23+
Install [CUDA v10.0](https://developer.nvidia.com/cuda-10.0-download-archive) and [CUDNN v7.6.4](https://developer.nvidia.com/rdp/cudnn-download)
24+
following [Nvidia's Install guide](https://docs.nvidia.com/cuda/cuda-quick-start-guide/index.html).
25+
26+
#### Usage
27+
To use TensorFlow with GPU support take a NuGet dependency on the following package depending on your OS:
28+
29+
Windows -> SciSharp.TensorFlow.Redist-Windows-GPU
30+
31+
No code modification should be necessary to leverage the GPU for TensorFlow operations.
32+
33+
#### Troubleshooting
34+
If you are not able to use your GPU after adding the GPU based TensorFlow NuGet,
35+
make sure that there is only a dependency on the GPU based version. If you have
36+
a dependency on both NuGets, the CPU based TensorFlow will run instead.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netcoreapp2.1</TargetFramework>
5+
<OutputType>Exe</OutputType>
6+
<SignAssembly>false</SignAssembly>
7+
<!--This ensures that we can never make the mistake of adding this as a friend assembly. Please don't remove.-->
8+
<PublicSign>false</PublicSign>
9+
<RootNamespace>Samples</RootNamespace>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<Compile Include="..\Microsoft.ML.Samples\Program.cs" Link="Program.cs" />
14+
<Compile Include="..\Microsoft.ML.Samples\Dynamic\ImageClassification\*.cs">
15+
<Link>Dynamic\ImageClassification\%(FileName)</Link>
16+
</Compile>
17+
<Compile Include="..\Microsoft.ML.Samples\Dynamic\TensorFlow\*.cs">
18+
<Link>Dynamic\TensorFlow\%(FileName)</Link>
19+
</Compile>
20+
</ItemGroup>
21+
22+
<ItemGroup>
23+
<ProjectReference Include="..\..\..\src\Microsoft.ML.Dnn\Microsoft.ML.Dnn.csproj" />
24+
<ProjectReference Include="..\..\..\src\Microsoft.ML.TensorFlow\Microsoft.ML.TensorFlow.csproj" />
25+
<ProjectReference Include="..\..\..\src\Microsoft.ML.SamplesUtils\Microsoft.ML.SamplesUtils.csproj" />
26+
27+
<NativeAssemblyReference Include="CpuMathNative" />
28+
<NativeAssemblyReference Include="FastTreeNative" />
29+
<NativeAssemblyReference Include="MatrixFactorizationNative" />
30+
<NativeAssemblyReference Include="LdaNative" />
31+
<NativeAssemblyReference Include="SymSgdNative" />
32+
<NativeAssemblyReference Include="MklProxyNative" />
33+
34+
</ItemGroup>
35+
36+
<ItemGroup>
37+
<Service Include="{508349b6-6b84-4df5-91f0-309beebad82d}" />
38+
</ItemGroup>
39+
40+
<ItemGroup>
41+
<PackageReference Include="Microsoft.ML.Onnx.TestModels" Version="$(MicrosoftMLOnnxTestModelsVersion)" />
42+
<PackageReference Include="SciSharp.TensorFlow.Redist-Windows-GPU" Version="$(TensorFlowVersion)" />
43+
</ItemGroup>
44+
45+
<ItemGroup>
46+
<Content Include="$(ObjDir)DnnImageModels\ResNet18Onnx\ResNet18.onnx">
47+
<Link>DnnImageModels\ResNet18Onnx\ResNet18.onnx</Link>
48+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
49+
</Content>
50+
</ItemGroup>
51+
52+
<ItemGroup>
53+
<Content Include="$(ObjDir)DnnImageModels\ResNetPrepOnnx\ResNetPreprocess.onnx">
54+
<Link>DnnImageModels\ResNetPrepOnnx\ResNetPreprocess.onnx</Link>
55+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
56+
</Content>
57+
</ItemGroup>
58+
59+
<ItemGroup>
60+
<Folder Include="Dynamic\" />
61+
</ItemGroup>
62+
63+
</Project>

docs/samples/Microsoft.ML.Samples/Microsoft.ML.Samples.csproj

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,6 @@
7070
<AutoGen>True</AutoGen>
7171
<DependentUpon>LbfgsLogisticRegressionWithOptions.tt</DependentUpon>
7272
</None>
73-
<PackageReference Include="Microsoft.ML.TensorFlow.Redist" Version="0.10.0" />
7473

7574
</ItemGroup>
7675

@@ -948,6 +947,7 @@
948947

949948
<ItemGroup>
950949
<PackageReference Include="Microsoft.ML.Onnx.TestModels" Version="$(MicrosoftMLOnnxTestModelsVersion)" />
950+
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="$(TensorFlowVersion)" />
951951
</ItemGroup>
952952

953953
<ItemGroup>

src/Microsoft.ML.Dnn/DnnCatalog.cs

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ public static class DnnCatalog
2020

2121
/// <summary>
2222
/// Retrain the dnn model on new data.
23+
/// usage of this API requires additional NuGet dependencies on TensorFlow redist, see linked document for more information.
24+
/// <format type="text/markdown">
25+
/// <![CDATA[
26+
/// [!include[io](~/../docs/samples/docs/api-reference/tensorflow-usage.md)]
27+
/// ]]>
28+
/// </format>
2329
/// </summary>
2430
/// <param name="catalog"></param>
2531
/// <param name="inputColumnNames"> The names of the model inputs.</param>
@@ -79,6 +85,12 @@ public static DnnRetrainEstimator RetrainDnnModel(
7985

8086
/// <summary>
8187
/// Performs image classification using transfer learning.
88+
/// usage of this API requires additional NuGet dependencies on TensorFlow redist, see linked document for more information.
89+
/// <format type="text/markdown">
90+
/// <![CDATA[
91+
/// [!include[io](~/../docs/samples/docs/api-reference/tensorflow-usage.md)]
92+
/// ]]>
93+
/// </format>
8294
/// </summary>
8395
/// <param name="catalog"></param>
8496
/// <param name="featuresColumnName">The name of the input features column.</param>

src/Microsoft.ML.Dnn/Microsoft.ML.Dnn.csproj

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
</PropertyGroup>
1414

1515
<ItemGroup>
16-
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="1.14.0" />
1716
<PackageReference Include="System.IO.FileSystem.AccessControl" Version="$(SystemIOFileSystemAccessControl)" />
1817
<PackageReference Include="System.Security.Principal.Windows" Version="$(SystemSecurityPrincipalWindows)" />
1918
<PackageReference Include="TensorFlow.NET" Version="$(TensorflowDotNETVersion)" />

src/Microsoft.ML.TensorFlow/TensorflowCatalog.cs

+6
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ public static class TensorflowCatalog
1414
/// <summary>
1515
/// Load TensorFlow model into memory. This is the convenience method that allows the model to be loaded once and subsequently use it for querying schema and creation of
1616
/// <see cref="TensorFlowEstimator"/> using <see cref="TensorFlowModel.ScoreTensorFlowModel(string, string, bool)"/>.
17+
/// usage of this API requires additional NuGet dependencies on TensorFlow redist, see linked document for more information.
18+
/// <format type="text/markdown">
19+
/// <![CDATA[
20+
/// [!include[io](~/../docs/samples/docs/api-reference/tensorflow-usage.md)]
21+
/// ]]>
22+
/// </format>
1723
/// </summary>
1824
/// <param name="catalog">The transform's catalog.</param>
1925
/// <param name="modelLocation">Location of the TensorFlow model.</param>

test/Microsoft.ML.Core.Tests/Microsoft.ML.Core.Tests.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525

2626
<ItemGroup>
2727
<PackageReference Include="Microsoft.ML.TestModels" Version="$(MicrosoftMLTestModelsPackageVersion)" />
28+
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="$(TensorFlowVersion)" />
2829
</ItemGroup>
2930

3031
<ItemGroup>
@@ -33,7 +34,7 @@
3334
<NativeAssemblyReference Include="FastTreeNative" />
3435
<NativeAssemblyReference Include="LdaNative" />
3536
<NativeAssemblyReference Include="MklImports" />
36-
<NativeAssemblyReference Condition="'$(OS)' == 'Windows_NT'" Include="libiomp5md"/>
37+
<NativeAssemblyReference Condition="'$(OS)' == 'Windows_NT'" Include="libiomp5md" />
3738
</ItemGroup>
3839

3940
<!-- TensorFlow is 64-bit only -->

test/Microsoft.ML.Tests/Microsoft.ML.Tests.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<PackageReference Include="Microsoft.ML.Onnx.TestModels" Version="$(MicrosoftMLOnnxTestModelsVersion)" />
5353
<PackageReference Include="Microsoft.ML.TestDatabases" Version="$(MicrosoftMLTestDatabasesPackageVersion)" />
5454
<PackageReference Include="Microsoft.ML.TestModels" Version="$(MicrosoftMLTestModelsPackageVersion)" />
55+
<PackageReference Include="SciSharp.TensorFlow.Redist" Version="$(TensorFlowVersion)" />
5556
<PackageReference Include="System.Data.SqlClient" Version="$(SystemDataSqlClientVersion)" />
5657
</ItemGroup>
5758
</Project>

0 commit comments

Comments
 (0)