YOLOv2 icon indicating copy to clipboard operation
YOLOv2 copied to clipboard

Question on yolo backward function

Open shuieryin opened this issue 6 years ago • 0 comments

Hi there, sorry about that to post this here, i was trying to write yolo in torch but struggled the backward function for so many days, but the gradients are always exploding slowly, could you kindly shed a light on my codes? Thank you so much.

gradInput[{ {}, {}, 1, {}, {} }] = self.mse:backward(torch.cmul(self.x_buffer, x, coord_mask), tx)
gradInput[{ {}, {}, 2, {}, {} }] = self.mse:backward(torch.cmul(self.y_buffer, y, coord_mask), ty)
gradInput[{ {}, {}, 3, {}, {} }] = self.mse:backward(torch.cmul(self.w_buffer, w, coord_mask), tw)
gradInput[{ {}, {}, 4, {}, {} }] = self.mse:backward(torch.cmul(self.h_buffer, h, coord_mask), th)
gradInput[{ {}, {}, 5, {}, {} }] = self.mse:backward(torch.cmul(self.conf_buffer, conf, coord_mask), tconf)
gradInput[{ {}, {}, { 6, 5 + nC }, {}, {} }][self.cls_mask] = self.ce:backward(torch.cmul(self.cls_buffer, cls), tcls)

shuieryin avatar Apr 07 '18 16:04 shuieryin