Funktion, die verwendet wird, um die Modellarchitektur zum Generieren von Bounding Box mit korrekten Koordinaten wie unten anzuordnen:
detections = result.reshape(-1, 5)
for i, detection in enumerate(detections):
xmin, ymin, xmax, ymax, confidence = detection
if confidence > 0.2:
xmin = int(max((xmin * image.shape[1]), 10))
ymin = int(max((ymin * image.shape[0]), 10))
xmax = int(min((xmax * image.shape[1]), image.shape[1] - 10))
ymax = int(min((ymax * image.shape[0]), image.shape[0] - 10))
Falsche Koordinaten des Begrenzungskartons erhalten.
Stellen Sie beim Zeichnen des Begrenzungsrahmens wie unten den Rand mindestens zehn Pixel vom Bildrand ein:
xmin = int(max(xmin, 10))
ymin = int(max(ymin, 10))
xmax = int(min(xmax, image.shape[1] - 10))
ymax = int(min(ymax, image.shape[0] - 10))