Skip to content
This repository was archived by the owner on Nov 27, 2024. It is now read-only.

Commit 23b0c27

Browse files
committed
Update README
1 parent 2ad5ae0 commit 23b0c27

File tree

2 files changed

+88
-29
lines changed

2 files changed

+88
-29
lines changed

OnnxStack.FeatureExtractor/README.md

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,72 @@
11
# OnnxStack.FeatureExtractor
22

3-
## Canny
4-
https://huggingface.co/axodoxian/controlnet_onnx/resolve/main/annotators/canny.onnx
3+
### Canny
4+
* https://huggingface.co/axodoxian/controlnet_onnx/resolve/main/annotators/canny.onnx
55

6-
## Hed
7-
https://huggingface.co/axodoxian/controlnet_onnx/resolve/main/annotators/hed.onnx
6+
### Hed
7+
* https://huggingface.co/axodoxian/controlnet_onnx/resolve/main/annotators/hed.onnx
88

9-
## Depth
10-
https://huggingface.co/axodoxian/controlnet_onnx/resolve/main/annotators/depth.onnx
11-
https://huggingface.co/Xenova/depth-anything-large-hf/onnx/model.onnx
12-
https://huggingface.co/julienkay/sentis-MiDaS
9+
### Depth
10+
* https://huggingface.co/axodoxian/controlnet_onnx/resolve/main/annotators/depth.onnx
11+
* https://huggingface.co/Xenova/depth-anything-large-hf/onnx/model.onnx
12+
* https://huggingface.co/julienkay/sentis-MiDaS
1313

14-
## OpenPose (TODO)
15-
https://huggingface.co/axodoxian/controlnet_onnx/resolve/main/annotators/openpose.onnx
14+
### OpenPose (TODO)
15+
* https://huggingface.co/axodoxian/controlnet_onnx/resolve/main/annotators/openpose.onnx
1616

1717
# Image Example
1818
```csharp
19-
2019
// Load Input Image
2120
var inputImage = await OnnxImage.FromFileAsync("Input.png");
2221

2322
// Load Pipeline
2423
var pipeline = FeatureExtractorPipeline.CreatePipeline("canny.onnx");
2524

2625
// Run Pipeline
27-
var imageFeature = await pipeline.RunAsync(inputImage);
26+
var result = await pipeline.RunAsync(inputImage);
2827

2928
// Save Image
30-
await imageFeature.Image.SaveAsync("Result.png");
29+
await result.SaveAsync("Result.png");
3130

3231
//Unload
3332
await pipeline.UnloadAsync();
3433
```
3534

3635
# Video Example
3736
```csharp
38-
39-
// Load Input Video
40-
var inputVideo = await OnnxVideo.FromFileAsync("Input.mp4");
37+
// Load Input Image
38+
var inputImage = await OnnxVideo.FromFileAsync("Input.mp4");
4139

4240
// Load Pipeline
4341
var pipeline = FeatureExtractorPipeline.CreatePipeline("canny.onnx");
4442

4543
// Run Pipeline
46-
var videoFeature = await pipeline.RunAsync(inputVideo);
44+
var result = await pipeline.RunAsync(inputImage);
45+
46+
// Save Image
47+
await result.SaveAsync("Result.mp4");
48+
49+
//Unload
50+
await pipeline.UnloadAsync();
51+
```
52+
53+
# Video Stream Example
54+
```csharp
55+
// Read Video Info
56+
var videoFile = "Input.mp4";
57+
var videoInfo = await VideoHelper.ReadVideoInfoAsync(videoFile);
58+
59+
// Create Video Stream
60+
var videoStream = VideoHelper.ReadVideoStreamAsync(videoFile, videoInfo.FrameRate);
61+
62+
// Create pipeline
63+
var pipeline = FeatureExtractorPipeline.CreatePipeline("canny.onnx");
64+
65+
// Create Pipeline Stream
66+
var pipelineStream = pipeline.RunAsync(videoStream);
4767

48-
// Save Video
49-
await videoFeature.SaveAsync("Result.mp4");
68+
// Write Video Stream
69+
await VideoHelper.WriteVideoStreamAsync(videoInfo, pipelineStream, "Result.mp4");
5070

5171
//Unload
5272
await pipeline.UnloadAsync();

OnnxStack.ImageUpscaler/README.md

Lines changed: 49 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,68 @@
11
# OnnxStack.ImageUpscaler
22

33
## Upscale Models
4-
https://huggingface.co/wuminghao/swinir
5-
https://huggingface.co/rocca/swin-ir-onnx
6-
https://huggingface.co/Xenova/swin2SR-classical-sr-x2-64
7-
https://huggingface.co/Xenova/swin2SR-classical-sr-x4-64
4+
Below is a small list of known/tested upscale models
5+
* https://huggingface.co/wuminghao/swinir
6+
* https://huggingface.co/rocca/swin-ir-onnx
7+
* https://huggingface.co/Xenova/swin2SR-classical-sr-x2-64
8+
* https://huggingface.co/Xenova/swin2SR-classical-sr-x4-64
89

910

10-
# Basic Example
11+
# Image Example
1112
```csharp
1213
// Load Input Image
1314
var inputImage = await OnnxImage.FromFileAsync("Input.png");
1415

1516
// Create Pipeline
16-
var pipeline = ImageUpscalePipeline.CreatePipeline("003_realSR_BSRGAN_DFO_s64w8_SwinIR-M_x4_GAN.onnx", scaleFactor: 4);
17+
var pipeline = ImageUpscalePipeline.CreatePipeline("SwinIR-M_x4_GAN.onnx", scaleFactor: 4);
1718

1819
// Run pipeline
1920
var result = await pipeline.RunAsync(inputImage);
2021

21-
// Create Image from Tensor result
22-
var image = new OnnxImage(result, ImageNormalizeType.ZeroToOne);
23-
2422
// Save Image File
25-
await image.SaveAsync("Upscaled.png");
23+
await result.SaveAsync("Result.png");
24+
25+
// Unload
26+
await pipeline.UnloadAsync();
27+
```
28+
29+
30+
# Video Example
31+
```csharp
32+
// Load Input Video
33+
var inputVideo = await OnnxVideo.FromFileAsync("Input.mp4");
34+
35+
// Create Pipeline
36+
var pipeline = ImageUpscalePipeline.CreatePipeline("SwinIR-M_x4_GAN.onnx", scaleFactor: 4);
37+
38+
// Run pipeline
39+
var result = await pipeline.RunAsync(inputVideo);
40+
41+
// Save Video File
42+
await result.SaveAsync("Result.mp4");
2643

2744
// Unload
2845
await pipeline.UnloadAsync();
46+
```
47+
48+
# Video Stream Example
49+
```csharp
50+
// Read Video Info
51+
var videoFile = "Input.mp4";
52+
var videoInfo = await VideoHelper.ReadVideoInfoAsync(videoFile);
53+
54+
// Create Video Stream
55+
var videoStream = VideoHelper.ReadVideoStreamAsync(videoFile, videoInfo.FrameRate);
56+
57+
// Create pipeline
58+
var pipeline = ImageUpscalePipeline.CreatePipeline("SwinIR-M_x4_GAN.onnx", scaleFactor: 4);
59+
60+
// Create Pipeline Stream
61+
var pipelineStream = pipeline.RunAsync(videoStream);
62+
63+
// Write Video Stream
64+
await VideoHelper.WriteVideoStreamAsync(videoInfo, pipelineStream, "Result.mp4");
65+
66+
//Unload
67+
await pipeline.UnloadAsync();
2968
```

0 commit comments

Comments
 (0)