yolov3-tf2 icon indicating copy to clipboard operation
yolov3-tf2 copied to clipboard

What does tf.pad do?

Open dhwgithub opened this issue 4 years ago • 3 comments

Source code link: https://github.com/zzh8829/yolov3-tf2/blob/master/yolov3_tf2/dataset.py#L115

    paddings = [[0, FLAGS.yolo_max_boxes - tf.shape(y_train)[0]], [0, 0]]
    y_train = tf.pad(y_train, paddings)

In addition, FLAGS.yolo_max_boxes I did not find the assignment statement

Can someone help me answer these two questions? Thank you

dhwgithub avatar Nov 27 '20 12:11 dhwgithub

Label shape must match network output shape. Network output shape is defined by yolo_max_boxes. So if image have only 2 label and yolo_max_boxes equals 100, you need to add padding with zeros (e.g. 98 "zeros" labels) so shapes matches.

KacperPaszkowski avatar Dec 02 '20 15:12 KacperPaszkowski

Where is yolo_max_boxes defined or initialized? thanks

dhwgithub avatar Dec 03 '20 02:12 dhwgithub

It can be passed as a flag. https://github.com/zzh8829/yolov3-tf2#maximum-number-of-boxes

KacperPaszkowski avatar Dec 03 '20 16:12 KacperPaszkowski