experiencor / keras-yolo2

Easy training on custom dataset. Various backends (MobileNet and SqueezeNet) supported. A YOLO demo to detect raccoon run entirely in brower is accessible at https://git.io/vF7vI (not on Windows).
MIT License
1.73k stars 785 forks source link

after first iteration i get the following error #369

Open SteveIb opened 5 years ago

SteveIb commented 5 years ago

File "train.py", line 101, in main(args) File "train.py", line 97, in main debug = config['train']['debug']) File "/home//Yolo2/keras-yolo2/frontend.py", line 336, in train max_queue_size = 8) File "/home//anaconda2/envs/py27/lib/python2.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, kwargs) File "/home//anaconda2/envs/py27/lib/python2.7/site-packages/keras/engine/training.py", line 1418, in fit_generator initial_epoch=initial_epoch) File "/home//anaconda2/envs/py27/lib/python2.7/site-packages/keras/engine/training_generator.py", line 250, in fit_generator callbacks.on_epoch_end(epoch, epoch_logs) File "/home//anaconda2/envs/py27/lib/python2.7/site-packages/keras/callbacks.py", line 79, in on_epoch_end callback.on_epoch_end(epoch, logs) File "/home//anaconda2/envs/py27/lib/python2.7/site-packages/keras/callbacks.py", line 446, in on_epoch_end self.model.save(filepath, overwrite=True) File "/home//anaconda2/envs/py27/lib/python2.7/site-packages/keras/engine/network.py", line 1090, in save save_model(self, filepath, overwrite, include_optimizer) File "/home//anaconda2/envs/py27/lib/python2.7/site-packages/keras/engine/saving.py", line 379, in save_model f = h5dict(filepath, mode='w') File "/home//anaconda2/envs/py27/lib/python2.7/site-packages/keras/utils/io_utils.py", line 195, in init 'Received: {}.'.format(type(path))) TypeError: Required Group, str or dict. Received: <type 'unicode'>.

SteveIb commented 5 years ago

I'm not sure how I solved it, I think it was something related to paths or slash. something like that. Good luck!

neurohn commented 5 years ago

I was getting a similar error. The solution is to fill up the concerned config.json file parameters. In my case, I had to input a non-null value for config[‘train’][‘saved_weights_name’]. Hope this helps.

rohitbhio commented 5 years ago

modify f = h5dict(filepath, mode='w') to f = h5dict(str(filepath), mode='w')

wilsonhermar commented 5 years ago

Thankyou rohitbhio

HAMZARaouia commented 5 years ago

**> modify f = h5dict(filepath, mode='w') to

f = h5dict(str(filepath), mode='w')**

In which file does this exist ?

HAMZARaouia commented 5 years ago

Thankyou rohitbhio

where did you add the line of code proposed by rohitbhio ?

akb4797 commented 5 years ago

@HAMZARaouia , As you can see from the stack trace,

File "/usr/local/lib/python2.7/dist-packages/keras/engine/saving.py", line 379, in save_model.

This is where you need to make the modification.