Methode zur Aktivierung von Looping mit einem Modell von 2 Ausgängen.
Es ist nicht möglich, ein Modell mit 2 Ausgängen zu verarbeiten, wenn Der Funktionscode unten verwendet wird:
for i, detection in enumerate(detections):
#_, image_id, confidence, xmin, ymin, xmax, ymax = detection
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))
Um das Looping von 2 Modell-Ausgängen zu ermöglichen, berücksichtigen Sie beide Ausgänge, da output2 eine Hintergrundklasse enthalten kann.
Verwenden Sie den Teil des Codes wie unten:
Anzahl output1, output2 = model()
für i, (Erkennung, Etikett) in enumerate (zip(output1, output2)): #_, image_id, confidence, xmin, ymin, xmax, ymax = Erkennung xmin, ymin, xmax, ymax, confidence = erkennung , wenn confidence > 0.2 und label == 1: # den Code aus dem Beispiel wiederverwenden