[Solved] An error occurred when reproducing the RGA model: ImportError: cannot import name 'imsave'

question

When reproducing Microsoft's open source REID model - "Attention_Networks/Relation-Aware-Global-Attention-Networks", ImportError: cannot import name 'imsave'an error occurred when running the program, as follows

Traceback (most recent call last):
  File "main_imgreid.py", line 19, in <module>
    from reid import data_manager
  File "/home/REID/Attention_Networks/Relation-Aware-Global-Attention-Networks-master/reid/data_manager/__init__.py", line 5, in <module>
    from .cuhk03 import CUHK03
  File "/home/REID/Attention_Networks/Relation-Aware-Global-Attention-Networks-master/reid/data_manager/cuhk03.py", line 16, in <module>
    from scipy.misc import imsave
ImportError: cannot import name 'imsave'

solve

in cuhk03.py_

  1. will be from scipy.misc import imsavereplaced withimport imageio
  2. will be imsave(img_path, img)replaced withimageio.imwrite(img_path, img)

analyze

The new version of the scipy library does not have the imsave method. If you want to continue using the original code, you need to install the old version of scipy.


Reference: https://blog.csdn.net/Rex_WUST/article/details/86250165

Guess you like

Origin blog.csdn.net/qq_41999731/article/details/123760596