Skip to content
This repository has been archived by the owner on Dec 1, 2021. It is now read-only.

Data shape error when executing usb_camera_demo.py #263

Closed
nabedev opened this issue May 9, 2019 · 0 comments · Fixed by #265
Closed

Data shape error when executing usb_camera_demo.py #263

nabedev opened this issue May 9, 2019 · 0 comments · Fixed by #265

Comments

@nabedev
Copy link
Contributor

nabedev commented May 9, 2019

I tried to run usb_camera_demo.py in Jetson TX2 with python3 it raises following data shape error.

ubuntu@ubuntu:~/gpu/python$ python3 usb_camera_demo.py -c ../models/meta.yaml -m ../models/minimal_graph_with_shape.pb
2019-05-08 19:00:36.089683: W tensorflow/core/platform/profile_utils/cpu_utils.cc:98] Failed to find bogomips in /proc/cpuinfo; cannot determine CPU frequency
2019-05-08 19:00:36.090686: I tensorflow/compiler/xla/service/service.cc:161] XLA service 0x439b2de0 executing computations on platform Host. Devices:
2019-05-08 19:00:36.090814: I tensorflow/compiler/xla/service/service.cc:168]   StreamExecutor device (0): <undefined>, <undefined>
2019-05-08 19:00:36.161812: I tensorflow/stream_executor/cuda/cuda_gpu_executor.cc:965] ARM64 does not support NUMA - returning NUMA node zero
2019-05-08 19:00:36.162111: I tensorflow/compiler/xla/service/service.cc:161] XLA service 0x3eca5f60 executing computations on platform CUDA. Devices:
2019-05-08 19:00:36.162165: I tensorflow/compiler/xla/service/service.cc:168]   StreamExecutor device (0): NVIDIA Tegra X2, Compute Capability 6.2
2019-05-08 19:00:36.162452: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties: 
name: NVIDIA Tegra X2 major: 6 minor: 2 memoryClockRate(GHz): 1.02
pciBusID: 0000:00:00.0
totalMemory: 7.68GiB freeMemory: 3.12GiB
2019-05-08 19:00:36.162502: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2019-05-08 19:00:37.254041: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-05-08 19:00:37.254265: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0 
2019-05-08 19:00:37.254410: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N 
2019-05-08 19:00:37.255722: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2693 MB memory) -> physical GPU (device: 0, name: NVIDIA Tegra X2, pci bus id: 0000:00:00.0, compute capability: 6.2)
Gtk-Message: 19:00:37.490: Failed to load module "canberra-gtk-module"
multiprocessing.pool.RemoteTraceback: 
"""
Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/pool.py", line 119, in worker
    result = (True, func(*args, **kwds))
  File "usb_camera_demo.py", line 93, in _run_inference
    result, fps, _ = run_inference(img, nn, pre_process, post_process)
  File "/home/ubuntu/gpu/python/lmnet/utils/demo.py", line 154, in run_inference
    result = nn.run(data)
  File "/home/ubuntu/gpu/python/lmnet/tensorflow_graph_runner.py", line 62, in run
    return self.sess.run(self.output_op, feed_dict={self.images_placeholder: data})
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 929, in run
    run_metadata_ptr)
  File "/home/ubuntu/.local/lib/python3.6/site-packages/tensorflow/python/client/session.py", line 1128, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (160, 160, 3) for Tensor 'images_placeholder:0', which has shape '(1, 160, 160, 3)'
"""

@ruimashita told me should add the following line in demo.py.

data = np.expand_dims(data, axis=0)

But I'm not sure where it is correct to add this line.

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

Successfully merging a pull request may close this issue.

1 participant