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.56k stars 2.19k forks source link

ValueError ('Empty training data.') #250

Closed durgaprasad4u closed 5 years ago

durgaprasad4u commented 5 years ago

HI,

when i start a custom trainings model, i get the following error message:

ValueError ('Empty training data.')

Full text:

HI,

when i start a custom trainings model, i get the following error message:

ValueError ('Empty training data.')

Full text:

Total params: 23,591,810 Trainable params: 23,538,690 Non-trainable params: 53,120

W0719 15:24:26.314924 11516 callbacks.py:875] period argument is deprecated. Please use save_freq to specify the frequency in number of samples seen. Using Enhanced Data Generation Found 198 images belonging to 2 classes. Found 23 images belonging to 2 classes. JSON Mapping for the model classes saved to C:\Users\indprasad\Documents\GitHub\ImageAI\imp-files\products\dataset\json\model_class.json Number of experiments (Epochs) : 100 Epoch 1/100 5/6 [========================>.....] - ETA: 55s - loss: 4.1674 - acc: 0.4179 Traceback (most recent call last): File "custom_model_training_new.py", line 9, in model_trainer.trainModel(num_objects=2, num_experiments=100, enhance_data=True, batch_size=32, show_network_summary=True) File "D:\ProgramData\anaconda3\lib\site-packages\imageai\Prediction\Custominit.py", line 309, in trainModel validation_steps=int(num_test / batch_size), callbacks=[checkpoint, lr_scheduler]) File "D:\ProgramData\anaconda3\lib\site-packages\tensorflow\python\keras\engine\training.py", line 1433, in fit_generator steps_name='steps_per_epoch') File "D:\ProgramData\anaconda3\lib\site-packages\tensorflow\python\keras\engine\training_generator.py", line 322, in model_iteration steps_name='validation_steps') File "D:\ProgramData\anaconda3\lib\site-packages\tensorflow\python\keras\engine\training_generator.py", line 300, in model_iteration aggregator.finalize() File "D:\ProgramData\anaconda3\lib\site-packages\tensorflow\python\keras\engine\training_utils.py", line 111, in finalize raise ValueError('Empty training data.') ValueError: Empty training data.

is this a problem for Keras? My Tensorflow Veriosn is: Using TensorFlow backend. 2.2.4

I used the custom training script from your docs

"from imageai.Prediction.Custom import ModelTraining import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2'

model_trainer = ModelTraining() model_trainer.setModelTypeAsResNet() model_trainer.setDataDirectory(r"C:\Users\indprasad\Documents\GitHub\ImageAI\imp-files\products\dataset")

model_trainer.trainModel(num_objects=2, num_experiments=100, enhance_data=True, batch_size=32, show_network_summary=True)"

Thanks for your help.`

ChanKimSiong commented 5 years ago

model_trainer.setDataDirectory(r"C:\Users\indprasad\Documents\GitHub\ImageAI\imp-files\products\dataset"), delete the r and try again