训练一个github的yolo3-TF2时在
model.compile(optimizer=Adam(lr=lr), loss={'yolo_loss': lambda y_true, y_pred: y_pred})
报错:
ValueError: slice index -1 of dimension 0 out of bounds. for ‘loss/yolo_loss_loss/strided_slice’ (op: ‘StridedSlice’) with input shapes: [0], [1], [1], [1] and with computed input tensors: input[1] = <-1>, input[2] = <0>, input[3] = <1>.
排查很久,而且这个报错很不好debug,全网的解决办法都不起作用。
最后发现作者用的tf2.2.0版本,而我用的是2.1.0,便怀疑是tf版本问题。
由于conda未提供tf2.2.0,索性直接安装tf2.3.0,问题得到了解决,希望能帮到以后遇到该问题的童鞋。