Delete 路径修改说明.md
Browse files
路径修改说明.md
DELETED
|
@@ -1,181 +0,0 @@
|
|
| 1 |
-
# Detection 文件夹路径修改说明
|
| 2 |
-
|
| 3 |
-
**修改日期**: 2025-10-28
|
| 4 |
-
**状态**: ✅ 已完成
|
| 5 |
-
|
| 6 |
-
---
|
| 7 |
-
|
| 8 |
-
## 📋 修改概述
|
| 9 |
-
|
| 10 |
-
将Detection文件夹从备份恢复后,所有脚本中的路径引用已更新为使用Detection文件夹内的相对路径,而非原项目的绝对路径。
|
| 11 |
-
|
| 12 |
-
---
|
| 13 |
-
|
| 14 |
-
## 🔧 具体修改
|
| 15 |
-
|
| 16 |
-
### 1. `scripts/run_inference_final.py`
|
| 17 |
-
|
| 18 |
-
**修改内容**:
|
| 19 |
-
- ✅ 修改导入语句:从 `from scripts.detection.inference_longemotion import` 改为 `from inference_longemotion import`
|
| 20 |
-
- ✅ 更新文件路径:使用Detection文件夹内的相对路径
|
| 21 |
-
- 模型路径: `Detection/model/best_model.pt`
|
| 22 |
-
- 测试数据: `Detection/test_data/test.jsonl`
|
| 23 |
-
- 输出文件: `Detection/submission/predictions.jsonl`
|
| 24 |
-
- 详细结果: `Detection/submission/predictions_detailed.json`
|
| 25 |
-
|
| 26 |
-
**关键代码**:
|
| 27 |
-
```python
|
| 28 |
-
detection_root = Path(__file__).parent.parent
|
| 29 |
-
model_path = detection_root / "model" / "best_model.pt"
|
| 30 |
-
test_file = detection_root / "test_data" / "test.jsonl"
|
| 31 |
-
output_file = detection_root / "submission" / "predictions.jsonl"
|
| 32 |
-
output_detailed = detection_root / "submission" / "predictions_detailed.json"
|
| 33 |
-
```
|
| 34 |
-
|
| 35 |
-
### 2. `scripts/inference_longemotion.py`
|
| 36 |
-
|
| 37 |
-
**修改内容**:
|
| 38 |
-
- ✅ 更新默认参数路径,使用相对于scripts文件夹的路径
|
| 39 |
-
- 默认模型路径: `../model/best_model.pt`
|
| 40 |
-
- 默认测试文件: `../test_data/test.jsonl`
|
| 41 |
-
- 默认输出文件: `../submission/predictions.jsonl`
|
| 42 |
-
- 默认详细结果: `../submission/predictions_detailed.json`
|
| 43 |
-
|
| 44 |
-
### 3. `scripts/convert_submission_format.py`
|
| 45 |
-
|
| 46 |
-
**修改内容**:
|
| 47 |
-
- ✅ 更新输入输出文件路径
|
| 48 |
-
- 输入文件: `../submission/predictions.jsonl`
|
| 49 |
-
- 输出文件: `../submission/Emotion_Detection_Result.jsonl`
|
| 50 |
-
|
| 51 |
-
### 4. 文档更新
|
| 52 |
-
|
| 53 |
-
#### `README.md`
|
| 54 |
-
- ✅ 更新使用说明,强调需要在Detection文件夹内运行
|
| 55 |
-
|
| 56 |
-
#### `快速使用指南.md`
|
| 57 |
-
- ✅ 更新所有运行步骤和命令
|
| 58 |
-
- ✅ 更新文件路径说明
|
| 59 |
-
- ✅ 添加故障排除指南
|
| 60 |
-
- ✅ 更新注意事项
|
| 61 |
-
|
| 62 |
-
---
|
| 63 |
-
|
| 64 |
-
## 📁 当前文件结构
|
| 65 |
-
|
| 66 |
-
```
|
| 67 |
-
Detection/
|
| 68 |
-
├── model/
|
| 69 |
-
│ └── best_model.pt # 训练好的模型
|
| 70 |
-
│
|
| 71 |
-
├── test_data/
|
| 72 |
-
│ └── test.jsonl # 测试集数据
|
| 73 |
-
│
|
| 74 |
-
├── scripts/
|
| 75 |
-
│ ├── run_inference_final.py # 主运行脚本
|
| 76 |
-
│ ├── inference_longemotion.py # 推理核心逻辑
|
| 77 |
-
│ ├── convert_submission_format.py # 格式转换脚本
|
| 78 |
-
│ └── detection_model.py # 模型定义
|
| 79 |
-
│
|
| 80 |
-
├── submission/
|
| 81 |
-
│ └── Emotion_Detection_Result.jsonl # 提交文件
|
| 82 |
-
│
|
| 83 |
-
├── reports/
|
| 84 |
-
│ ├── 项目最终进度报告.md
|
| 85 |
-
│ ├── 项目自查完整报告_20251025.txt
|
| 86 |
-
│ └── 项目自查报告.md
|
| 87 |
-
│
|
| 88 |
-
├── README.md # 项目说明
|
| 89 |
-
├── 快速使用指南.md # 使用指南
|
| 90 |
-
└── 路径修改说明.md # 本文档
|
| 91 |
-
```
|
| 92 |
-
|
| 93 |
-
---
|
| 94 |
-
|
| 95 |
-
## 🚀 使用方法
|
| 96 |
-
|
| 97 |
-
### 方法1: 从Detection文件夹运行(推荐)
|
| 98 |
-
|
| 99 |
-
```bash
|
| 100 |
-
# 1. 激活虚拟环境(在项目根目录)
|
| 101 |
-
.\venv\Scripts\activate
|
| 102 |
-
|
| 103 |
-
# 2. 进入Detection文件夹
|
| 104 |
-
cd Detection
|
| 105 |
-
|
| 106 |
-
# 3. 运行推理
|
| 107 |
-
python scripts/run_inference_final.py
|
| 108 |
-
```
|
| 109 |
-
|
| 110 |
-
### 方法2: 从scripts文件夹运行
|
| 111 |
-
|
| 112 |
-
```bash
|
| 113 |
-
# 1. 激活虚拟环境
|
| 114 |
-
.\venv\Scripts\activate
|
| 115 |
-
|
| 116 |
-
# 2. 进入scripts文件夹
|
| 117 |
-
cd Detection/scripts
|
| 118 |
-
|
| 119 |
-
# 3. 直接运行(使用默认相对路径)
|
| 120 |
-
python inference_longemotion.py
|
| 121 |
-
```
|
| 122 |
-
|
| 123 |
-
---
|
| 124 |
-
|
| 125 |
-
## ✅ 验证结果
|
| 126 |
-
|
| 127 |
-
所有关键文件已验证存在:
|
| 128 |
-
- ✅ `model/best_model.pt` - 模型文件 (~400MB)
|
| 129 |
-
- ✅ `test_data/test.jsonl` - 测试集(136个样本)
|
| 130 |
-
- ✅ `submission/Emotion_Detection_Result.jsonl` - 提交文件(136行)
|
| 131 |
-
- ✅ 所有脚本文件完整
|
| 132 |
-
- ✅ 所有文档文件完整
|
| 133 |
-
|
| 134 |
-
---
|
| 135 |
-
|
| 136 |
-
## 📝 重要注意事项
|
| 137 |
-
|
| 138 |
-
1. **运行位置**: 脚本必须在Detection文件夹内(或其子文件夹)运行
|
| 139 |
-
2. **相对路径**: 所有路径都基于Detection文件夹的相对路径
|
| 140 |
-
3. **虚拟环境**: 运行前请确保激活项目的虚拟环境
|
| 141 |
-
4. **文件完整性**: 请勿移动或删除model文件夹中的best_model.pt
|
| 142 |
-
|
| 143 |
-
---
|
| 144 |
-
|
| 145 |
-
## 🔄 与原项目的区别
|
| 146 |
-
|
| 147 |
-
| 原路径 | 新路径 | 说明 |
|
| 148 |
-
|--------|--------|------|
|
| 149 |
-
| `checkpoints/detection/best_model.pt` | `Detection/model/best_model.pt` | 模型位置 |
|
| 150 |
-
| `data/detection/test/test.jsonl` | `Detection/test_data/test.jsonl` | 测试数据 |
|
| 151 |
-
| `evaluation/detection/test_results/` | `Detection/submission/` | 输出目录 |
|
| 152 |
-
|
| 153 |
-
---
|
| 154 |
-
|
| 155 |
-
## 🐛 常见问题
|
| 156 |
-
|
| 157 |
-
### Q: 运行脚本时找不到文件?
|
| 158 |
-
**A**: 确保在Detection文件夹内运行,使用 `cd Detection` 进入文件夹。
|
| 159 |
-
|
| 160 |
-
### Q: 模型加载失败?
|
| 161 |
-
**A**: 检查 `model/best_model.pt` 文件是否存在,大小约400MB。
|
| 162 |
-
|
| 163 |
-
### Q: 导入模块失败?
|
| 164 |
-
**A**: 确保虚拟环境已激活,并已安装所需依赖:
|
| 165 |
-
```bash
|
| 166 |
-
pip install torch transformers tqdm
|
| 167 |
-
```
|
| 168 |
-
|
| 169 |
-
---
|
| 170 |
-
|
| 171 |
-
## 📞 技术支持
|
| 172 |
-
|
| 173 |
-
如有问题,请查看:
|
| 174 |
-
- `快速使用指南.md` - 详细使用说明
|
| 175 |
-
- `reports/项目最终进度报告.md` - 完整技术报告
|
| 176 |
-
- `README.md` - 项目概览
|
| 177 |
-
|
| 178 |
-
---
|
| 179 |
-
|
| 180 |
-
**修改完成!所有路径已正确配置。** ✅
|
| 181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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