保存:
def save(self,time):
current_path = os.path.dirname(os.path.abspath(__file__))
model_path='model/***_model_'+time+'_'+self.name+'/weights_'+self.name
save_path = os.path.join(current_path,model_path)
if not os.path.exists(save_path):os.makedirs(save_path)
self.saver.save(self.sess,save_path)
生成文件
checkpoint 正确路径:
加载:
def load(self,model_path):
check_path= os.path.join(model_path, 'weights_intersection_1_1')
meta_path = 'weights_'+self.name+'.meta'
mata_path_dir = os.path.join(model_path,meta_path)
self.saver = tf.compat.v1.train.import_meta_graph(mata_path_dir)
a=model_path+'/'
self.saver.restore(self.sess, tf.train.latest_checkpoint(a))