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

problem about running the evaluation code #1

Open
Sean0120 opened this issue Jul 9, 2022 · 1 comment
Open

problem about running the evaluation code #1

Sean0120 opened this issue Jul 9, 2022 · 1 comment

Comments

@Sean0120
Copy link

Sean0120 commented Jul 9, 2022

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
Copy link

YWQQQQQQ commented Nov 2, 2022

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))
`

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

2 participants