wqwzyinge 2020-02-22 11:57 采纳率: 0%
浏览 1877

python运行时出现ValueError: Invalid file name (invalid file name)

相关程序如下

parser = argparse.ArgumentParser(description='evaluate.py')                                                        
parser.add_argument('INPUT',  help='path to input image')                                                          
parser.add_argument('REF', default="", nargs="?", help='path to reference image, if omitted NR IQA is assumed')    
parser.add_argument('--model', '-m', default='',                                                                   
                    help='path to the trained model')                                                              
parser.add_argument('--top', choices=('patchwise', 'weighted'),                                                    
                    default='weighted', help='top layer and loss definition')                                      
parser.add_argument('--gpu', '-g', default=0, type=int,                                                            
                    help='GPU ID')                                                                                 
args = parser.parse_args()                                                                                         

我在运行

python evaluate.py D:\PyCharm 2019.3.3\test-code\deepIQA-master\img.jpg

后提示我

Traceback (most recent call last):
  File "D:/PyCharm 2019.3.3/test-code/deepIQA-master/evaluate.py", line 75, in <module>
    serializers.load_hdf5(args.model, model)
  File "D:\PyCharm 2019.3.3\lib\site-packages\chainer\serializers\hdf5.py", line 195, in load_hdf5
    with h5py.File(filename, 'r') as f:
  File "D:\PyCharm 2019.3.3\lib\site-packages\h5py\_hl\files.py", line 408, in __init__
    swmr=swmr)
  File "D:\PyCharm 2019.3.3\lib\site-packages\h5py\_hl\files.py", line 173, in make_fid
    fid = h5f.open(name, flags, fapl=fapl)
  File "h5py\_objects.pyx", line 54, in h5py._objects.with_phil.wrapper
  File "h5py\_objects.pyx", line 55, in h5py._objects.with_phil.wrapper
  File "h5py\h5f.pyx", line 88, in h5py.h5f.open
ValueError: Invalid file name (invalid file name)

是我的图片路径不对么?

  • 写回答

3条回答 默认 最新

  • threenewbee 2020-02-22 11:58
    关注

    python evaluate.py "D:\PyCharm 2019.3.3\test-code\deepIQA-master\img.jpg"
    带一个引号看看
    或者把img.jpg放在没有空格的路径里

    评论

报告相同问题?

悬赏问题

  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥30 vmware exsi重置后登不上
  • ¥15 MATLAB运行显示错误,如何解决?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?