Search code examples
bounding-boxyolodarkflow

Change Bounding Box thickness in YOLO Darkflow


i am playing arround with the YOLO darkflow (https://github.com/thtrieu/darkflow) and I want to know how to Change the bounding box thickness of the predicted objects.

I use the following command to test a video

flow --model cfg/yolo-new.cfg --load bin/yolo-new.weights --demo videofile.avi

Actually the bounding boxes are too thick. When there are many objects on the image, i see only bounding boxes and no objects. So I want to know how to make the boxes thinner, eg 1 or 2 Pixels thick only.

Thank you :)


Solution

  • EDIT

    For darflow: Change following line in file predict.py in yolo and yolo2

    cv2.rectangle(imgcv,(left, top), (right, bot),self.meta['colors'][max_indx], thick)
    

    to

    cv2.rectangle(imgcv,(left, top), (right, bot),self.meta['colors'][max_indx], 1)
    

    For darknet: You have to change thickness of the box manually. So, search for following line in image.c file

    cvRectangle(show_img, pt1, pt2, color, width, 8, 0);
    

    and change 5th parameter width with pixel value

    for example, if you want 1px box then

    cvRectangle(show_img, pt1, pt2, color, 1, 8, 0);