Beispielcode zum Generieren von Begrenzungsboxen.
Kann nicht verstehen, wie Sie für benutzerdefinierte Objekterkennungsanwendungen Begrenzungsboxen um Objekte im Bild zeichnen.
Beispielcode zum Generieren von Begrenzungsboxen:
For box in boxes:
#Pick a confidence factor from the last place in an array.
conf=box[-1]
If conf > threshold:
#Convert float to int and multiply corner position of each box by x and y ration.
#If the bounding box is found that the top of the image
#Position the upper box bar little lower to make it visible on the image
(x_min, y_min, x_max, y_max) = [
int (max(corner_position*ratio_y, 10)) if idx%2
else int (corner_position*ratio_x)
for idx, corner_position in enumerate(box[:-1])
#Draw a box base on the position, parameters in rectangle function are: image,start_point, end_point, color, thickness.
rgb_image = cv2.rectangle(rgb_image, (x_min,y_min), (x_max,y_max),
colors["green"], 3)
Lesen Sie den Quellcode der Objekterkennung Python* Demo , um die OpenVINO™ Inferenz-Engine-API-Nutzung für das Erstellen von BoundingBoxen und die Handhabung des Modells zu erfahren.