1、unireplknet
(1)代码目录总览
(2)README
1.总述
Code and checkpoints have been thoroughly tested.
code跟checkpoints已经通过了测试,large-kernel convolution with PyTorch尝试使用
2.Motivation
3.Highlights
4.TODOs
- Model code
- 预训练权重(ImageNet-1K and ImageNet-22K )
- 在Google Drive (see this page) and hugging face (see unireplknet.py)发布的权重
- pythorch大卷积核的实现
- ImageNet 训练代码
- audio, video, point cloud, and time-series tasks的代码
- 语义分割代码,记录和所有的checkpoint
ImageNet, COCO, and ADE20K checkpoints 已经被放在了huggingface repo 上。
ImageNet-22K pretrained UniRepLKNet-S, and UperNet with UniRepLKNet-XL, which were lost, and we are reproducing them.
5.Code design
- unireplknet.py中有一些与MMDetection和MMSegmentation相关的代码,因此您可以直接将其复制粘贴到MMDetection或MMSegmention中,例如,在此处和此处。如果您不想将其与MMDetection或MMSegmentation一起使用,您可以安全地删除这些代码行。(这里面提到的MMDetection和MMSegmentation我没有太理解是什么意思)
- 提供一个代码去自动构建模型并加载权重。(有一个位置可以实现)。另外还可以用timm.create_model('unireplknet_l',num_classes = num_classes_of_your_task,in_22l_pretrained = True) 下一行内容是一个代码,说更简要的方法是复制粘贴unireplknet.py 到自己的运行的目录下,然后:from unireplknet import * medel = timm.create_model()(补充知识:timm是pytorch原生实现的一个模型库,里面有各种预训练库和各种网络组件)
- reparameterize_unireplknet()实现一个结构重构参数方法。涉及推断过程(inference structure):移除了Dialted Reparam Blocks, Batch Norm layers, and the bias term in GRN。
伪代码如下:
training_model = unireplknet_l(..., deploy=False)
训练模型
测试已训练好的模型
重参数化函数
测试已训练好的模型
save(模型,权重)
6.Models
提供了五种方式去download checkpoints
权重可以直接下载
7.ImageNet evaluation and training
给了一个测试评估命令:
单GPU
python main.py --model unireplknet_b --eval true \(这里提到了unireplknet_b,是一种变体)
--resume unireplknet_b_in22k_to_in1k_384_acc87.40.pth \(加载对应的权重,这个想法是错误的,它目的是为了指定从哪个checkpoint文件中恢复模型参数,resume参数指定checkpoint文件)
--input_size 384 \(指定输入图片大小)
--data_path /path/to/imagenet-1k(制定了数据集的路径,用于模型的评估操作)