open-mmlab / mmrotate

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

[Bug] #1040

Open 0Freeebaby opened 3 months ago

0Freeebaby commented 3 months ago

Prerequisite

Task

I have modified the scripts/configs, or I'm working on my own tasks/models/datasets.

Branch

master branch https://github.com/open-mmlab/mmrotate

Environment

TorchVision: 0.15.0 OpenCV: 4.9.0 MMCV: 1.7.2 MMCV Compiler: GCC 9.4 MMCV CUDA Compiler: 11.8 MMRotate: 0.3.4+unknown

Reproduces the problem - code sample

Copyright (c) OpenMMLab. All rights reserved.

from argparse import ArgumentParser

from mmdet.apis import inference_detector, init_detector, show_result_pyplot

import mmrotate # noqa: F401

def parse_args(): parser = ArgumentParser() parser.add_argument('--img', default='images/000094.png', help='Image file') parser.add_argument('--config', default='../run/r3det_ssdd/r3det_refine_r50_fpn_1x_ssdd_oc.py', help='Config file') parser.add_argument('--checkpoint', default='../run/r3det_ssdd_new/epoch_12.pth',help='Checkpoint file') parser.add_argument('--out-file', default='ship/test8.png', help='Path to output file') parser.add_argument( '--device', default='cuda:0', help='Device used for inference') parser.add_argument( '--palette', default='dota', choices=['dota', 'sar', 'hrsc', 'hrsc_classwise', 'random'], help='Color palette used for visualization') parser.add_argument( '--score-thr', type=float, default=0.3, help='bbox score threshold') args = parser.parse_args() return args

def main(args):

build the model from a config file and a checkpoint file

model = init_detector(args.config, args.checkpoint, device=args.device)
# test a single image
result = inference_detector(model, args.img)
# show the results
show_result_pyplot(
    model,
    args.img,
    result,
    palette=args.palette,
    score_thr=args.score_thr,
    out_file=args.out_file)

if name == 'main': args = parse_args() main(args)

Reproduces the problem - command or script

/home/abc/.conda/envs/openmmlab/bin/python /home/abc/yuanruirui/mmrotate/demo/image_demo.py /home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/mmcv/init.py:20: UserWarning: On January 1, 2023, MMCV will release v2.0.0, in which it will remove components related to the training process and add a data transformation module. In addition, it will rename the package names mmcv to mmcv-lite and mmcv-full to mmcv. See https://github.com/open-mmlab/mmcv/blob/master/docs/en/compatibility.md for more details. warnings.warn( load checkpoint from local path: ../run/r3det_ssdd_new/epoch_12.pth Traceback (most recent call last): File "/home/abc/yuanruirui/mmrotate/demo/image_demo.py", line 45, in main(args) File "/home/abc/yuanruirui/mmrotate/demo/image_demo.py", line 34, in main show_result_pyplot( File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/mmdet/apis/inference.py", line 247, in show_result_pyplot model.show_result( File "/home/abc/yuanruirui/mmrotate/mmrotate/models/detectors/base.py", line 87, in show_result img = imshow_det_rbboxes( File "/home/abc/yuanruirui/mmrotate/mmrotate/core/visualization/image.py", line 151, in imshow_det_rbboxes fig = plt.figure(win_name, frameon=False) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/_api/deprecation.py", line 454, in wrapper return func(*args, *kwargs) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/pyplot.py", line 840, in figure manager = new_figure_manager( File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/pyplot.py", line 384, in new_figure_manager return _get_backend_mod().new_figure_manager(args, **kwargs) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 3574, in new_figure_manager return cls.new_figure_manager_given_figure(num, fig) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 3579, in new_figure_manager_given_figure return cls.FigureCanvas.new_manager(figure, num) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 1742, in new_manager return cls.manager_class.create_with_canvas(cls, figure, num) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backends/_backend_tk.py", line 507, in create_with_canvas manager = cls(canvas, num, window) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backends/_backend_tk.py", line 457, in init super().init(canvas, num) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 2832, in init self.toolbar = self._toolbar2_class(self.canvas) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backends/_backend_tk.py", line 630, in init self._buttons[text] = button = self._Button( File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backends/_backend_tk.py", line 834, in _Button NavigationToolbar2Tk._set_image_for_button(self, b) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/matplotlib/backends/_backend_tk.py", line 770, in _set_image_for_button image = ImageTk.PhotoImage(im.resize((size, size)), master=self) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/PIL/Image.py", line 2060, in resize im = im.resize(size, resample, box) File "/home/abc/.conda/envs/openmmlab/lib/python3.8/site-packages/PIL/Image.py", line 2082, in resize return self._new(self.im.resize(size, resample, box)) ValueError: height and width must be > 0

Process finished with exit code 1

Reproduces the problem - error message

no

Additional information

help me ,please