Skip to content
This repository has been archived by the owner on Nov 21, 2023. It is now read-only.

AssertionError: #590

Closed
elfpattern opened this issue Jul 26, 2018 · 3 comments
Closed

AssertionError: #590

elfpattern opened this issue Jul 26, 2018 · 3 comments

Comments

@elfpattern
Copy link

Expected results

Running

Actual results

Workspace blob cls_score_w with shape (21, 2048) does not match weights file shape (81, 2048)

Detailed steps to reproduce

E.g.:

 python tools/train_net.py --cfg /root/Detectron/tmp/e2e_faster_rcnn_R-50-C4_1x.yaml OUTPUT_DIR tmp/det

System information

  • Operating system: Ubuntu
  • Compiler version: caffe2
  • CUDA version: 9
  • cuDNN version: 7
  • NVIDIA driver version: Titanx
  • GPU models (for all devices if they are not all the same): ?
  • PYTHONPATH environment variable: /root/anaconda
  • python --version output: 2.7
  • Anything else that seems relevant: ?
@zeenolife
Copy link

You've probably set the NUM_CLASSES: 21 in your config file, whereas you weights file has 81 classes. One way to get around that is to just load it and delete the conflicting blobs.

import cPickle as pkl 

with open('model.pkl', 'rb') as f:
    wts = pkl.load(f)

for blob in wts['blobs'].keys():
    if blob.startswith('cls_score_') or blob.startswith('bbox_pred_'):
        del wts['blobs'][blob]

with open('new_model.pkl', 'wb') as f:
    pkl.dump(wts, f)

Hope this helps.

@elfpattern
Copy link
Author

thx have done it

@ir413 ir413 closed this as completed Jul 27, 2018
@AhmadShaik
Copy link

You've probably set the NUM_CLASSES: 21 in your config file, whereas you weights file has 81 classes. One way to get around that is to just load it and delete the conflicting blobs.

import cPickle as pkl 

with open('model.pkl', 'rb') as f:
    wts = pkl.load(f)

for blob in wts['blobs'].keys():
    if blob.startswith('cls_score_') or blob.startswith('bbox_pred_'):
        del wts['blobs'][blob]

with open('new_model.pkl', 'wb') as f:
    pkl.dump(wts, f)

Hope this helps.

In which file do I need to add this details

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants