Unable to run demo test_attr_predictor
mulunur opened this issue · 1 comments
mulunur commented
Hello everyone. With great difficulty, I was able to figure out (thanks to the issues section) the structure of this library.
I want to run demo. This is my command:
python3 demo/test_attr_predictor.py --input demo/imgs/attr_pred_demo1.jpg --checkpoint checkpoint/landmark_pooling/latest.pth --config configs/attribute_predict/global_predictor_vgg_attr.py
I get this error:
warnings.warn(
load checkpoint from local path: checkpoint/landmark_pooling/latest.pth
[ Top3 Attribute Prediction ]
Traceback (most recent call last):
File "/Users/mulunur/Documents/универ/диплом/mmfashion/demo/test_attr_predictor.py", line 62, in <module>
main()
File "/Users/mulunur/Documents/универ/диплом/mmfashion/demo/test_attr_predictor.py", line 58, in main
attr_predictor.show_prediction(attr_prob)
File "/Library/Python/3.9/site-packages/mmfashion-0.4.0-py3.9.egg/mmfashion/core/evaluation/attr_predict_demo.py", line 40, in show_prediction
self.print_attr_name(idxes)
File "/Library/Python/3.9/site-packages/mmfashion-0.4.0-py3.9.egg/mmfashion/core/evaluation/attr_predict_demo.py", line 25, in print_attr_name
print(self.attr_idx2name[idx])
KeyError: 730
If in previous command I try to change checkpoint from landmark pooling to global, then I get another error:
warnings.warn(
load checkpoint from local path: checkpoint/latest.pth
The model and loaded state dict do not match exactly
unexpected key in source state_dict: roi_pool.linear.0.weight, roi_pool.linear.0.bias, concat.fc_fusion.weight, concat.fc_fusion.bias
[ Top3 Attribute Prediction ]
Traceback (most recent call last):
File "/Users/mulunur/Documents/универ/диплом/mmfashion/demo/test_attr_predictor.py", line 62, in <module>
main()
File "/Users/mulunur/Documents/универ/диплом/mmfashion/demo/test_attr_predictor.py", line 58, in main
attr_predictor.show_prediction(attr_prob)
File "/Library/Python/3.9/site-packages/mmfashion-0.4.0-py3.9.egg/mmfashion/core/evaluation/attr_predict_demo.py", line 40, in show_prediction
self.print_attr_name(idxes)
File "/Library/Python/3.9/site-packages/mmfashion-0.4.0-py3.9.egg/mmfashion/core/evaluation/attr_predict_demo.py", line 25, in print_attr_name
print(self.attr_idx2name[idx])
KeyError: 836
I tried to prepare the data, downloaded Attr_Predict and used Anno_fine folder, but renamed it to Anno, because data/prepare_attr_pred.py
file had code like PREFIX = 'Attr_Predict/Anno'
. In #146 question it was said that if you use the Anno_fine, then you do not need to run the prepare script.
Anyway, I tried to run prepare_attr_pred.py, get this error:
File "/Users/mulunur/Documents/универ/диплом/mmfashion/data/prepare_attr_pred.py", line 172, in <module>
split_img()
File "/Users/mulunur/Documents/универ/диплом/mmfashion/data/prepare_attr_pred.py", line 8, in split_img
wf1 = open(os.path.join(PREFIX, 'train.txt'), 'w')
FileNotFoundError: [Errno 2] No such file or directory: 'Attr_Predict/Anno/train.txt'
mulunur@192 data % python3 prepare_attr_pred.py
Traceback (most recent call last):
File "/Users/mulunur/Documents/универ/диплом/mmfashion/data/prepare_attr_pred.py", line 177, in <module>
split_attribute(train_img, test_img, val_img)
File "/Users/mulunur/Documents/универ/диплом/mmfashion/data/prepare_attr_pred.py", line 58, in split_attribute
write_attr(train_img, wf1)
File "/Users/mulunur/Documents/универ/диплом/mmfashion/data/prepare_attr_pred.py", line 52, in write_attr
attr = attributes[imgname]
KeyError: 'img/Sheer_Pleated-Front_Blouse/img_00000001.jpg'
Can you please help me, what am I doing wrong? 🥺