edit README

This commit is contained in:
HengZhang 2025-03-03 13:19:03 +08:00
parent d2b0ac5f9a
commit 5df1c810b1
6 changed files with 28 additions and 19 deletions

View File

@ -1,32 +1,41 @@
依赖包
# Traffic Wheel 交通轮
# 依赖环境
支持python 3.10以上版本。
使用conda创建基本环境
```
conda create -n trafficwheel python=3.10
```
pip install pyyaml tqdm statsmodels h5py kagglehub torch torchvision torchaudio torchdiffeq fastdtw
pip下载安装包
```
pip install pyyaml tqdm statsmodels h5py kagglehub torch torchvision torchaudio torchdiffeq fastdtw notebook
```
# 快速开始
命令
参考baseline.ipynb中的命令执行或者使用下面的命令请确保当前目录为TrafficWheel
![image-20241214230153502](./assets/image-20241214230153502.png)
```
python run.py --model {model_name} --dataset {dataset_name} --mode {train, test} --device {cuda:0}
```
- model_name: 目前支持DSANET、STGCN、DCRNN、 GWN(GraphWaveNet)、STSGCN、AGCRN、STFGNN、STGODE、STGNCDE、DDGCRN、TWDGCN
- dataset_name目前支持PEMSD3PEMSD4、PEMSD7、PEMSD8
- modetrain为训练模型test为测试模型。测试模型需要在pre-train文件中找到模型的pth存档。
- device: 支持'cpu'、'cuda:0'、cuda:1 ... 取决于机器卡数
# 测试模型
添加模型:
在实验结束后,模型的存档文件会被保存在 `experiments/dataset/训练时间 `文件夹下共有4个文件。
三步1. 在config下新建文件夹复制其他模型的参数项改命令
- best_model.pth 保存了使验证集效果最好的checkpoint
- best_test_model.pth 保存了使测试集的效果最好的checkpoint
- DATASET.yaml 存放了训练模型时所使用的参数
- run.log 记录了训练日志。
2. 在model新建文件夹复制模型文件
![image-20241214230303239](./assets/image-20241214230303239.png)
使用 arg['参数名']访问参数具体参数在yaml文件中的model类下对应配置有啥写啥。一般只要这里的参数就可以了不需要动其他的train,data
![image-20241214230331273](./assets/image-20241214230331273.png)
第三步在model/model_selector下添加自己的模型类似这种格式
![image-20241214230447678](./assets/image-20241214230447678.png)
然后就可以运行了。其中ARIMA,VAR还没做好不要运行。
可以创建`pre-train/{dataset_name}`文件夹,把整个文件夹的内容拷贝到`experiments/dataset/训练时间 `文件夹下的内容全部拷贝到`pre-train/{dataset_name}`里面。之后就可以在命令中调用` --model test`进行测试。

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB