Open satakiolo opened 5 years ago
class SEResNet_IR(nn.Module): def __init__(self, num_layers, feature_dim=512, drop_ratio=0.4, mode = 'ir'): super(SEResNet_IR, self).__init__() assert num_layers in [50, 100, 152], 'num_layers should be 50, 100 or 152' assert mode in ['ir', 'se_ir'], 'mode should be ir or se_ir' blocks = get_blocks(num_layers) if mode == 'ir': unit_module = BottleNeck_IR elif mode == 'se_ir': unit_module = BottleNeck_IR_SE self.input_layer = nn.Sequential(nn.Conv2d(3, 64, (3, 3), 1, 1, bias=False), nn.BatchNorm2d(64), nn.PReLU(64)) self.output_layer = nn.Sequential(nn.BatchNorm2d(512), nn.Dropout(drop_ratio), Flatten(), nn.Linear(512 * 7 * 7, feature_dim), nn.BatchNorm1d(feature_dim))
您默认的是选择resnet100的,那如果我使用50以及152,需要修改 nn.Linear(512 7 7, feature_dim)吗?或者arcfacenet这个脚本需要修改吗?
我训练到4400次时出现了个问题 ValueError: Expected more than 1 value per channel when training, got input size [1, 512],百度之后是说我batchsize存在1个样本,可是我计算了没有出现1个样本,不知道怎么解决,如果您知道的话麻烦告诉我一下
You could try to use drop_last=true to avoid this situation
好的,谢谢你们
您默认的是选择resnet100的,那如果我使用50以及152,需要修改 nn.Linear(512 7 7, feature_dim)吗?或者arcfacenet这个脚本需要修改吗?
我训练到4400次时出现了个问题 ValueError: Expected more than 1 value per channel when training, got input size [1, 512],百度之后是说我batchsize存在1个样本,可是我计算了没有出现1个样本,不知道怎么解决,如果您知道的话麻烦告诉我一下