aioz-ai/MICCAI21_MMQ

Cannot run script : No such file or directory

HannibalWangLecter opened this issue · 2 comments

Hi, I installed all the requirements and run the sh file, but it reports an error, here is the information :

sh run_pathVQA.sh
Namespace(data='data/pathvqa_maml/', epoch=10000, imgc=3, imgsz=84, k_qry=15, k_spt=5, meta_lr=0.001, n_way=6, output='saved_models', t_dst=0, task_num=4, update_lr=0.01, update_step=5, update_step_test=10)
Meta(
  (net): Learner(
    conv2d:(ch_in:3, ch_out:32, k:3x3, stride:1, padding:0)
    relu:(True,)
    bn:(32,)
    max_pool2d:(k:2, stride:2, padding:0)
    conv2d:(ch_in:32, ch_out:32, k:3x3, stride:1, padding:0)
    relu:(True,)
    bn:(32,)
    max_pool2d:(k:2, stride:2, padding:0)
    conv2d:(ch_in:32, ch_out:32, k:3x3, stride:1, padding:0)
    relu:(True,)
    bn:(32,)
    max_pool2d:(k:2, stride:2, padding:0)
    conv2d:(ch_in:32, ch_out:32, k:3x3, stride:1, padding:0)
    relu:(True,)
    bn:(32,)
    max_pool2d:(k:2, stride:1, padding:0)
    flatten:()
    linear:(in:800, out:6)
    
    (vars): ParameterList(
        (0): Parameter containing: [torch.cuda.FloatTensor of size 32x3x3x3 (GPU 0)]
        (1): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (2): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (3): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (4): Parameter containing: [torch.cuda.FloatTensor of size 32x32x3x3 (GPU 0)]
        (5): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (6): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (7): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (8): Parameter containing: [torch.cuda.FloatTensor of size 32x32x3x3 (GPU 0)]
        (9): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (10): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (11): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (12): Parameter containing: [torch.cuda.FloatTensor of size 32x32x3x3 (GPU 0)]
        (13): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (14): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (15): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (16): Parameter containing: [torch.cuda.FloatTensor of size 6x800 (GPU 0)]
        (17): Parameter containing: [torch.cuda.FloatTensor of size 6 (GPU 0)]
    )
    (vars_bn): ParameterList(
        (0): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (1): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (2): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (3): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (4): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (5): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (6): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
        (7): Parameter containing: [torch.cuda.FloatTensor of size 32 (GPU 0)]
    )
  )
)
Total trainable tensors: 33702
shuffle DB :train, b:10000, 6-way, 5-shot, 15-query, resize:84
--loading data from: data/pathvqa_maml/t0/train
Traceback (most recent call last):
  File "pathVQA_maml_train.py", line 133, in <module>
    main(args)
  File "pathVQA_maml_train.py", line 68, in main
    batchsz=10000, resize=args.imgsz, t = args.t_dst)
  File "/home/wanghao/Code/VQA/MICCAI21_MMQ/mmq_maml/pathVQA_maml.py", line 72, in __init__
    self.img2label['x'] = i + 1 + self.startidx
UnboundLocalError: local variable 'i' referenced before assignment
Traceback (most recent call last):
  File "pathVQA_maml_half.py", line 224, in <module>
    main(args)
  File "pathVQA_maml_half.py", line 136, in main
    maml.load_state_dict(torch.load(model_path))
  File "/home/zhhliu/anaconda3/envs/MMQ/lib/python3.6/site-packages/torch/serialization.py", line 356, in load
    f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'saved_models/maml84_miccai2021_optimization_newmethod_6way_5shot_t0/model_epoch0.pth'
Traceback (most recent call last):
  File "pathVQA_maml_train.py", line 133, in <module>
    main(args)
  File "pathVQA_maml_train.py", line 68, in main
    batchsz=10000, resize=args.imgsz, t = args.t_dst)
  File "/home/wanghao/Code/VQA/MICCAI21_MMQ/mmq_maml/pathVQA_maml.py", line 72, in __init__
    self.img2label['x'] = i + 1 + self.startidx
UnboundLocalError: local variable 'i' referenced before assignment
Traceback (most recent call last):
  File "pathVQA_maml_half.py", line 224, in <module>
    main(args)
  File "pathVQA_maml_half.py", line 136, in main
    maml.load_state_dict(torch.load(model_path))
  File "/home/zhhliu/anaconda3/envs/MMQ/lib/python3.6/site-packages/torch/serialization.py", line 356, in load
    f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'saved_models/maml84_miccai2021_optimization_newmethod_6way_5shot_t1/model_epoch0.pth'
Traceback (most recent call last):
  File "pathVQA_maml_train.py", line 133, in <module>
    main(args)
  File "pathVQA_maml_train.py", line 68, in main
    batchsz=10000, resize=args.imgsz, t = args.t_dst)
  File "/home/wanghao/Code/VQA/MICCAI21_MMQ/mmq_maml/pathVQA_maml.py", line 72, in __init__
    self.img2label['x'] = i + 1 + self.startidx
UnboundLocalError: local variable 'i' referenced before assignment
Traceback (most recent call last):
  File "pathVQA_maml_half.py", line 224, in <module>
    main(args)
  File "pathVQA_maml_half.py", line 136, in main
    maml.load_state_dict(torch.load(model_path))
  File "/home/zhhliu/anaconda3/envs/MMQ/lib/python3.6/site-packages/torch/serialization.py", line 356, in load
    f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'saved_models/maml84_miccai2021_optimization_newmethod_6way_5shot_t2/model_epoch0.pth'
Traceback (most recent call last):
  File "pathVQA_maml_train.py", line 133, in <module>
    main(args)
  File "pathVQA_maml_train.py", line 68, in main
    batchsz=10000, resize=args.imgsz, t = args.t_dst)
  File "/home/wanghao/Code/VQA/MICCAI21_MMQ/mmq_maml/pathVQA_maml.py", line 72, in __init__
    self.img2label['x'] = i + 1 + self.startidx
UnboundLocalError: local variable 'i' referenced before assignment
Traceback (most recent call last):
  File "pathVQA_maml_half.py", line 224, in <module>
    main(args)
  File "pathVQA_maml_half.py", line 136, in main
    maml.load_state_dict(torch.load(model_path))
  File "/home/zhhliu/anaconda3/envs/MMQ/lib/python3.6/site-packages/torch/serialization.py", line 356, in load
    f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'saved_models/maml84_miccai2021_optimization_newmethod_6way_5shot_t3/model_epoch0.pth'
Traceback (most recent call last):
  File "pathVQA_maml_train.py", line 133, in <module>
    main(args)
  File "pathVQA_maml_train.py", line 68, in main
    batchsz=10000, resize=args.imgsz, t = args.t_dst)
  File "/home/wanghao/Code/VQA/MICCAI21_MMQ/mmq_maml/pathVQA_maml.py", line 72, in __init__
    self.img2label['x'] = i + 1 + self.startidx
UnboundLocalError: local variable 'i' referenced before assignment
Traceback (most recent call last):
  File "pathVQA_maml_half.py", line 224, in <module>
    main(args)
  File "pathVQA_maml_half.py", line 136, in main
    maml.load_state_dict(torch.load(model_path))
  File "/home/zhhliu/anaconda3/envs/MMQ/lib/python3.6/site-packages/torch/serialization.py", line 356, in load
    f = open(f, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'saved_models/maml84_miccai2021_optimization_newmethod_6way_5shot_t4/model_epoch0.pth'
Traceback (most recent call last):
  File "pathVQA_maml_train.py", line 133, in <module>
    main(args)
  File "pathVQA_maml_train.py", line 68, in main
    batchsz=10000, resize=args.imgsz, t = args.t_dst)
  File "/home/wanghao/Code/VQA/MICCAI21_MMQ/mmq_maml/pathVQA_maml.py", line 72, in __init__
    self.img2label['x'] = i + 1 + self.startidx
UnboundLocalError: local variable 'i' referenced before assignment
Traceback (most recent call last):
  File "pathVQA_maml_fuse.py", line 175, in <module>
    main(args)
  File "pathVQA_maml_fuse.py", line 137, in main
    batchsz=600, resize=args.imgsz)
  File "/home/wanghao/Code/VQA/MICCAI21_MMQ/mmq_maml/pathVQA_maml.py", line 72, in __init__
    self.img2label['x'] = i + 1 + self.startidx
UnboundLocalError: local variable 'i' referenced before assignment
run_pathVQA.sh: line 29: Namespace(data='data/pathvqa_maml/',: No such file or directory

And I suggest that you could write down your python version so that I could create the right edition, I tried python 3.8, it failed, and then I tried python 3.6, it could run but report error.

Hi Hao Wang,
I tried running it a few times and didn't find any problems. Please make sure you followed the instructions correctly, specially the "data preprocessing step".

Sincerely!