pytorch-semseg
pytorch-semseg copied to clipboard
get_model line in test.py
I have a question about line 67 in test.py:
model = get_model(model_name, n_classes, version=args.dataset)
model_name is a string but the first argument in get_model is a dict so the code raises an exception here.
Am I missing something?
https://github.com/meetshah1995/pytorch-semseg/blob/81997cd5af36759773a67b11cf148d3876b13a69/ptsemseg/models/init.py#L14
this line gets the model name from dict, and use _get_model_instance
get an instance of the arch you want to use, what's your error?
Thanks for your response. The problem is that get_model is being passed a string, not a dict, as the first argument in line 67 of test.py.
oh, I get it, maybe you could add if ... else
in get_model
function to solve this error,such as;
if isinstance(model_dict,str):
model = _get_model_instance(model_dict)
else:
name = model_dict['arch']
model = _get_model_instance(name)
if isinstance(model_dict,str): model = _get_model_instance(model_dict) else: name = model_dict['arch'] model = _get_model_instance(name)
This wont help because later we use it again as a dictionary
#131 check this issue. It has been answered here @serge-m @3bobo @david-bernstein