-
Notifications
You must be signed in to change notification settings - Fork 204
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
Testing Trained Weights #17
Comments
Getting the same error. After some research, it might be because the weights were trained using an older version of Keras or TensorFlow. Currently trying to generate new weights to try to solve this. Any help is greatly appreciated. |
What version are you using?
|
I actually was able to get it working when I manually installed Python 3.5, Keras 2.0.8, and Tensorflow 1.3.0. |
I tried "Python 3.5, Keras 2.0.8, and Tensorflow 1.3.0" setting, but failed, yielding "tensorflow has no attribute math". |
Firstly, I think you should use --class_map=./taco_config/map_10.csv instead of map_3.csv Anyway, just as you did, I downloaded the taco_10_3.zip, placed the split data and .h5 in the mentioned directories. During handling of the above exception, another exception occurred: Traceback (most recent call last): Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/install_sources#common_installation_problems for some common reasons and solutions. Include the entire stack trace I'm really stacked here, anyone could help please? |
use 'tf.divide' instead of 'tf.math.divide' |
Worked for me. |
I am getting the same error not able to make it work. Can you please help me with this error and what changes you made? |
Just download these versions: |
The following environment works for me:
And manually patch keras encoding/decoding issue: --- /home/user/anaconda3/envs/taco37/lib/python3.7/site-packages/keras/engine/topology.py 2022-09-20 13:33:37 +0000
+++ /home/user/anaconda3/envs/taco37/lib/python3.7/site-packages/keras/engine/topology.py 2022-09-20 13:33:37 +0000
@@ -3111,11 +3111,11 @@
and weights file.
"""
if 'keras_version' in f.attrs:
- original_keras_version = f.attrs['keras_version']#.decode('utf8')
+ original_keras_version = f.attrs['keras_version'].decode('utf8')
else:
original_keras_version = '1'
if 'backend' in f.attrs:
- original_backend = f.attrs['backend']#.decode('utf8')
+ original_backend = f.attrs['backend'].decode('utf8')
else:
original_backend = None Patch the detector so it won't use checkpoints: index f96510e..7bcfadc 100644
--- a/detector/detector.py
+++ b/detector/detector.py
@@ -286,7 +286,10 @@ if __name__ == '__main__':
# Start from ImageNet trained weights
model_path = model.get_imagenet_weights()
else:
- _, model_path = model.get_last_checkpoint(args.model)
+ #_, model_path = model.get_last_checkpoint(args.model)
+ model_path = str(__import__("pathlib").Path(args.model).absolute())
+
+ Finally, set environment variable so protobuf can work with pure Python implementation: export PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python |
Does anyone have a fork that works on modern-ish versions? |
Currently trying to test the trained weights that were already provided, but getting an error.
I downloaded the taco_10_3.zip, placed the split data and .h5 in the mentioned directories.
Then ran this command:
python3 detector.py test --dataset=../data --model=./models/logs/mask_rcnn_taco_0100.h5 --round 3 --class_map=./taco_config/map_3.csv
This is the error:
Traceback (most recent call last): File "detector.py", line 283, in <module> model.load_weights(model_path, by_name=True) File "/Users/ellioteckholm/Documents/AI/Pre_trained_TACO/detector/model.py", line 2088, in load_weights topology.load_weights_from_hdf5_group_by_name(f, layers) File "/usr/local/lib/python3.7/site-packages/keras/engine/topology.py", line 3479, in load_weights_from_hdf5_group_by_name K.batch_set_value(weight_value_tuples) File "/usr/local/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 2372, in batch_set_value assign_op = x.assign(assign_placeholder) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/variables.py", line 2067, in assign self._variable, value, use_locking=use_locking, name=name) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/state_ops.py", line 227, in assign validate_shape=validate_shape) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/ops/gen_state_ops.py", line 66, in assign use_locking=use_locking, name=name) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/op_def_library.py", line 794, in _apply_op_helper op_def=op_def) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py", line 507, in new_func return func(*args, **kwargs) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3357, in create_op attrs, op_def, compute_device) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 3426, in _create_op_internal op_def=op_def) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1770, in __init__ control_input_ops) File "/usr/local/lib/python3.7/site-packages/tensorflow_core/python/framework/ops.py", line 1610, in _create_c_op raise ValueError(str(e)) ValueError: Dimension 1 in both shapes must be equal, but are 16 and 44. Shapes are [1024,16] and [1024,44]. for 'Assign_376' (op: 'Assign') with input shapes: [1024,16], [1024,44].
The text was updated successfully, but these errors were encountered: