tinyvision / DAMO-YOLO

DAMO-YOLO: a fast and accurate object detection method with some new techs, including NAS backbones, efficient RepGFPN, ZeroHead, AlignedOTA, and distillation enhancement.
Apache License 2.0
3.78k stars 476 forks source link

[bug fix] pass parameters explicitly in transform_img to avoid prarameter missing error #83

Closed mucunwuxian closed 1 year ago

mucunwuxian commented 1 year ago

Thank you for your great work.

I made a little fix for a bug that seems to be caused by the addition of keep_ratio. What do you think?

The error is below.

2023-03-01 09:33:22.532 | ERROR    | __main__:<module>:360 - An error has been caught in function '<module>', process 'MainProcess' (5257), thread 'MainThread' (140704481396928):
Traceback (most recent call last):

> File "tools/demo.py", line 360, in <module>
    main()
    └ <function main at 0x7f84c06e5160>

  File "tools/demo.py", line 344, in main
    bboxes, scores, cls_inds = infer_engine.forward(frame)
                               │            │       └ array([[[ 12,  19,  20],
                               │            │                 [ 13,  18,  20],
                               │            │                 [ 14,  18,  20],
                               │            │                 ...,
                               │            │                 [128, 112,  96],
                               │            │                 [125...
                               │            └ <function Infer.forward at 0x7f84c06e2f70>
                               └ <__main__.Infer object at 0x7f84c06c59d0>

  File "tools/demo.py", line 233, in forward
    image, ratio = self.preprocess(image)
    │              │    │          └ array([[[ 12,  19,  20],
    │              │    │                    [ 13,  18,  20],
    │              │    │                    [ 14,  18,  20],
    │              │    │                    ...,
    │              │    │                    [128, 112,  96],
    │              │    │                    [125...
    │              │    └ <function Infer.preprocess at 0x7f84c06e2e50>
    │              └ <__main__.Infer object at 0x7f84c06c59d0>
    └ array([[[ 12,  19,  20],
              [ 13,  18,  20],
              [ 14,  18,  20],
              ...,
              [128, 112,  96],
              [125...

  File "tools/demo.py", line 166, in preprocess
    img = transform_img(origin_img, 0,
          │             └ array([[[ 12,  19,  20],
          │                       [ 13,  18,  20],
          │                       [ 14,  18,  20],
          │                       ...,
          │                       [128, 112,  96],
          │                       [125...
          └ <function transform_img at 0x7f84e02ab9d0>

TypeError: transform_img() got an unexpected keyword argument 'keep_ratio'

best regards, :-D

XianzheXu commented 1 year ago

Thanks for your feedback, we will verify your modification and merge it later. Thanks again!