一个面向中学生的简单AI工具包,提供人脸分析、人体分析、相机工具和图像分析功能
Project description
AIToolkit Base
一个面向中学生的简单AI工具包,基于MediaPipe封装,提供简单易用的人脸检测、人脸关键点检测、手部关键点检测、人体姿态检测、手势识别和物体检测功能。
功能特点
- 简单易用的API设计
- 统一的接口风格
- 中文注释和文档
- 自动的可视化功能
- 实时处理支持
1.0版本固化功能
人脸分析
- 人脸检测:提升多人脸检测稳定性
- 人脸关键点:优化478点精确定位
人体分析
- 手部关键点:提升21点3D坐标准确性
- 人体姿态:优化33点检测与多人跟踪
- 手势识别:扩展更多手势类型识别
相机工具
- 相机工具:增强实时处理功能
- 支持cv2,web api 等多种网页端显示功能
- 迭代器支持:可使用
for frame in camera:语法直接遍历视频帧
图像分析
- 物体检测:提升检测速度与精度
安装说明
Windows系统
- 下载或克隆本仓库
- 进入项目目录:
cd aitoolkit_base - 运行安装脚本:
build_wheel.bat
Linux/Mac系统
- 下载或克隆本仓库
- 进入项目目录:
cd aitoolkit_base - 添加执行权限:
chmod +x build_wheel.sh - 运行安装脚本:
./build_wheel.sh
手动安装
如果安装脚本不起作用,可以手动安装:
- 创建模型目录:
mkdir -p aitoolkit_base/models
-
复制模型文件(从mediapipe-samples目录)到
aitoolkit_base/models/ -
安装依赖:
pip install -r requirements.txt
- 安装包:
pip install -e .
使用方法
1. 人脸检测
from aitoolkit_base import FaceDetector
import cv2
# 创建检测器
detector = FaceDetector()
# 读取图像
image = cv2.imread('test.jpg')
# 运行检测
faces = detector.run(image)
# 绘制结果
result = detector.draw(image, faces)
2. 手势识别
from aitoolkit_base import GestureRecognizer
import cv2
# 创建识别器
recognizer = GestureRecognizer()
# 读取图像
image = cv2.imread('test.jpg')
# 运行识别
gestures = recognizer.run(image)
# 绘制结果
result = recognizer.draw(image, gestures)
3. 相机实时处理
from aitoolkit_base import Camera, FaceDetector
import cv2
# 创建相机和检测器
camera = Camera()
detector = FaceDetector()
# 实时检测循环
while True:
frame = camera.read()
faces = detector.run(frame)
result = detector.draw(frame, faces)
cv2.imshow("人脸检测", result)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
camera.release()
cv2.destroyAllWindows()
4. 相机迭代器用法
from aitoolkit_base import Camera, FaceDetector
import cv2
# 创建相机和检测器
camera = Camera()
detector = FaceDetector()
# 使用迭代器语法直接遍历视频帧
for frame in camera:
# 处理每一帧
faces = detector.run(frame)
result = detector.draw(frame, faces)
# 显示结果
cv2.imshow("人脸检测", result)
# 按q键退出
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# 释放资源
camera.release()
cv2.destroyAllWindows()
实时处理示例
查看 examples 目录获取更多实时处理的示例代码。
常见问题
-
模型文件找不到
- 确保模型文件已正确复制到
aitoolkit_base/models/目录 - 检查模型文件名是否正确
- 确保模型文件已正确复制到
-
实时处理速度慢
- 尝试降低输入图像分辨率
- 使用
ImageUtils.resize_image()调整图像大小 - 考虑使用性能更好的硬件
-
检测不准确
- 调整
min_detection_confidence参数 - 确保光线充足
- 保持适当的距离
- 调整
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aitoolkit_base-1.0.0.tar.gz
(31.9 MB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aitoolkit_base-1.0.0.tar.gz.
File metadata
- Download URL: aitoolkit_base-1.0.0.tar.gz
- Upload date:
- Size: 31.9 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c7d78abec33c3105a06e4d13b8483dbd36c0d3712dca0395649208de61435695
|
|
| MD5 |
e9cc6a5103c19fda567d59a9f9abc959
|
|
| BLAKE2b-256 |
620a0a3581fa6bcc86538987801396b5bea9becfcb09d3d039d51aaaed7b0661
|
File details
Details for the file aitoolkit_base-1.0.0-py3-none-any.whl.
File metadata
- Download URL: aitoolkit_base-1.0.0-py3-none-any.whl
- Upload date:
- Size: 32.0 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
292889d2a5106e18449b3ecd2855a258d4d22be14ab835f974dd5d4bfda0cf25
|
|
| MD5 |
f9984325a5c0f0338cfc4820cebddb21
|
|
| BLAKE2b-256 |
098b3c87fa90963115d6d76043a12cfc43b2ada911b1a0f967c63fbbee61ad26
|