Skip to content

Instantly share code, notes, and snippets.

View steve3nto's full-sized avatar

Stefano Imoscopi steve3nto

  • Università della Svizzera italiana
  • Lugano, Switzerland
View GitHub Profile
@renexu
renexu / train.py
Created December 28, 2017 05:46
Keras HDF5Matrix and fit_generator for huge hdf5 dataset
import threading
from keras.applications.inception_v3 import InceptionV3
from keras.optimizers import Adam
from keras.utils.io_utils import HDF5Matrix
class threadsafe_iter:
"""Takes an iterator/generator and makes it thread-safe by
serializing call to the `next` method of given iterator/generator.