# model **Repository Path**: wang_ling_hui/model ## Basic Information - **Project Name**: model - **Description**: 核心痛点是无人机图像数量大、人工筛选和标注成本高、检测训练链路分散。项目基于 FastAPI、CLIP、YOLOv11、LangChain/LangGraph、lakeFS/clake 和 Vue 构建,支持图像筛选、自动标注、YOLO 检测/训练和 AI 对话。核心流为:用户创建任务 → 读取图像 → CLIP 按自然语言条件筛选 → YOLO 检测或训练 → Worker 保存结果 → Web - **Primary Language**: Python - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2025-12-19 - **Last Updated**: 2026-04-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 无人机图像智能分析系统 基于 CLIP 模型的图像语义分析与筛选工具,支持递归处理目录结构和多种词汇库。 ## 功能 1. **图像筛选器 (Selector)** - 使用 K-Means 聚类从大量图像中筛选代表性样本 2. **图像检测器 (Detector)** - 基于词汇库的图像语义检测与标注 ## 快速开始 ### 1. 构建镜像 ```bash docker build -f Dockerfile.base -t clake:base . ``` ### 2. 准备数据 将图像放入 `images/data/` 目录,支持多级子目录结构。 ### 3. 运行筛选器 ```bash # 启动筛选器 docker-compose --profile selector up -d # 查看日志 docker logs -f visdrone-selector ``` 输出目录:`select_data/` ### 4. 运行检测器 ```bash # 通用词库 docker-compose --profile detector up -d # 军事词库 docker-compose --profile detector-military up -d # 组合词库 docker-compose --profile detector-combined up -d # 查看日志 docker logs -f visdrone-detector-general ``` 输出目录:`detector_data/` ## 本地运行 ### 安装依赖 ```bash pip install -r requirements.txt ``` ### 运行筛选器 ```bash # 递归模式,筛选比例 20% python src/visdrone_selector.py -r --selection-ratio 0.2 ``` ### 运行检测器 ```bash # 使用通用词库 python src/visdrone_detector.py vocabularies/general.json -r # 使用军事词库 python src/visdrone_detector.py vocabularies/military.json -r ``` ## 配置参数 ### 筛选器环境变量 | 变量 | 默认值 | 说明 | |------|--------|------| | `DATA_ROOT` | `/app/data` | 输入图像目录 | | `OUTPUT_DIR` | `/app/select_data` | 输出目录 | | `RECURSIVE` | `true` | 递归处理子目录 | | `SELECTION_RATIO` | `0.2` | 筛选比例 (0.2 = 20%) | ### 检测器环境变量 | 变量 | 默认值 | 说明 | |------|--------|------| | `VOCABULARY` | `general` | 词汇库 (general/military/combined) | | `DATA_ROOT` | `/app/data` | 输入图像目录 | | `OUTPUT_DIR` | `/app/detector_data` | 输出目录 | | `RECURSIVE` | `true` | 递归处理子目录 | ## 词汇库 ### 内置词汇库 - **general.json** - 通用场景(城市、交通、日常) - **military.json** - 军事场景(基地、设施) - **combined.json** - 组合词汇库 ### 自定义词汇库 创建 `vocabularies/custom.json`: ```json { "name": "Custom Vocabulary", "description": "自定义词汇库", "objects": ["object1", "object2"], "scenes": ["scene1", "scene2"], "conditions": ["condition1", "condition2"] } ``` 使用: ```bash python src/visdrone_detector.py vocabularies/custom.json -r ``` ## 输出说明 ### 筛选器输出 - `selected_images.json` - 选中的图像列表 - `statistics.json` - 统计数据 - `clustering_visualization.png` - 聚类可视化 - `cluster_distribution.png` - 簇分布图 - `selected_images/` - 筛选后的图像 - `summary.json` - 汇总结果 ### 检测器输出 - `*.txt` - 每张图像的标注文件 - `detection_stats.json` - 检测统计 - `summary.json` - 汇总结果 ## 常用命令 ```bash # 查看运行中的容器 docker ps # 停止容器 docker-compose --profile selector down docker-compose --profile detector down # 清理容器 docker-compose down --remove-orphans # 查看日志 docker logs -f ``` ## 许可证 MIT License