Skip to content

Yolo loss binary_crossentropy version #396

@ZXTFINAL

Description

@ZXTFINAL

change

TODO: use binary_crossentropy instead

class_loss = obj_mask * sparse_categorical_crossentropy(
true_class_idx, pred_class)

to

true_class_onehot = tf.one_hot(tf.cast(true_class_idx, tf.int64), depth=classes, axis=-1)
true_class_binary = tf.reshape(true_class_onehot, (tf.shape(y_true)[0], grid_size,grid_size,tf.shape(y_true)[3],-1, 1))
pred_class_binary = tf.reshape(pred_class, (tf.shape(y_true)[0], grid_size,grid_size,tf.shape(y_true)[3],-1, 1))
class_loss = obj_mask * tf.reduce_sum(binary_crossentropy(true_class_binary, pred_class_binary), axis=-1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions