tiktok-person-detection || tiktok-scene-detection
📅 2026/7/19 6:07:05
👁️ 阅读次数
📝 编程学习
license: apache-2.0
language:
- en
- zh
tags: - tiktok
- person-detection
- face-detection
- body-detection
- gguf
- mlp
- deep-learning
metrics: - accuracy
base_model: []
pipeline_tag: image-classification
library_name: gguf
TikTok 视频人物检测模型
模型简介
基于深度MLP(多层感知器)的TikTok视频人物检测模型,能够检测视频中是否存在人物,以及人物的身体和脸部特征。
模型架构
输入层: 12维手工特征 ↓ 标准化 (X - mean) / std 隐藏层1: 2048神经元 (ReLU激活) ↓ 隐藏层2: 1024神经元 (ReLU激活) ↓ 隐藏层3: 512神经元 (ReLU激活) ↓ 输出层: 4类 (Softmax)模型规格
| 项目 | 数值 |
|---|---|
| 架构 | Deep MLP 4层 |
| 参数量 | 2,651,652 |
| 模型大小 | 10.12 MB |
| 模型格式 | GGUF v3 |
| 输入特征 | 12维 |
| 输出类别 | 4类 |
| 准确率 | 100.00% |
| 优化器 | Adam |
| 学习率 | 0.005 |
| 训练轮数 | 300 (提前停止) |
人物类别
| ID | 类别 | 说明 |
|---|---|---|
| 0 | no_person | 无人 |
| 1 | face_only | 仅人脸 |
| 2 | body_only | 仅身体 |
| 3 | face_and_body | 人脸+身体 |
检测特征
模型通过分析以下特征来检测人物的身体和脸部:
脸部检测特征
- 肤色像素比例 (YCbCr颜色空间)
- 中心区域亮度 (脸部通常位于中心)
身体检测特征
- 肤色区域分布范围
- 整体图像亮度分布
辅助特征
- 平均亮度、颜色饱和度、RGB通道均值
- 边缘密度、对比度、纹理复杂度
- 暖色调比例、垂直边缘比例
GGUF文件结构
模型包含10个张量:
- W1 (12×2048), b1 (2048)
- W2 (2048×1024), b2 (1024)
- W3 (1024×512), b3 (512)
- W4 (512×4), b4 (4)
- X_mean (12) - 输入标准化均值
- X_std (12) - 输入标准化标准差
使用方法
importnumpyasnpimportstructfromPILimportImage# 提取图像特征defextract_features(image_path):img=Image.open(image_path).convert('RGB')img=img.resize((64,64))arr=np.array(img,dtype=np.float32)/255.0# 提取12维特征gray=0.299*arr[:,:,0]+0.587*arr[:,:,1]+0.114*arr[:,:,2]brightness=np.mean(gray)# ... 完整的特征提取returnfeatures# 推理features=extract_features("video_thumbnail.jpg")features=(features-X_mean)/X_std# 前向传播z1=features @ W1+b1 a1=np.maximum(0,z1)z2=a1 @ W2+b2 a2=np.maximum(0,z2)z3=a2 @ W3+b3 a3=np.maximum(0,z3)z4=a3 @ W4+b4 pred=np.argmax(z4)print(f"人物类别:{PERSON_CLASSES[pred]}")训练数据
- 数据来源: Archive.org TikToks集合 (https://archive.org/details/tiktoks)
- 训练样本: 287个 (4类,每类最多80个)
- 标签生成: 基于肤色检测和图像特征的启发式规则
训练过程
| Epoch | Loss | Accuracy |
|---|---|---|
| 1 | 9.0784 | 32.06% |
| 20 | 0.1293 | 98.61% |
| 40 | 0.0006 | 100.00% (停止) |
局限性
- 标签为启发式规则生成,非人工标注
- 肤色检测受光照条件影响
- 仅基于缩略图分析,未使用视频时序信息
- 无法识别多个人物或人物身份
License
Apache 2.0
license: apache-2.0
language:
- en
- zh
tags: - tiktok
- scene-detection
- video-analysis
- gguf
- mlp
- deep-learning
metrics: - accuracy
base_model: []
pipeline_tag: image-classification
library_name: gguf
TikTok 视频场景检测模型
模型简介
基于深度MLP(多层感知器)的TikTok视频场景检测模型,能够对TikTok视频缩略图进行8类场景分类。
模型架构
输入层: 12维手工特征 ↓ 标准化 (X - mean) / std 隐藏层1: 2048神经元 (ReLU激活) ↓ 隐藏层2: 1024神经元 (ReLU激活) ↓ 隐藏层3: 512神经元 (ReLU激活) ↓ 输出层: 8类 (Softmax)模型规格
| 项目 | 数值 |
|---|---|
| 架构 | Deep MLP 4层 |
| 参数量 | 2,653,704 |
| 模型大小 | 10.12 MB |
| 模型格式 | GGUF v3 |
| 输入特征 | 12维 |
| 输出类别 | 8类 |
| 准确率 | 99.79% |
| 优化器 | Adam |
| 学习率 | 0.005 |
| 训练轮数 | 300 (提前停止) |
场景类别
| ID | 类别 | 说明 |
|---|---|---|
| 0 | indoor | 室内场景 |
| 1 | outdoor | 室外场景 |
| 2 | urban | 城市场景 |
| 3 | nature | 自然场景 |
| 4 | night | 夜景 |
| 5 | stage | 舞台场景 |
| 6 | sports | 运动场景 |
| 7 | restaurant | 餐厅场景 |
输入特征 (12维)
| 特征 | 说明 |
|---|---|
| 0 | 平均亮度 |
| 1 | 颜色饱和度 |
| 2-4 | RGB通道均值 |
| 5 | 边缘密度 |
| 6 | 中心区域亮度 |
| 7 | 肤色像素比例 |
| 8 | 对比度 |
| 9 | 纹理复杂度 |
| 10 | 暖色调比例 |
| 11 | 垂直边缘比例 |
GGUF文件结构
模型包含10个张量:
- W1 (12×2048), b1 (2048)
- W2 (2048×1024), b2 (1024)
- W3 (1024×512), b3 (512)
- W4 (512×8), b4 (8)
- X_mean (12) - 输入标准化均值
- X_std (12) - 输入标准化标准差
使用方法
importnumpyasnpimportstructfromPILimportImage# 加载GGUF模型defload_gguf_model(gguf_path):withopen(gguf_path,'rb')asf:# 读取GGUF头部magic=struct.unpack('<I',f.read(4))[0]version=struct.unpack('<I',f.read(4))[0]n_tensors=struct.unpack('<Q',f.read(8))[0]# ... 解析元数据和张量returnmodel# 提取图像特征defextract_features(image_path):img=Image.open(image_path).convert('RGB')img=img.resize((64,64))arr=np.array(img,dtype=np.float32)/255.0# 提取12维特征...returnfeatures# 推理features=extract_features("video_thumbnail.jpg")features=(features-X_mean)/X_std# 前向传播z1=features @ W1+b1 a1=np.maximum(0,z1)z2=a1 @ W2+b2 a2=np.maximum(0,z2)z3=a2 @ W3+b3 a3=np.maximum(0,z3)z4=a3 @ W4+b4 pred=np.argmax(z4)print(f"场景类别:{SCENE_CLASSES[pred]}")训练数据
- 数据来源: Archive.org TikToks集合 (https://archive.org/details/tiktoks)
- 训练样本: 487个 (8类,每类最多80个)
- 标签生成: 基于图像手工特征的启发式规则
训练过程
| Epoch | Loss | Accuracy |
|---|---|---|
| 1 | 6.3942 | 60.99% |
| 20 | 0.1787 | 98.15% |
| 40 | 0.0852 | 99.79% (停止) |
局限性
- 标签为启发式规则生成,非人工标注
- 仅基于缩略图分析,未使用视频时序信息
- 8类场景覆盖有限,未包含所有可能场景
- 仅适用于TikTok类短视频平台内容
License
Apache 2.0
编程学习
技术分享
实战经验