AI课程任务2 - 多模态融合之文本指导的图像上色,已实现推理
- 创建并激活虚拟环境:
conda create -n pris2 python=3.8pip install git+https://github.com/sheqian36/pris2.git
or
git clone https://github.com/sheqian36/pris2.git
cd pris2
pip install ./pris2
把预训练权重 largedecoder.pth 放到当前目录。权重下载:谷歌网盘
- 导入并启动测试:
import pris2
img_path = "L-CoDer.jpg"
caption = "There is a blue car in the middle of the road."
output_path = "colorized.jpg"
pris2.color(img_path, caption, output_path)
或者
python demo.py
可以更换需要上色的图像和测试不同的文本
- Python 3.8
- Conda
该项目基于 https://github.com/changzheng123/L-CoDer进行封装,可以给原仓库一个 ⭐