Skip to content

Commit 40d6dce

Browse files
working style transfer, need to clean up
1 parent 8fd55a4 commit 40d6dce

File tree

7 files changed

+20
-5
lines changed

7 files changed

+20
-5
lines changed

Samples/StyleTransfer/AppViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
using Windows.Media.Effects;
1515
using Windows.Media;
1616
using Windows.Foundation.Collections;
17-
using Windows.AI.MachineLearning;
17+
using Microsoft.AI.MachineLearning;
1818
using Windows.Storage;
1919
using System.Runtime.CompilerServices;
2020
using Windows.Graphics.Imaging;

Samples/StyleTransfer/RuntimeComponent2/Class.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace winrt::RuntimeComponent2::implementation
77
{
8+
Class::Class() : outputTransformed(VideoFrame(Windows::Graphics::Imaging::BitmapPixelFormat::Bgra8, 720, 720)) {}
89

910
IVectorView<VideoEncodingProperties> Class::SupportedEncodingProperties() {
1011
VideoEncodingProperties encodingProperties = VideoEncodingProperties();
@@ -60,16 +61,19 @@ namespace winrt::RuntimeComponent2::implementation
6061
throw hresult_not_implemented();
6162
}
6263

64+
6365
void Class::ProcessFrame(ProcessVideoFrameContext context) {
6466
LearningModelSession _session = Session();
6567
LearningModelBinding _binding = Binding();
6668
VideoFrame inputFrame = context.InputFrame();
6769
VideoFrame outputFrame = context.OutputFrame();
6870

71+
6972
_binding.Bind(InputImageDescription(), inputFrame);
70-
_binding.Bind(OutputImageDescription(), outputFrame);
73+
_binding.Bind(OutputImageDescription(), outputTransformed);
7174

72-
auto results = _session.Evaluate(_binding, L"test");
75+
_session.Evaluate(_binding, L"test");
76+
outputTransformed.CopyToAsync(context.OutputFrame());
7377
}
7478

7579
void Class::SetEncodingProperties(VideoEncodingProperties props, IDirect3DDevice device) {

Samples/StyleTransfer/RuntimeComponent2/Class.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ namespace winrt::RuntimeComponent2::implementation
1414
{
1515
struct Class : ClassT<Class>
1616
{
17-
Class() = default;
17+
Class();
18+
VideoFrame outputTransformed;
1819

1920
IVectorView<VideoEncodingProperties> SupportedEncodingProperties();
2021
bool TimeIndependent();

Samples/StyleTransfer/RuntimeComponent2/RuntimeComponent2.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.props')" />
34
<Import Project="packages\Microsoft.AI.MachineLearning.1.3.0\build\native\Microsoft.AI.MachineLearning.props" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.3.0\build\native\Microsoft.AI.MachineLearning.props')" />
45
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.props')" />
56
<PropertyGroup Label="Globals">
@@ -149,6 +150,7 @@
149150
<ImportGroup Label="ExtensionTargets">
150151
<Import Project="packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.targets')" />
151152
<Import Project="packages\Microsoft.AI.MachineLearning.1.3.0\build\native\Microsoft.AI.MachineLearning.targets" Condition="Exists('packages\Microsoft.AI.MachineLearning.1.3.0\build\native\Microsoft.AI.MachineLearning.targets')" />
153+
<Import Project="..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.targets" Condition="Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.targets')" />
152154
</ImportGroup>
153155
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
154156
<PropertyGroup>
@@ -158,5 +160,7 @@
158160
<Error Condition="!Exists('packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.Windows.CppWinRT.2.0.200615.7\build\native\Microsoft.Windows.CppWinRT.targets'))" />
159161
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.3.0\build\native\Microsoft.AI.MachineLearning.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.3.0\build\native\Microsoft.AI.MachineLearning.props'))" />
160162
<Error Condition="!Exists('packages\Microsoft.AI.MachineLearning.1.3.0\build\native\Microsoft.AI.MachineLearning.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Microsoft.AI.MachineLearning.1.3.0\build\native\Microsoft.AI.MachineLearning.targets'))" />
163+
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.props'))" />
164+
<Error Condition="!Exists('..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.Windows.CppWinRT.2.0.200630.5\build\native\Microsoft.Windows.CppWinRT.targets'))" />
161165
</Target>
162166
</Project>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<packages>
33
<package id="Microsoft.AI.MachineLearning" version="1.3.0" targetFramework="native" />
4-
<package id="Microsoft.Windows.CppWinRT" version="2.0.200615.7" targetFramework="native" />
4+
<package id="Microsoft.Windows.CppWinRT" version="2.0.200630.5" targetFramework="native" />
55
</packages>

Samples/StyleTransfer/StyleTransfer.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,9 @@
216216
</Page>
217217
</ItemGroup>
218218
<ItemGroup>
219+
<PackageReference Include="Microsoft.AI.MachineLearning">
220+
<Version>1.3.0</Version>
221+
</PackageReference>
219222
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
220223
<Version>6.2.10</Version>
221224
</PackageReference>

Samples/StyleTransfer/StyleTransferEffectComponent/StyleTransferEffectComponent.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@
125125
<Compile Include="Properties\AssemblyInfo.cs" />
126126
</ItemGroup>
127127
<ItemGroup>
128+
<PackageReference Include="Microsoft.AI.MachineLearning">
129+
<Version>1.3.0</Version>
130+
</PackageReference>
128131
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
129132
<Version>6.2.10</Version>
130133
</PackageReference>

0 commit comments

Comments
 (0)