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

ImageClassification fails to load custom ResNet50 model with ".pt" file #845

Open
KaleBats123 opened this issue Nov 30, 2024 · 0 comments
Open

Comments

@KaleBats123
Copy link

Environment Details;

  • OS: Windows 11
  • Python Version: 3.12
  • ImageAI Version: 3.0.3
  • PyTorch Version: 2.5.1+cu118

Problem Description;
When attempting to load a custom-trained ResNet50 model using ImageAI's ImageClassification, the model fails to load with the error:
"Classification failed: Model not yet loaded. You need to call '.loadModel()' before performing image classification"

Reproduction Steps;

  1. Initialize ImageClassification
  2. Set model path using setModelPath()
  3. Set model type using setModelTypeAsResNet50()
  4. Call loadModel()

Code Snippet;

from imageai.Classification import ImageClassification

classifier = ImageClassification()
classifier.setModelPath("path/to/model.pt")
classifier.setModelTypeAsResNet50()
classifier.loadModel()  # Fails here

Additional Context;
Model trained using custom dataset
Model saved as '.pt' file
Attempting to use for image classification

Questions;
Does ImageAI support loading custom-trained models?
Are there specific model export requirements?

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

1 participant