small typing addition I LOVE TYPING go go go

This commit is contained in:
lda committed 2026-01-15 23:54:50 +07:00
1 parent cdbca0f370
commit 73b1705fa3
2 files changed
+10 -6

No files matched your search

+2 -2
View File
@@ -8,5 +8,5 @@ wheels/
# Virtual environments
.venv
logs/
events/
Group_project_*
+8 -4
View File
@@ -195,12 +195,16 @@ class SmokingDetectionPipeline:
people = self.person_model.predict(frame.data)
return nms_by_class(people, self.cfg.person_nms_iou)
type Candidates = Tuple[Detection, List[Detection], Tuple[int, int]]
type Hit = Tuple[Detection, Detection, float, Tuple[int, int]]
# the __doc__s tell you what these are
def _detect_cigarettes(
self,
frame: Frame,
people: List[Detection],
detections_out: List[Detection],
) -> Tuple[List[Tuple], Optional[Tuple]]:
) -> Tuple[List[Candidates], Optional[Hit]]:
"""
Stage 2: Detect cigarettes in person crops.
@@ -249,9 +253,9 @@ class SmokingDetectionPipeline:
def _verify_candidates(
self,
frame: Frame,
candidates: List[Tuple],
candidates: List[Candidates],
detections_out: List[Detection],
) -> Optional[Tuple]:
) -> Optional[Hit]:
"""
Stage 3: Run classifier on cigarette crops.
@@ -353,7 +357,7 @@ class SmokingDetectionPipeline:
return image[y1:y2, x1:x2]
def _create_ticket(self, frame: Frame, hit: Tuple, stage: str) -> Ticket:
def _create_ticket(self, frame: Frame, hit: Hit, stage: str) -> Ticket:
"""Create alert ticket from detection hit."""
person, cig, score, (ex1, ey1) = hit
logger.info("CONFIRMED SMOKING! Score: %.2f (Stage: %s)", score, stage)