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

Error in loading weights #6

Closed
cppntn opened this issue Jul 19, 2018 · 4 comments
Closed

Error in loading weights #6

cppntn opened this issue Jul 19, 2018 · 4 comments

Comments

@cppntn
Copy link

cppntn commented Jul 19, 2018

raise ValueError(err.message)
ValueError: Dimension 1 in both shapes must be equal, but are 92 and 84 for 'Assign_682' (op: 'Assign') with input shapes: [1024,92], [1024,84].

Any help would be appreciated,
Thanks!

@hanskrupakar
Copy link
Owner

This error is usually related to the number of classes in the dataset. Can you give me some more specifics? What did you try to run?

@cppntn
Copy link
Author

cppntn commented Jul 23, 2018

I ran with a class file .txt made only by three classes. What exactly is the txt classe file that i should use?
Thanks

@cppntn
Copy link
Author

cppntn commented Jul 24, 2018

Hi @hanskrupakar

I ran the command :

python segment.py -i set/ -f -p ../Mask_RCNN/ -w pretrained_weights/coco_10/mask_rcnn_bags_0006.h5 -c classes/products.txt

But this still gives me the error about the weights:

Traceback (most recent call last):
File "segment.py", line 434, in
gen = COCO_dataset_generator(fig, ax, args)
File "segment.py", line 110, in init
model.load_weights(args['weights_path'], by_name=True)
File "../Mask_RCNN/model.py", line 2105, in load_weights
topology.load_weights_from_hdf5_group_by_name(f, layers)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/keras/engine/topology.py", line 3248, in load_weights_from_hdf5_group_by_name
K.batch_set_value(weight_value_tuples)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/keras/backend/tensorflow_backend.py", line 2365, in batch_set_value
assign_op = x.assign(assign_placeholder)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/ops/variables.py", line 573, in assign
return state_ops.assign(self._variable, value, use_locking=use_locking)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/ops/state_ops.py", line 276, in assign
validate_shape=validate_shape)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/ops/gen_state_ops.py", line 57, in assign
use_locking=use_locking, name=name)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2958, in create_op
set_shapes_for_outputs(ret)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2209, in set_shapes_for_outputs
shapes = shape_func(op)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/framework/ops.py", line 2159, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "/home/addfor/anaconda3/envs/coco/lib/python3.6/site-packages/tensorflow/python/framework/common_shapes.py", line 691, in _call_cpp_shape_fn_impl
raise ValueError(err.message)
ValueError: Dimension 1 in both shapes must be equal, but are 92 and 84 for 'Assign_682' (op: 'Assign') with input shapes: [1024,92], [1024,84].

@hanskrupakar
Copy link
Owner

Oh I think the problem is that you're trying to get initial segmentations for a custom dataset (with different number of classes) using the pre-trained model for the products dataset used in this repo. You can generate the initial segmentations using Mask RCNN model for your custom dataset only if you train a Mask RCNN model for it.

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

2 participants