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

train -- File "/home/mona/effpose/EfficientPose/custom_load_weights.py", line 69, in load_weights_from_hdf5_group_by_name original_keras_version = f.attrs['keras_version'].decode('utf8') AttributeError: 'str' object has no attribute 'decode' #80

Closed
monajalal opened this issue Feb 21, 2024 · 1 comment

Comments

@monajalal
Copy link

(EfficientPose) mona@ada:~/effpose/EfficientPose$ python train.py --phi 0 --weights weights/Weights/Linemod/object_8/phi_0_linemod_best_ADD.h5 linemod data/Linemod_preprocessed/ --object-id 8
WARNING:tensorflow:From train.py:204: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.

WARNING:tensorflow:From train.py:206: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.

2024-02-21 15:09:11.571815: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA
2024-02-21 15:09:11.580551: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 3096000000 Hz
2024-02-21 15:09:11.582540: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x2138b60 initialized for platform Host (this does not guarantee that XLA will be used). Devices:
2024-02-21 15:09:11.582578: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): Host, Default Version
2024-02-21 15:09:11.584130: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcuda.so.1
2024-02-21 15:09:11.673316: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0x3100790 initialized for platform CUDA (this does not guarantee that XLA will be used). Devices:
2024-02-21 15:09:11.673379: I tensorflow/compiler/xla/service/service.cc:176]   StreamExecutor device (0): NVIDIA RTX 6000 Ada Generation, Compute Capability 8.9
2024-02-21 15:09:11.674181: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: NVIDIA RTX 6000 Ada Generation major: 8 minor: 9 memoryClockRate(GHz): 2.505
pciBusID: 0000:52:00.0
2024-02-21 15:09:11.674710: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2024-02-21 15:09:11.677345: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2024-02-21 15:09:11.678287: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2024-02-21 15:09:11.678511: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2024-02-21 15:09:11.679611: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2024-02-21 15:09:11.680411: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2024-02-21 15:09:11.683054: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2024-02-21 15:09:11.683255: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2024-02-21 15:09:11.683282: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2024-02-21 15:09:11.683432: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2024-02-21 15:09:11.683437: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 
2024-02-21 15:09:11.683440: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N 
2024-02-21 15:09:11.683598: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 27778 MB memory) -> physical GPU (device: 0, name: NVIDIA RTX 6000 Ada Generation, pci bus id: 0000:52:00.0, compute capability: 8.9)
{'dataset_type': 'linemod', 'rotation_representation': 'axis_angle', 'weights': 'weights/Weights/Linemod/object_8/phi_0_linemod_best_ADD.h5', 'freeze_backbone': False, 'no_freeze_bn': False, 'batch_size': 1, 'lr': 0.0001, 'no_color_augmentation': False, 'no_6dof_augmentation': False, 'phi': 0, 'gpu': None, 'epochs': 500, 'steps': 1790, 'snapshot_path': 'checkpoints/21_02_2024_15_09_11', 'tensorboard_dir': 'logs/21_02_2024_15_09_11', 'snapshots': True, 'evaluation': True, 'compute_val_loss': False, 'score_threshold': 0.5, 'validation_image_save_path': None, 'multiprocessing': False, 'workers': 4, 'max_queue_size': 10, 'linemod_path': 'data/Linemod_preprocessed/', 'object_id': 8}

Creating the Generators...
Done!

Building the Model...
input shape is:  (512, 512, 3)
ArgSpec(args=['shape', 'batch_size', 'name', 'dtype', 'sparse', 'tensor', 'ragged'], varargs=None, keywords='kwargs', defaults=(None, None, None, None, False, None, False))
WARNING:tensorflow:From /home/mona/anaconda3/envs/EfficientPose/lib/python3.7/site-packages/tensorflow_core/python/util/deprecation.py:507: calling VarianceScaling.__init__ (from tensorflow.python.ops.init_ops) with distribution=normal is deprecated and will be removed in a future version.
Instructions for updating:
`normal` is a deprecated alias for `truncated_normal`
WARNING:tensorflow:From /home/mona/anaconda3/envs/EfficientPose/lib/python3.7/site-packages/tensorflow_core/python/ops/resource_variable_ops.py:1630: calling BaseResourceVariable.__init__ (from tensorflow.python.ops.resource_variable_ops) with constraint is deprecated and will be removed in a future version.
Instructions for updating:
If using Keras pass *_constraint arguments to layers.
2024-02-21 15:09:25.637669: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: NVIDIA RTX 6000 Ada Generation major: 8 minor: 9 memoryClockRate(GHz): 2.505
pciBusID: 0000:52:00.0
2024-02-21 15:09:25.637722: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2024-02-21 15:09:25.637731: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2024-02-21 15:09:25.637739: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2024-02-21 15:09:25.637745: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2024-02-21 15:09:25.637752: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2024-02-21 15:09:25.637802: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2024-02-21 15:09:25.637824: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2024-02-21 15:09:25.637965: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2024-02-21 15:09:25.638309: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1618] Found device 0 with properties: 
name: NVIDIA RTX 6000 Ada Generation major: 8 minor: 9 memoryClockRate(GHz): 2.505
pciBusID: 0000:52:00.0
2024-02-21 15:09:25.638324: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudart.so.10.0
2024-02-21 15:09:25.638331: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcublas.so.10.0
2024-02-21 15:09:25.638337: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcufft.so.10.0
2024-02-21 15:09:25.638343: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcurand.so.10.0
2024-02-21 15:09:25.638350: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusolver.so.10.0
2024-02-21 15:09:25.638356: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcusparse.so.10.0
2024-02-21 15:09:25.638362: I tensorflow/stream_executor/platform/default/dso_loader.cc:44] Successfully opened dynamic library libcudnn.so.7
2024-02-21 15:09:25.638474: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1746] Adding visible gpu devices: 0
2024-02-21 15:09:25.638494: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1159] Device interconnect StreamExecutor with strength 1 edge matrix:
2024-02-21 15:09:25.638498: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1165]      0 
2024-02-21 15:09:25.638501: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1178] 0:   N 
2024-02-21 15:09:25.638635: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1304] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 27778 MB memory) -> physical GPU (device: 0, name: NVIDIA RTX 6000 Ada Generation, pci bus id: 0000:52:00.0, compute capability: 8.9)
WARNING:tensorflow:From /home/mona/effpose/EfficientPose/layers.py:298: where (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
MODEL DETAILS


=================================================================
Total params: 34,665
Trainable params: 34,665
Non-trainable params: 0
_________________________________________________________________



Done!
Loading model, this may take a second...
Traceback (most recent call last):
  File "train.py", line 368, in <module>
    main()
  File "train.py", line 152, in main
    custom_load_weights(filepath = args.weights, layers = all_layers, skip_mismatch = True)
  File "/home/mona/effpose/EfficientPose/custom_load_weights.py", line 49, in custom_load_weights
    load_weights_from_hdf5_group_by_name(f, layers, skip_mismatch = skip_mismatch)
  File "/home/mona/effpose/EfficientPose/custom_load_weights.py", line 69, in load_weights_from_hdf5_group_by_name
    original_keras_version = f.attrs['keras_version'].decode('utf8')
AttributeError: 'str' object has no attribute 'decode'

@monajalal
Copy link
Author

(EfficientPose) mona@ada:~/effpose/EfficientPose$ pip show h5py
Name: h5py
Version: 3.7.0
Summary: Read and write HDF5 files from Python
Home-page: http://www.h5py.org
Author: Andrew Collette
Author-email: andrew.collette@gmail.com
License: BSD
Location: /home/mona/anaconda3/envs/EfficientPose/lib/python3.7/site-packages
Requires: numpy
Required-by: Keras-Applications
(EfficientPose) mona@ada:~/effpose/EfficientPose$ pip uninstall h5py
Found existing installation: h5py 3.7.0
Uninstalling h5py-3.7.0:
  Would remove:
    /home/mona/anaconda3/envs/EfficientPose/lib/python3.7/site-packages/h5py-3.7.0.dist-info/*
    /home/mona/anaconda3/envs/EfficientPose/lib/python3.7/site-packages/h5py/*
Proceed (Y/n)? y
  Successfully uninstalled h5py-3.7.0
(EfficientPose) mona@ada:~/effpose/EfficientPose$ pip install h5py==2.10.0
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting h5py==2.10.0
  Downloading h5py-2.10.0-cp37-cp37m-manylinux1_x86_64.whl (2.9 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 2.9/2.9 MB 16.1 MB/s eta 0:00:00
Requirement already satisfied: numpy>=1.7 in /home/mona/anaconda3/envs/EfficientPose/lib/python3.7/site-packages (from h5py==2.10.0) (1.18.5)
Requirement already satisfied: six in /home/mona/anaconda3/envs/EfficientPose/lib/python3.7/site-packages (from h5py==2.10.0) (1.16.0)
Installing collected packages: h5py
Successfully installed h5py-2.10.0

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

No branches or pull requests

1 participant