imgly / background-removal-js

Remove backgrounds from images directly in the browser environment with ease and no additional costs or privacy concerns. Explore an interactive demo.
https://img.ly/showcases/cesdk/web/background-removal/web
GNU Affero General Public License v3.0
5.6k stars 350 forks source link

How do i use custom models? #76

Open isntfunny opened 9 months ago

isntfunny commented 9 months ago

Is it possible to use custom models, for example from here?

And if so, can they be hosted locally instead of being loaded from an url when using the node version?

DanielHauschildt commented 9 months ago

No.

isntfunny commented 9 months ago

In this line there is a reference to a large model. Is it somehow possible to use that to get better results?

https://github.com/imgly/background-removal-js/blob/main/packages/node/src/schema.ts#L43

DanielHauschildt commented 8 months ago

The large model is using float32 compared to float16. The quality is almost the same.

DanielHauschildt commented 8 months ago

FYI: I added a new mode with 1.3.0 that outputs the original image resolution

dylie-eth commented 6 months ago

Is there any way (could be hacky) that we can use custom models?

I understand that you said there was no way to do it currently, but I likely need a stronger model to accurately remove backgrounds as neither of the current ones are good enough for my use case.

Piliuta commented 5 months ago

Joining the original question. Whereas the library works great on complex images, it often fails on images with simple objects. Having the ability to switch models would be an amazing feature of this library.

@DanielHauschildt could you elaborate on why the answer is no? Is this because it is hard to integrate or there are no human resources to do it or something else?

DanielHauschildt commented 3 months ago

Its just a resource thing.

If you have a proposal for models that work better, please let me know.