Open wshzd opened 1 year ago
I'm facing the same issue.
facing the same issue
Please restart runtime with this command for installation:
pip install layoutparser torchvision && pip install "detectron2@git+https://github.com/facebookresearch/detectron2.git@v0.5#egg=detectron2"
for more details go to: https://github.com/Layout-Parser/layout-parser/blob/main/installation.md#additional-instruction-install-detectron2-layout-model-backend
Describe the bug A clear and concise description of what the bug is.
Checklist
To Reproduce Steps to reproduce the behavior:
Environment
$PATH
,$LD_LIBRARY_PATH
,$PYTHONPATH
, etc.)Error traceback If applicable, paste the error traceback here. l run the code as follows: model = lp.models.Detectron2LayoutModel('lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config', extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.8],label_map={0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"})
the error as follows:
ImportError Traceback (most recent call last) /tmp/ipykernel_17039/2299831570.py in
----> 1 model = lp.models.Detectron2LayoutModel('lp://PubLayNet/faster_rcnn_R_50_FPN_3x/config', extra_config=["MODEL.ROI_HEADS.SCORE_THRESH_TEST", 0.8],label_map={0: "Text", 1: "Title", 2: "List", 3:"Table", 4:"Figure"})
xxx/layoutparser/models/base_layoutmodel.py in new(cls, *args, *kwargs) 85 def new(cls, args, **kwargs): 86 ---> 87 requires_backends(cls, cls.DEPENDENCIES) 88 return super().new(cls)
xxx/layoutparser/file_utils.py in requires_backends(obj, backends) 173 name = obj.name if hasattr(obj, "name") else obj.class.name 174 if not all(BACKENDS_MAPPING[backend][0]() for backend in backends): --> 175 raise ImportError( 176 "".join([BACKENDS_MAPPING[backend][1].format(name) for backend in backends]) 177 ) ImportError: Detectron2LayoutModel requires the detectron2 library but it was not found in your environment. Checkout the instructions on the installation page: https://github.com/facebookresearch/detectron2/blob/master/INSTALL.md and follow the ones that match your environment. Typically the following would work for MacOS or Linux CPU machines: pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.4#egg=detectron2'
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
l have installed the detectron2 refer to the code of pip install 'git+https://github.com/facebookresearch/detectron2.git@v0.4#egg=detectron2'
but, the error always occures