Metadata-Version: 2.4
Name: person_pose_faceid
Version: 0.4.0
Summary: Person pose estimation with person face ID recognition (YOWOv2 + SCRFD/ArcFace + BoTSORT)
Author-email: brusselslee <brusselslee@163.com>
License-Expression: MIT
Project-URL: Homepage, https://github.com/brusselslee/person_pose_faceid
Keywords: pose-estimation,face-recognition,violence-detection
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Multimedia :: Video
Requires-Python: >=3.10
Description-Content-Type: text/markdown
Requires-Dist: numpy
Requires-Dist: opencv-python

# Person Pose FaceID

人体姿态估计与行人人脸身份识别（Person pose estimation with person face ID recognition）。

基于 YOWOv2 的动作/姿态检测 + SCRFD 人脸检测 + ArcFace 人脸识别（FAISS 向量检索）+ BoTSORT 多目标跟踪，可用于校园监控、暴力行为检测等场景。

## 特性

- **姿态与动作检测：** 基于 YOWOv2（AVA v2.2 数据集），支持 80 类动作识别
- **人脸检测：** SCRFD (ONNX)，支持关键点输出
- **人脸识别：** ArcFace（ONNX / PyTorch 双引擎），FAISS 向量库检索，支持大规模人脸库
- **多目标跟踪：** BoTSORT / DeepSort，支持跨帧 ID 保持
- **视频流处理：** FFmpeg 拉流（支持 RTSP + CUDA 硬解）、断线自动重连
- **命令行入口：** 安装后可直接使用 `person-pose-faceid` 命令

## 安装

```bash
pip install person_pose_faceid
```

**注意：** 模型权重体积较大（数百 MB），不包含在 wheel 中，请单独下载：
<!-- >
> - 人脸检测模型：`det_face.onnx`（SCRFD）
> - 人脸识别模型：`w600k_r50.onnx`（ArcFace）或 `w600_r50_torch.pt`
> - 姿态检测权重：`yowo_v2_large_ava_k32.pth`

## 快速开始

### 人脸识别

```python
from person_pose_faceid.face_reidentification.main import FaceRecognition

# 初始化（指定检测与识别模型路径）
facerecon = FaceRecognition(
    det_weight="det_face.onnx",
    rec_weight="w600k_r50.onnx",
)

# 读取一帧图像（BGR）
import cv2
frame = cv2.imread("frame.jpg")

boxes, kpss = facerecon.face_detection(frame)   # 检测人脸
name, similarity = facerecon.one_face_search(frame, kpss)  # 识别
print(name, similarity)
```

### 命令行

```bash
# 视频推理
person-pose-faceid --video test_video/proj_test/output_3fps_push.mp4

# 查看全部参数
person-pose-faceid --help
``` -->

<!-- ### 作为库使用

```python
import person_pose_faceid
from person_pose_faceid.main import main_run
from person_pose_faceid.utils.misc import load_weight
from person_pose_faceid.config import build_dataset_config, build_model_config
from person_pose_faceid.models import build_model
from person_pose_faceid.tracking.bot_tracker.mc_bot_sort import BoTSORT
``` -->

<!-- ## 项目结构

```
person_pose_faceid/                # 顶层包
├── __init__.py
├── main.py                        # 主程序（命令行入口，姿态检测 + 人脸识别流水线）
├── config/                        # 数据集 / 模型配置
├── models/                        # YOWOv2 检测模型（backbone / yowo）
├── tracking/                      # BoTSORT / DeepSort 多目标跟踪
├── utils/                         # 工具函数（权重加载、可视化、日志等）
└── face_reidentification/         # 人脸识别子模块（SCRFD + ArcFace + FAISS）
    ├── database/                  # 人脸数据库与 FAISS 检索
    ├── nets/                      # 网络结构（iresnet / mobilefacenet / mobilenet）
    ├── models/                    # SCRFD / ArcFace 推理封装
    └── utils/                     # 对齐、相似度等工具 -->

<!-- ## 本地开发与构建

```bash
# 安装构建工具
pip install build twine

# 构建 wheel 与 sdist（核心模块自动 Cython 编译）
python -m build

# 检查 wheel 内容（应不包含权重；核心模块为 .so 编译版）
unzip -l dist/*.whl

# 上传到 PyPI
twine upload dist/*
```

> **说明：**
> - `main.py`、`face_reidentification/main.py`、`arcface_pt.py` 会被 Cython 编译为 `.so` 打包进 wheel（对应 `.py` 不进入 wheel），因此 wheel 是**平台相关**的（如 `cp311-cp311-linux_x86_64`），只能在相同 Python 版本与平台上安装
> - 编译后的模块不支持 `python -m person_pose_faceid.main`，请使用 `person-pose-faceid` 命令
> - 如需仅本地加速（不打包 wheel），可运行 `python setup.py build_ext --inplace` -->

## 许可证

[MIT](./LICENSE)
