在 docker 中安装 GLEE

1、安装 detectron2。

2、git clone GLEE。

git clone https://github.com/FoundationVision/GLEE.git

docker 中没有 git,可以通过共享主机文件夹,在主机中做 git clone。

3、删除 GLEE/app/requirements.txt 中的 torch 和 torchvision,再 pip 。

root@e86d0af48236:/host_share/GLEE/app# cat requirements.txt 
--extra-index-url https://download.pytorch.org/whl/cu118
torch==2.1.0        #删除
torchvision        #删除
scipy
opencv-python
timm
transformers
einops
root@e86d0af48236:/host_share/GLEE/app# vi requirements.txt 
root@e86d0af48236:/host_share/GLEE/app# cat requirements.txt 
--extra-index-url https://download.pytorch.org/whl/cu118
scipy
opencv-python
timm
transformers
einops
root@e86d0af48236:/host_share/GLEE/app# pip install -r requirements.txt

4、安装 gradio 和 对 pillow 降级(版本不大于10)。

pip install gradio
pip install pillow==9.5.0  # 如果 pillow 出现错误“AttributeError: module 'PIL.Image' has no attribute 'LINEAR'”,需要降级。

5、下载 GLEE_R50_Scaleup10m.pth 和 GLEE_R50_Scaleup10m.pth,放在 GLEE/app/ 中;下载 clip_vit_base_patch32 到 GLEE/app/GLEE/ 中。

6、运行 app.py。

root@e86d0af48236:/host_share/GLEE/app# python3.8 app.py
Is CUDA available: True
CUDA device: Tesla T4
use cuda
Config 'GLEE/configs/R50.yaml' has no VERSION. Assuming it to be compatible with latest v2.
Config 'GLEE/configs/SwinL.yaml' has no VERSION. Assuming it to be compatible with latest v2.
/usr/local/lib/python3.8/dist-packages/torch/functional.py:445: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at  ../aten/src/ATen/native/TensorShape.cpp:2157.)
  return _VF.meshgrid(tensors, **kwargs)  # type: ignore[attr-defined]
Running on local URL:  http://127.0.0.1:7860

To create a public link, set `share=True` in `launch()`

你可能感兴趣的:(模式识别,docker,GLEE)