Skip to content

Commit

Permalink
docs: models output
Browse files Browse the repository at this point in the history
  • Loading branch information
qq15725 committed Dec 7, 2023
1 parent 58a148e commit 07811a9
Show file tree
Hide file tree
Showing 13 changed files with 16 additions and 20 deletions.
32 changes: 14 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@
</a>
</p>

<p style="display: flex; align-items: center; justify-content: center;">
<img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/example.jpg" width="200" />
<img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/example.out.png" width="200" />
</p>

## 📦 Install

```shell
Expand All @@ -49,7 +44,7 @@ import { removeBackground } from 'modern-rembg'

removeBackground('/example.jpg', {
debug: true,
model: '/you-custom-model.onnx',
model: '/you-custom-model.onnx', // default use u2netp.onnx
resolution: 320, // model resolution
}).then(blob => {
window.open(URL.createObjectURL(blob))
Expand All @@ -58,16 +53,17 @@ removeBackground('/example.jpg', {

## Open source models

| Model | Resolution | Size(MB) | From |
|----------------------------------------------------------------------------------------------------------------|------------|-----------|-------------------------------------------------------------------------------|
| [u2net.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx) | 320 | 168 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| [u2netp.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2netp.onnx) | 320 | 4 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| [u2net_human_seg.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx) | 320 | 168 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| [u2net_cloth_seg.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_cloth_seg.onnx) | 320 | 168 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| [silueta.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/silueta.onnx) | 320 | 42 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| [isnet-general-use.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/isnet-general-use.onnx) | 320 | 170 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| [isnet-anime.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/isnet-anime.onnx) | 320 | 168 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| [large](https://github.com/imgly/background-removal-js/raw/main/bundle/models/large?download=) | 1024 | 176 | [imgly/background-removal-js](https://github.com/imgly/background-removal-js) |
| [medium](https://github.com/imgly/background-removal-js/raw/main/bundle/models/medium?download=) | 1024 | 88 | [imgly/background-removal-js](https://github.com/imgly/background-removal-js) |
| [small](https://github.com/imgly/background-removal-js/raw/main/bundle/models/small?download=) | 1024 | 44 | [imgly/background-removal-js](https://github.com/imgly/background-removal-js) |
| Output | Model | Resolution | Size(MB) | From |
|---------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------|------------|----------|-------------------------------------------------------------------------------|
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/example.jpb" width="100" /> | | | | |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/u2net.onnx.png" width="100" /> | [u2net.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net.onnx) | 320 | 168 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/u2netp.onnx.png" width="100" /> | [u2netp.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2netp.onnx) | 320 | 4 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/u2net_human_seg.onnx.png" width="100" /> | [u2net_human_seg.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_human_seg.onnx) | 320 | 168 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/u2net_cloth_seg.onnx.png" width="100" /> | [u2net_cloth_seg.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/u2net_cloth_seg.onnx) | 768 | 168 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/silueta.onnx.png" width="100" /> | [silueta.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/silueta.onnx) | 320 | 42 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/isnet-general-use.onnx.png" width="100" /> | [isnet-general-use.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/isnet-general-use.onnx) | 320 | 170 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/isnet-anime.onnx.png" width="100" /> | [isnet-anime.onnx](https://github.com/danielgatis/rembg/releases/download/v0.0.0/isnet-anime.onnx) | 1024 | 168 | [danielgatis/rembg](https://github.com/danielgatis/rembg) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/large.png" width="100" /> | [large](https://github.com/imgly/background-removal-js/raw/main/bundle/models/large?download=) | 1024 | 176 | [imgly/background-removal-js](https://github.com/imgly/background-removal-js) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/medium.png" width="100" /> | [medium](https://github.com/imgly/background-removal-js/raw/main/bundle/models/medium?download=) | 1024 | 88 | [imgly/background-removal-js](https://github.com/imgly/background-removal-js) |
| <img src="https://raw.githubusercontent.com/qq15725/modern-rembg/main/examples/small.png" width="100" /> | [small](https://github.com/imgly/background-removal-js/raw/main/bundle/models/small?download=) | 1024 | 44 | [imgly/background-removal-js](https://github.com/imgly/background-removal-js) |

Binary file added examples/isnet-anime.onnx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/isnet-general-use.onnx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/large.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/medium.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
Binary file added examples/small.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/u2net.onnx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/u2net_cloth_seg.onnx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/u2net_human_seg.onnx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/u2netp.onnx.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

const blob = await removeBackground(imageSource, {
debug: true,
model: '/models/small.onnx',
model: '/models/u2netp.onnx',
resolution: 1024,
wasmPaths: {
'ort-wasm-simd.wasm': './node_modules/onnxruntime-web/dist/ort-wasm-simd.wasm',
Expand Down
2 changes: 1 addition & 1 deletion src/remove-background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export async function removeBackground(
resized.toBchwImageTensor().toTensor(),
])
model.release()
debug && consoleDebug('Compute inference completion', result)
debug && consoleDebug('Completion', result)

const stride = resolution * resolution
switch (options.output ?? 'foreground') {
Expand Down

0 comments on commit 07811a9

Please sign in to comment.