本文主要是介绍recognize-anything 识别万物,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
docker run --gpus all -itd --name=test -v /app:/app nvcr.io/nvidia/cuda:11.8.0-devel-ubuntu22.04
###########安装过程########################
# 更新包索引
apt update
# 安装 Python 3
apt install python3 -y
# 安装 pip
apt install python3-pip -y
# 安装 Git
apt install git -y
# 安装 ffmpeg 和一些图形相关的库
apt-get install ffmpeg libsm6 libxext6 -y
# 安装 OpenGL 库
apt-get install libgl1 -y
# 将 Python 3 的可执行文件复制到一个更通用的命令名
cp /usr/bin/python3 /usr/bin/python
# 安装 wget
apt-get install -y wget
# 克隆 “recognize-anything” 项目
git clone https://github.com/xinyu1205/recognize-anything.git
# 进入项目文件夹
cd recognize-anything/
# 安装一些 Python 包
pip install timm transformers fairscale pycocoevalcap
# 安装项目所需的所有依赖项
pip install -r requirements.txt
# 创建并进入一个名为 `pretrained` 的文件夹
mkdir pretrained
cd pretrained
# 使用 wget 下载预训练模型
wget https://huggingface.co/xinyu1205/recognize-anything-plus-model/resolve/main/ram_plus_swin_large_14m.pth
wget https://huggingface.co/xinyu1205/recognize-anything-plus-model/resolve/main/ram_plus_tag_embedding_class_4585_des_51.pth
wget https://huggingface.co/spaces/xinyu1205/Recognize_Anything-Tag2Text/resolve/main/ram_swin_large_14m.pth
wget https://huggingface.co/spaces/xinyu1205/Recognize_Anything-Tag2Text/resolve/main/tag2text_swin_14m.pth
#######################
启动脚本如下
python inference_ram_plus.py --image images/demo/demo1.jpg \
> --pretrained pretrained/ram_plus_swin_large_14m.pth
这篇关于recognize-anything 识别万物的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!