如何修改YOLO Darkflow中预测目标的边界框厚度?
Hey there, let's fix that thick bounding box issue right away! Here's exactly what you need to do:
Locate the drawing utility file
Navigate to your Darkflow project directory and open uputils/draw.py— this is where all the bounding box rendering logic lives.Find the rectangle drawing line
Look for the line that usescv2.rectangleto draw the box around detected objects. It should look something like this:cv2.rectangle(img, (x1, y1), (x2, y2), color, 3)The last parameter (
3here) controls the thickness of the box.Adjust the thickness value
Change that number to1or2depending on how thin you want the box to be. So the line becomes:cv2.rectangle(img, (x1, y1), (x2, y2), color, 1)or
cv2.rectangle(img, (x1, y1), (x2, y2), color, 2)Save the file and re-run your command
Once you've made the change, save thedraw.pyfile, then run your original demo command again:--model cfg/yolo-new.cfg --load bin/yolo-new.weights --demo videofile.avi
If you don't see the change take effect immediately, double-check that you're modifying the draw.py file in the exact Darkflow instance you're running (e.g., if you installed it via pip, you might need to find the site-packages directory instead of your cloned repo).
内容的提问来源于stack exchange,提问作者HKC72

