ethereon / caffe-tensorflow

Caffe models in TensorFlow
Other
2.8k stars 1.04k forks source link

numpy array is an unnatural container for weights #190

Open Permafacture opened 4 years ago

Permafacture commented 4 years ago

I had an issue loading a model's weights after converting with some error about dtype being object in numpy.load with allow_pickle=False, which must be some sort of environment issue I haven't dug into. Looking into it I see the weights are dumped as a numpy "scalar" of type object, and it's really just a dict of dicts of arrays. hdf5 is a much more natural datatype for this which would be less fragile, and is what keras, tensorflow and scipy use too, so users will have it installed already. Would you be open to a pull request to change this?

Although this library doesn't use keras, keras saves the model architecture in hdf5 too.