nadermx / backgroundremover

Background Remover lets you Remove Background from images and video using AI with a simple command line interface that is free and open source.
https://www.backgroundremoverai.com
MIT License
6.7k stars 558 forks source link

non-cli usage #62

Closed WASasquatch closed 1 year ago

WASasquatch commented 1 year ago

Is there no programming usage? Is this really just a tool uploaded as a module to pip?

nadermx commented 1 year ago

Not sure I underatand your question. You can use it just via pip install. No meed to use the website

El dom, 26 de mar de 2023 15:13, WAS @.***> escribió:

Is there no programming usage? Is this really just a tool uploaded as a module to pip?

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/62, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXHGU5QQXGGYEVYKGY3W6CINDANCNFSM6AAAAAAWILKDFA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

nadermx commented 1 year ago

Completly free to use, models are lodaded on local when you run it.

El dom, 26 de mar de 2023 15:40, Johnathan Nader @.***> escribió:

Not sure I underatand your question. You can use it just via pip install. No meed to use the website

El dom, 26 de mar de 2023 15:13, WAS @.***> escribió:

Is there no programming usage? Is this really just a tool uploaded as a module to pip?

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/62, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXHGU5QQXGGYEVYKGY3W6CINDANCNFSM6AAAAAAWILKDFA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

WASasquatch commented 1 year ago

Not sure I underatand your question. You can use it just via pip install. No meed to use the website El dom, 26 de mar de 2023 15:13, WAS @.> escribió: Is there no programming usage? Is this really just a tool uploaded as a module to pip? — Reply to this email directly, view it on GitHub <#62>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXHGU5QQXGGYEVYKGY3W6CINDANCNFSM6AAAAAAWILKDFA . You are receiving this because you are subscribed to this thread.Message ID: @.>

I mean, like is there example usage for simply importing the core code and using it within a program. Currently the only directions listed are CLI, which isn't what I'm looking for. I try to avoid system execution calls as much as possible.

nadermx commented 1 year ago

If you want to use the api go to https://backgroundremoverai.com/api/#settings-i18n-introduction

WASasquatch commented 1 year ago

If you want to use the api go to https://backgroundremoverai.com/api/#settings-i18n-introduction

This topic isn't considered closed.

That's an API, which has nothing to do with what I'm asking. In previous versions you could just use PyTorch Hub, load the model, and use them, but the newest models aren't downloadable, and even if you have it, pytorch hub doesn't have the right conf.

        torch.hub.set_dir(self.midas_dir)
        midas = torch.hub.load("intel-isl/MiDaS", midas_model, trust_repo=True)
        device = torch.device("cuda") if torch.cuda.is_available(
        ) and use_cpu == 'false' else torch.device("cpu")

        midas.to(device).eval()
        midas_transforms = torch.hub.load("intel-isl/MiDaS", "transforms")

        if midas_model == "DPT_Large" or midas_model == "DPT_Hybrid":
            transform = midas_transforms.dpt_transform
        else:
            transform = midas_transforms.small_transform

        # Do some predictions

I'd expect usage like this to continue through the versions, or have documentation on how to achieve the same sort of programming functionality used a lot in scripts elsewhere with newer models.

nadermx commented 1 year ago

Ah okay, misunderstand. I'll check this later

El mar, 28 de mar de 2023 23:49, WAS @.***> escribió:

If you want to use the api go to https://backgroundremoverai.com/api/#settings-i18n-introduction

That's an API, which has nothing to do with what I'm asking. In previous versions you could just use PyTorch Hub, load the model, and use them, but the newest models aren't downloadable, and even if you have it, pytorch hub doesn't have the right conf.

    torch.hub.set_dir(self.midas_dir)
    midas = torch.hub.load("intel-isl/MiDaS", midas_model, trust_repo=True)
    device = torch.device("cuda") if torch.cuda.is_available(
    ) and use_cpu == 'false' else torch.device("cpu")

    midas.to(device).eval()
    midas_transforms = torch.hub.load("intel-isl/MiDaS", "transforms")

    if midas_model == "DPT_Large" or midas_model == "DPT_Hybrid":
        transform = midas_transforms.dpt_transform
    else:
        transform = midas_transforms.small_transform

— Reply to this email directly, view it on GitHub https://github.com/nadermx/backgroundremover/issues/62#issuecomment-1487905489, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYACXDI7PUE4AXXOMSQRADW6OWMJANCNFSM6AAAAAAWILKDFA . You are receiving this because you modified the open/close state.Message ID: @.***>

WASasquatch commented 1 year ago

I see the confusion, I thought I was making this issue on the MiDaS repo, but apparently I made the issue in the wrong tab, as I was inspecting this repo for possible usage. I apologize for the confusion.