Layout-Parser / layout-parser

A Unified Toolkit for Deep Learning Based Document Image Analysis
https://layout-parser.github.io/
Apache License 2.0
4.67k stars 449 forks source link

OSError: [Errno 22] on Detectron2LayoutModel() #140

Open FuJiK0 opened 2 years ago

FuJiK0 commented 2 years ago

When I try to Create a Detectron2-based Layout Detection Model, I encounter the following error:

model = lp.Detectron2LayoutModel(
    'lp://PrimaLayout/mask_rcnn_R_50_FPN_3x/config',
    extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.5],
    label_map={
        1: "TextRegion",
        2: "ImageRegion"
    })

Error:

File f:\Coding\Conda\envs\LP\lib\site-packages\portalocker\utils.py:289, in Lock._get_fh(self)
    [287](file:///f%3A/Coding/Conda/envs/LP/lib/site-packages/portalocker/utils.py?line=286) def _get_fh(self) -> typing.IO:
    [288](file:///f%3A/Coding/Conda/envs/LP/lib/site-packages/portalocker/utils.py?line=287)     '''Get a new filehandle'''
--> [289](file:///f%3A/Coding/Conda/envs/LP/lib/site-packages/portalocker/utils.py?line=288)     return open(self.filename, self.mode, **self.file_open_kwargs)

OSError: [Errno 22] Invalid argument: 'C:\\Users\\60953/.torch/iopath_cache\\s/yc92x97k50abynt\\config.yaml?dl=1.lock'

image

image

Environment

  1. Platform Windows 11
  2. Layout Parser version 0.3.4
  3. Torch version 1.10.0+cu113
jiboncom commented 2 years ago

I am also experiencing this in the same environment. It seems to be related to a problem downloading files from the LP API because when downloading the config files and pointing LP to use the local file the error is mentions model_final.pth?dl=1odel_final.pth?dl=1 .

Micheduc25 commented 2 years ago

I am also experiencing this in the same environment. It seems to be related to a problem downloading files from the LP API because when downloading the config files and pointing LP to use the local file the error is mentions model_final.pth?dl=1odel_final.pth?dl=1 .

Have you been able to find a solution so far?

jiboncom commented 2 years ago

Not really. I did a few experiments I needed to run using Google Colab but I couldn't fix the problem in my computer. It seems to be related to the long path issue in Windows but allowing that from registry didn't fix the problem. I didn't try running python on "higher" level folder (I am using Vs Code) but read that it could help.

lolipopshock commented 2 years ago

This seems to be a known issue for Windows users and we plan to implement some important fixes in the next version. Stay tuned -- thanks!

MarouaneZ1 commented 1 year ago

i'm trying to use detectron2 model for extraction information but i got this problem, i tried many ways but i failed to solve it, i tried to use google collab but it throws me :"ImportError: you cannot import is_directory", does anyone know how can i fix it ? any help would be appreciated

erreurDetectron erreurDetectronn
MarouaneZ1 commented 1 year ago

This seems to be a known issue for Windows users and we plan to implement some important fixes in the next version. Stay tuned -- thanks!

did you implement new important fixes yet ? bcz i'm hard stuck on an error : OSerror : invalid argument

zellsophia commented 1 year ago

any updates on this issue? Coz I'm still running into it

uzairaslam19 commented 1 year ago

Any Updates on this? I'm running into same error

1042312930 commented 1 year ago

Any Updates on this? I'm running into same error

i find this in https://github.com/Layout-Parser/layout-parser/issues/15 image