人工智能之基于阿里云进行人脸特征检测部署

人工智能之基于阿里云进行人脸特征检测部署

需求描述

  1. 基于阿里云搭建真人人脸68个关键点检测模型,模型名称:Damo_XR_Lab/cv_human_68-facial-landmark-detection
  2. 使用上述模型进行人脸关键点识别,模型地址

业务实现

阿里云配置

阿里云配置如下:

依赖工具安装

bash 复制代码
# 安装ModelScope, 建议git安装
git clone https://github.com/modelscope/modelscope.git
cd modelscope
pip install -e .

SDK模型下载

python 复制代码
# SDK模型下载
from modelscope import snapshot_download
model_dir = snapshot_download('Damo_XR_Lab/cv_human_68-facial-landmark-detection')

图片验证

python 复制代码
import cv2
import copy
from modelscope.pipelines import pipeline
from modelscope.utils.constant import Tasks

model_id = 'Damo_XR_Lab/cv_human_68-facial-landmark-detection'
estimator = pipeline(Tasks.facial_68ldk_detection, model=model_id)

Input_file = '/mnt/workspace/105910221.jpg'
cv_img = cv2.imread(Input_file)
cv_img = cv2.resize(cv_img, (256, 256))

results = estimator(input=cv_img)
landmarks = results['landmarks']

image_draw = copy.copy(cv_img)
for num in range(landmarks.shape[0]):
    cv2.circle(image_draw, (round(landmarks[num][0]), round(landmarks[num][1])), 2, (0, 255, 0), -1)
cv2.imwrite('result.png', image_draw)

结果展示如下:测试数据图片路径

从多次搭建的经验来看,建议在搭建模型相关的内容的时候,优先选择阿里云的相关服务,很多东西阿里云的容器云已经提供底层技术,可以很快的使用modelscope提供的操作内容进行快速的模型搭建。

相关推荐
乌恩大侠3 小时前
自动驾驶的未来:多模态传感器钻机
人工智能·机器学习·自动驾驶
光锥智能4 小时前
AI办公的效率革命,金山办公从未被颠覆
人工智能
GetcharZp4 小时前
爆肝整理!带你快速上手LangChain,轻松集成DeepSeek,打造自己的AI应用
人工智能·llm·deepseek
猫头虎5 小时前
新手小白如何快速检测IP 的好坏?
网络·人工智能·网络协议·tcp/ip·开源·github·php
GeeJoe5 小时前
凡人炼丹传之 · 我让 AI 帮我训练了一个 AI
人工智能·机器学习·llm
小和尚同志5 小时前
Dify29. 为你的 Dify API 穿层衣服吧
人工智能·aigc
不会学习的小白O^O5 小时前
神经网络----卷积层(Conv2D)
人工智能·深度学习·神经网络
bastgia5 小时前
Transformer终结者?Google DeepMind新架构实现2倍推理速度和一半内存占用
人工智能·llm
努力一点9486 小时前
ubuntu22.04系统入门 linux入门(二) 简单命令 多实践以及相关文件管理命令
linux·运维·服务器·人工智能·gpu算力