rgeirhos / generalisation-humans-DNNs

Data, code & materials from the paper "Generalisation in humans and deep neural networks" (NeurIPS 2018)
http://papers.nips.cc/paper/7982-generalisation-in-humans-and-deep-neural-networks.pdf
Other
95 stars 21 forks source link

mean_power_spectrum_grey #5

Closed f-amerehi closed 1 year ago

f-amerehi commented 1 year ago

I would like to ask you how can I modify mean_power_spectrum_grey.npy file.It seems it only works for 224x224 images. For the default "test_image.JPEG" image as it is 256x256 I got error the following error

Traceback (most recent call last):
  File "code/image_manipulation.py", line 635, in <module>
    img_power_equalisation = power_equalisation(img, avg_power_spectrum)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "code/image_manipulation.py", line 203, in power_equalisation
    return equalise_power_spectrum(image, avg_power_spectrum)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "code/image_manipulation.py", line 478, in equalise_power_spectrum
    assert image.shape[:2] == avg_power_spectrum.shape, 'Image shape={} unequal \
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: Image shape=(256, 256) unequal             avg_spectrum shape=(224, 224)

I read calculate_mean_power_spectrum.py file and tried to use get_mean_amplitude_spectrum function but is seems the file is buggy and calculate_amplitude_spectrum is not defined or imported

f-amerehi commented 1 year ago

Hi @rgeirhos hope that all is well. Could you please let me know how could I change mean_power_spectrum_grey.npy file to be able to run that code?

Thanks!

rgeirhos commented 1 year ago

Hi @f-amerehi I messaged my co-author @carmete regarding this and am currently waiting for their reply.

carmete commented 1 year ago

Hi @f-amerehi! Thank you for trying out our code. Unfortunately, I cannot re-run the code right now, but here is my quick assessment.

With regards to code bugs in calculate_mean_power_spectrum.py:

Let me know, if this works and sorry for the inconvenience!

f-amerehi commented 1 year ago

Hi @carmete. Many thanks for the help!

f-amerehi commented 1 year ago

Thank you very much @rgeirhos also. I'll close off the issue.