In the relevant code of SegMunich, there is a file called train_rulti_GPU_new.cpy, which has a parameter of num classes to determine the number of classes. When the model was just created, num classes were indeed passed in as parameters. The source code is: model=creat_madel (nb_classes=num_classes, weight_path=pretrain_path, pretrain=True), But in fact, model=vit_dase-patch8 (num_classes=nb_classes) was called in the creat_madel function. After going deeper layer by layer, the final code is: model=VisionTransformer(
img_size=128,
in_chans=1,
patch_size=8,
embed_dim=768,
depth=12,
num_heads=12,
mlp_ratio=4,
num_frames=12,
t_patch_size=3,
norm_layer=partial(nn. LayerNorm, eps=1e-6),
**kwargs,
)
Find the location of the model definition. There is a parameter of num_classes=10, which is the num-class we initially passed in. However, in reality, this parameter has not been used, and the model has been written to 13 instead of num-class. The source code is self. cls_sg=nn Sequential(
nn.Conv2d(256, 13, kernel_size=3, padding=1),
)
The correct answer should be: self. cls_sg=nn Sequential(
nn.Conv2d(256, num_classes, kernel_size=3, padding=1),
)
In the relevant code of SegMunich, there is a file called train_rulti_GPU_new.cpy, which has a parameter of num classes to determine the number of classes. When the model was just created, num classes were indeed passed in as parameters. The source code is: model=creat_madel (nb_classes=num_classes, weight_path=pretrain_path, pretrain=True), But in fact, model=vit_dase-patch8 (num_classes=nb_classes) was called in the creat_madel function. After going deeper layer by layer, the final code is: model=VisionTransformer( img_size=128, in_chans=1, patch_size=8, embed_dim=768, depth=12, num_heads=12, mlp_ratio=4, num_frames=12, t_patch_size=3, norm_layer=partial(nn. LayerNorm, eps=1e-6), **kwargs, ) Find the location of the model definition. There is a parameter of num_classes=10, which is the num-class we initially passed in. However, in reality, this parameter has not been used, and the model has been written to 13 instead of num-class. The source code is self. cls_sg=nn Sequential( nn.Conv2d(256, 13, kernel_size=3, padding=1), ) The correct answer should be: self. cls_sg=nn Sequential( nn.Conv2d(256, num_classes, kernel_size=3, padding=1), )