hello i am working on this project in YOLOv5. i want to only save the image when the boundary box is 20% or more of the total image size. i also want it to only save the detection when it is atleast 10% away from all sides of the image here is visualization of what im trying to do hope it helps https://i.stack.imgur.com/g8Ne4.png
currently i have this code that displays x1 1277 y1 641 x2 1819 y2 829 H 188 W 542 Img size : 1080 2048
x1 = int(xyxy[0].item())
y1 = int(xyxy[1].item())
x2 = int(xyxy[2].item())
y2 = int(xyxy[3].item())
print("x1 ", x1)
print("y1 ", y1)
print("x2 ", x2)
print("y2 ", y2)
# Bounding box size (Alternativt så kan du bruke xywh objektet)
w = x2 - x1
h = y2 - y1
print("H ", h)
print("W ",w)
# Image size
height, width, channels = imc.shape
print("Img size : ",height, width)
savename= (Path(path).name).replace(".", "_")
print("Savename : ",savename)
print("Frame :", frame)