【发布时间】:2021-06-23 06:54:05
【问题描述】:
出于提取目的,我一直在尝试将 pdf 页面作为图像读取。
我发现 layoutparser 通过识别文本块来达到这个目的。但是,当我尝试Create a Detectron2-based Layout Detection Model 时,遇到以下错误:
代码块:
model = lp.Detectron2LayoutModel(
config_path ='lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config',
label_map = {0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"},
extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.8]
)
错误:
OSError Traceback (most recent call last)
<ipython-input-16-893fdc4d537c> in <module>
2 config_path ='lp://PubLayNet/mask_rcnn_X_101_32x8d_FPN_3x/config',
3 label_map = {0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"},
----> 4 extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.8]
5 )
6
.
.
.
d:\softwares\python3\lib\site-packages\portalocker\utils.py in _get_fh(self)
269 def _get_fh(self) -> typing.IO:
270 '''Get a new filehandle'''
--> 271 return open(self.filename, self.mode, **self.file_open_kwargs)
272
273 def _get_lock(self, fh: typing.IO) -> typing.IO:
OSError: [Errno 22] Invalid argument: 'C:\\Users\\user/.torch/iopath_cache\\s/nau5ut6zgthunil\\config.yaml?dl=1.lock'
我检查了目标路径文件夹,令人惊讶的是,没有config.yaml 文件,这可能是出现错误的原因。我尝试卸载并重新安装 PyTorch,希望 .yaml 文件能够正确安装。不幸的是,问题仍然存在。
如果有此问题的解决方案或替代建议,我将不胜感激。
【问题讨论】:
标签: python python-3.x opencv deep-learning pytorch