pierluigiferrari / ssd_keras

A Keras port of Single Shot MultiBox Detector
Apache License 2.0
1.86k stars 934 forks source link

Error in transfer learning part #351

Closed Monster-Gaming-Studios closed 4 years ago

Monster-Gaming-Studios commented 4 years ago

---------------------------------------------------------------------------
InvalidArgumentError                      Traceback (most recent call last)
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1658   try:
-> 1659     c_op = c_api.TF_FinishOperation(op_desc)
   1660   except errors.InvalidArgumentError as e:

InvalidArgumentError: Dimension 0 in both shapes must be equal, but are 3 and 328. Shapes are [3,3,512,324] and [328,512,3,3]. for 'Assign_49' (op: 'Assign') with input shapes: [3,3,512,324], [328,512,3,3].

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
11 frames
/usr/local/lib/python3.6/dist-packages/tensorflow/python/framework/ops.py in _create_c_op(graph, node_def, inputs, control_inputs)
   1660   except errors.InvalidArgumentError as e:
   1661     # Convert to ValueError for backwards compatibility.
-> 1662     raise ValueError(str(e))
   1663 
   1664   return c_op

ValueError: Dimension 0 in both shapes must be equal, but are 3 and 328. Shapes are [3,3,512,324] and [328,512,3,3]. for 'Assign_49' (op: 'Assign') with input shapes: [3,3,512,324], [328,512,3,3].

I am getting the above error when loading weights in the section 5.2 Build the model for weight_sampling_tutorial.ipynb

I am using tensorflow 1.13.2 and keras 2.1.4

Please help me @pierluigiferrari .

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Monster-Gaming-Studios commented 4 years ago

@pierluigiferrari

Somebody please help me.

Sri-user commented 4 years ago

@Monster-Gaming-Studios

I ran this today. I came across the same problem. U have to downgrade tensor flow and keras

Install tensorflow 1.4 and keras 2.0.4

After creating model and saving it, when u try to load it, u will face another problem, closure must be none or tuple error

Remove the line clear session in the load_model block. This part alone i did it in google colab

You can do all the above steps in google colab itself.

But you have to do this two steps %tensorflow_version 1.x !pip install q keras==2.1.5

Monster-Gaming-Studios commented 4 years ago

@Sri-user Right now I am out of station, but I will try once I get home. But thanks for your help.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.