background-removal-js icon indicating copy to clipboard operation
background-removal-js copied to clipboard

How do i use custom models?

Open isntfunny opened this issue 1 year ago • 7 comments

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?

isntfunny avatar Nov 23 '23 15:11 isntfunny

No.

DanielHauschildt avatar Nov 23 '23 18:11 DanielHauschildt

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

isntfunny avatar Nov 23 '23 18:11 isntfunny

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

DanielHauschildt avatar Dec 24 '23 07:12 DanielHauschildt

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

DanielHauschildt avatar Dec 24 '23 07:12 DanielHauschildt

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.

dylie-eth avatar Feb 28 '24 18:02 dylie-eth

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?

Piliuta avatar Mar 27 '24 18:03 Piliuta

Its just a resource thing.

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

DanielHauschildt avatar May 16 '24 05:05 DanielHauschildt