What does tf.pad do?
dhwgithub opened this issue · 3 comments
dhwgithub commented
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
KacperPaszkowski commented
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.
dhwgithub commented
Where is yolo_max_boxes
defined or initialized? thanks
KacperPaszkowski commented
It can be passed as a flag. https://github.com/zzh8829/yolov3-tf2#maximum-number-of-boxes