Megvii-BaseDetection / Megvii-BaseDetection/YOLOX

model.head.decode_in_inference = False 导致torch.jit.trace之后的的输出不对

Open
#1,351 2 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

正常运行tools/demo.py,trt = False,这个时候model.head.decode_in_inference = True,能得到预期输出。
正常运行tools/export_torchscript.py,这个时候model.head.decode_in_inference = False,成功保存下来model.pt。
一:
model = torch.jit.load('model.pt')
model.eval()
trace_output = model(img)
二:
demo.py的158行
demo_outputs = self.model(img)
trace_output和demo_outputs不一样。

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 by reproducing the two inference paths described in tools/export_torchscript.py and tools/demo.py, including demo.py line 158. Compare the loaded TorchScript model's output with the demo model output while checking the different decode_in_inference settings. Done means the cause of the mismatch is identified and the two outputs agree under the intended inference path.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
machine-learning
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 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.