Skip to content

Commit 86edf08

Browse files
committed
More Upscale/Extractor demos
1 parent 0735887 commit 86edf08

File tree

7 files changed

+280
-10
lines changed

7 files changed

+280
-10
lines changed

Examples/TensorStack.Example.Extractors/MainWindow.xaml.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public MainWindow(Settings configuration, NavigationService navigation)
1717
NavigateCommand = new AsyncRelayCommand<View>(NavigateAsync, CanNavigate);
1818
InitializeComponent();
1919

20-
NavigateCommand.Execute(View.ImageBackground);
20+
NavigateCommand.Execute(View.ImageExtractor);
2121
}
2222

2323
public NavigationService Navigation { get; }
@@ -29,6 +29,7 @@ private async Task NavigateAsync(View view)
2929
await Navigation.NavigateAsync((int)view);
3030
}
3131

32+
3233
private bool CanNavigate(View view)
3334
{
3435
return true;

Examples/TensorStack.Example.Extractors/Settings.json

Lines changed: 62 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,61 @@
2727
{
2828
"Id": 3,
2929
"Name": "Depth",
30-
"IsDefault": true,
3130
"Channels": 3,
3231
"SampleSize": 0,
3332
"OutputChannels": 1,
34-
"Normalization": "ZeroToOne",
33+
"Normalization": "OneToOne",
3534
"OutputNormalization": "MinMaxOneToOne",
3635
"IsDynamicOutput": true,
3736
"Path": "Models\\Depth.onnx",
3837
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/Depth.onnx?download=true"
38+
},
39+
{
40+
"Id": 4,
41+
"Name": "LineDrawing",
42+
"Channels": 3,
43+
"SampleSize": 0,
44+
"OutputChannels": 1,
45+
"Normalization": "OneToOne",
46+
"OutputNormalization": "ZeroToOne",
47+
"Path": "Models\\LineDrawing.onnx",
48+
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/LineDrawing.onnx?download=true"
49+
},
50+
{
51+
"Id": 5,
52+
"Name": "DepthAnything-Small",
53+
"Channels": 3,
54+
"SampleSize": 0,
55+
"OutputChannels": 1,
56+
"IsDynamicOutput": true,
57+
"Normalization": "OneToOne",
58+
"OutputNormalization": "MinMaxOneToOne",
59+
"Path": "Models\\DepthAnything-Small.onnx",
60+
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/DepthAnything-Small.onnx?download=true"
61+
},
62+
{
63+
"Id": 6,
64+
"Name": "DepthAnything-Base",
65+
"Channels": 3,
66+
"SampleSize": 0,
67+
"OutputChannels": 1,
68+
"IsDynamicOutput": true,
69+
"Normalization": "OneToOne",
70+
"OutputNormalization": "MinMaxOneToOne",
71+
"Path": "Models\\DepthAnything-Base.onnx",
72+
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/DepthAnything-Base.onnx?download=true"
73+
},
74+
{
75+
"Id": 8,
76+
"Name": "DepthAnything-Large",
77+
"Channels": 3,
78+
"SampleSize": 0,
79+
"OutputChannels": 1,
80+
"IsDynamicOutput": true,
81+
"Normalization": "OneToOne",
82+
"OutputNormalization": "MinMaxOneToOne",
83+
"Path": "Models\\DepthAnything-Large.onnx",
84+
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/DepthAnything-Large.onnx?download=true"
3985
}
4086
],
4187
"BackgroundModels": [
@@ -48,7 +94,7 @@
4894
"Normalization": "ZeroToOne",
4995
"OutputNormalization": "OneToOne",
5096
"Path": "Models\\BiRefNet.onnx",
51-
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/RMBGv1.4.onnx?download=true"
97+
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/BiRefNet.onnx?download=true"
5298
},
5399
{
54100
"Id": 2,
@@ -60,7 +106,19 @@
60106
"Normalization": "ZeroToOne",
61107
"OutputNormalization": "OneToOne",
62108
"Path": "Models\\RMBGv1.4.onnx",
63-
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/BiRefNet.onnx?download=true"
109+
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/RMBGv1.4.onnx?download=true"
110+
},
111+
{
112+
"Id": 3,
113+
"Name": "RMBG 2.0",
114+
"IsDefault": true,
115+
"Channels": 3,
116+
"SampleSize": 1024,
117+
"OutputChannels": 1,
118+
"Normalization": "ZeroToOne",
119+
"OutputNormalization": "OneToOne",
120+
"Path": "Models\\RMBGv2.0.onnx",
121+
"UrlPath": "https://huggingface.co/TensorStack/TensorStack/resolve/main/Extractor/RMBGv2.0.onnx?download=true"
64122
}
65123
]
66124
}

Examples/TensorStack.Example.Extractors/Views/ImageExtractorView.xaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@
9090
</StackPanel>
9191
</UniformGrid>
9292

93+
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
94+
<CheckBox Content="Invert Output" IsChecked="{Binding InvertOutput}" />
95+
<CheckBox Content="Merge Output" IsChecked="{Binding MergeOutput}" Margin="20,0,0,0"/>
96+
</StackPanel>
97+
9398
</StackPanel>
9499
</DockPanel>
95100
</Border>

Examples/TensorStack.Example.Extractors/Views/ImageExtractorView.xaml.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ public partial class ImageExtractorView : ViewBase
2424
private TileMode _tileMode;
2525
private int _tileSize = 512;
2626
private int _tileOverlap = 16;
27+
private bool _invertOutput;
28+
private bool _mergeOutput;
2729

2830
public ImageExtractorView(Settings settings, NavigationService navigationService, IExtractorService extractorService)
2931
: base(settings, navigationService)
@@ -93,6 +95,18 @@ public int TileOverlap
9395
set { SetProperty(ref _tileOverlap, value); }
9496
}
9597

98+
public bool InvertOutput
99+
{
100+
get { return _invertOutput; }
101+
set { SetProperty(ref _invertOutput, value); }
102+
}
103+
104+
public bool MergeOutput
105+
{
106+
get { return _mergeOutput; }
107+
set { SetProperty(ref _mergeOutput, value); }
108+
}
109+
96110

97111
private async Task LoadAsync()
98112
{
@@ -143,7 +157,9 @@ private async Task ExecuteAsync()
143157
Image = _sourceImage,
144158
TileMode = _tileMode,
145159
MaxTileSize = _tileSize,
146-
TileOverlap = _tileOverlap
160+
TileOverlap = _tileOverlap,
161+
IsInverted = _invertOutput,
162+
MergeInput = _mergeOutput
147163
});
148164

149165
// Set Result

Examples/TensorStack.Example.Extractors/Views/VideoExtractorView.xaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,10 @@
9292
<TextBox Text="{Binding TileOverlap}" />
9393
</StackPanel>
9494
</UniformGrid>
95+
<StackPanel Orientation="Horizontal" Margin="0,8,0,0">
96+
<CheckBox Content="Invert Output" IsChecked="{Binding InvertOutput}" />
97+
<CheckBox Content="Merge Output" IsChecked="{Binding MergeOutput}" Margin="20,0,0,0"/>
98+
</StackPanel>
9599

96100
</StackPanel>
97101
</DockPanel>

Examples/TensorStack.Example.Extractors/Views/VideoExtractorView.xaml.cs

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ public partial class VideoExtractorView : ViewBase
2626
private TileMode _tileMode;
2727
private int _tileSize = 512;
2828
private int _tileOverlap = 16;
29+
private bool _invertOutput;
30+
private bool _mergeOutput;
2931
private IProgress<RunProgress> _progressCallback;
3032

3133
public VideoExtractorView(Settings settings, NavigationService navigationService, IExtractorService extractorService)
@@ -97,6 +99,18 @@ public int TileOverlap
9799
set { SetProperty(ref _tileOverlap, value); }
98100
}
99101

102+
public bool InvertOutput
103+
{
104+
get { return _invertOutput; }
105+
set { SetProperty(ref _invertOutput, value); }
106+
}
107+
108+
public bool MergeOutput
109+
{
110+
get { return _mergeOutput; }
111+
set { SetProperty(ref _mergeOutput, value); }
112+
}
113+
100114

101115
private async Task LoadAsync()
102116
{
@@ -149,6 +163,8 @@ private async Task ExecuteAsync()
149163
TileMode = _tileMode,
150164
MaxTileSize = _tileSize,
151165
TileOverlap = _tileOverlap,
166+
IsInverted = _invertOutput,
167+
MergeInput = _mergeOutput
152168
}, _progressCallback);
153169

154170
// Set Result

0 commit comments

Comments
 (0)