Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip model download on import #200

Open
bogdan-galileo opened this issue Jul 26, 2023 · 1 comment
Open

Skip model download on import #200

bogdan-galileo opened this issue Jul 26, 2023 · 1 comment

Comments

@bogdan-galileo
Copy link

bogdan-galileo commented Jul 26, 2023

Importing PHash causes the import of the CNN class and triggers the download of the Mobilenet model from torchvision.

Screenshot 2023-07-26 at 3 25 33 PM

Although very small, it's just and extra log that can be distracting in applications.

Can I get rid of it ? This was just introduced in the PR #190

It seems to be caused by the import of the class CNN from imagededup.methods.cnn, which downloads the model as part as evaluating the default argument of __init__.

@nibnahzuh
Copy link

You can do as follow:

def __init__(
    self,
    verbose: bool = True,
    model_config: CustomModel = CustomModel()
    
    # model_config: CustomModel = CustomModel(
    #     model=MobilenetV3(), transform=MobilenetV3.transform, name=MobilenetV3.name
    # ),

And manually select the downloaded model like: https://github.com/idealo/imagededup/blob/master/examples/use_custom_model.ipynb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants