วิธีการเปิดใช้งานการวนรอบกับโมเดลเอาต์พุต 2 รายการ
ไม่สามารถจัดการกับรุ่นที่มี 2 เอาต์พุตเมื่อใช้รหัสฟังก์ชันด้านล่าง:
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))
หากต้องการเปิดใช้งานการวนรอบเอาต์พุตโมเดล 2 รายการ ให้ คํานึงถึง เอาต์พุตทั้งสองเนื่องจาก เอาต์พุต 2 อาจมีระดับพื้นหลัง
นําส่วนหนึ่งของโค้ดมาใช้ใหม่ดังนี้:
# output1, output2 = รุ่น()
สําหรับ i, (การตรวจจับ, ฉลาก) ในแจงนับ (zip1, output2): #_, image_id, ความมั่นใจ, xmin, ymin, xmax, ymax = detection xmin, ymin, xmax, ymax, ymax, ความมั่นใจ = การตรวจจับ หากความมั่นใจ > 0.2 และฉลาก == 1: # ใช้รหัสอีกครั้งจากตัวอย่าง