experiencor / keras-yolo3

Training and Detecting Objects with YOLO3
MIT License
1.6k stars 861 forks source link

true_boxes = Input(shape=(1, 1, 1, max_box_per_image, 4)) #166

Open YunYang1994 opened 5 years ago

YunYang1994 commented 5 years ago

hi , thanks for your wonderful contribution ! I am a littiled confused by " true_boxes = Input(shape=(1, 1, 1, max_box_per_image, 4)) "

So what's is the meaning of this ? looking forward to your reply ! thanks in anticipation!

def create_yolov3_model(
    nb_class, 
    anchors, 
    max_box_per_image, 
    max_grid, 
    batch_size, 
    warmup_batches,
    ignore_thresh,
    grid_scales,
    obj_scale,
    noobj_scale,
    xywh_scale,
    class_scale
):
    input_image = Input(shape=(None, None, 3)) # net_h, net_w, 3
    true_boxes  = Input(shape=(1, 1, 1, max_box_per_image, 4))
    true_yolo_1 = Input(shape=(None, None, len(anchors)//6, 4+1+nb_class)) # grid_h, grid_w, nb_anchor, 5+nb_class
    true_yolo_2 = Input(shape=(None, None, len(anchors)//6, 4+1+nb_class)) # grid_h, grid_w, nb_anchor, 5+nb_class
    true_yolo_3 = Input(shape=(None, None, len(anchors)//6, 4+1+nb_class)) # grid_h, grid_w, nb_anchor, 5+nb_class
HoracceFeng commented 5 years ago

Confused too. Based on the code of "qqwwwee/kears-yolo3", I guess it means (batch, width, height, max_num_gtbox, box_params). But I am not sure what variables are included in the "box_params". According to the code in "generator.py", I think the box_params = [center_x, center_y, w, h]. But then the second and the third variable which are set as "1" is strange ...

YunYang1994 commented 5 years ago

Confused too. Based on the code of "qqwwwee/kears-yolo3", I guess it means (batch, width, height, max_num_gtbox, box_params). But I am not sure what variables are included in the "box_params". According to the code in "generator.py", I think the box_params = [center_x, center_y, w, h]. But then the second and the third variable which are set as "1" is strange ...

I have implemented it with tensorflow and got something to share with you. https://github.com/YunYang1994/tensorflow-yolov3

HoracceFeng commented 5 years ago

Hi YunYang, thank you for your code, much clear and it does help me a lot. So what I guess above seems right, but I then have a question, the 2nd and the 3rd one actually is the grid id right? Then why the 5th channel should be absolute (center-x, center-y, w, h) but not use (x-offset, y-offset, w, h) instead?

Also, is it possible that, for example, I got 1313 grid from a 416416 image and then in the grid cell (3,3) I finally got a detection box which far away from grid cell (3,3), like near the grid cell (12, 12)? If so, why should we set a fix grid cell to train the model?

Thank you for your reply.

Sent from my iPhone

On Jan 28, 2019, at 01:17, YangYun notifications@github.com<mailto:notifications@github.com> wrote:

Confused too. Based on the code of "qqwwwee/kears-yolo3", I guess it means (batch, width, height, max_num_gtbox, box_params). But I am not sure what variables are included in the "box_params". According to the code in "generator.py", I think the box_params = [center_x, center_y, w, h]. But then the second and the third variable which are set as "1" is strange ...

I have implemented it with tensorflow and got something to share with you. https://github.com/YunYang1994/tensorflow-yolov3https://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FYunYang1994%2Ftensorflow-yolov3&data=02%7C01%7C%7C694af12f590744dd5fff08d6847b4fa5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636842062476671858&sdata=tAlCg7%2BHaY0Ii%2B8K6cRQ%2B1DroQ65DiFNeGl%2FVLVDYvw%3D&reserved=0

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fexperiencor%2Fkeras-yolo3%2Fissues%2F166%23issuecomment-457936413&data=02%7C01%7C%7C694af12f590744dd5fff08d6847b4fa5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636842062476671858&sdata=w1YW67n2%2B%2Bh44Y%2BwUaoOaNID2C4CtG5Q0QYHAMbHRQ4%3D&reserved=0, or mute the threadhttps://eur03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAT2_6WhnmLiYWWh-tG-M8zs6eXyVL19_ks5vHd8mgaJpZM4ZzIcF&data=02%7C01%7C%7C694af12f590744dd5fff08d6847b4fa5%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C636842062476671858&sdata=EjY3DErmdIbsxzbZ834szkWiIz10AvlGuzU5aalTa5U%3D&reserved=0.