FileNotFoundError:实体文件夹不存在!在谷歌 Colab 中

发布于 2025-01-10 13:58:18 字数 4031 浏览 5 评论 0原文

谁能帮我解决这个问题? 当我在 Colab 中运行这些行时

:param files_name: 包含训练和验证样本列表文件。 :param box_and_transcripts_folder: 包含转录本、框和框实体类型(可选)的 gt 或 ocr 结果。 :param images_folder: 整个图像文件夹 :paramEntity_folder:文档的实体类型和实体值,包含json格式文件 :param iob_tagging_type: 'box_level', 'document_level', 'box_and_within_box_level' :param resized_image_size: 调整整个图像大小,(w, h) :param keep_ratio: TODO 实现此参数 :参数忽略错误: :param Training: True 表示训练和验证模式,False 表示测试模式。 True 还将加载标签,并且必须设置files_name 和entities_file。 ''' class PICKDataset(Dataset):

    def __init__(self, files_name: str = None,
                 boxes_and_transcripts_folder: str = 'boxes_and_transcripts',
                 images_folder: str = 'images',
                 entities_folder: str = 'entities',
                 iob_tagging_type: str = 'box_and_within_box_level',
                 resized_image_size: Tuple[int, int] = (480, 960),
                 keep_ratio: bool = True,
                 ignore_error: bool = False,
                 training: bool = True
                 ):
        
        super().__init__()
        self._image_ext = None
        self._ann_ext = None
        self.iob_tagging_type = iob_tagging_type
        self.keep_ratio = keep_ratio
        self.ignore_error = ignore_error
        self.training = training
        assert resized_image_size and len(resized_image_size) == 2, 'resized image size not be set.'
        self.resized_image_size = tuple(resized_image_size)  # (w, h)

        if self.training:  # used for train and validation mode
            self.files_name = Path(files_name)
            self.data_root = self.files_name.parent
            self.boxes_and_transcripts_folder: Path = self.data_root.joinpath(boxes_and_transcripts_folder)
            self.images_folder: Path = self.data_root.joinpath(images_folder)
            self.entities_folder: Path = self.data_root.joinpath(entities_folder)
            if self.iob_tagging_type != 'box_level':
                if not self.entities_folder.exists():
                    raise FileNotFoundError('Entity folder is not exist!')

我收到此错误

RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
[2022-02-26 13:17:11,933 - train - INFO] - Distributed GPU training model start...
[2022-02-26 13:17:11,933 - train - INFO] - [Process 306] Initializing process group with: {'MASTER_ADDR': '127.0.0.1', 'MASTER_PORT': '29500', 'RANK': '0', 'WORLD_SIZE': '1'}
[2022-02-26 13:17:11,934 - train - INFO] - [Process 306] world_size = 1, rank = 0, backend=nccl
Traceback (most recent call last):
  File "train.py", line 162, in <module>
    entry_point(config)
  File "train.py", line 126, in entry_point
    main(config, local_master, logger if local_master else None)
  File "train.py", line 34, in main
    train_dataset = config.init_obj('train_dataset', pick_dataset_module)
  File "/content/PICK-pytorch/parse_config.py", line 105, in init_obj
    return getattr(module, module_name)(*args, **module_args)
  File "/content/PICK-pytorch/data_utils/pick_dataset.py", line 66, in __init__
    raise FileNotFoundError('Entity folder is not exist!')
FileNotFoundError: Entity folder is not exist!
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/torch/distributed/launch.py", line 263, in <module>
    main()
  File "/usr/local/lib/python3.7/dist-packages/torch/distributed/launch.py", line 259, in main
    cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-u', 'train.py', '--local_rank=0', '-c', 'config.json', '-d', '0', '--local_world_size', '1']' returned non-zero exit status 1.

我尝试过什么 更改 PICKDataset 中的输入文件路径,删除引发错误的行。

完整笔记本

Can anyone help me in sorting out this issue?
When I run these lines in Colab

:param files_name: containing training and validation samples list file.
:param boxes_and_transcripts_folder: gt or ocr result containing transcripts, boxes and box entity type (optional).
:param images_folder: whole images file folder
:param entities_folder: exactly entity type and entity value of documents, containing json format file
:param iob_tagging_type: 'box_level', 'document_level', 'box_and_within_box_level'
:param resized_image_size: resize whole image size, (w, h)
:param keep_ratio: TODO implement this parames
:param ignore_error:
:param training: True for train and validation mode, False for test mode. True will also load labels, and files_name and entities_file must be set.
'''
class PICKDataset(Dataset):

    def __init__(self, files_name: str = None,
                 boxes_and_transcripts_folder: str = 'boxes_and_transcripts',
                 images_folder: str = 'images',
                 entities_folder: str = 'entities',
                 iob_tagging_type: str = 'box_and_within_box_level',
                 resized_image_size: Tuple[int, int] = (480, 960),
                 keep_ratio: bool = True,
                 ignore_error: bool = False,
                 training: bool = True
                 ):
        
        super().__init__()
        self._image_ext = None
        self._ann_ext = None
        self.iob_tagging_type = iob_tagging_type
        self.keep_ratio = keep_ratio
        self.ignore_error = ignore_error
        self.training = training
        assert resized_image_size and len(resized_image_size) == 2, 'resized image size not be set.'
        self.resized_image_size = tuple(resized_image_size)  # (w, h)

        if self.training:  # used for train and validation mode
            self.files_name = Path(files_name)
            self.data_root = self.files_name.parent
            self.boxes_and_transcripts_folder: Path = self.data_root.joinpath(boxes_and_transcripts_folder)
            self.images_folder: Path = self.data_root.joinpath(images_folder)
            self.entities_folder: Path = self.data_root.joinpath(entities_folder)
            if self.iob_tagging_type != 'box_level':
                if not self.entities_folder.exists():
                    raise FileNotFoundError('Entity folder is not exist!')

I get this error

RuntimeError: module compiled against API version 0xe but this version of numpy is 0xd
[2022-02-26 13:17:11,933 - train - INFO] - Distributed GPU training model start...
[2022-02-26 13:17:11,933 - train - INFO] - [Process 306] Initializing process group with: {'MASTER_ADDR': '127.0.0.1', 'MASTER_PORT': '29500', 'RANK': '0', 'WORLD_SIZE': '1'}
[2022-02-26 13:17:11,934 - train - INFO] - [Process 306] world_size = 1, rank = 0, backend=nccl
Traceback (most recent call last):
  File "train.py", line 162, in <module>
    entry_point(config)
  File "train.py", line 126, in entry_point
    main(config, local_master, logger if local_master else None)
  File "train.py", line 34, in main
    train_dataset = config.init_obj('train_dataset', pick_dataset_module)
  File "/content/PICK-pytorch/parse_config.py", line 105, in init_obj
    return getattr(module, module_name)(*args, **module_args)
  File "/content/PICK-pytorch/data_utils/pick_dataset.py", line 66, in __init__
    raise FileNotFoundError('Entity folder is not exist!')
FileNotFoundError: Entity folder is not exist!
Traceback (most recent call last):
  File "/usr/lib/python3.7/runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.7/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.7/dist-packages/torch/distributed/launch.py", line 263, in <module>
    main()
  File "/usr/local/lib/python3.7/dist-packages/torch/distributed/launch.py", line 259, in main
    cmd=cmd)
subprocess.CalledProcessError: Command '['/usr/bin/python3', '-u', 'train.py', '--local_rank=0', '-c', 'config.json', '-d', '0', '--local_world_size', '1']' returned non-zero exit status 1.

What I have tried
Changing inputfilepath in PICKDataset, remving lines which rise error.

Complete Notebook

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

浪漫之都 2025-01-17 13:58:18

https://github.com/wenwenyu/PICK- 有错误pytorch/blob/master/config.json 文件。您必须根据工作目录更改数据路径。检查行号 61 至 64 和 73 至 76。

There is error in https://github.com/wenwenyu/PICK-pytorch/blob/master/config.json file. you have to change the path of data as per your working directory. Check line number 61 to 64 and 73 to 76.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文