anuragmishracse / caption_generator

A modular library built on top of Keras and TensorFlow to generate a caption in natural language for any input image.
MIT License
265 stars 120 forks source link

caption_generator.py : How do you break out of "while 1" #4

Closed namp closed 6 years ago

namp commented 7 years ago

In file caption_generator.py in function "data_generator" at line 81 there's a

while 1:

During training I only see thousands of executions of the statement

print "yielding count: "+str(gen_count)

which is within this loop.

Since I don't see any exit conditions or break within this loop, I am wondering when and how do we break out of this loop.

Thanks

zhaochunhua commented 7 years ago

I encounter the same problems, the process has trained 12 hours, but it continue.I wonder whether it can be broken.

anuragmishracse commented 7 years ago

@namp @zhaochunhua This function is basically a generator for generating batches of training data for keras fit_generator method. The fit_generator method uses this generator until it completes the specified number of epochs provided as an argument and proceeds further.

Usually, this batch generator function should provide batches of data indefinitely. Hence, there is no need of breaking out of this.

@zhaochunhua It might be due to large number of epochs. I trained it for about 3 days in a go. You can reduce your training epochs to make it quick.

francistec commented 6 years ago

Ok, but the process ends by self? i just need to know if after 50 epochs the process continue by self Thanks.