在 Windows 11 上安装 detectorron2 时遇到问题

问题描述 投票:0回答:1

我在 Windows11 中安装 detectorron2 时遇到一些问题。

!pip install -U layoutparser
!pip install 'git+https://github.com/facebookresearch/[email protected]#egg=detectron2'
!pip install layoutparser[ocr]
!git clone https://github.com/Layout-Parser/layout-parser.git
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"})

我尝试了这些命令并尝试运行它返回的布局解析器

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/[email protected]#egg=detectron2' 

然后我按照这些命令尝试了 Windows 版的 detectorr

git clone https://github.com/DGMaxime/detectron2-windows.git
cd detectron2-windows
pip install -e 

我收到这条消息

Note: you may need to restart the kernel to use updated packages.
Usage:   
  C:\Users\msubh\anaconda3\envs\expOPlay\python.exe -m pip install [options] <requirement specifier> [package-index-options] ...
  C:\Users\msubh\anaconda3\envs\expOPlay\python.exe -m pip install [options] -r <requirements file> [package-index-options] ...
  C:\Users\msubh\anaconda3\envs\expOPlay\python.exe -m pip install [options] [-e] <vcs project url> ...
  C:\Users\msubh\anaconda3\envs\expOPlay\python.exe -m pip install [options] [-e] <local project path> ...
  C:\Users\msubh\anaconda3\envs\expOPlay\python.exe -m pip install [options] <archive url/path> ...

-e option requires 1 argument

当我尝试运行layoutparser模型时,它说在您的环境中找不到库错误。 现在我创建了新环境并运行 pip install torch 我收到了

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
gdown 4.7.1 requires requests[socks], which is not installed.
gdown 4.7.1 requires tqdm, which is not installed.
ocrd 2.53.0 requires bagit>=1.7.0, which is not installed.
ocrd 2.53.0 requires click>=7, which is not installed.
ocrd 2.53.0 requires Flask, which is not installed.
ocrd 2.53.0 requires pyyaml, which is not installed.
ocrd 2.53.0 requires requests, which is not installed.
ocrd 2.53.0 requires sparklines>=0.4.2, which is not installed.

现在我尝试了

pip install requests
I received 
ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
bagit-profile 1.3.1 requires bagit, which is not installed.
gdown 4.7.1 requires tqdm, which is not installed.
ocrd 2.53.0 requires bagit>=1.7.0, which is not installed.
ocrd 2.53.0 requires click>=7, which is not installed.
ocrd 2.53.0 requires Flask, which is not installed.
ocrd 2.53.0 requires pyyaml, which is not installed.
ocrd 2.53.0 requires sparklines>=0.4.2, which is not installed.
ocrd-network 2.53.0 requires fastapi>=0.78.0, which is not installed.
ocrd-network 2.53.0 requires httpx>=0.22.0, which is not installed.
ocrd-network 2.53.0 requires pika>=1.2.0, which is not installed.
ocrd-network 2.53.0 requires uvicorn>=0.17.6, which is not installed.
ocrd-validators 2.53.0 requires bagit>=1.7.0, which is not installed.
ocrd-validators 2.53.0 requires click>=7, which is not installed.
ocrd-validators 2.53.0 requires pyyaml, which is not installed.
ocrd-validators 2.53.0 requires shapely, which is not installed.
tensorboard 2.13.0 requires absl-py>=0.4, which is not installed.
tensorboard 2.13.0 requires google-auth<3,>=1.6.3, which is not installed.
tensorboard 2.13.0 requires google-auth-oauthlib<1.1,>=0.5, which is not installed.
tensorboard 2.13.0 requires grpcio>=1.48.2, which is not installed.
tensorboard 2.13.0 requires markdown>=2.6.8, which is not installed.
tensorboard 2.13.0 requires numpy>=1.12.0, which is not installed.
tensorboard 2.13.0 requires protobuf>=3.19.6, which is not installed.
tensorboard 2.13.0 requires tensorboard-data-server<0.8.0,>=0.7.0, which is not installed.
tensorboard 2.13.0 requires werkzeug>=1.0.1, which is not installed.
tensorflow-intel 2.13.0 requires absl-py>=1.0.0, which is not installed.
tensorflow-intel 2.13.0 requires flatbuffers>=23.1.21, which is not installed.
tensorflow-intel 2.13.0 requires grpcio<2.0,>=1.24.3, which is not installed.
tensorflow-intel 2.13.0 requires libclang>=13.0.0, which is not installed.
tensorflow-intel 2.13.0 requires numpy<=1.24.3,>=1.22, which is not installed.
tensorflow-intel 2.13.0 requires opt-einsum>=2.3.2, which is not installed.
tensorflow-intel 2.13.0 requires protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3, which is not installed.
tensorflow-intel 2.13.0 requires tensorflow-estimator<2.14,>=2.13.0, which is not installed.
tensorflow-intel 2.13.0 requires tensorflow-io-gcs-filesystem>=0.23.1; platform_machine != "arm64" or platform_system != "Darwin", which is not installed.
tensorflow-intel 2.13.0 requires termcolor>=1.1.0, which is not installed.
tensorflow-intel 2.13.0 requires wrapt>=1.11.0, which is not installed.
tensorflow-intel 2.13.0 requires typing-extensions<4.6.0,>=3.6.6, but you have typing-extensions 4.7.1 which is incompatible.

我应该怎么做才能解决这些错误并使布局解析器正常工作

我尝试创建一个新环境并再次重复。它没有产生任何结果。如果你们需要我提供任何其他信息,我将随时为您服务。

python deep-learning pytorch detectron layout-parser
1个回答
0
投票

看来您必须在不同位置添加依赖项,它们在您的计算机上无法相互访问。我将删除您当前安装在计算机上的所有与 detector2 相关的库,然后重新开始。我也遇到了错误,但当我在这里观看此视频时,它开始工作:https://www.youtube.com/watch?time_continue=920&v=JC4D9kfZdDI&embeds_referring_euri=https%3A%2F%2Fwww.bing.com%2F&embeds_referring_origin= https%3A%2F%2Fwww.bing.com&source_ve_path=Mjg2NjY&feature=emb_logo。祝你好运。

© www.soinside.com 2019 - 2024. All rights reserved.