Skip to content

Commit 887e929

Browse files
committed
1. 코드 업데이트
1 parent 3040747 commit 887e929

File tree

19 files changed

+409
-64
lines changed

19 files changed

+409
-64
lines changed

LLE/CSharpInference/CSharpInference.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</PropertyGroup>
1010

1111
<ItemGroup>
12-
<PackageReference Include="LLE.Managed.Cu118" Version="1.0.5" />
12+
<PackageReference Include="LLE.Managed.Cu118" Version="1.0.5.2" />
1313
</ItemGroup>
1414

1515
</Project>

LLE/LLE.Native.Cu118/LLE.Native.Cu118.vcxproj

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,10 @@ xcopy /Y /E /I "$(OutDir)*.dll" "$(SolutionDir)LLE.Native.Cu118.Package\build\na
156156

157157

158158

159-
xcopy /Y /E /I "$(OutDir)*.dll" "$(SolutionDir)LLE.Managed.Cu118.Package\runtimes\win-x64\native\"</Command>
159+
xcopy /Y /E /I "$(OutDir)*.dll" "$(SolutionDir)LLE.Managed.Cu118.Package\runtimes\win-x64\native\"
160+
161+
copy /Y "$(OutDir)zlib1.dll" "$(SolutionDir)LLE.Managed.Cu118.Package\lib\$(TargetFramework)zlibwapi.dll"
162+
copy /Y "$(OutDir)zlib1.dll" "$(SolutionDir)LLE.Managed.Cu118.Package\runtimes\win-x64\native\zlibwapi.dll"</Command>
160163
</PostBuildEvent>
161164
</ItemDefinitionGroup>
162165
<ItemGroup>

LLE/LLEViewer/BootStrapper.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using ConvMVVM2.Core.MVVM;
2+
using LLEViewer.Services;
23
using LLEViewer.ViewModels;
34
using LLEViewer.Views;
45
using LLEViewer.Windows;
@@ -48,6 +49,11 @@ protected override void RegisterServices(IServiceCollection serviceCollection)
4849
serviceCollection.AddSingleton<CameraViewModel>();
4950
serviceCollection.AddSingleton<ImageViewModel>();
5051
serviceCollection.AddSingleton<VideoViewModel>();
52+
53+
54+
55+
//Service
56+
serviceCollection.AddSingleton<ILLEService, LLEService>();
5157
}
5258

5359
protected override void ViewModelMapping(IViewModelMapper viewModelMapper)
4.33 KB
Loading

LLE/LLEViewer/Images/notice.png

2.76 MB
Loading

LLE/LLEViewer/Images/off.png

10.8 KB
Loading

LLE/LLEViewer/Images/on.png

10.8 KB
Loading

LLE/LLEViewer/LLEViewer.csproj

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<ImplicitUsings>enable</ImplicitUsings>
88
<UseWPF>true</UseWPF>
99
<Platforms>AnyCPU;x64</Platforms>
10+
<ApplicationIcon>program_icon.ico</ApplicationIcon>
1011
</PropertyGroup>
1112

1213
<ItemGroup>
@@ -15,6 +16,10 @@
1516
<None Remove="Images\garbage.png" />
1617
<None Remove="Images\home.png" />
1718
<None Remove="Images\image.png" />
19+
<None Remove="Images\image_file.png" />
20+
<None Remove="Images\notice.png" />
21+
<None Remove="Images\off.png" />
22+
<None Remove="Images\on.png" />
1823
<None Remove="Images\video.png" />
1924
<None Remove="Resources\readme.html" />
2025
</ItemGroup>
@@ -23,9 +28,13 @@
2328
<Page Remove="Resources\Style.xaml" />
2429
</ItemGroup>
2530

31+
<ItemGroup>
32+
<Content Include="program_icon.ico" />
33+
</ItemGroup>
34+
2635
<ItemGroup>
2736
<PackageReference Include="ConvMVVM2.WPF" Version="1.23.1.1" />
28-
<PackageReference Include="LLE.Managed.Cu118" Version="1.0.5.1" />
37+
<PackageReference Include="LLE.Managed.Cu118" Version="1.0.5.2" />
2938
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.3650.58" />
3039
</ItemGroup>
3140

@@ -50,6 +59,10 @@
5059
<Resource Include="Images\garbage.png" />
5160
<Resource Include="Images\home.png" />
5261
<Resource Include="Images\image.png" />
62+
<Resource Include="Images\image_file.png" />
63+
<Resource Include="Images\notice.png" />
64+
<Resource Include="Images\off.png" />
65+
<Resource Include="Images\on.png" />
5366
<Resource Include="Images\video.png" />
5467
<Resource Include="Resources\readme.html" />
5568
<Resource Include="Resources\Style.xaml" />

LLE/LLEViewer/Services/ILLEService.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ public interface ILLEService
1313
#region Public Functions
1414
public Image Predict(string path);
1515
public Image Predict(Image input);
16-
public void Setup();
16+
public void Setup(string device);
1717
public void Shutdown();
1818
#endregion
19+
20+
#region Event
21+
public event Action OnSetup;
22+
public event Action OnShutdown;
23+
#endregion
1924
}
2025
}

LLE/LLEViewer/Services/LLEService.cs

Lines changed: 42 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,40 @@
77

88
namespace LLEViewer.Services
99
{
10-
public class LLEService
10+
public class LLEService : ILLEService
1111
{
1212
#region Private Property
13-
private readonly LLEAPI.V1.MemoryPool pool = null;
14-
private readonly LLEAPI.V1.LLE lle = LLEAPI.V1.LLE.Create();
13+
private readonly LLEAPI.V1.MemoryPool pool = LLEAPI.V1.MemoryPool.Create();
14+
private readonly LLEAPI.V1.LLE lle = null;
1515
#endregion
1616

1717
#region Constructor
1818
public LLEService()
1919
{
2020

2121

22+
this.lle = LLEAPI.V1.LLE.Create(this.pool);
2223

2324
}
2425
#endregion
2526

27+
#region Event
28+
public event Action OnSetup;
29+
public event Action OnShutdown;
30+
#endregion
31+
2632
#region Public Functions
2733
public Image Predict(string path)
2834
{
2935
try
3036
{
31-
return lle.Predict(path);
37+
38+
lock (this.lle)
39+
{
40+
return lle.Predict(path);
41+
}
42+
43+
3244
}
3345
catch
3446
{
@@ -39,7 +51,12 @@ public Image Predict(Image input)
3951
{
4052
try
4153
{
42-
return lle.Predict(input);
54+
lock (this.lle)
55+
{
56+
return lle.Predict(input);
57+
}
58+
59+
4360
}
4461
catch
4562
{
@@ -50,16 +67,22 @@ public void Setup(string device)
5067
{
5168
try
5269
{
53-
switch (device)
70+
lock (this.lle)
5471
{
55-
case "CPU":
56-
lle.Setup(DlType.ZeroDCE, Device.Cpu);
57-
break;
72+
switch (device)
73+
{
74+
case "CPU":
75+
lle.Setup(DlType.ZeroDCE, Device.Cpu);
76+
this.OnSetup();
77+
break;
5878

59-
case "CUDA":
60-
lle.Setup(DlType.ZeroDCE, Device.Cuda);
61-
break;
79+
case "CUDA":
80+
lle.Setup(DlType.ZeroDCE, Device.Cuda);
81+
this.OnSetup();
82+
break;
83+
}
6284
}
85+
6386
}
6487
catch
6588
{
@@ -70,13 +93,19 @@ public void Shutdown()
7093
{
7194
try
7295
{
73-
lle.Shutdown();
96+
lock (this.lle)
97+
{
98+
lle.Shutdown();
99+
this.OnShutdown();
100+
}
74101
}
75102
catch
76103
{
77104
throw;
78105
}
79106
}
80107
#endregion
108+
109+
81110
}
82111
}

0 commit comments

Comments
 (0)