karta0807913 / caffe-yolo-9000

caffe-yolo-9000
Other
48 stars 16 forks source link

get_region_box doesn't appear to be using sigmoid #13

Open zhengstake opened 6 years ago

zhengstake commented 6 years ago

The get_region_box function in yolo_v2_loss_layer.cpp doesn't appear to be using sigmoid to compute box.x and box.y. I wonder why? The logistic_activate() function is defined by never called.

    //why aren't we use sigmoid for box.x and box.y?
    box.x = (i + x[0 * SIZE]) / side;
    box.y = (j + x[1 * SIZE]) / side;
    box.w = exp(x[2 * SIZE]) * biases[2 * n];
    box.h = exp(x[3 * SIZE]) * biases[2 * n + 1];

I checked the ground truth label conversion steps. The ground truth values seem to be used just as normalized x, y values relative to image size. There doesn't appear to be any conversion in box_data_layer.cpp either. So how can we use the prediction value without applying sigmoid, in the mix with a linear ground truth to compute the diff?

Is it because the way the diff gradient formula is written in delta_region_box()?

karta0807913 commented 6 years ago

that because the sigmoid function on my data will make loss to nan so i differentiate the loss function

origin function 1

my loss function 2