softened-similarity-learning
softened-similarity-learning copied to clipboard
Train.py
I'm sorry to bother you to consult a low-level question. There is a code in line 25 like this: train_loader, memory_table = load_data(config['Train Data']) I think you want to use configparser to read the parameters. But when I run this programm it send a Traceback to me without saying anything. I know it's low-level, but I really can't solve it myself. I express my highest thanks to you.
Hi, could you show me traceback?
Also, please don't hold back asking any questions you have, I'll try to answer them all.
Hi, could you show me traceback?
Also, please don't hold back asking any questions you have, I'll try to answer them all.
Sure.
Traceback (most recent call last): File "train.py", line 217, in main() File "train.py", line 25, in main train_loader, memory_table = load_data(config['Train Data']) File "D:\miniconda\envs\py37\lib\configparser.py", line 958, in getitem raise KeyError(key) KeyError: 'Train Data'
Thanks. You are really kind.
It seems that python cannot find the config group 'Train Data' in your config file. It looks like this.
[Train Data]
path=Market-1501-v15.09.15
batch_size=8
memory_vectors_path=memory_table/vectors.pth
memory_parts_path=memory_table/parts.pth
memory_cameras_path=memory_table/cameras.pth
lambda_c=0.02
lambda_p=0.5
reliable_num=4
Please make sure the 'Train Data' config group is in the config file and run the command again
If you're still not sure put these lines in the train.py file after the the config has been loaded to see if the necessary configurations are present
for key in config:
print(key)
It seems that python cannot find the config group 'Train Data' in your config file. It looks like this.
[Train Data] path=Market-1501-v15.09.15 batch_size=8 memory_vectors_path=memory_table/vectors.pth memory_parts_path=memory_table/parts.pth memory_cameras_path=memory_table/cameras.pth lambda_c=0.02 lambda_p=0.5 reliable_num=4
Please make sure the 'Train Data' config group is in the config file and run the command again
If you're still not sure put these lines in the train.py file after the the config has been loaded to see if the necessary configurations are present
for key in config: print(key)
Yes. 'Train Data' is still in my config file. It's like this:
[Train Data]
#prtrained=
path=D:\Workspace\Datasets\Market-1501-v15.09.15
...
I've added this code to the program, and it returned 'DEFAULT'
DEFAULT
Traceback (most recent call last):
File "train.py", line 218, in <module>
main()
File "train.py", line 27, in main
train_loader, memory_table = load_data(config['Train Data'])
File "D:\miniconda\envs\py37\lib\configparser.py", line 958, in __getitem__
raise KeyError(key)
KeyError: 'Train Data'
Thank you for your help and patience
Apparently, configparser seemed to have failed to read the config file, most likely because the path was wrong (configparser won't tell you whether or not the file is valid or even exists). Please check the path of the config file again to make sure that the path is correct or try running the script with absolute path just to be sure.
Apparently, configparser seemed to have failed to read the config file, most likely because the path was wrong (configparser won't tell you whether or not the file is valid or even exists). Please check the path of the config file again to make sure that the path is correct or try running the script with absolute path just to be sure.
Your suggestion reminds me. Thank you. I changed
config.read(args.config)
with
config.read('config.ini')
And then the program works.
Thank you again for your program, your patience and your enthusiasm.