titu1994 / tf_SIREN

Tensorflow 2.0 implementation of Sinusodial Representation networks (SIREN)
MIT License
149 stars 26 forks source link

Problem when loading a model #17

Open TheFloHub opened 3 years ago

TheFloHub commented 3 years ago

Hey, that's a really nice implementation =) I'm using tf2.3.1 and training works perfectly but when I save and load a model I get this error message:

File "D:\virtualenv\tensorflow2\lib\site-packages\tensorflow\python\ops\init_ops_v2.py", line 90, in from_config return cls(**config) TypeError: init() got an unexpected keyword argument 'scale'

Before loading the model I'm already setting up the custom objects with: tf.keras.utils.get_custom_objects().update({ 'Sine': Sine, 'SIRENInitializer': SIRENInitializer, 'SIRENFirstLayerInitializer': SIRENFirstLayerInitializer, 'SinusodialRepresentationDense': SinusodialRepresentationDense, 'ScaledSinusodialRepresentationDense': ScaledSinusodialRepresentationDense, }) model = tf.keras.models.load_model(str(modelPath))

I'm only using SinusodialRepresentationDense in my model and there is indeed a scale variable passed to tf.keras.initializers.VarianceScaling in the SIRENInitializer, but I'm not sure where the problem is =(

I hoped you could help me out here. Cheers, Flo