devrimcavusoglu/pybboxes

I am getting wrong boxes values when converting from YOLO to VOC.

kadirnar opened this issue · 2 comments

Hi @devrimcavusoglu ,

I added the yolov7 model to the SAHI library. I am using scale_coords function for Boxes transforms. But I want to use the pybboxes library.

Scale_Coords:
https://github.com/kadirnar/Yolov7-SAHI/blob/main/model.py#L1140

Pybboxes:
https://github.com/kadirnar/Yolov7-SAHI/blob/main/model.py#L1143

Scale_Coords Output:
https://github.com/kadirnar/Yolov7-SAHI/blob/main/demo_data/yolov7_bbox.png

[923, 1233, 1009, 1319]

Pybboxes Output:
https://github.com/kadirnar/Yolov7-SAHI/blob/main/demo_data/pybboxes.png

(158, 316, 172, 338)

@kadirnar Can you please provide the source box (YOLO) for this VOC Box (158, 316, 172, 338) ? What was the input YOLO box ?

Provide:

  • Input YOLO Box:
  • Image Size (w x h):

I fixed the error. I was giving the manual img_size. When I gave the image_size values of the picture, the boxes values were fixed.

pbx.convert_bbox(xywh, from_type="yolo", to_type="voc", image_size=(self.im0s.shape[1],self.im0s.shape[0])) 

You can develop a module instead of manually entering its value.
Example Code:

img = cv2.imread('data/file.jpg')
image_size = (img.shape[1], img.shape[0])
pbx.convert_bbox(xywh, from_type="yolo", to_type="voc", image_size=image_size.shape[1],image_size.shape[0])) 

You can close the issue.