Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ambiguous dimension while trying to load weights. #383

Open
federicoAntosiano opened this issue Jul 6, 2021 · 0 comments
Open

Ambiguous dimension while trying to load weights. #383

federicoAntosiano opened this issue Jul 6, 2021 · 0 comments

Comments

@federicoAntosiano
Copy link

federicoAntosiano commented Jul 6, 2021

Hi everyone,
I'm trying to load the SSD300 for inferencing but I'm facing this ValueError:


ValueError Traceback (most recent call last)
in
25 iou_threshold=0.45,
26 top_k=200,
---> 27 nms_max_output_size=400)
28
29 # 2: Load the trained weights into the model.

~/.../keras_ssd300.py in ssd_300(image_size, n_classes, mode, l2_regularization, min_scale, max_scale, scales, aspect_ratios_global, aspect_ratios_per_layer, two_boxes_for_ar1, steps, offsets, clip_boxes, variances, coords, normalize_coords, subtract_mean, divide_by_stddev, swap_channels, confidence_thresh, iou_threshold, top_k, nms_max_output_size, return_predictor_sizes)
340 conv4_3_norm_mbox_priorbox = AnchorBoxes(img_height, img_width, this_scale=scales[0], next_scale=scales[1], aspect_ratios=aspect_ratios[0],
341 two_boxes_for_ar1=two_boxes_for_ar1, this_steps=steps[0], this_offsets=offsets[0], clip_boxes=clip_boxes,
--> 342 variances=variances, coords=coords, normalize_coords=normalize_coords, name='conv4_3_norm_mbox_priorbox')(conv4_3_norm_mbox_loc)
343 fc7_mbox_priorbox = AnchorBoxes(img_height, img_width, this_scale=scales[1], next_scale=scales[2], aspect_ratios=aspect_ratios[1],
344 two_boxes_for_ar1=two_boxes_for_ar1, this_steps=steps[1], this_offsets=offsets[1], clip_boxes=clip_boxes,

/opt/DL/tensorflow/lib/python3.6/site-packages/tensorflow/python/keras/engine/base_layer.py in call(self, inputs, *args, **kwargs)
755 if not in_deferred_mode:
756 self._in_call = True
--> 757 outputs = self.call(inputs, *args, **kwargs)
758 self._in_call = False
759 if outputs is None:

~/I.../keras_object_detection/ssd_keras/keras_layers/keras_layer_AnchorBoxes.py in call(self, x, mask)
203 offset_width = self.this_offsets
204 # Now that we have the offsets and step sizes, compute the grid of anchor box center points.
--> 205 cy = np.linspace(offset_height * step_height, (offset_height + feature_map_height - 1) * step_height, feature_map_height)
206 cx = np.linspace(offset_width * step_width, (offset_width + feature_map_width - 1) * step_width, feature_map_width)
207 cx_grid, cy_grid = np.meshgrid(cx, cy)

/opt/DL/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py in radd(self, other)
180 A Dimension whose value is the sum of self and other.
181 """
--> 182 return self + other
183
184 def sub(self, other):

/opt/DL/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py in add(self, other)
165 A Dimension whose value is the sum of self and other.
166 """
--> 167 other = as_dimension(other)
168 if self._value is None or other.value is None:
169 return Dimension(None)

/opt/DL/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py in as_dimension(value)
480 return value
481 else:
--> 482 return Dimension(value)
483
484

/opt/DL/tensorflow/lib/python3.6/site-packages/tensorflow/python/framework/tensor_shape.py in init(self, value)
38 if (not isinstance(value, compat.bytes_or_text_types) and
39 self._value != value):
---> 40 raise ValueError("Ambiguous dimension: %s" % value)
41 if self._value < 0:
42 raise ValueError("Dimension %d must be >= 0" % self._value)

ValueError: Ambiguous dimension: 0.5

Do you know why this error appears? How can I fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant