OlafenwaMoses / ImageAI

A python library built to empower developers to build applications and systems with self-contained Computer Vision capabilities
https://www.genxr.co/#products
MIT License
8.58k stars 2.19k forks source link

UnboundLocalError: local variable 'outs' referenced before assignment #73

Closed BillSJC closed 5 years ago

BillSJC commented 6 years ago

caught an err when using the smple code

UnboundLocalError: local variable 'outs' referenced before assignment

  File "C:\Python36\lib\site-packages\tensorflow\python\keras\engine\training_generator.py", line 358, in evaluate_generator
    if not isinstance(outs, list):
UnboundLocalError: local variable 'outs' referenced before assignment
from imageai.Prediction.Custom import ModelTraining
model_trainer = ModelTraining()
model_trainer.setModelTypeAsResNet()
model_trainer.setDataDirectory("pets")
model_trainer.trainModel(num_objects=2, num_experiments=2, enhance_data=True, batch_size=4, show_network_summary=True)

and here are the struct of folder pets

image

OlafenwaMoses commented 6 years ago

How many pictures are in the test and train folder for each object class?

BillSJC commented 6 years ago

i do it only for test so i use a small amount of pictures

test:

train:

OlafenwaMoses commented 6 years ago

The recommended number of training images for each object class is 500. Check out the documentation link below.

https://imageai.readthedocs.io/en/latest/custom/index.html