RKNN NPU加速

在添加智能识别API和人脸识别API时,使用本教程中的镜像,可以调用Rockchip NPU的来加速识别任务;

镜像介绍:

ayaya大佬 针对mt-photos-ai 开发了RKNN 移植版本,可以调用RK3588的NPU来处理识别任务

相关仓库地址:

yaml模板

  • 请确定Rockchip NPU 驱动已安装

完整的yaml示例:

version: "3"

services:
  mtphotos:
    image: registry.cn-hangzhou.aliyuncs.com/mtphotos/mt-photos:arm-latest
    container_name: mtphotos
    restart: always
    ports:
      - 8063:8063
    volumes:
      - /volume1/docker/mt_photos/config:/config
      - /volume1/photos/mt_photos_upload:/upload
      - /volume1/xxx/其他需要映射的目录:/photos #提示:这一行是其他需要映射给容器的文件夹,如果没有可以删除这一行
    environment:
      - TZ=Asia/Shanghai
      - LANG=C.UTF-8
    dns:
      - 114.114.114.114
    depends_on:
      - mtphotos_ai
      - mtphotos_insightface
  mtphotos_ai:
    image: a15355447898a/mt-photos-ai-rknn:latest #使用支持rknn的镜像
    container_name: mtphotos_ai
    environment:
      - API_AUTH_KEY=mt_photos_ai_extra
    devices: 
      - /dev/dri:/dev/dri #映射/dev/dri给容器
    ports:
      - 8060:8060
    restart: always
    privileged: true # 开启特权模式
    volumes:  #映射相关文件给容器
      - /proc/device-tree/compatible:/proc/device-tree/compatible
      - /usr/lib/librknnrt.so:/usr/lib/librknnrt.so
  mtphotos_insightface:
    image: a15355447898a/mt-photos-insightface-rknn:latest
    container_name: mtphotos_insightface
    environment:
      - API_AUTH_KEY=mt_photos_ai_extra
    ports:
      - 8066:8066
    restart: always
    devices:
      - /dev/dri:/dev/dri
    privileged: true
    volumes:
      - /proc/device-tree/compatible:/proc/device-tree/compatible
      - /usr/lib/librknnrt.so:/usr/lib/librknnrt.so

镜像加速

当nas无法访问DockerHub时,请参考 无法下载镜像的解决方法

选择一个在线的镜像站, 然后替换镜像的地址;

比如:

a15355447898a/mt-photos-ai-rknn:latest 替换为 => docker.1panel.live/a15355447898a/mt-photos-ai-rknn:latest

a15355447898a/mt-photos-insightface-rknn:latest 替换为 => docker.1panel.live/a15355447898a/mt-photos-insightface-rknn:latest

如何使用API

智能识别API配置参数

安装完成后,智能识别API使用8060端口;

比如:nas的ip为 192.168.1.8 ,那么接口地址填写: http://192.168.1.8:8060

API_AUTH_KEY 默认值为 mt_photos_ai_extra ,如果修改了,填写对应的值即可

添加智能识别api

人脸识别API配置参数

在使用本镜像之前,如果已经用其他的镜像处理了人脸识别,需要先按切换识别模型的步骤,清除旧数据;

人脸置信度阈值设置 建议填 0.65

人脸匹配差异度阈值 建议填 0.5

配置

Copyright © 2025 杭州相册家科技有限公司 All Rights Reserved

隐私协议软件许可及服务协议

浙公网安备 33019202000625号浙ICP备2022014580号