Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

找不文件错误 #2

Open
g807504297 opened this issue Nov 27, 2019 · 7 comments
Open

找不文件错误 #2

g807504297 opened this issue Nov 27, 2019 · 7 comments

Comments

@g807504297
Copy link

我已经把那两个.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'
@Stephenfang51
Copy link
Owner

@g807504297

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

@StellaGAN
Copy link

我已经把那两个.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曲线图自动展示出来再保存下来。目前,我也只能是这样解决这个问题,希望能对你有所帮助。

@ZYN-guy
Copy link

ZYN-guy commented Dec 24, 2019

我已经把那两个.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中进行同样的操作,就可以画第一个

@Michaell109
Copy link

我已经把那两个.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曲线图自动展示出来再保存下来。目前,我也只能是这样解决这个问题,希望能对你有所帮助。

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

@butter0312
Copy link

我已经把那两个.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即可

@xiaoyu1233
Copy link

我已经把那两个.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文件。

@lijf138
Copy link

lijf138 commented Jun 5, 2021

(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
请问问题出在哪里阿?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants