-
Notifications
You must be signed in to change notification settings - Fork 5
分类任务
Mr.Li edited this page Jun 20, 2022
·
3 revisions
pip install -r ./Package/requirements.txt
根目录已包含
CatDog
数据集,且Config/
已生成dataset.txt
。
txt格式为[类型, 类别名, 图像路径]
train, dog, /xxxx/img1.jpg
val, cat, /xxxx/img2.jpg
test, cat, /xxxx/img3.jpg
-
Config/config.py
训练参数已配好 -
开始训练
假设单机2卡,执行如下命令 访问更多详情
torchrun --nproc_per_node 2 train.py
控制台输出 TensorBoard和Checkpoint将保存在
/ExpLog/
文件夹下**************************** The nums of trainSet: 140 The nums of each class: {'dog': 70, 'cat': 70} **************************** The nums of valSet: 20 The nums of each class: {'dog': 10, 'cat': 10} start epoch 0/50...
-
TensorBoard可视化
python test.py --txt ./Config/dataset.txt --weights 权重路径
控制台输出 120+指标
****************************
The nums of testSet: 40
The nums of each class: {'dog': 20, 'cat': 20}
Overall ACC is 0.900
matrix save in /../matrix.jpg
Predict cat dog
Actual
cat 0.95 0.05
dog 0.15 0.85
Predict cat dog
Actual
cat 19 1
dog 3 17
Overall Statistics :
95% CI (0.80703,0.99297)
ACC Macro 0.9
ARI 0.63062
AUNP 0.9
AUNU 0.9
Bangdiwala B 0.8125
Bennett S 0.8
CBA 0.85682
CSI 0.80404
Chi-Squared 25.85859
Chi-Squared DF 1
Conditional Entropy 0.44812
Cramer V 0.80403
Cross Entropy 1.00725
F1 Macro 0.89975
F1 Micro 0.9
...
python predict.py -weights 权重路径 --vis_cam