WangXin93 / fashion_compatibility_mcn

Outfit Compatibility Prediction and Diagnosis with Multi-Layered Comparison Network
MIT License
82 stars 31 forks source link

Issue in polyvore dataset trained model #5

Open ajinkya933 opened 3 years ago

ajinkya933 commented 3 years ago

I am able to train model from polyvore dataset, and after training when I run diagnosis.ipynb I get this error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-14-59c7a44be6c0> in <module>
     10 
     11 # Step 2: show diagnosis results
---> 12 relation, out = defect_detect(x, model)
     13 relation = relation.squeeze().cpu().data
     14 show_rela_diagnosis(relation, select, cmap=plt.cm.Blues)

<ipython-input-8-e1c436475b1a> in defect_detect(img, model, normalize)
     31 
     32     if normalize:
---> 33         relation = relation / (relation.max() - relation.min())
     34     relation += 1e-3
     35     return relation, out.item()

AttributeError: 'NoneType' object has no attribute 'max'

Why is this error ?

WangXin93 commented 3 years ago

This problem can be solved by change the following lines in the function defect_detect, or directly use the latest version of code.

for name, module in model.named_modules():
    if name == 'predictor.0':
        module.register_backward_hook(func_r)

the reason is the previous name fc1 is no longer used, new model use predictor as the new name. The hook function cannot work if it cannot find the specific layer.

hyyuan123 commented 2 years ago

@ajinkya933 Hello, would you like to ask if the polyvore-images.tar.gz data file can provide Baidu Cloud link? It won't open on github.

WangXin93 commented 2 years ago

Duplicate of #8

@ajinkya933 Hello, would you like to ask if the polyvore-images.tar.gz data file can provide Baidu Cloud link? It won't open on github.