Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: operands could not be broadcast together with shapes (133,) (17,) #777

Closed
deep-practice opened this issue Jan 5, 2021 · 5 comments

Comments

@deep-practice
Copy link

deep-practice commented Jan 5, 2021

############# Starting Epoch 0 | LR: 0.001 #############
loss: 6.28594531 | acc: 0.6746: 100%|████████████████████████████████████████████████████████████████████████████████| 3122/3122 [16:03<00:00, 3.24it/s]
Train-0 epoch | loss:6.28594531 | acc:0.6746
loading annotations into memory...
Done (t=0.89s)
creating index...
index created!
100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 318/318 [00:57<00:00, 5.52it/s]
Traceback (most recent call last):
File "./scripts/train.py", line 267, in
main()
File "./scripts/train.py", line 224, in main
gt_AP = validate_gt(m.module, opt, cfg, heatmap_to_coord)
File "./scripts/train.py", line 172, in validate_gt
res = evaluate_mAP(os.path.join(opt.work_dir, 'test_gt_kpt.json'), ann_type='keypoints', ann_file=os.path.join(cfg.DATASET.VAL.ROOT, cfg.DATASET.VAL.ANN))
File "/home/work/deep_learning/AlphaPose/alphapose/utils/metrics.py", line 99, in evaluate_mAP
cocoEval.evaluate()
File "/home/work/.local/lib/python3.6/site-packages/pycocotools-2.0.0-py3.6-linux-x86_64.egg/pycocotools/cocoeval.py", line 150, in evaluate
for imgId in p.imgIds
File "/home/work/.local/lib/python3.6/site-packages/pycocotools-2.0.0-py3.6-linux-x86_64.egg/pycocotools/cocoeval.py", line 151, in
for catId in catIds}
File "/home/work/.local/lib/python3.6/site-packages/pycocotools-2.0.0-py3.6-linux-x86_64.egg/pycocotools/cocoeval.py", line 223, in computeOks
dx = xd - xg
ValueError: operands could not be broadcast together with shapes (133,) (17,)
Exception ignored in: <alphapose.utils.metrics.evaluate_mAP..NullWriter object at 0x7fc8dd641908>
AttributeError: 'NullWriter' object has no attribute 'flush'

@Fang-Haoshu
Copy link
Member

are you trying to train the coco wholebody? you need to change your pycocotools

@deep-practice
Copy link
Author

Yes.I'm trainning coco wholebody.
Can you give some hints on how to change pycocotools?

@sid0407
Copy link

sid0407 commented Jan 26, 2021

I am getting the same error. Please tell me how did you correct this error?

@oreo-lp
Copy link

oreo-lp commented Apr 26, 2021

I am getting the same error. Please tell me how did you correct this error?

Hi, I have solved this problem, i reinstall numpy == 1.17.4, my cuda == 11.1, and python == 1.8

@Ostyk
Copy link

Ostyk commented Dec 1, 2022

Basically you have to fork the repo and change this line https://github.com/cocodataset/cocoapi/blob/8c9bcc3cf640524c4c20a9c40e89cb6a2f2fa0e9/PythonAPI/pycocotools/cocoeval.py#L523

It seems to be hardcoded to 17 and you cannot pass this as a parameter

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

No branches or pull requests

5 participants