Fix priors boxes generation in case of non square inputs for TensorFlow SSDs
authorDmitry Kurtaev <dmitry.kurtaev+github@gmail.com>
Mon, 25 Feb 2019 09:43:42 +0000 (12:43 +0300)
committerDmitry Kurtaev <dmitry.kurtaev+github@gmail.com>
Mon, 25 Feb 2019 09:43:42 +0000 (12:43 +0300)
samples/dnn/tf_text_graph_ssd.py

index 1576380..35207ca 100644 (file)
@@ -35,8 +35,9 @@ class SSDAnchorGenerator:
 
             widths += [sqrt(self.scales[layer_id] * self.scales[layer_id + 1])]
             heights += [sqrt(self.scales[layer_id] * self.scales[layer_id + 1])]
-        widths = [w * self.image_width for w in widths]
-        heights = [h * self.image_height for h in heights]
+        min_size = min(self.image_width, self.image_height)
+        widths = [w * min_size for w in widths]
+        heights = [h * min_size for h in heights]
         return widths, heights