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

Multiple Errors #832

Open
rellyc opened this issue Feb 1, 2024 · 2 comments
Open

Multiple Errors #832

rellyc opened this issue Feb 1, 2024 · 2 comments

Comments

@rellyc
Copy link

rellyc commented Feb 1, 2024

Hello,
I tried training image recognition AI using the code:

from imageai.Classification.Custom import ClassificationModelTrainer

model_trainer = ClassificationModelTrainer()
model_trainer.setModelTypeAsResNet50()
model_trainer.setDataDirectory("idenprof")
model_trainer.trainModel(num_objects=10, num_experiments=200, enhance_data=True, batch_size=32, show_network_summary=True)

Received there errors:

C:\Users\Optiplex3070\anaconda3\python.exe "C:\Users\Optiplex3070\Downloads\python training\idenprof-jpg\FirstTraining.py"
C:\Users\Optiplex3070\AppData\Roaming\Python\Python311\site-packages\torchvision\models_utils.py:208: UserWarning: The parameter 'pretrained' is deprecated since 0.13 and may be removed in the future, please use 'weights' instead.
warnings.warn(
C:\Users\Optiplex3070\AppData\Roaming\Python\Python311\site-packages\torchvision\models_utils.py:223: UserWarning: Arguments other than a weight enum or None for 'weights' are deprecated since 0.13 and may be removed in the future. The current behavior is equivalent to passing weights=None.
warnings.warn(msg)
C:\Users\Optiplex3070\AppData\Roaming\Python\Python311\site-packages\torchvision\models\inception.py:43: FutureWarning: The default weight initialization of inception_v3 will be changed in future releases of torchvision. If you wish to keep the old behavior (which leads to long initialization times due to scipy/scipy#11299), please set init_weights=True.
warnings.warn(
Traceback (most recent call last):
File "C:\Users\Optiplex3070\Downloads\python training\idenprof-jpg\FirstTraining.py", line 6, in
model_trainer.trainModel(num_objects=10, num_experiments=200, enhance_data=True, batch_size=32, show_network_summary=True)
TypeError: ClassificationModelTrainer.trainModel() got an unexpected keyword argument 'num_objects'

@rellyc
Copy link
Author

rellyc commented Feb 2, 2024

it only works with model_trainer.trainModel(num_experiments=200, batch_size=32) if I remove num_objects=10 enhance_data=True show_network_summary=True
Also, how can I make it use the GPU? (nVidia 1650 super, Conda installed). Tensorflow is installed.
It throws Training with CPU. This might cause slower train.

@6monkeyrs
Copy link

TypeError: ClassificationModelTrainer.trainModel() got an unexpected keyword argument 'num_objects'

This error happens when you have a missmatch on number of class you have on your label data vs what you are telling the trainModel you are expecting.

for example, you may have 5 annotation types for class, but on your num_objects is set to 10

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