Megvii-BaseDetection / Megvii-BaseDetection/YOLOX

webcam-------------------> export PYTHONIOENCODING=utf-8;python tools/demo.py webcam ....--conf 0.25 --nms 0.45 --tsize 640 --save_result --device gpu

Open
#1,489 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
10.6k
Forks
2.5k
PR merge metrics
No merged PRs in 30d

Description

Traceback (most recent call last):
File "/data/my_cv/YOLOX/tools/demo.py", line 306, in
main(exp, args)
File "/data/my_cv/YOLOX/tools/demo.py", line 274, in main
model.load_state_dict(ckpt["model"])
File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1224, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for YOLOX:
size mismatch for head.cls_preds.0.weight: copying a param with shape torch.Size([80, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([20, 128, 1, 1]).
size mismatch for head.cls_preds.0.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([20]).
size mismatch for head.cls_preds.1.weight: copying a param with shape torch.Size([80, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([20, 128, 1, 1]).
size mismatch for head.cls_preds.1.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([20]).
size mismatch for head.cls_preds.2.weight: copying a param with shape torch.Size([80, 128, 1, 1]) from checkpoint, the shape in current model is torch.Size([20, 128, 1, 1]).
size mismatch for head.cls_preds.2.bias: copying a param with shape torch.Size([80]) from checkpoint, the shape in current model is torch.Size([20]).

while True:
        ret_val, frame = cap.read()
        if ret_val:
            outputs, img_info = predictor.inference(frame)
            result_frame, _ = predictor.visual(outputs[0], img_info, predictor.confthre)
            cv2.imshow("det2022",result_frame)
            if args.save_result:
                vid_writer.write(result_frame)
            ch = cv2.waitKey(1)
            if ch == 27 or ch == ord("q") or ch == ord("Q"):
                break
        else:
            break


Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in tools/demo.py at the model.load_state_dict call and reproduce the supplied webcam command. Inspect how the experiment and checkpoint are selected, then verify that their class counts agree so loading completes and webcam inference starts successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
computer-vision, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.