Acnext / Optical-Flow-For-Spiking-Camera

36 stars 3 forks source link

problem about running the evaluation code #1

Open Sean0120 opened 2 years ago

Sean0120 commented 2 years ago

Hi, Thanks for your great work. I try to run your evaluation code but I meet a problem with the scflow.py file. python3 eval.py --dt=20 --pretrained='./ckpt/dt20_e80.pth.tar' And I get the following error message: => using pre-trained model 'scflow' Traceback (most recent call last): File "/data2/sean/Optical-Flow-For-Spiking-Camera/eval.py", line 159, in <module> main() File "/data2/sean/Optical-Flow-For-Spiking-Camera/eval.py", line 144, in main model = models.__dict__[args.arch](network_data, args.batch_norm).cuda() File "/data2/sean/Optical-Flow-For-Spiking-Camera/models/scflow.py", line 177, in scflow model = scflow(batchNorm=batchNorm) File "/data2/sean/Optical-Flow-For-Spiking-Camera/models/scflow.py", line 177, in scflow model = scflow(batchNorm=batchNorm) File "/data2/sean/Optical-Flow-For-Spiking-Camera/models/scflow.py", line 177, in scflow model = scflow(batchNorm=batchNorm) [Previous line repeated 995 more times] RecursionError: maximum recursion depth exceeded Do you have any idea about this problem?

Thanks for your attention and help.

YWQQQQQQ commented 1 year ago

That's because the author uses same name 'scflow' for function and class in scflow.py. The author expects the 'scflow' function to construct the 'scflow' class but your interpreter calls the 'scflow' function instead. Simply rename the 'scflow' function into any other name such as 'build_scflow' and also modify the code in 9 line __all__ = ['scflow'] to the updated function name.

` scflow.py line 9 all = ['build_scflow']

line 176 def build_scflow(data=None, batchNorm=False): model = scflow(batchNorm=batchNorm) if data is not None: model.load_state_dict(data['state_dict']) else: model.init_weights() return model

eval.py line 26

parser.add_argument('-a', '--arch', default='build_scflow', choices=model_names, help='model architecture, overwritten if pretrained is specified: ' + ' | '.join(model_names)) `