This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras import backend as K | |
def custom_loss(args, anchors, num_classes, ignore_thresh=.5, print_loss=False): | |
num_layers = len(anchors)//3 # default setting | |
yolo_outputs = args[:num_layers] | |
y_true = args[num_layers:] | |
anchor_mask = [[6,7,8], [3,4,5], [0,1,2]] if num_layers==3 else [[3,4,5], [1,2,3]] | |
input_shape = K.cast(K.shape(yolo_outputs[0])[1:3] * 32, K.dtype(y_true[0])) |