lattice-ai / DeepLabV3-Plus

Tensorflow 2.3.0 implementation of DeepLabV3-Plus
https://keras.io/examples/vision/deeplabv3_plus/
98 stars 22 forks source link

How to re-train or continue training ?!?! #19

Open thusinh1969 opened 3 years ago

thusinh1969 commented 3 years ago

Hi,

Great stuffs really. I walked through your code a lot, but still not sure how to reload weights to continue training should I terminate in the middle for some reasons.

I edited train.py: ... if "reload_weight_checkpoint" in self.config.keys() and self.config["reload_weight_checkpoint"]!="": self.model.load_weights(self.config["reload_weight_checkpoint"]) ... right before fit.

--> ERROR:

ValueError Traceback (most recent call last)

in ----> 1 history = trainer.train() D:\AI\Human_Pose\DeepLabV3-Plus\deeplabv3plus\train.py in train(self) 188 189 if "reload_weight_checkpoint" in self.config.keys() and self.config["reload_weight_checkpoint"]!="": --> 190 self.model.load_weights(self.config["reload_weight_checkpoint"]) 191 192 history = self.model.fit( ~\AppData\Roaming\Python\Python38\site-packages\tensorflow\python\keras\engine\training.py in load_weights(self, filepath, by_name, skip_mismatch, options) 2220 '`load_weights` requires h5py when loading weights from HDF5.') 2221 if not self._is_graph_network and not self.built: -> 2222 raise ValueError( 2223 'Unable to load weights saved in HDF5 format into a subclassed ' 2224 'Model which has not created its variables yet. Call the Model ' ValueError: Unable to load weights saved in HDF5 format into a subclassed Model which has not created its variables yet. Call the Model first, then load the weights. Thanks much. Steve