Commit ·
89bcbfe
1
Parent(s): 131f661
Yolo model logging added
Browse files- agents/visual_counter.py +16 -0
agents/visual_counter.py
CHANGED
|
@@ -184,15 +184,31 @@ class VisualCounterAgent:
|
|
| 184 |
low_confidence.append(str(path))
|
| 185 |
continue
|
| 186 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
if not counts:
|
| 188 |
low_confidence.append(str(path))
|
| 189 |
continue
|
| 190 |
|
| 191 |
# Map class names → product_ids and aggregate
|
|
|
|
|
|
|
| 192 |
for class_name, cnt in counts.items():
|
| 193 |
pid = self._class_name_to_product_id(class_name)
|
| 194 |
key = pid if pid else class_name
|
| 195 |
aggregated[key] = aggregated.get(key, 0) + cnt
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 196 |
|
| 197 |
except Exception as e:
|
| 198 |
exception.append(e)
|
|
|
|
| 184 |
low_confidence.append(str(path))
|
| 185 |
continue
|
| 186 |
|
| 187 |
+
photo_name = Path(path).name
|
| 188 |
+
logger.info(
|
| 189 |
+
"VisualCounter[%s]: raw detections (conf>%.2f): %s",
|
| 190 |
+
photo_name, CONF_THRESHOLD, dict(counts),
|
| 191 |
+
)
|
| 192 |
+
|
| 193 |
if not counts:
|
| 194 |
low_confidence.append(str(path))
|
| 195 |
continue
|
| 196 |
|
| 197 |
# Map class names → product_ids and aggregate
|
| 198 |
+
mapped: Dict[str, int] = {}
|
| 199 |
+
unmapped: List[str] = []
|
| 200 |
for class_name, cnt in counts.items():
|
| 201 |
pid = self._class_name_to_product_id(class_name)
|
| 202 |
key = pid if pid else class_name
|
| 203 |
aggregated[key] = aggregated.get(key, 0) + cnt
|
| 204 |
+
if pid:
|
| 205 |
+
mapped[pid] = mapped.get(pid, 0) + cnt
|
| 206 |
+
else:
|
| 207 |
+
unmapped.append(class_name)
|
| 208 |
+
logger.info(
|
| 209 |
+
"VisualCounter[%s]: mapped to catalog=%s; unmapped classes=%s",
|
| 210 |
+
photo_name, mapped, unmapped,
|
| 211 |
+
)
|
| 212 |
|
| 213 |
except Exception as e:
|
| 214 |
exception.append(e)
|