本文整理汇总了Python中utility.Utility.get_dir方法的典型用法代码示例。如果您正苦于以下问题:Python Utility.get_dir方法的具体用法?Python Utility.get_dir怎么用?Python Utility.get_dir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类utility.Utility
的用法示例。
在下文中一共展示了Utility.get_dir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: save_current
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_dir [as 别名]
def save_current(self):
path = Utility.get_dir(self.path)
j_path = '%s/%s_%s.json'%(Paths.Models, self.id, self.type)
w_path = '%s/%s_%s_weights.h5'%(Paths.Models, self.id, self.type)
j_path = j_path.lower()
w_path = w_path.lower()
json_string = self.model.to_json()
open(j_path, 'w').write(json_string)
self.model.save_weights(w_path, overwrite=True)
示例2: get_model_paths
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_dir [as 别名]
def get_model_paths(self):
path = self.get_path()
j_path = '%s_best.json'%(path)
w_path = '%s_best_weights.h5'%(path)
# first, attempt the best model, otherwise default to the latest
if not os.path.exists( j_path ) and not os.path.exists( w_path ):
path = Utility.get_dir(self.path)
j_path = '%s/%s_%s.json'%(Paths.Models, self.id, self.type)
w_path = '%s/%s_%s_weights.h5'%(Paths.Models, self.id, self.type)
return j_path.lower(), w_path.lower()
示例3: save_best
# 需要导入模块: from utility import Utility [as 别名]
# 或者: from utility.Utility import get_dir [as 别名]
def save_best(self):
print 'Unet.save'
path = Utility.get_dir(self.path)
revision = 0
if not self.offline:
revision = DB.getRevision( self.id )
revision = (revision+1)%10
path = '%s/%s_%s_%d'%(Paths.Models, self.id, self.type, revision)
path = path.lower()
j_path = '%s_best.json'%(path)
w_path = '%s_best_weights.h5'%(path)
j_path = j_path.lower()
w_path = w_path.lower()
print 'saving...', path
# saving code here...
json_string = self.model.to_json()
open(j_path, 'w').write(json_string)
self.model.save_weights(w_path, overwrite=True)
if not self.offline:
DB.finishSaveModel( self.id, revision )