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

YOLOv7 Demo flips the Red and Blue channels on inference #323

Open
elijah-utopia opened this issue Jul 5, 2024 · 0 comments
Open

YOLOv7 Demo flips the Red and Blue channels on inference #323

elijah-utopia opened this issue Jul 5, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@elijah-utopia
Copy link

The Video class that reads from a variety of image sources and returns "regular OpenCV frames" seems to return frames in the BGR format when the model autoshape function interprets at RGB frames.

It seems the expected behavior for python autoshape is that cv images are meant to have their channels already flipped
https://github.com/ultralytics/yolov5/blob/30e4c4f09297b67afedf8b2bcd851833ddc9dead/models/common.py#L243-L252

This is a model trained to recognize red rovers as targets and blue rovers as allies
trained model with test images
This is what happens with the yolov7 norfair tracker demo
not working
This is what happens with the demo modified with reversing the channels

        yolo_detections = model(
            frame[:,:,::-1], # convert from cv format BGR to np format RGB
            conf_threshold=args.conf_threshold,
            iou_threshold=args.iou_threshold,
            image_size=args.img_size,
            classes=args.classes,
        )

working, with flip

Environment :

  • OS: Ubuntu 20.04
  • Python version: 3.8.10
  • Norfair version: commit 009a1b1 (master branch as of July 5, 2024)
@elijah-utopia elijah-utopia added the bug Something isn't working label Jul 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant