mmdetection_visualize icon indicating copy to clipboard operation
mmdetection_visualize copied to clipboard

找不文件错误

Open g807504297 opened this issue 5 years ago • 7 comments

我已经把那两个.py文件放到了正确的位置上,运行第一个脚本没有问题,在output文件夹,找到了生成的png文件,但是运行第二个文件用了下面这条命令```python tools/voc_eval_visualize.py result.pkl configs/pascal_voc/my.py

/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/numpy/core/_methods.py:161:RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
Traceback (most recent call last):
  File "tools/voc_eval_visualize.py", line 62, in <module>
    main()
  File "tools/voc_eval_visualize.py", line 58, in main
    voc_eval(args.result, test_dataset, args.iou_thr)
  File "tools/voc_eval_visualize.py", line 43, in voc_eval
    print_summary=True)
  File "/media/dataset/workplace/zz/mmdetection/mmdet/core/evaluation/mean_ap_visualize.py", line 357, in map_roc_pr
    plt.savefig('/mmdetection/PR_Curve_each_class.png')
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/pyplot.py", line 722, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2089, in print_figure
    **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 530, in print_png
    cbook.open_file_cm(filename_or_obj, "wb") as fh:
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 447, in open_file_cm
    fh, opened = to_filehandle(path_or_file, mode, True, encoding)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 432, in to_filehandle
    fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/mmdetection/PR_Curve_each_class.png'

g807504297 avatar Nov 27 '19 09:11 g807504297

@g807504297

看一看感觉只有configs/pascal_voc/my.py的文件 你的好像不是官方的? 感觉问题是出在这边

Stephenfang51 avatar Nov 28 '19 02:11 Stephenfang51

我已经把那两个.py文件放到了正确的位置上,运行第一个脚本没有问题,在output文件夹,找到了生成的png文件,但是运行第二个文件用了下面这条命令```python tools/voc_eval_visualize.py result.pkl configs/pascal_voc/my.py

/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/numpy/core/_methods.py:161:RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
Traceback (most recent call last):
  File "tools/voc_eval_visualize.py", line 62, in <module>
    main()
  File "tools/voc_eval_visualize.py", line 58, in main
    voc_eval(args.result, test_dataset, args.iou_thr)
  File "tools/voc_eval_visualize.py", line 43, in voc_eval
    print_summary=True)
  File "/media/dataset/workplace/zz/mmdetection/mmdet/core/evaluation/mean_ap_visualize.py", line 357, in map_roc_pr
    plt.savefig('/mmdetection/PR_Curve_each_class.png')
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/pyplot.py", line 722, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2089, in print_figure
    **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 530, in print_png
    cbook.open_file_cm(filename_or_obj, "wb") as fh:
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 447, in open_file_cm
    fh, opened = to_filehandle(path_or_file, mode, True, encoding)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 432, in to_filehandle
    fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/mmdetection/PR_Curve_each_class.png'

你可以在mean_ap_visualize.py 365行(在 plt.savefig('/mmdetection/PR_Curve_each_class.png')之前一行)加上 plt.show() ,可以将PR曲线图自动展示出来再保存下来。目前,我也只能是这样解决这个问题,希望能对你有所帮助。

StellaGAN avatar Dec 03 '19 05:12 StellaGAN

我已经把那两个.py文件放到了正确的位置上,运行第一个脚本没有问题,在output文件夹,找到了生成的png文件,但是运行第二个文件用了下面这条命令```python tools/voc_eval_visualize.py result.pkl configs/pascal_voc/my.py

/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/numpy/core/_methods.py:161:RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
Traceback (most recent call last):
  File "tools/voc_eval_visualize.py", line 62, in <module>
    main()
  File "tools/voc_eval_visualize.py", line 58, in main
    voc_eval(args.result, test_dataset, args.iou_thr)
  File "tools/voc_eval_visualize.py", line 43, in voc_eval
    print_summary=True)
  File "/media/dataset/workplace/zz/mmdetection/mmdet/core/evaluation/mean_ap_visualize.py", line 357, in map_roc_pr
    plt.savefig('/mmdetection/PR_Curve_each_class.png')
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/pyplot.py", line 722, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2089, in print_figure
    **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 530, in print_png
    cbook.open_file_cm(filename_or_obj, "wb") as fh:
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 447, in open_file_cm
    fh, opened = to_filehandle(path_or_file, mode, True, encoding)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 432, in to_filehandle
    fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/mmdetection/PR_Curve_each_class.png'

你可以在mean_ap_visualize.py 365行(在 plt.savefig('/mmdetection/PR_Curve_each_class.png')之前一行)加上 plt.show() ,可以将PR曲线图自动展示出来再保存下来。目前,我也只能是这样解决这个问题,希望能对你有所帮助

同样,在visualize.py中进行同样的操作,就可以画第一个

ZYN-guy avatar Dec 24 '19 05:12 ZYN-guy

我已经把那两个.py文件放到了正确的位置上,运行第一个脚本没有问题,在output文件夹,找到了生成的png文件,但是运行第二个文件用了下面这条命令```python tools/voc_eval_visualize.py result.pkl configs/pascal_voc/my.py

/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/numpy/core/_methods.py:161:RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
Traceback (most recent call last):
  File "tools/voc_eval_visualize.py", line 62, in <module>
    main()
  File "tools/voc_eval_visualize.py", line 58, in main
    voc_eval(args.result, test_dataset, args.iou_thr)
  File "tools/voc_eval_visualize.py", line 43, in voc_eval
    print_summary=True)
  File "/media/dataset/workplace/zz/mmdetection/mmdet/core/evaluation/mean_ap_visualize.py", line 357, in map_roc_pr
    plt.savefig('/mmdetection/PR_Curve_each_class.png')
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/pyplot.py", line 722, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2089, in print_figure
    **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 530, in print_png
    cbook.open_file_cm(filename_or_obj, "wb") as fh:
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 447, in open_file_cm
    fh, opened = to_filehandle(path_or_file, mode, True, encoding)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 432, in to_filehandle
    fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/mmdetection/PR_Curve_each_class.png'

你可以在mean_ap_visualize.py 365行(在 plt.savefig('/mmdetection/PR_Curve_each_class.png')之前一行)加上 plt.show() ,可以将PR曲线图自动展示出来再保存下来。目前,我也只能是这样解决这个问题,希望能对你有所帮助。

我把这一行代码里的路径改成绝对路径之后就可以正常保存图片了。

Michaell109 avatar May 19 '20 08:05 Michaell109

我已经把那两个.py文件放到了正确的位置上,运行第一个脚本没有问题,在output文件夹,找到了生成的png文件,但是运行第二个文件用了下面这条命令```python tools/voc_eval_visualize.py result.pkl configs/pascal_voc/my.py

/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/numpy/core/_methods.py:161:RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
Traceback (most recent call last):
  File "tools/voc_eval_visualize.py", line 62, in <module>
    main()
  File "tools/voc_eval_visualize.py", line 58, in main
    voc_eval(args.result, test_dataset, args.iou_thr)
  File "tools/voc_eval_visualize.py", line 43, in voc_eval
    print_summary=True)
  File "/media/dataset/workplace/zz/mmdetection/mmdet/core/evaluation/mean_ap_visualize.py", line 357, in map_roc_pr
    plt.savefig('/mmdetection/PR_Curve_each_class.png')
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/pyplot.py", line 722, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2089, in print_figure
    **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 530, in print_png
    cbook.open_file_cm(filename_or_obj, "wb") as fh:
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 447, in open_file_cm
    fh, opened = to_filehandle(path_or_file, mode, True, encoding)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 432, in to_filehandle
    fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/mmdetection/PR_Curve_each_class.png'

就是路径的问题,没有/mmdetection这个文件夹,可以改为./PR_Curve_each_class.png即可

butter0312 avatar Jun 11 '20 12:06 butter0312

我已经把那两个.py文件放到了正确的位置上,运行第一个脚本没有问题,在output文件夹,找到了生成的png文件,但是运行第二个文件用了下面这条命令```python tools/voc_eval_visualize.py result.pkl configs/pascal_voc/my.py

/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/numpy/core/_methods.py:161:RuntimeWarning: invalid value encountered in double_scalars
  ret = ret.dtype.type(ret / rcount)
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
posx and posy should be finite values
Traceback (most recent call last):
  File "tools/voc_eval_visualize.py", line 62, in <module>
    main()
  File "tools/voc_eval_visualize.py", line 58, in main
    voc_eval(args.result, test_dataset, args.iou_thr)
  File "tools/voc_eval_visualize.py", line 43, in voc_eval
    print_summary=True)
  File "/media/dataset/workplace/zz/mmdetection/mmdet/core/evaluation/mean_ap_visualize.py", line 357, in map_roc_pr
    plt.savefig('/mmdetection/PR_Curve_each_class.png')
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/pyplot.py", line 722, in savefig
    res = fig.savefig(*args, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/figure.py", line 2180, in savefig
    self.canvas.print_figure(fname, **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backend_bases.py", line 2089, in print_figure
    **kwargs)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/backends/backend_agg.py", line 530, in print_png
    cbook.open_file_cm(filename_or_obj, "wb") as fh:
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 447, in open_file_cm
    fh, opened = to_filehandle(path_or_file, mode, True, encoding)
  File "/home/linux412/anaconda3/envs/mmlab/lib/python3.7/site-packages/matplotlib/cbook/__init__.py", line 432, in to_filehandle
    fh = open(fname, flag, encoding=encoding)
FileNotFoundError: [Errno 2] No such file or directory: '/mmdetection/PR_Curve_each_class.png'

'/mmdetection/PR_Curve_each_class.png'改成'./mmdetection/PR_Curve_each_class.png',加个点就行了。作者写相对路径的时候漏了个点。另外这些报错可不止路径的问题呀,你大概是用的新版mmdetection,需要重新修改mean_ap文件。

xiaoyu1233 avatar Nov 24 '20 07:11 xiaoyu1233

(mede) ii@ii-Legion-Y7000P-2019:~/mmdetection$ python tools/voc_eval_visualize.py result.pkl ./configs/faster_rcnn_r101_fpn_1x_coco.py Traceback (most recent call last): File "tools/voc_eval_visualize.py", line 62, in main() File "tools/voc_eval_visualize.py", line 58, in main voc_eval(args.result, test_dataset, args.iou_thr) File "tools/voc_eval_visualize.py", line 43, in voc_eval print_summary=True) File "/home/ii/mmdetection/mmdet/core/evaluation/mean_ap_visualize.py", line 247, in map_roc_pr assert len(det_results) == len(gt_bboxes) == len(gt_labels) AssertionError 请问问题出在哪里阿?

lijf138 avatar Jun 05 '21 16:06 lijf138