Skip to content

Error while loading weights for damage_inference.pyΒ #18

@nka77

Description

@nka77

I am getting shape mis-match error while loading weights in damage_inference.py, which is using 'classification.hdf5' file.
ValueError: Cannot assign to variable conv3_block1_0_conv/kernel:0 due to variable shape (1, 1, 256, 512) and value shape (1, 1, 128, 512) are incompatible
(The weights for 'localization.h5' are loaded fine.)

Below is the snapshot for error:

File "./damage_inference.py", line 93, in run_inference
    model.load_weights(model_weights)
  File "/Users/navjotkaur/miniforge3/envs/tfmacos/lib/python3.8/site-packages/tensorflow/python/keras/engine/training.py", line 2234, in load_weights
    hdf5_format.load_weights_from_hdf5_group(f, self.layers)
  File "/Users/navjotkaur/miniforge3/envs/tfmacos/lib/python3.8/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 710, in load_weights_from_hdf5_group
    K.batch_set_value(weight_value_tuples)
  File "/Users/navjotkaur/miniforge3/envs/tfmacos/lib/python3.8/site-packages/tensorflow/python/util/dispatch.py", line 201, in wrapper
    return target(*args, **kwargs)
  File "/Users/navjotkaur/miniforge3/envs/tfmacos/lib/python3.8/site-packages/tensorflow/python/keras/backend.py", line 3745, in batch_set_value
    x.assign(np.asarray(value, dtype=dtype(x)))
  File "/Users/navjotkaur/miniforge3/envs/tfmacos/lib/python3.8/site-packages/tensorflow/python/ops/resource_variable_ops.py", line 888, in assign
    raise ValueError(
ValueError: Cannot assign to variable conv3_block1_0_conv/kernel:0 due to variable shape (1, 1, 256, 512) and value shape (1, 1, 128, 512) are incompatible

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions