myPCL/README.md
2023-05-17 09:21:06 +08:00

54 lines
3.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# myPCL
## Training:
#### 参数解析
| 简写参数 | 全称参数 | 描述 |
|:----:|:---------------:|:---------------------------------------|
| -a | --arch | 指定主干网络类型resnet-18resnet-50 |
| -j | --workers | 指定线程数默认为4 |
| | --epochs | 总训练循环次数默认为200 |
| | --warmup-epoch | 有监督epoch次数默认为100 |
| | --exp-dir | 输出路径默认为experiment |
| -b | --batch-size | 一批的数量默认为8必须为标签数的倍数 |
| -lr | --learning-rate | 学习率默认为0.03 |
| | --cos | 使用cosine学习率 |
| | --schedule | 指定学习率下降的epoch默认为[120,160]只在cos未指定时生效 |
| | --momentum | 优化器的动量餐宿默认为0.9 |
| --wd | --weight-decay | SSPCL模型的权重衰减默认为1e-4 |
| | --low-dim | 输出维度默认为128 |
| | --num-cluster | 聚类个数,默认为'20,25,30' |
| | --pcl-r | 负例对需要小于聚类个数默认为16 |
| | --moco-m | SSPCL中ME更新参数使用的动量默认为0.999 |
| | --mlp | 设置即为使用mlp无参数参考PCL模型 |
| | --temperature | softmax层温度参数默认为0.2 |
| -p | --print-freq | 显示频率默认为每10个数据 |
| | --save-freq | 保存模型的频率默认为每10个epoch |
| | --world-size | 总训练程序数量默认为1 |
| | --rank | 此训练程序编号默认编号0 |
| | --dist-url | 多程序训练连接地址此参数参照pytorch分布式训练解释 |
| | --dist-backend | 默认为nccl |
| | --gpu | 用于训练的gpu编号 |
| | --seed | 随机数种子,默认为自动生成 |
| | --resume | 需要载入的模型位置 |
| | --start-epoch | 训练起始的epoch与resume配合使用 |
| | | |
#### 用例
<pre>
python main.py -a resnet18 --lr 0.03 --batch-size 8 --workers 4 --temperature 0.2 --mlp --aug-plus --cos --dist-url "tcp://localhost:10001" --world-size 1 --rank 0 --warmup-epoch 100 --epochs 100 --exp-dir exp images
</pre>
## Testing:
#### 参数解析
**如训练时修改了以上默认的参数,在测试时也需要指定**
以下是必须要设置的参数
| 简写参数 | 全称参数 | 描述 |
|:----:|:------------:|:----------|
| | --pretrained | 需要载入模型的路径 |
#### 用例
<pre>
python test_svm.py --pretrained exp/checkpoint_0199.pth.tar
</pre>