mmfashion
mmfashion copied to clipboard
Can't run Coarse Attribute Prediction
-
Clone project
-
pip3 install scikit-build
-
python setup.py install
-
Download Coarse Attribute Pre-Trained Model File here https://drive.google.com/file/d/1bOL4GhLyBEcXgATiVcZ-g3RD8xhKsj5f/view
wget --load-cookies /tmp/cookies.txt "https://docs.google.com/uc?export=download&confirm=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate 'https://docs.google.com/uc?export=download&id=1bOL4GhLyBEcXgATiVcZ-g3RD8xhKsj5f' -O- | sed -rn 's/.*confirm=([0-9A-Za-z_]+).*/\1\n/p')&id=1bOL4GhLyBEcXgATiVcZ-g3RD8xhKsj5f" -O fine.pth && rm -rf /tmp/cookies.txt
- Download Anno_Coarse folder from here https://drive.google.com/drive/folders/0B7EVK8r0v71pWWxJeGVqMjRkUVE
Place it in the proper directory
-
python test_attr_predictor.py --checkpoint latest.pth --input test.jpg
Traceback (most recent call last):
File "test_attr_predictor.py", line 62, in <module>
main()
File "test_attr_predictor.py", line 45, in main
model = build_predictor(cfg.model)
File "/Users/alex/DeepFashion/mmfashion/mmfashion/models/builder.py", line 87, in build_predictor
return build(cfg, PREDICTOR)
File "/Users/alex/DeepFashion/mmfashion/mmfashion/models/builder.py", line 38, in build
return _build_module(cfg, registry, default_args)
File "/Users/alex/DeepFashion/mmfashion/mmfashion/models/builder.py", line 30, in _build_module
return obj_type(**args)
TypeError: __init__() got an unexpected keyword argument 'loss_attr'
- According to #86 change the
init()
method inmmfashion/mmfashion/models/predictor/global_predictor.py
and add a parameterlos_attr
def __init__(self,
backbone,
global_pool,
attr_predictor,
loss_attr, #ADDED LOSS_ATTR HERE
cate_predictor=None,
roi_pool=None,
pretrained=None):
super(GlobalPredictor, self).__init__()
self.backbone = builder.build_backbone(backbone)
self.global_pool = builder.build_global_pool(global_pool)
self.attr_predictor = builder.build_attr_predictor(attr_predictor)
self.loss_attr = builder.build_loss(loss_attr)
- Same error occurs
Traceback (most recent call last):
File "test_attr_predictor.py", line 62, in <module>
main()
File "test_attr_predictor.py", line 45, in main
model = build_predictor(cfg.model)
File "/Users/alex/DeepFashion/mmfashion/mmfashion/models/builder.py", line 87, in build_predictor
return build(cfg, PREDICTOR)
File "/Users/alex/DeepFashion/mmfashion/mmfashion/models/builder.py", line 38, in build
return _build_module(cfg, registry, default_args)
File "/Users/alex/DeepFashion/mmfashion/mmfashion/models/builder.py", line 30, in _build_module
return obj_type(**args)
TypeError: __init__() got an unexpected keyword argument 'loss_attr'
Python 3.7.7
@liuziwei7 @veralauee @hellock
Thanks for the info. I've followed the list and fixed the final issue. You have to add that 'loss_attr' to the file in the site-package rather than to the one in the current folder which is github cloned.
The output I got looks like this
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 ]
sleeve
knit
striped
[ Top5 Attribute Prediction ]
sleeve
knit
striped
stripe
denim
[ Top10 Attribute Prediction ]
sleeve
knit
striped
stripe
denim
leather
lace
maxi
shirt
wash
There's still error I hope I can figure out. Not sure if that affects the accuracy of the output.
@SikandAlex same error , did you find any solution ?
i found it ..you should add loss_attr in /usr/local/lib/python3.6/dist-packages/mmfashion-0.4.0-py3.6.egg/mmfashion/models/predictor/global_predictor.py and it'll work
I think it works but the prediction confidences are pretty low.