From 8ff0c513c5f321cbb6f1c9f409207eae358d53e3 Mon Sep 17 00:00:00 2001 From: Hojjat Date: Wed, 12 Dec 2018 15:58:26 -0700 Subject: [PATCH 1/2] Sovled the error: "TypeError: can't multiply sequence by non-int of type 'Tensor'" --- core/yolov3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/yolov3.py b/core/yolov3.py index f4521512d..7fe2412b0 100755 --- a/core/yolov3.py +++ b/core/yolov3.py @@ -98,7 +98,7 @@ def _detection_layer(self, inputs, anchors): def get_boxes_confs_scores(self, feature_map, anchors): num_anchors = len(anchors) # num_anchors=3 - grid_size = tf.shape(feature_map)[1:3] + grid_size = feature_map.get_shape().as_list()[1:3] stride = (self.img_size[0] // grid_size[0], self.img_size[1] // grid_size[1]) anchors = [(a[0] / stride[0], a[1] / stride[1]) for a in anchors] @@ -161,7 +161,7 @@ def forward(self, inputs, is_training=False, reuse=False): :return: """ # it will be needed later on - self.img_size = tf.shape(inputs)[1:3] + self.img_size = inputs.get_shape().as_list()[1:3] # set batch norm params batch_norm_params = { 'decay': self._BATCH_NORM_DECAY, From cf85aa2157c50751d5d514eab1e9f3f8239ad1de Mon Sep 17 00:00:00 2001 From: Hojjat Date: Tue, 18 Dec 2018 12:03:12 -0700 Subject: [PATCH 2/2] Revert "Sovled the error: "TypeError: can't multiply sequence by non-int of type 'Tensor'"" This reverts commit 8ff0c513c5f321cbb6f1c9f409207eae358d53e3. --- core/yolov3.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/yolov3.py b/core/yolov3.py index 7fe2412b0..f4521512d 100755 --- a/core/yolov3.py +++ b/core/yolov3.py @@ -98,7 +98,7 @@ def _detection_layer(self, inputs, anchors): def get_boxes_confs_scores(self, feature_map, anchors): num_anchors = len(anchors) # num_anchors=3 - grid_size = feature_map.get_shape().as_list()[1:3] + grid_size = tf.shape(feature_map)[1:3] stride = (self.img_size[0] // grid_size[0], self.img_size[1] // grid_size[1]) anchors = [(a[0] / stride[0], a[1] / stride[1]) for a in anchors] @@ -161,7 +161,7 @@ def forward(self, inputs, is_training=False, reuse=False): :return: """ # it will be needed later on - self.img_size = inputs.get_shape().as_list()[1:3] + self.img_size = tf.shape(inputs)[1:3] # set batch norm params batch_norm_params = { 'decay': self._BATCH_NORM_DECAY,