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

upgrade pytohn2 to python3 and TF working with GPU #85

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

SothanaV
Copy link

  • python2 to python3
  • edit detect Car yolo -> yolo2
  • train LPR cpu with GPU

Future

  • yolo2 to yolo3 because yolo3 fasterthan yolo2
  • maybe blocking to thread,subprocess.queue or async

@Harsha-1729
Copy link

Harsha-1729 commented Aug 11, 2020

Hello Sothana,

Thanks for these commits,

I tried to use these files and getting the following error when I run following command: bash run.sh -i samples/test -o /tmp/output -c /tmp/output/results.csv:

Versions:
Keras - 2.2.4
TF - 2.1.0

Couldn't open file: data/vehicle-detector/coco.data Using TensorFlow backend. 2020-08-11 12:01:48.304925: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory 2020-08-11 12:01:48.305004: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory 2020-08-11 12:01:48.305016: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly. Traceback (most recent call last): File "license-plate-detection.py", line 29, in <module> wpod_net = load_model(wpod_net_path) File "/home/harsha/PycharmProjects/WPODpy3/alpr-unconstrained/src/keras_utils.py", line 35, in load_model model = model_from_json(model_json, custom_objects=custom_objects) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/saving.py", line 492, in model_from_json return deserialize(config, custom_objects=custom_objects) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object list(custom_objects.items()))) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/network.py", line 1022, in from_config process_layer(layer_data) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/network.py", line 1008, in process_layer custom_objects=custom_objects) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/utils/generic_utils.py", line 147, in deserialize_keras_object return cls.from_config(config['config']) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/base_layer.py", line 1109, in from_config return cls(**config) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/input_layer.py", line 87, in __init__ name=self.name) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 520, in placeholder x = tf.placeholder(dtype, shape=shape, name=name) AttributeError: module 'tensorflow' has no attribute 'placeholder'

image

Could you please let me know how to resolve the error.

Thanks in Advance,

Regards
Harsha

@Harsha-1729
Copy link

Hello Sothana,

Thanks for these commits,

I tried to use these files and getting the following error when I run following command: bash run.sh -i samples/test -o /tmp/output -c /tmp/output/results.csv:

Versions:
Keras - 2.2.4
TF - 2.1.0

Couldn't open file: data/vehicle-detector/coco.data Using TensorFlow backend. 2020-08-11 12:01:48.304925: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer.so.6'; dlerror: libnvinfer.so.6: cannot open shared object file: No such file or directory 2020-08-11 12:01:48.305004: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'libnvinfer_plugin.so.6'; dlerror: libnvinfer_plugin.so.6: cannot open shared object file: No such file or directory 2020-08-11 12:01:48.305016: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:30] Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly. Traceback (most recent call last): File "license-plate-detection.py", line 29, in <module> wpod_net = load_model(wpod_net_path) File "/home/harsha/PycharmProjects/WPODpy3/alpr-unconstrained/src/keras_utils.py", line 35, in load_model model = model_from_json(model_json, custom_objects=custom_objects) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/saving.py", line 492, in model_from_json return deserialize(config, custom_objects=custom_objects) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object list(custom_objects.items()))) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/network.py", line 1022, in from_config process_layer(layer_data) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/network.py", line 1008, in process_layer custom_objects=custom_objects) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/utils/generic_utils.py", line 147, in deserialize_keras_object return cls.from_config(config['config']) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/base_layer.py", line 1109, in from_config return cls(**config) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/legacy/interfaces.py", line 91, in wrapper return func(*args, **kwargs) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/engine/input_layer.py", line 87, in __init__ name=self.name) File "/home/harsha/PycharmProjects/WPODpy3/venv/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 520, in placeholder x = tf.placeholder(dtype, shape=shape, name=name) AttributeError: module 'tensorflow' has no attribute 'placeholder'

image

Could you please let me know how to resolve the error.

Thanks in Advance,

Regards
Harsha

Hi,

I tried using the following to over come the issue, Could you please confirm whether this solution is recommended?

import tensorflow.compat.v1 as tf
tf.disable_v2_behavior()

Regards
Harsha

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

Successfully merging this pull request may close these issues.

None yet

4 participants