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

export_model.py ONNX gives a model that does not work #5431

Open
enislalmi opened this issue Jan 30, 2025 · 1 comment
Open

export_model.py ONNX gives a model that does not work #5431

enislalmi opened this issue Jan 30, 2025 · 1 comment

Comments

@enislalmi
Copy link

Instructions To Reproduce the 🐛 Bug:

  1. Full runnable code or full changes you made:
    No changes.

  2. What exact command you run:
    python detectron2/tools/deploy/export_model.py --config-file Detectron2/detectron2/configs/COCO-Detection/retinanet_R_101_FPN_3x.yaml --output ./output --export-method tracing --format onnx --sample-image image_1.bmp MODEL.DEVICE cuda MODEL.WEIGHTS Detectron2/output_object_detection/model_final.pth

  3. Full logs or other relevant observations:```
    TracerWarning: Converting a tensor to a Python boolean might cause the trace to be incorrect. We can't record the data flow of Python values, so this value will be treated as a constant in the future. This means that the trace might not generalize to other inputs!
    assert tensor.dim() == 2 and tensor.size(-1) == 4, tensor.size()
    ============= Diagnostic Run torch.onnx.export version 2.0.0+cu117 =============
    verbose: False, log level: Level.ERROR
    ======================= 0 NONE 0 NOTE 0 WARNING 0 ERROR ========================

[01/30 14:29:26 detectron2]: Inputs schema: TupleSchema(schemas=[ListSchema(schemas=[DictSchema(schemas=[IdentitySchema()], sizes=[1], keys=['image'])], sizes=[1])], sizes=[1])
[01/30 14:29:26 detectron2]: Outputs schema: ListSchema(schemas=[DictSchema(schemas=[InstancesSchema(schemas=[TensorWrapSchema(class_name='detectron2.structures.Boxes'), IdentitySchema(), IdentitySchema()], sizes=[1, 1, 1], keys=['pred_boxes', 'pred_classes', 'scores'])], sizes=[4], keys=['instances'])], sizes=[4])
[01/30 14:29:26 detectron2]: Success.

  1. please simplify the steps as much as possible so they do not require additional resources to

Expected behavior:

After running the conversion command to ONNX, to have a ONNX that is able to find the same boxes as the .pt does per the same image. The ONNX does not find any boxes.

Environment:

Everything has been done following this:
https://colab.research.google.com/github/mashyko/object_detection/blob/master/Detectron2_Tutorial.ipynb

@enislalmi
Copy link
Author

@thiagocrepaldi I also followed your tutorial, pr and open issues, any idea?

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

1 participant