Skip to content

Commit

Permalink
Improved Remove Background types (#2291)
Browse files Browse the repository at this point in the history
* Improved Remove Background types

* Minor fix
  • Loading branch information
RunDevelopment authored Oct 30, 2023
1 parent c41f915 commit 8e8be5d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
Currently supports u2net models from the rembg project (links found in readme).""",
icon="ONNX",
inputs=[
ImageInput(),
ImageInput(channels=[3, 4]),
OnnxRemBgModelInput(),
BoolInput("Post-process Mask", default=False),
BoolInput("Alpha Matting", default=False),
Expand All @@ -38,7 +38,16 @@
outputs=[
ImageOutput(
"Image",
image_type="""removeBackground(Input1, Input0)""",
image_type="""
let image = Input0;
let model = Input1;
Image {
width: image.width,
height: image.height * model.scaleHeight,
}
""",
channels=4,
),
ImageOutput("Mask", image_type=navi.Image(size_as="Input0"), channels=1),
],
Expand Down
8 changes: 0 additions & 8 deletions src/common/types/chainner-scope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,14 +122,6 @@ def convenientUpscale(model: PyTorchModel | NcnnNetwork, image: Image) {
}
}
def removeBackground(model: OnnxRemBgModel, image: Image) {
Image {
width: image.width,
height: image.height * model.scaleHeight,
channels: 4,
}
}
struct SplitFilePath {
dir: Directory,
basename: string,
Expand Down

0 comments on commit 8e8be5d

Please sign in to comment.