训练一个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,问题得到了解决,希望能帮到以后遇到该问题的童鞋。
本文讲述了作者在训练GitHub上的yolo3-TF2模型时遇到的报错,经过排查发现是TensorFlow版本问题,从2.1.0升级到2.3.0解决了错误。这对于使用不同版本TF遇到类似问题的开发者可能有帮助。
6620

被折叠的 条评论
为什么被折叠?



