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

dimension error #3

Open
prashant0079 opened this issue Feb 18, 2018 · 5 comments
Open

dimension error #3

prashant0079 opened this issue Feb 18, 2018 · 5 comments

Comments

@prashant0079
Copy link

I don't know why it's giving me dimension error, during prediction?
Traceback (most recent call last):
File "predict.py", line 225, in
predict_model(image_crops, image_crops_name)
File "predict.py", line 54, in predict_model
model = create_model(False, True, input_shape, len(class_names), optimizer, learn_rate, decay, momentum, activation, dropout_rate)
File "/home/prashant/DeepFashion/model.py", line 67, in create_model
model.load_weights(top_model_weights_path_load, by_name=True)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2570, in load_weights
load_weights_from_hdf5_group_by_name(f, self.layers)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 3111, in load_weights_from_hdf5_group_by_name
K.batch_set_value(weight_value_tuples)
File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 2183, in batch_set_value
assign_op = x.assign(assign_placeholder)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/variables.py", line 594, in assign
return state_ops.assign(self._variable, value, use_locking=use_locking)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/state_ops.py", line 276, in assign
validate_shape=validate_shape)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_state_ops.py", line 59, in assign
use_locking=use_locking, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 787, in _apply_op_helper
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3162, in create_op
compute_device=compute_device)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 3208, in _create_op_helper
set_shapes_for_outputs(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2427, in set_shapes_for_outputs
return _set_shapes_for_outputs(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2400, in _set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2330, in call_with_requiring
return call_cpp_shape_fn(op, require_shape_fn=True)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 627, in call_cpp_shape_fn
require_shape_fn)
File "/usr/local/lib/python2.7/dist-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 19 and 3. Shapes are [256,19] and [256,3]. for 'Assign_32' (op: 'Assign') with input shapes: [256,19], [256,3].

@ligaoyi101
Copy link

Hi ! Did you solve this problem? I also encountered the same situation during prediction

“ Dimension 1 in both shapes must be equal, but are 19 and 3 for 'Assign_32' (op: 'Assign') with input shapes: [256,19], [256,3]. ”

@mhdbnmsd
Copy link

Hi i have the same problem, did anyone find the solution

@hoanganh928
Copy link

perhaps this is a mismatch in the number of output classes. Check the output classes of the checkpoint and the base model.

@jiayi42
Copy link

jiayi42 commented May 28, 2018

@hoanganh928 is right. dataset_download.sh is failure.
you should download data in Google drive.
Just set variable category_name_generate in dataset_create.py as line 49 and add fashion_dataset_path.
finally run dataset_create.py and it will take a very long time to create right dataset in fashion_data.

@MTKSHU
Copy link

MTKSHU commented Sep 4, 2018

predict.py line 28 and above, change class_names = ['Coat', 'Kaftan', 'Robe']
Because your dataset_create.py creates three classes.

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

6 participants