allanzelener / YAD2K

YAD2K: Yet Another Darknet 2 Keras
Other
2.71k stars 877 forks source link

yolo_loss function #108

Open voqtuyen opened 6 years ago

voqtuyen commented 6 years ago

What is num_true_boxes? is this the same as num_anchors? And i see that it is not actually used in the code at all

def yolo_loss(args,
              anchors,
              num_classes,
              rescore_confidence=False,
              print_loss=False):
    """YOLO localization loss function.
    Parameters
    ----------
    yolo_output : tensor
        Final convolutional layer features.
    true_boxes : tensor
        Ground truth boxes tensor with shape [batch, num_true_boxes, 5]
        containing box x_center, y_center, width, height, and class.
    detectors_mask : array
        0/1 mask for detector positions where there is a matching ground truth.
    matching_true_boxes : array
        Corresponding ground truth boxes for positive detector positions.
        Already adjusted for conv height and width.
    anchors : tensor
        Anchor boxes for model.
    num_classes : int
        Number of object classes.
    rescore_confidence : bool, default=False
        If true then set confidence target to IOU of best predicted box with
        the closest matching ground truth box.
    print_loss : bool, default=False
        If True then use a tf.Print() to print the loss components.
    Returns
    -------
    mean_loss : float
        mean localization loss across minibatch
    """
tianyu-tristan commented 6 years ago

@voqtuyen I think it is the same as max_output_size found in https://www.tensorflow.org/api_docs/python/tf/image/non_max_suppression