fuy34 / superpixel_fcn

[CVPR‘20] SpixelFCN: Superpixel Segmentation with Fully Convolutional Network
Other
392 stars 80 forks source link

label2one_hot_torch may have bug #5

Closed feivelliu closed 3 years ago

feivelliu commented 4 years ago

I check your code, maybe label2one_hot_torch have some bug? Because I don't see you to convert labels from N x H x W to N x 1 x H x W .

for i, (input, label) in enumerate(train_loader):

        iteration = i + epoch * epoch_size

        # ========== adjust lr if necessary  ===============
        if (iteration + 1) in args.milestones:
            state_dict = optimizer.state_dict()
            for param_group in state_dict['param_groups']:
                param_group['lr'] = args.lr * ((0.5) ** (args.milestones.index(iteration + 1) + 1))
            optimizer.load_state_dict(state_dict)

        # ========== complete data loading ================
        label_1hot = label2one_hot_torch(label.to(device), C=50) 
def label2one_hot_torch(labels, C=14):
    b, _, h, w = labels.shape
    one_hot = torch.zeros(b, C, h, w, dtype=torch.long).cuda()
    target = one_hot.scatter_(1, labels.type(torch.long).data, 1)  
fuy34 commented 4 years ago

Hi,

Thank you for your interest in our work. I am not sure why there is a bug.

Did you observe anything wrong when you were running our code?

fuy34 commented 3 years ago

close because of inactivity