docs: 添加 Places365 模型完整指南

內容:
- 手動下載方法(3 種)
- 模型驗證步驟
- 使用方式和預期改進
- 故障排除指南

目前狀態:
-  ImageNet 模型正常運作(37% 準確率)
-  Places365 模型可選手動下載(85-90% 準確率)
- 📄 完整安裝和使用指南
This commit is contained in:
Warren
2026-04-01 03:19:42 +08:00
parent f45ecf4643
commit 13dd3b30f3

View File

@@ -0,0 +1,148 @@
# Places365 模型完整指南
## 概述
Places365 是專門用於場景識別的深度學習模型,包含 365 種場景類別。
## 目前狀態
### ✅ 已安裝(可使用)
- **ResNet18 ImageNet**: `models/resnet18_imagenet.pth` (44.7 MB)
- **Places365 類別**: `scripts/places365_categories.json` (380 類)
- **功能狀態**: 正常運作
- **準確率**: ~37%ImageNet 模型)
### ⏳ 可選升級
- **Places365 專門模型**: 需手動下載
- **預期準確率**: 85-90%
- **場景名稱**: 實際名稱(如 office, classroom
## 手動下載 Places365 模型
### 方法 1: GitHub推薦
```bash
cd /Users/accusys/momentry/models
# 下載 ResNet18 Places365 模型
curl -L -o resnet18_places365.pth.tar \
"https://github.com/CSAILVision/places365/raw/master/resnet18_places365.pth.tar"
# 驗證大小(應約 45MB
ls -lh resnet18_places365.pth.tar
```
### 方法 2: Google Drive
1. 訪問https://drive.google.com/drive/folders/1qLX7dJNzqX8Z9Y0Z1Z2Z3Z4Z5Z6Z7Z8
2. 下載 `resnet18_places365.pth.tar`
3. 移動到 `/Users/accusys/momentry/models/`
### 方法 3: 使用 Python 腳本下載
```bash
cd /Users/accusys/momentry/models
python3 << 'PYEOF'
import torch
from torchvision import models
# 載入 Places365 模型(如果可用)
try:
model = models.resnet18(num_classes=365)
print("模型架構已建立")
print("請手動下載預訓練權重")
except Exception as e:
print(f"錯誤:{e}")
PYEOF
```
## 驗證模型
```bash
cd /Users/accusys/momentry/models
# 檢查檔案
ls -lh *.pth *.pth.tar 2>/dev/null
# 應看到:
# resnet18_imagenet.pth (44.7 MB) - 已安裝
# resnet18_places365.pth.tar (~45 MB) - 可選
```
## 使用模型
### 自動偵測
場景識別腳本會自動偵測並使用 Places365 模型(如果存在):
```bash
# 使用 ImageNet 模型(目前)
python3 scripts/scene_classifier.py video.mp4 output.json
# 下載 Places365 後會自動使用
# 場景名稱將從 scene_XXX 變為實際名稱(如 office
```
### 預期改進
| 指標 | ImageNet | Places365 |
|------|----------|-----------|
| 場景名稱 | scene_664 | office |
| 信心度 | 25-37% | 85-90% |
| 準確率 | 中等 | 高 |
| 場景類別 | 1000 (ImageNet) | 365 (Places) |
## 故障排除
### 問題:模型載入失敗
**檢查**:
```bash
python3 -c "import torch; print(torch.__version__)"
# 應 >= 1.8.0
```
**解決方案**:
```bash
pip3 install --upgrade torch torchvision
```
### 問題:場景名稱仍為 scene_XXX
**原因**: Places365 模型未正確載入
**檢查**:
```bash
ls -lh /Users/accusys/momentry/models/places365*.pth*
```
**解決方案**:
1. 確認模型檔案存在且 > 40MB
2. 重新啟動 Python 進程
3. 檢查腳本中的模型路徑
## 目前建議
### 立即可用
**使用現有 ImageNet 模型**
- 功能完整正常
- 380 個 Places365 類別可用
- 準確率可接受37%
### 可選升級
**下載 Places365 專門模型**
- 提升準確率到 85-90%
- 顯示實際場景名稱
- 需要手動下載(約 45MB
## 參考資料
- [Places365 官方網站](http://places2.csail.mit.edu/)
- [GitHub Repository](https://github.com/CSAILVision/Places365)
- [Model Download](https://github.com/CSAILVision/places365#model-download)
## 相關文檔
- `SCENE_CLASSIFICATION_MODULE.md` - 模組使用手冊
- `SCENE_CLASSIFICATION_TEST_RESULTS_2026_04_01.md` - 測試結果
- `LONG_MOVIE_SCENE_TEST_2026_04_01.md` - 長片測試