mystic123 / tensorflow-yolo-v3

Implementation of YOLO v3 object detector in Tensorflow (TF-Slim)
https://medium.com/@pawekapica_31302/implementing-yolo-v3-in-tensorflow-tf-slim-c3c55ff59dbe
Apache License 2.0
890 stars 353 forks source link

error python3 demo.py --input_img 20.jpg --output_img output.jpg #86

Open alontrais opened 5 years ago

alontrais commented 5 years ago

When I write this command python3 demo.py --input_img 20.jpg --output_img output.jpg I get this error

Traceback (most recent call last): File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1356, in _do_call return fn(*args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1341, in _run_fn options, feed_dict, fetch_list, target_list, run_metadata) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1429, in _call_tf_sessionrun run_metadata) tensorflow.python.framework.errors_impl.UnimplementedError: Generic conv implementation only supports NHWC tensor format for now. [[{{node detector/darknet-53/Conv/Conv2D}}]]

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "demo.py", line 101, in tf.app.run() File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299, in run _run_main(main, args) File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250, in _run_main sys.exit(main(argv)) File "demo.py", line 88, in main boxes, feed_dict={inputs: [img_resized]}) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 950, in run run_metadata_ptr) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1173, in _run feed_dict_tensor, options, run_metadata) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1350, in _do_run run_metadata) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/client/session.py", line 1370, in _do_call raise type(e)(node_def, op, message) tensorflow.python.framework.errors_impl.UnimplementedError: Generic conv implementation only supports NHWC tensor format for now. [[node detector/darknet-53/Conv/Conv2D (defined at /tmp/tmpaj9rhkx4.py:12) ]]

Errors may have originated from an input operation. Input Source operations connected to node detector/darknet-53/Conv/Conv2D: detector/darknet-53/Conv/weights/read (defined at /home/cvat/Downloads/tensorflow-yolo-v3/yolo_v3.py:53)
detector/truediv (defined at /home/cvat/Downloads/tensorflow-yolo-v3/yolo_v3.py:210)

Original stack trace for 'detector/darknet-53/Conv/Conv2D': File "demo.py", line 101, in tf.app.run() File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/platform/app.py", line 40, in run _run(main=main, argv=argv, flags_parser=_parse_flags_tolerate_undef) File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 299, in run _run_main(main, args) File "/usr/local/lib/python3.6/dist-packages/absl/app.py", line 250, in _run_main sys.exit(main(argv)) File "demo.py", line 77, in main boxes, inputs = get_boxes_and_inputs(model, len(classes), FLAGS.size, FLAGS.data_format) File "/home/cvat/Downloads/tensorflow-yolo-v3/utils.py", line 23, in get_boxes_and_inputs data_format=data_format) File "/home/cvat/Downloads/tensorflow-yolo-v3/yolo_v3.py", line 228, in yolo_v3 route_1, route_2, inputs = darknet53(inputs) File "/home/cvat/Downloads/tensorflow-yolo-v3/yolo_v3.py", line 21, in darknet53 inputs = _conv2d_fixed_padding(inputs, 32, 3) File "/home/cvat/Downloads/tensorflow-yolo-v3/yolo_v3.py", line 53, in _conv2d_fixed_padding padding=('SAME' if strides == 1 else 'VALID')) File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 182, in func_with_args return func(*args, current_args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1159, in convolution2d conv_dims=2) File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/framework/python/ops/arg_scope.py", line 182, in func_with_args return func(*args, *current_args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/contrib/layers/python/layers/layers.py", line 1057, in convolution outputs = layer.apply(inputs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 1479, in apply return self.call(inputs, args, kwargs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/layers/base.py", line 537, in call outputs = super(Layer, self).call(inputs, *args, kwargs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/keras/engine/base_layer.py", line 634, in call outputs = call_fn(inputs, *args, *kwargs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py", line 146, in wrapper ), args, kwargs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py", line 450, in converted_call result = converted_f(effective_args, kwargs) File "/tmp/tmpaj9rhkx4.py", line 12, in tfcall outputs = ag.converted_call('_convolution_op', self, ag.ConversionOptions(recursive=True, force_conversion=False, optional_features=(), internal_convert_user_code=True), (inputs, self.kernel), None) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py", line 356, in converted_call return _call_unconverted(f, args, kwargs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/autograph/impl/api.py", line 255, in _call_unconverted return f(*args) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/nn_ops.py", line 1079, in call return self.conv_op(inp, filter) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/nn_ops.py", line 635, in call return self.call(inp, filter) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/nn_ops.py", line 234, in call name=self.name) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/nn_ops.py", line 1953, in conv2d name=name) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/ops/gen_nn_ops.py", line 1071, in conv2d data_format=data_format, dilations=dilations, name=name) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/op_def_library.py", line 788, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 3616, in create_op op_def=op_def) File "/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py", line 2005, in init__ self._traceback = tf_stack.extract_stack()

tiexuedanxin commented 5 years ago

Do you solve your problem, i come across the same problem.

yurui777 commented 4 years ago

U maybe use "NCWH" in convert_weights_pb.py, change it may work.

PranshuTople commented 4 years ago

U maybe use "NCWH" in convert_weights_pb.py, change it may work.

I am not getting what exactly to change. could you please help me with it. I am facing same problem

ZUB41R commented 4 years ago

@alontrais.. might consider to change the gpu_memory_fraction from 1.0 to lesser value e.g. 0.6.