open-mmlab / mmrotate

OpenMMLab Rotated Object Detection Toolbox and Benchmark
https://mmrotate.readthedocs.io/en/latest/
Apache License 2.0
1.84k stars 540 forks source link

[Docs] Problems with draw_texts, can't run the demo_image.py #755

Open zhou233-33 opened 1 year ago

zhou233-33 commented 1 year ago

Branch

master branch https://mmrotate.readthedocs.io/en/latest/

📚 The doc issue

Install according to the documentation, cuda version 10.2, pytorch version 1.8.0 The following error was encountered during the installation of openmim.

ERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.
matplotlib 3.2.2 requires cycler>=0.10, which is not installed.
matplotlib 3.2.2 requires kiwisolver>=1.0.1, which is not installed.
matplotlib 3.2.2 requires pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1, which is not installed.

I reinstalled the request dependency as follows:

pip install cycler==0.10
pip install kiwisolver==1.0.1
pip install pyparsing==2.0.1

After that, the installation of mmcv, mmdet, and mmrotate went smoothly. However, when I tried to run the demo_image.py, An error occurred regarding draw_text as follows:

Traceback (most recent call last):
  File "demo/image_demo.py", line 63, in <module>
    main(args)
  File "demo/image_demo.py", line 50, in main
    visualizer.add_datasample(
  File "/home/scut/anaconda3/envs/mmrotate-v1/lib/python3.8/site-packages/mmengine/dist/utils.py", line 360, in wrapper
    return func(*args, **kwargs)
  File "/media/scut/File/zhz/mmdetection/mmdet/visualization/local_visualizer.py", line 369, in add_datasample
    pred_img_data = self._draw_instances(image, pred_instances,
  File "/media/scut/File/zhz/mmrotate/mmrotate/visualization/local_visualizer.py", line 104, in _draw_instances
    self.draw_texts(
  File "/home/scut/anaconda3/envs/mmrotate-v1/lib/python3.8/site-packages/mmengine/dist/utils.py", line 360, in wrapper
    return func(*args, **kwargs)
  File "/home/scut/anaconda3/envs/mmrotate-v1/lib/python3.8/site-packages/mmengine/visualization/visualizer.py", line 526, in draw_texts
    self.ax_save.text(
  File "/home/scut/.local/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py", line 358, in wrapper
    return func(*args, **kwargs)
  File "/home/scut/.local/lib/python3.8/site-packages/matplotlib/axes/_axes.py", line 770, in text
    t.update(effective_kwargs)
  File "/home/scut/.local/lib/python3.8/site-packages/matplotlib/text.py", line 177, in update
    super().update(kwargs)
  File "/home/scut/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 1006, in update
    ret = [_update_property(self, k, v) for k, v in props.items()]
  File "/home/scut/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 1006, in <listcomp>
    ret = [_update_property(self, k, v) for k, v in props.items()]
  File "/home/scut/.local/lib/python3.8/site-packages/matplotlib/artist.py", line 1003, in _update_property
    return func(v)
  File "/home/scut/.local/lib/python3.8/site-packages/matplotlib/text.py", line 1224, in set_fontproperties
    self._fontproperties = fp.copy()
AttributeError: 'NoneType' object has no attribute 'copy'

Suggest a potential alternative/fix

No response

zytx121 commented 1 year ago

Hi @zhou233-33, please try installing a higher version of matplotlib,e.g., pip install matplotlib==3.7.0