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

Bounding box color #1120

Closed
joel5638 opened this issue May 1, 2020 · 8 comments
Closed

Bounding box color #1120

joel5638 opened this issue May 1, 2020 · 8 comments
Labels
Stale Stale and schedule for closing soon

Comments

@joel5638
Copy link

joel5638 commented May 1, 2020

How can we change the bounding box colors? I get different colors everytime. Can I have them with fixed colors?

@joel5638 joel5638 added the bug Something isn't working label May 1, 2020
@glenn-jocher
Copy link
Member

@joel5638 which boxes are you referring to?

You may want to git pull, we recently updated some plotting functions. See #1114

@glenn-jocher glenn-jocher removed the bug Something isn't working label May 1, 2020
@glenn-jocher
Copy link
Member

@joel5638 ah you mean using detect.py. Sure, the colors are here:

yolov3/detect.py

Lines 73 to 76 in be87b41

# Get names and colors
names = load_classes(opt.names)
colors = [[random.randint(0, 255) for _ in range(3)] for _ in range(len(names))]

@glenn-jocher
Copy link
Member

@joel5638 btw, you should update your code, as multi-label is now False by default when NMS is called through detect.py. This means you won't get duplicate labels for the same box, as in your car truck example.

@joel5638
Copy link
Author

joel5638 commented May 1, 2020

@glenn-jocher perfect. Thank you so much.
Can you also tell me about image size? I posted a question yesterday.
I have few different sized images to test.
But with detect.py — img-size 608 works perfect for me. But i dont want to pass the argument all the time instead i want resize all the images to 608 in detect.py to test. How can i change that?

@glenn-jocher
Copy link
Member

@joel5638 just modify the argparser defaults:

yolov3/detect.py

Lines 167 to 185 in be87b41

parser = argparse.ArgumentParser()
parser.add_argument('--cfg', type=str, default='cfg/yolov3-spp.cfg', help='*.cfg path')
parser.add_argument('--names', type=str, default='data/coco.names', help='*.names path')
parser.add_argument('--weights', type=str, default='weights/yolov3-spp-ultralytics.pt', help='weights path')
parser.add_argument('--source', type=str, default='data/samples', help='source') # input file/folder, 0 for webcam
parser.add_argument('--output', type=str, default='output', help='output folder') # output folder
parser.add_argument('--img-size', type=int, default=512, help='inference size (pixels)')
parser.add_argument('--conf-thres', type=float, default=0.3, help='object confidence threshold')
parser.add_argument('--iou-thres', type=float, default=0.6, help='IOU threshold for NMS')
parser.add_argument('--fourcc', type=str, default='mp4v', help='output video codec (verify ffmpeg support)')
parser.add_argument('--half', action='store_true', help='half precision FP16 inference')
parser.add_argument('--device', default='', help='device id (i.e. 0 or 0,1) or cpu')
parser.add_argument('--view-img', action='store_true', help='display results')
parser.add_argument('--save-txt', action='store_true', help='save results to *.txt')
parser.add_argument('--classes', nargs='+', type=int, help='filter by class')
parser.add_argument('--agnostic-nms', action='store_true', help='class-agnostic NMS')
parser.add_argument('--augment', action='store_true', help='augmented inference')
opt = parser.parse_args()
print(opt)

@joel5638
Copy link
Author

joel5638 commented May 1, 2020

@glenn-jocher i tried that. I changed it to 608. But the results are different than earlier. Its different when passing the argument and not passing

@glenn-jocher
Copy link
Member

@joel5638 no, its not different. The argparser literally handles the arguments. It doesn't get any simpler.

@github-actions
Copy link

github-actions bot commented Jun 2, 2020

This issue is stale because it has been open 30 days with no activity. Remove Stale label or comment or this will be closed in 5 days.

@github-actions github-actions bot added the Stale Stale and schedule for closing soon label Jun 2, 2020
@github-actions github-actions bot closed this as completed Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale Stale and schedule for closing soon
Projects
None yet
Development

No branches or pull requests

2 participants