pytorch-semseg
pytorch-semseg copied to clipboard
TypeError: string indices must be integers, not str when run test.py
Hello, When I run test.py, I get the following error:
Traceback (most recent call last):
File "/home/ubuntu/pytorch-semseg/test.py", line 170, in <module>
test(args)
File "/home/ubuntu/pytorch-semseg/test.py", line 67, in test
model = get_model(model_name, n_classes, version=args.dataset)
File "/home/ubuntu/pytorch-semseg/ptsemseg/models/__init__.py", line 14, in get_model
name = model_dict['arch']
TypeError: string indices must be integers, not str
How to solve the problem? Thank you for your help.
@henry678 the code change in this PR fixed this problem for me https://github.com/meetshah1995/pytorch-semseg/pull/133
Your code did not fix anything. Where is the dictionary that we are supposed to pass in? Is it supposed to come from a file?
Your code did not fix anything. Where is the dictionary that we are supposed to pass in? Is it supposed to come from a file?
@johnathanchiu @henry678 there are some changes to be made in test.py to make it run. The error here states that get_model function accepts a dict, but the input is the name of the model which is a string. Change it accordingly like in train.py or validate.py. Then you will be able to run it.