Metadata-Version: 2.4
Name: myscent
Version: 0.1.0
Summary: 图像 -> 10种香料配比，CLIP零样本分类的轻量香调视觉识别库
Author-email: jeffchen1995 <10977437+jeffchen1995@user.noreply.gitee.com>
License: MIT
Project-URL: Homepage, https://gitee.com/jeffchen1995/myscent
Project-URL: Bug Reports, https://gitee.com/jeffchen1995/myscent/issues
Keywords: clip,scent,fragrance,vision,zero-shot,perfume
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Python: >=3.9
Description-Content-Type: text/markdown
Requires-Dist: open_clip_torch>=2.24.0
Requires-Dist: torch>=2.0.0
Requires-Dist: torchvision>=0.15.0
Requires-Dist: Pillow>=9.0.0
Requires-Dist: opencv-python>=4.5.0
Requires-Dist: numpy<2,>=1.21.0
Requires-Dist: PyYAML>=6.0
Requires-Dist: huggingface_hub>=0.20.0
Requires-Dist: timm>=0.9.0

# Scent Vision Pipeline
图像输入 → CLIP 零样本分类 → 10种基础香料配比输出 的轻量算法。

## 核心特性
- 单模型 CLIP 一步输出 10 维香调配比，架构极简
- 零样本分类，无需训练，可快速扩展香调类别
- 可视化输出：主调标识 + 配比柱状图（支持中文）
- 支持国内 huggingface 镜像（hf-mirror.com），开箱即用
- 内置帧间平滑，支持视频流/实时摄像头输入
- 配置与代码分离，模块化设计，易于扩展

## 性能指标
| 设备 | 模型 | 速度 | 显存占用 |
|------|------|------|----------|
| GTX 1050 Ti (4GB) | ViT-B-32 | ~50 FPS | ~590 MB |
| CPU (i7) | ViT-B-32 | ~5 FPS | - |

## 环境要求
- Python: 3.10.x
- GPU: NVIDIA 显卡，显存 3GB+
- CUDA: 11.8
- 系统: Ubuntu 20.04+ / Windows 10+

## 快速开始
安装依赖：
    pip install -r requirements.txt

运行测试：
    python tests/test_scent.py --image data/input/test1.png --output data/output/result.jpg

自定义镜像（可选）：
    export HF_ENDPOINT=https://你的镜像地址
    python tests/test_scent.py --image data/input/test1.png

## 10 种基础香料
柑橘调 / 木质调 / 草本调 / 花香调 / 海洋调 / 焦甜调 / 肉烤调 / 奶脂调 / 鲜腥调 / 酸酪调
注：鲜腥调、酸酪调默认有浓度上限（50%），可在 configs/base_scents.yaml 中调整。

## API 用法
    from src.scent_pipeline import ScentPipeline
    from src.visualizer import ResultVisualizer
    import cv2

    pipeline = ScentPipeline(config_dir="configs")
    viz = ResultVisualizer()

    img = cv2.imread("test.jpg")
    img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)

    ratio = pipeline.predict(img_rgb)  # 10维数组，0~100
    top_name, top_val = pipeline.get_top_scent(ratio)

    # 可视化
    result_img = viz.draw(img, f"主调: {top_name} ({top_val:.1f}%)", ratio, pipeline.scent_names)
    cv2.imwrite("result.jpg", result_img)

## 目录结构
    data/input/     输入图片
    data/output/    可视化输出
    src/            源代码
    models/         模型缓存（自动下载）
    configs/        配置文件（香调定义、场景、气味源）
    tests/          测试脚本
    logs/           运行日志

## 配置说明
所有可配置项都在 configs/ 目录下：
- base_scents.yaml：10种基础香料定义（名称、浓度上限）
- odor_sources.yaml：常见气味源物体的香调特征向量
- scenes.yaml：不同场景的背景香调配比
