From 0453b758e7ff645528ae52aa85228f3672ff7594 Mon Sep 17 00:00:00 2001 From: Nrupatunga Date: Tue, 16 Nov 2021 17:06:00 +0530 Subject: [PATCH] TFDetect dynamic anchor count assignment fix (#5668) * fix tf.py when anchors not equal to 3 * revert the isort fix * update the fix to use anchor attribute available already --- models/tf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/tf.py b/models/tf.py index 6de0245..96482dd 100644 --- a/models/tf.py +++ b/models/tf.py @@ -233,7 +233,7 @@ class TFDetect(keras.layers.Layer): xy /= tf.constant([[self.imgsz[1], self.imgsz[0]]], dtype=tf.float32) wh /= tf.constant([[self.imgsz[1], self.imgsz[0]]], dtype=tf.float32) y = tf.concat([xy, wh, y[..., 4:]], -1) - z.append(tf.reshape(y, [-1, 3 * ny * nx, self.no])) + z.append(tf.reshape(y, [-1, self.na * ny * nx, self.no])) return x if self.training else (tf.concat(z, 1), x)