Spaces:
Sleeping
Sleeping
|
Download SETUP.md from Shuxian/SGDNet-Fish-Classification: direct link, hf CLI and curl.
- Browser
- Download file 2.06 kB
-
https://huggingface.co/spaces/Shuxian/SGDNet-Fish-Classification/resolve/main/SETUP.md
- Command line
-
hf download hf://spaces/Shuxian/SGDNet-Fish-Classification/SETUP.md
-
curl -L -o SETUP.md https://huggingface.co/spaces/Shuxian/SGDNet-Fish-Classification/resolve/main/SETUP.md
2.06 kB
| # Hugging Face Spaces 设置说明 | |
| ## 需要复制的模型文件 | |
| 在部署到 Hugging Face Spaces 之前,需要将以下模型文件复制到 `huggingface_space/` 目录: | |
| ### 1. YOLO 模型 | |
| - **源文件路径**: `E:\ECSF\dahuangyu\code\runs\segment\train4\weights\best.pt` | |
| - **目标文件名**: `huggingface_space/yolo_model.pt` | |
| - **说明**: YOLO分割模型,用于检测大黄鱼并生成mask | |
| ### 2. SGD-Net 模型 | |
| - **源文件路径**: `experiments\exp3_4_strategy_ours_stage2_finetune\checkpoint_final.pth` | |
| - **目标文件名**: `huggingface_space/sgd_net_checkpoint.pth` | |
| - **说明**: 训练好的SGD-Net分类模型权重 | |
| ## 复制命令(Windows PowerShell) | |
| ```powershell | |
| # 复制YOLO模型 | |
| Copy-Item "E:\ECSF\dahuangyu\code\runs\segment\train4\weights\best.pt" -Destination "huggingface_space\yolo_model.pt" | |
| # 复制SGD-Net模型 | |
| Copy-Item "experiments\exp3_4_strategy_ours_stage2_finetune\checkpoint_final.pth" -Destination "huggingface_space\sgd_net_checkpoint.pth" | |
| ``` | |
| ## 文件结构 | |
| 部署后的文件结构应该是: | |
| ``` | |
| huggingface_space/ | |
| ├── app.py # Gradio应用主文件 | |
| ├── gradcam.py # Grad-CAM实现 | |
| ├── models/ | |
| │ ├── __init__.py | |
| │ └── sgd_net.py # SGD-Net模型定义 | |
| ├── requirements.txt # 依赖 | |
| ├── README.md # 说明文档 | |
| ├── SETUP.md # 设置说明(本文件) | |
| ├── yolo_model.pt # YOLO模型文件(需要复制) | |
| └── sgd_net_checkpoint.pth # SGD-Net模型文件(需要复制) | |
| ``` | |
| ## 部署到 Hugging Face Spaces | |
| 1. 将整个 `huggingface_space/` 目录上传到 Hugging Face Spaces | |
| 2. 确保所有模型文件都已上传 | |
| 3. Hugging Face Spaces 会自动安装 `requirements.txt` 中的依赖 | |
| 4. 应用会自动运行 `app.py` | |
| ## 注意事项 | |
| - 模型文件可能较大(几百MB),上传需要一些时间 | |
| - 确保模型文件路径在代码中正确 | |
| - 首次运行时,timm会自动下载ResNet50的预训练权重 | |