alpr-unconstrained icon indicating copy to clipboard operation
alpr-unconstrained copied to clipboard

upgrade pytohn2 to python3 and TF working with GPU

Open SothanaV opened this issue 5 years ago • 2 comments

  • 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

SothanaV avatar Jul 12 '19 07:07 SothanaV

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 avatar Aug 11 '20 10:08 Harsha-1729

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

Harsha-1729 avatar Aug 11 '20 10:08 Harsha-1729