IsGarrido commited on
Commit
bec1a4a
·
verified ·
1 Parent(s): 74c72b3

Upload folder using huggingface_hub

Browse files
Files changed (9) hide show
  1. .gitattributes +3 -0
  2. README.md +59 -0
  3. image.jpg +0 -0
  4. lama.onnx +3 -0
  5. lama_fp32.onnx +3 -0
  6. mask.png +0 -0
  7. output_onnx.png +3 -0
  8. output_onnx_fp32.png +3 -0
  9. output_orig.png +3 -0
.gitattributes CHANGED
@@ -33,3 +33,6 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ output_onnx.png filter=lfs diff=lfs merge=lfs -text
37
+ output_onnx_fp32.png filter=lfs diff=lfs merge=lfs -text
38
+ output_orig.png filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pipeline_tag: image-to-image
6
+ tags:
7
+ - art
8
+ - lama
9
+ - inpainting
10
+ ---
11
+ # LaMa Inpainting Model
12
+
13
+ This ONNX model is a port of the original PyTorch big-lama model.
14
+
15
+ > HG Space: https://huggingface.co/spaces/Carve/LaMa-Demo-ONNX
16
+ ## Description
17
+
18
+ There are two versions of the model:
19
+
20
+ ### 1. `lama_fp32.onnx` (RECOMMENDED)
21
+
22
+ This version was exported using the old torch to ONNX converter (`torch.onnx.export`).
23
+
24
+ **Notes:**
25
+ 1. **Custom FourierUnitJIT**: A custom [FourierUnitJIT](https://github.com/Carve-Photos/lama/blob/main/saicinpainting/training/modules/ffc.py) implementation is used since the original cannot be directly ported to ONNX without overhead. The result is identical to the original model.
26
+ 2. **Fixed Input Shape**: The input shape is fixed at 512x512 pixels. Although dynamic input shapes are possible, they would require resolving issues with dynamic padding in the `irfft` and `rfftn` functions in `ffc.py`.
27
+ 3. **Opset Version 17**: This model uses opset version 17.
28
+ 4. **Exportable to TensorRT**: The model can be successfully used in TensorRT, etc.
29
+ > if you need other resolution - export it using our [jupyter notebook](https://colab.research.google.com/github/Carve-Photos/lama/blob/main/export_LaMa_to_onnx.ipynb)
30
+
31
+ ### 2. `lama.onnx` (NOT RECOMMENDED)
32
+
33
+ This version was exported using the new torch to ONNX converter (`torch.onnx.dynamo_export`).
34
+
35
+ **Notes:**
36
+ 1. **Custom DFT irfftn Logic**: Uses a custom irfftn ONNX logic (patched `onnxscript`).
37
+ 2. **Fixed Input Shape**: The input shape is fixed at 512x512 pixels.
38
+ 3. **Opset Version 18**: This model uses opset version 18.
39
+ 4. **Performance**: The model works slowly due to issues with `torch.onnx.dynamo_export` and optimization of the ONNX model.
40
+
41
+ ## Resources
42
+
43
+ - Original repository: [advimman/lama](https://github.com/advimman/lama)
44
+ - Repository with custom implementation of exportable LaMa: [Carve-Photos/lama](https://github.com/Carve-Photos/lama)
45
+
46
+ ## Example
47
+
48
+ **Original image:**
49
+ ![original image](./image.jpg)
50
+
51
+
52
+ **lama_fp32.onnx - output:**
53
+ ![onnx output](./output_onnx_fp32.png)
54
+
55
+ **lama.onnx - output:**
56
+ ![onnx output](./output_onnx.png)
57
+
58
+ **Original model output:**
59
+ ![original model output](./output_orig.png)
image.jpg ADDED
lama.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:351e481e287f345b7fbfd026068cfb9ec0c7f24b440e6501458ebe54a833d1a1
3
+ size 207479252
lama_fp32.onnx ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1faef5301d78db7dda502fe59966957ec4b79dd64e16f03ed96913c7a4eb68d6
3
+ size 208044816
mask.png ADDED
output_onnx.png ADDED

Git LFS Details

  • SHA256: e5d14af07fdc00f40561c821adb5e05bf8ada0635f5a24d2f869f63875688bef
  • Pointer size: 131 Bytes
  • Size of remote file: 241 kB
output_onnx_fp32.png ADDED

Git LFS Details

  • SHA256: 0da016c2c4de80551cb1cc3eb83ead31f9c07bea0cbbdbda23e19d50bbfdef93
  • Pointer size: 131 Bytes
  • Size of remote file: 241 kB
output_orig.png ADDED

Git LFS Details

  • SHA256: 1578f4df474a638f1bbe5be41c97f90d70d505662b62e6ad7b4ef87b1acdb14d
  • Pointer size: 131 Bytes
  • Size of remote file: 316 kB