rodrigo2019 / keras_yolo2

MIT License
46 stars 15 forks source link

predict problem tf not defined ?? #4

Closed dr-askar closed 5 years ago

dr-askar commented 5 years ago

i have this problem when i try to predict using h5 file

_______________________________________________________________ Traceback (most recent call last): File "predict.py", line 146, in <module> _main_(_args) File "predict.py", line 75, in _main_ yolo.load_weights(weights_path) File "/content/keras_yolo2/keras_yolov2/frontend.py", line 83, in load_weights self._model = load_model(weight_path, custom_objects={"yolo_loss": keras.losses.mse}) File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 419, in load_model model = _deserialize_model(f, custom_objects, compile) File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 225, in _deserialize_model model = model_from_config(model_config, custom_objects=custom_objects) File "/usr/local/lib/python3.6/dist-packages/keras/engine/saving.py", line 458, in model_from_config return deserialize(config, custom_objects=custom_objects) File "/usr/local/lib/python3.6/dist-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/usr/local/lib/python3.6/dist-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object list(custom_objects.items()))) File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 1022, in from_config process_layer(layer_data) File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 1008, in process_layer custom_objects=custom_objects) File "/usr/local/lib/python3.6/dist-packages/keras/layers/__init__.py", line 55, in deserialize printable_module_name='layer') File "/usr/local/lib/python3.6/dist-packages/keras/utils/generic_utils.py", line 145, in deserialize_keras_object list(custom_objects.items()))) File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 1032, in from_config process_node(layer, node_data) File "/usr/local/lib/python3.6/dist-packages/keras/engine/network.py", line 991, in process_node layer(unpack_singleton(input_tensors), **kwargs) File "/usr/local/lib/python3.6/dist-packages/keras/engine/base_layer.py", line 457, in __call__ output = self.call(inputs, **kwargs) File "/usr/local/lib/python3.6/dist-packages/keras/layers/core.py", line 687, in call return self.function(inputs, **arguments) File "/content/keras_yolo2/keras_yolov2/backend.py", line 46, in space_to_depth_x2 import tensorflow as tf NameError: name 'tf' is not defined

rodrigo2019 commented 5 years ago

The problem was fixed, please update your fork

dr-askar commented 5 years ago

thanx very much i have already fix it any advice to improve learning score with out overfitting and early stoping

rodrigo2019 commented 5 years ago

usually a custom backend for simple problems has better precision, also I don't like to use early stop, some times its stops too early