yolo-tf icon indicating copy to clipboard operation
yolo-tf copied to clipboard

Yolov2 training and loss function

Open simo23 opened this issue 6 years ago • 0 comments

Hi everyone! First of all thanks @ruiminshen for the amazing work.

I've been studying your code for a while now and I could not get the training work when using the yolov2 tiny model. In particular I wanted to ask you about the yolov2 loss function. When you are extracting the values just computed by the forward pass here:

inputs = tf.reshape(net, [-1, cells, len(anchors), 5 + classes], name='inputs')
inputs_sigmoid = tf.nn.sigmoid(inputs[:, :, :, :3], name=name)
self.iou = tf.identity(inputs_sigmoid[:, :, :, 0], name='iou')
self.offset_xy = tf.identity(inputs_sigmoid[:, :, :, 1:3], name='offset_xy')
self.wh = tf.identity(tf.exp(inputs[:, :, :, 3:5]) * np.reshape(anchors, [1, 1, len(anchors), -1]), name=name)
self.prob = tf.identity(tf.nn.softmax(inputs[:, :, :, 5:]), `name=name)

Are you sure about the values that you are picking with inputs[:,:,:,values]?

I've implemented a model that can perform the forward pass of the tiny-yolov2 and I can say that in inputs you will have:

inputs[:,:,:,:5] = t_x , t_y , t_w, t_h , t_objectness
inputs[:,:,:,5:] = scores of the 20 classes

In your code you seem to take values from different positions, like the first value inputs[:,:,:,0] for 'iou' and also the others don't seem to match what the network is predicting.

Can you please explain your choices? Thank you very much. By the way, have you been able to train the model? @TaihuLight can you explain how you trained the model please?

simo23 avatar Aug 31 '17 16:08 simo23