jhb86253817 / PIPNet

Efficient facial landmark detector
MIT License
412 stars 82 forks source link

train_gssl wrong #27

Closed ly0303521 closed 2 years ago

ly0303521 commented 2 years ago

File "/home/inspur/Projects/PIPNet/lib/functions_gssl.py", line 85, in compute_loss_pip │ outputs_local_x_select = torch.gather(outputs_local_x, 1, labels_max_ids) │ RuntimeError: index 18 is out of bounds for dimension 1 with size 16 when I use train_gssl.py, the problem comes. Below is my config `# with curriculum

class Config(): def init(self): self.det_head = 'pip' self.net_stride = 32 self.batch_size = 16 self.init_lr = 0.0001 self.num_epochs = 60 self.decay_steps = [30, 50] self.input_size = 256 self.backbone = 'resnet18' self.pretrained = True self.criterion_cls = 'l2' self.criterion_reg = 'l1' self.cls_loss_weight = 10 self.reg_loss_weight = 1 self.num_lms = 68 self.save_interval = self.num_epochs self.num_nb = 10 self.use_gpu = False self.gpu_id = 1 self.curriculum = True`

jhb86253817 commented 2 years ago

could you do "print(outputs_local_x.size())" right before "outputs_local_x = outputs_local_x.view(tmp_batch*tmp_channel, -1)"? The printed size of outputs_local_x should be 16x68x8x8.

ly0303521 commented 2 years ago

could you do "print(outputs_local_x.size())" right before "outputs_local_x = outputs_local_x.view(tmp_batch*tmp_channel, -1)"? The printed size of outputs_local_x should be 16x68x8x8.

I got the size like this, but I didnt change the code outputs_local_x.size(): torch.Size([16, 68, 4, 4])

ly0303521 commented 2 years ago

could you do "print(outputs_local_x.size())" right before "outputs_local_x = outputs_local_x.view(tmp_batch*tmp_channel, -1)"? The printed size of outputs_local_x should be 16x68x8x8.

I found the reason, the input image is wrong, input shape size inputs.shape: torch.Size([16, 3, 128, 128]), thank you very much

jhb86253817 commented 2 years ago

Good to know. No problem.