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

could not load pretrained resnet50 #11

Open
renaldfredy opened this issue Oct 7, 2024 · 9 comments
Open

could not load pretrained resnet50 #11

renaldfredy opened this issue Oct 7, 2024 · 9 comments

Comments

@renaldfredy
Copy link

Hi Erika,

I got error about the shape of resnet, and could not solved it. May you help?

==> could not load pretrained resnet50
/usr/local/lib/python3.10/dist-packages/keras/src/models/functional.py:225: UserWarning: The structure of inputs doesn't match the expected structure: ['image_patch', 'image']. Received: the structure of inputs={'image': '', 'image_patch': ''}
warnings.warn(
Traceback (most recent call last):
File "/content/drive/MyDrive/Disertasi/Class-Agnostic-Counting/class-agnostic-counting/demo.py", line 56, in
inference(args)
File "/content/drive/MyDrive/Disertasi/Class-Agnostic-Counting/class-agnostic-counting/demo.py", line 36, in inference
pred = model.predict(data)[0, :vis_im.shape[0], :vis_im.shape[1]]
File "/usr/local/lib/python3.10/dist-packages/keras/src/utils/traceback_utils.py", line 122, in error_handler
raise e.with_traceback(filtered_tb) from None
File "/usr/local/lib/python3.10/dist-packages/keras/src/layers/input_spec.py", line 245, in assert_input_compatibility
raise ValueError(
ValueError: Exception encountered when calling Functional.call().

Input 0 of layer "resnet50_patchnet" is incompatible with the layer: expected shape=(None, 63, 63, 3), found shape=(1, 800, 800, 3)

Arguments received by Functional.call():
• inputs={'image': 'tf.Tensor(shape=(1, 800, 800, 3), dtype=float32)', 'image_patch': 'tf.Tensor(shape=(1, 63, 63, 3), dtype=float32)'}
• training=False
• mask={'image': 'None', 'image_patch': 'None'}

@erikalu
Copy link
Owner

erikalu commented Oct 7, 2024

Hi, does your input data consist of an image of size 800x800 and image patch of size 63x63?

@renaldfredy
Copy link
Author

Yes, as your instruction in the description

@erikalu
Copy link
Owner

erikalu commented Oct 7, 2024

Is this your custom data or the example data? Are you able to run the demo successfully?

@renaldfredy
Copy link
Author

This is example data from yours, and still unable to run the demo

@erikalu
Copy link
Owner

erikalu commented Oct 7, 2024

Hi, I wasn't able to reproduce the error using the Conda environment. What versions are you using for tensorflow, keras, etc.?

@renaldfredy
Copy link
Author

I’m using google colab, so actually no need to download tensorslow and keras. However, I have check those version specifically python 3.10.12, keras 3.4.1, tensorflow 2.17.0

@erikalu
Copy link
Owner

erikalu commented Oct 8, 2024

The versions required are keras 2.4.3 and tensorflow 2.2.0, could you please try with those?

@renaldfredy
Copy link
Author

image
Okay all done properly, thank you. But it seems like hitmap_vis.jpg quiet different with your paper.
image

@erikalu
Copy link
Owner

erikalu commented Oct 14, 2024

heatmap_vis overlays the prediction in green on top of the input image for visualization purposes.

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