pip install modelscope modelscope download --model 'iic/cv_ddcolor_image-colorization' --local_dir './DDColormodel'
pytroch环境:
conda install pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia -y pip install addict modelscope datasets sympy==1.13.1 simplejson sortedcontainers timm
推理:
pythonimport cv2
from modelscope.outputs import OutputKeys
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks
img_colorization = pipeline(Tasks.image_colorization,
model='./DDColormodel')
img_path = 'https://modelscope.oss-cn-beijing.aliyuncs.com/test/images/audrey_hepburn.jpg'
result = img_colorization(img_path)
cv2.imwrite('result.png', result[OutputKeys.OUTPUT_IMG])
原图:
docker run --gpus all --shm-size=32g -it --net host -v ./:/ddcolor kevinchina/deeplearning:2.5.1-cuda12.1-cudnn9-devel-pix2pix bash pip install addict modelscope datasets sympy==1.13.1 simplejson sortedcontainers timm opencv-python apt-get update apt-get install -y libgl1-mesa-glx libjpeg-dev libpng-dev libtiff-dev libopencv-dev docker commit 731cbf160933 kevinchina/deeplearning:2.5.1-cuda12.1-cudnn9-devel-ddcolor docker push kevinchina/deeplearning:2.5.1-cuda12.1-cudnn9-devel-ddcolor
本文作者:Dong
本文链接:
版权声明:本博客所有文章除特别声明外,均采用 CC BY-NC。本作品采用《知识共享署名-非商业性使用 4.0 国际许可协议》进行许可。您可以在非商业用途下自由转载和修改,但必须注明出处并提供原作者链接。 许可协议。转载请注明出处!