srihari-humbarwadi / DeepLabV3_Plus-Tensorflow2.0

DeepLabV3+ implemented in TensorFlow2.0
https://arxiv.org/pdf/1802.02611.pdf
168 stars 45 forks source link

ValueError: You are trying to load a weight file containing 105 layers into a model with 42 layers. #7

Closed B10532021 closed 5 years ago

B10532021 commented 5 years ago

Hi, I'm trying to write a predict.py. and i just downloaded last_epoch.h5 to be the model weight model = DeepLabV3Plus(512, 512, 34) model.load_weights('last_epoch.h5') and i got this error *** Output_Shape => (None, 512, 512, 34) *** 74 Traceback (most recent call last): File "d:/howardchulin/TrafficAccident/DeepLabV3_Plus-Tensorflow2.0-master/predict.py", line 19, in <module> model.load_weights('models/last_epoch.h5') File "C:\Users\howardchulin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_core\python\keras\engine\training.py", line 182, in load_weights return super(Model, self).load_weights(filepath, by_name) File "C:\Users\howardchulin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_core\python\keras\engine\network.py", line 1368, in load_weights saving.load_weights_from_hdf5_group(f, self.layers) File "C:\Users\howardchulin\AppData\Local\Programs\Python\Python36\lib\site-packages\tensorflow_core\python\keras\saving\hdf5_format.py", line 671, in load_weights_from_hdf5_group ' layers.') ValueError: You are trying to load a weight file containing 105 layers into a model with 42 layers plz help to solve it, thanks very much!!

srihari-humbarwadi commented 5 years ago

@B10532021 should work now, make sure you have TF2.0-rc0 installed