Skip to content

YoloV3_V4_tiny_training.ipynb - convert_weights_pb.py error: Cannot convert a symbolic Tensor (detector/yolo-v4-tiny/meshgrid/Size_1:0) to a numpy array.  #22

@itsderek23

Description

@itsderek23

The following cell:

!python3 convert_weights_pb.py \
--yolo $yolo_version \
--weights_file $weights_best \
--class_names /content/obj.names \
--output $output_name_pb \
--tiny \
-h 320 \
-w 512

Fails w/the output below:

!python3 convert_weights_pb.py \
--yolo $yolo_version \
--weights_file $weights_best \
--class_names /content/obj.names \
--output $output_name_pb \
--tiny \
-h 320 \
-w 512
WARNING:tensorflow:
The TensorFlow contrib module will not be included in TensorFlow 2.0.
For more information, please see:
  * https://github.com/tensorflow/community/blob/master/rfcs/20180907-contrib-sunset.md
  * https://github.com/tensorflow/addons
  * https://github.com/tensorflow/io (for I/O related ops)
If you depend on functionality not listed there, please file an issue.

WARNING:tensorflow:From convert_weights_pb.py:94: The name tf.app.run is deprecated. Please use tf.compat.v1.app.run instead.

None
WARNING:tensorflow:From convert_weights_pb.py:68: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

W0323 14:01:30.138594 140253906458496 module_wrapper.py:139] From convert_weights_pb.py:68: The name tf.placeholder is deprecated. Please use tf.compat.v1.placeholder instead.

WARNING:tensorflow:From convert_weights_pb.py:76: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

W0323 14:01:30.147910 140253906458496 module_wrapper.py:139] From convert_weights_pb.py:76: The name tf.variable_scope is deprecated. Please use tf.compat.v1.variable_scope instead.

WARNING:tensorflow:From /tensorflow-1.15.2/python3.7/tensorflow_core/contrib/layers/python/layers/layers.py:1057: Layer.apply (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `layer.__call__` method instead.
W0323 14:01:30.156273 140253906458496 deprecation.py:323] From /tensorflow-1.15.2/python3.7/tensorflow_core/contrib/layers/python/layers/layers.py:1057: Layer.apply (from tensorflow.python.keras.engine.base_layer) is deprecated and will be removed in a future version.
Instructions for updating:
Please use `layer.__call__` method instead.
Traceback (most recent call last):
  File "convert_weights_pb.py", line 94, in <module>
    tf.app.run()
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/platform/app.py", line 40, in run
    _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 312, in run
    _run_main(main, args)
  File "/usr/local/lib/python3.7/dist-packages/absl/app.py", line 258, in _run_main
    sys.exit(main(argv))
  File "convert_weights_pb.py", line 77, in main
    detections = model(inputs, len(classes), anchors, data_format=FLAGS.data_format)
  File "/content/yolo2openvino/models/yolo_v4_tiny.py", line 87, in yolo_v4_tiny
    net, num_classes, anchors[3:6], img_size, data_format)
  File "/content/yolo2openvino/models/common.py", line 79, in _detection_layer
    a, b = tf.meshgrid(grid_x, grid_y)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/array_ops.py", line 2943, in meshgrid
    mult_fact = ones(shapes, output_dtype)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/array_ops.py", line 2560, in ones
    output = _constant_if_small(one, shape, dtype, name)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/ops/array_ops.py", line 2295, in _constant_if_small
    if np.prod(shape) < 1000:
  File "<__array_function__ internals>", line 6, in prod
  File "/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py", line 3052, in prod
    keepdims=keepdims, initial=initial, where=where)
  File "/usr/local/lib/python3.7/dist-packages/numpy/core/fromnumeric.py", line 86, in _wrapreduction
    return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
  File "/tensorflow-1.15.2/python3.7/tensorflow_core/python/framework/ops.py", line 736, in __array__
    " array.".format(self.name))
NotImplementedError: Cannot convert a symbolic Tensor (detector/yolo-v4-tiny/meshgrid/Size_1:0) to a numpy array.

I'm running on Google Colab. Here is a gist of the notebook output.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions