普通网友 2022-11-19 11:25 采纳率: 25%
浏览 9
已结题

dataset 的cache工作原理

问题遇到的现象和发生背景

关于您在一篇博客中分析了YOLOv5中dataset部分关于cache的用法我想了解一下 问您几个相关问题

用代码块功能插入代码,请勿粘贴截图

Check cache

    self.label_files = img2label_paths(self.img_files)  # labels
    cache_path = (p if p.is_file() else Path(self.label_files[0]).parent).with_suffix('.cache')  # cached labels
    if cache_path.is_file():
        cache, exists = torch.load(cache_path), True  # load
        #if cache['hash'] != get_hash(self.label_files + self.img_files) or 'version' not in cache:  # changed
        #    cache, exists = self.cache_labels(cache_path, prefix), False  # re-cache
    else:
        cache, exists = self.cache_labels(cache_path, prefix), False  # cache

    # Display cache
    nf, nm, ne, nc, n = cache.pop('results')  # found, missing, empty, corrupted, total
    if exists:
        d = f"Scanning '{cache_path}' images and labels... {nf} found, {nm} missing, {ne} empty, {nc} corrupted"
        tqdm(None, desc=prefix + d, total=n, initial=n)  # display cache results
    assert nf > 0 or not augment, f'{prefix}No labels in {cache_path}. Can not train without labels. See {help_url}'
我的解答思路和尝试过的方法

我其实想过 是否可以不应用这个cache缓存 直接读取图片呢

  • 写回答

0条回答 默认 最新

    报告相同问题?

    问题事件

    • 系统已结题 11月27日
    • 创建了问题 11月19日

    悬赏问题

    • ¥15 is not in the mmseg::model registry。报错,模型注册表找不到自定义模块。
    • ¥15 安装quartus II18.1时弹出此error,怎么解决?
    • ¥15 keil官网下载psn序列号在哪
    • ¥15 想用adb命令做一个通话软件,播放录音
    • ¥30 Pytorch深度学习服务器跑不通问题解决?
    • ¥15 部分客户订单定位有误的问题
    • ¥15 如何在maya程序中利用python编写领子和褶裥的模型的方法
    • ¥15 Bug traq 数据包 大概什么价
    • ¥15 在anaconda上pytorch和paddle paddle下载报错
    • ¥25 自动填写QQ腾讯文档收集表