Unverified 提交 955eea8b authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Make cache saving optional (#2977)

上级 a833ee2a
......@@ -502,8 +502,11 @@ class LoadImagesAndLabels(Dataset): # for training/testing
x['hash'] = get_hash(self.label_files + self.img_files)
x['results'] = nf, nm, ne, nc, i + 1
x['version'] = 0.1 # cache version
torch.save(x, path) # save for next time
logging.info(f'{prefix}New cache created: {path}')
try:
torch.save(x, path) # save for next time
logging.info(f'{prefix}New cache created: {path}')
except Exception as e:
logging.info(f'{prefix}WARNING: Cache directory {path.parent} is not writeable: {e}') # path not writeable
return x
def __len__(self):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论