nathanrooy / rpi-urban-mobility-tracker

The easiest way to count pedestrians, cyclists, and vehicles on edge computing devices or live video feeds.
GNU General Public License v3.0
122 stars 37 forks source link

umt won't work #26

Open aweussom opened 3 years ago

aweussom commented 3 years ago

I followed the instructions at https://github.com/nathanrooy/rpi-urban-mobility-tracker

I'm getting this error: (The first three lines as apparently just noise)

root@674b2ef1ec82:~# umt -video highway_01.mp4 WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation. WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation. WARNING:root:Limited tf.compat.v2.summary API due to missing TensorBoard installation. WARNING:root:Limited tf.summary API due to missing TensorBoard installation. Traceback (most recent call last): File "/usr/local/bin/umt", line 5, in from umt.umt_main import main File "/usr/local/lib/python3.7/dist-packages/umt/umt_main.py", line 15, in from umt.umt_utils import parse_label_map File "/usr/local/lib/python3.7/dist-packages/umt/umt_utils.py", line 26, in encoder = gd.create_box_encoder(w_path, batch_size=1) File "/usr/local/lib/python3.7/dist-packages/deep_sort_tools/generate_detections.py", line 123, in create_box_encoder image_encoder = ImageEncoder(model_filename, input_name, output_name) File "/usr/local/lib/python3.7/dist-packages/deep_sort_tools/generate_detections.py", line 97, in init f"net/{input_name}:0") File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py", line 3902, in get_tensor_by_name return self.as_graph_element(name, allow_tensor=True, allow_operation=False) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py", line 3726, in as_graph_element return self._as_graph_element_locked(obj, allow_tensor, allow_operation) File "/usr/local/lib/python3.7/dist-packages/tensorflow/python/framework/ops.py", line 3768, in _as_graph_element_locked "graph." % (repr(name), repr(op_name))) KeyError: "The name 'net/images:0' refers to a Tensor which does not exist. The operation, 'net/images', does not exist in the graph."

Coral USB is working in the host os:

[40332.332886] usb 2-2: New USB device strings: Mfr=0, Product=0, SerialNumber=0

pi@pifem:~/coral/tflite/python/examples/classification $ python3 classify_image.py --model models/mobilenet_v2_1.0_224_inat_bird_quant_edgetpu.tflite --labels models/inat_bird_labels.txt --input images/parrot.jpg ----INFERENCE TIME---- Note: The first inference on Edge TPU is slow because it includes loading the model into Edge TPU memory. 17.4ms 4.4ms 4.4ms 4.4ms 4.4ms -------RESULTS-------- Ara macao (Scarlet Macaw): 0.77734

aweussom commented 3 years ago

Exactly the same problem in Ubuntu as in Raspberry PI OS/Docker.

paulbozans commented 3 years ago

I confirm, I have the same problem.

Gazuru commented 2 years ago

First you need to locate where your Python packages were installed, then in "deep_sort_tools/generate_detections.py" you need to change these two lines from :

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"net/{input_name}:0")
self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"net/{output_name}:0")

to this:

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"{input_name}:0")
self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"{output_name}:0")
senker commented 2 years ago

This is referred to the ubuntu installation I would assume, right? By making this change has everything worked correctly afterwards?

First you need to locate where your Python packages were installed, then in "deep_sort_tools/generate_detections.py" you need to change these two lines from :

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"net/{input_name}:0")
self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"net/{output_name}:0")

to this:

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"{input_name}:0")
self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"{output_name}:0")
aweussom commented 2 years ago

This is referred to the ubuntu installation I would assume, right? By making this change has everything worked correctly afterwards?

First you need to locate where your Python packages were installed, then in "deep_sort_tools/generate_detections.py" you need to change these two lines from :

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"net/{input_name}:0")
self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"net/{output_name}:0")

to this:


self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"{input_name}:0")h

This is on Ubuntu also - however - the latest UMT code from GitHub have fixed this.

I have a NEW issue, bit I will create another thread for that :-)

aweussom commented 2 years ago

These two erranous lines are still there in the docker install.

xuniluser commented 1 year ago

This is referred to the ubuntu installation I would assume, right? By making this change has everything worked correctly afterwards?

First you need to locate where your Python packages were installed, then in "deep_sort_tools/generate_detections.py" you need to change these two lines from :

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"net/{input_name}:0")
self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"net/{output_name}:0")

to this:

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"{input_name}:0")
self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name(
     f"{output_name}:0")

This worked for me in RPi OS

paulbozans commented 1 year ago

In my case, yes.

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: xuniluser @.> Sent: Monday, October 9, 2023 7:20:25 PM To: nathanrooy/rpi-urban-mobility-tracker @.> Cc: Paul Bozan @.>; Comment @.> Subject: Re: [nathanrooy/rpi-urban-mobility-tracker] umt won't work (#26)

This is referred to the ubuntu installation I would assume, right? By making this change has everything worked correctly afterwards?

First you need to locate where your Python packages were installed, then in "deep_sort_tools/generate_detections.py" you need to change these two lines from :

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name( f"net/{input_name}:0") self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name( f"net/{output_name}:0")

to this:

self.input_var = tf.compat.v1.get_default_graph().get_tensor_by_name( f"{input_name}:0") self.output_var = tf.compat.v1.get_default_graph().get_tensor_by_name( f"{output_name}:0")

This worked for me in RPi OS

— Reply to this email directly, view it on GitHubhttps://github.com/nathanrooy/rpi-urban-mobility-tracker/issues/26#issuecomment-1753307788, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ASFFA6JPMNGHTXCXD2OARKDX6QP4TAVCNFSM5EKWP6U2U5DIOJSWCZC7NNSXTN2JONZXKZKDN5WW2ZLOOQ5TCNZVGMZTANZXHA4A. You are receiving this because you commented.Message ID: @.***>

jacksonalanhenry commented 3 months ago

the deep_sort repo updated the version number from v1.2.0 to v1.3.0 and added the net for weighting in this commit I'm going to submit a pull request on the Dockerfile so that this problem won't happen for other folks just looking to use the Dockerfile.

For tracking though, you can change this line:

RUN pip3 install git+https://github.com/mk-michal/deep_sort

to

RUN pip3 install git+https://github.com/mk-michal/deep_sort.git@v1.2.0