0llheaven commited on
Commit
a830ccd
·
verified ·
1 Parent(s): 6e8beb5

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +26 -26
README.md CHANGED
@@ -54,32 +54,32 @@ for image_name in os.listdir(folder_path):
54
  boxes = result["boxes"]
55
 
56
  filtered_data = [(score, label, box) for score, label, box in zip(scores, labels, boxes) if score > 0.5][:2] # จำกัดให้เก็บได้ไม่เกิน 2 กล่อง
57
- # for score, label, box in zip(scores, labels, boxes):
58
- # if score > 0.5:
59
- if len(filtered_data) > 0:
60
- detected_any = True
61
-
62
- for score, label, box in filtered_data:
63
- if label.item() == 0:
64
- label_name = "Pneumonia"
65
- elif label.item() == 1:
66
- label_name = "Normal"
67
- elif label.item() == 2:
68
- label_name = "Pneumonia_bacteria"
69
- else:
70
- label_name = "Pneumonia_virus"
71
-
72
- xmin, ymin, xmax, ymax = [round(i, 2) for i in box.tolist()]
73
- print(f" - Detected {label_name} with score {round(score.item(), 3)} at {xmin, ymin, xmax, ymax}")
74
- results_list.append({
75
- "image_name": image_name,
76
- "label": label_name,
77
- "xmin": xmin,
78
- "ymin": ymin,
79
- "xmax": xmax,
80
- "ymax": ymax,
81
- "score": round(score.item(), 3),
82
- })
83
 
84
  if not detected_any:
85
  print(" - No Detect")
 
54
  boxes = result["boxes"]
55
 
56
  filtered_data = [(score, label, box) for score, label, box in zip(scores, labels, boxes) if score > 0.5][:2] # จำกัดให้เก็บได้ไม่เกิน 2 กล่อง
57
+ for score, label, box in zip(scores, labels, boxes):
58
+ if score > 0.5:
59
+ if len(filtered_data) > 0:
60
+ detected_any = True
61
+
62
+ for score, label, box in filtered_data:
63
+ if label.item() == 0:
64
+ label_name = "Pneumonia"
65
+ elif label.item() == 1:
66
+ label_name = "Normal"
67
+ elif label.item() == 2:
68
+ label_name = "Pneumonia_bacteria"
69
+ else:
70
+ label_name = "Pneumonia_virus"
71
+
72
+ xmin, ymin, xmax, ymax = [round(i, 2) for i in box.tolist()]
73
+ print(f" - Detected {label_name} with score {round(score.item(), 3)} at {xmin, ymin, xmax, ymax}")
74
+ results_list.append({
75
+ "image_name": image_name,
76
+ "label": label_name,
77
+ "xmin": xmin,
78
+ "ymin": ymin,
79
+ "xmax": xmax,
80
+ "ymax": ymax,
81
+ "score": round(score.item(), 3),
82
+ })
83
 
84
  if not detected_any:
85
  print(" - No Detect")