small typing addition I LOVE TYPING go go go
This commit is contained in:
1 parent
cdbca0f370
commit
73b1705fa3
2 files changed
+10
-6
No files matched your search
+2
-2
@@ -8,5 +8,5 @@ wheels/
|
|||||||
|
|
||||||
# Virtual environments
|
# Virtual environments
|
||||||
.venv
|
.venv
|
||||||
logs/
|
|
||||||
events/
|
Group_project_*
|
||||||
+8
-4
@@ -195,12 +195,16 @@ class SmokingDetectionPipeline:
|
|||||||
people = self.person_model.predict(frame.data)
|
people = self.person_model.predict(frame.data)
|
||||||
return nms_by_class(people, self.cfg.person_nms_iou)
|
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(
|
def _detect_cigarettes(
|
||||||
self,
|
self,
|
||||||
frame: Frame,
|
frame: Frame,
|
||||||
people: List[Detection],
|
people: List[Detection],
|
||||||
detections_out: List[Detection],
|
detections_out: List[Detection],
|
||||||
) -> Tuple[List[Tuple], Optional[Tuple]]:
|
) -> Tuple[List[Candidates], Optional[Hit]]:
|
||||||
"""
|
"""
|
||||||
Stage 2: Detect cigarettes in person crops.
|
Stage 2: Detect cigarettes in person crops.
|
||||||
|
|
||||||
@@ -249,9 +253,9 @@ class SmokingDetectionPipeline:
|
|||||||
def _verify_candidates(
|
def _verify_candidates(
|
||||||
self,
|
self,
|
||||||
frame: Frame,
|
frame: Frame,
|
||||||
candidates: List[Tuple],
|
candidates: List[Candidates],
|
||||||
detections_out: List[Detection],
|
detections_out: List[Detection],
|
||||||
) -> Optional[Tuple]:
|
) -> Optional[Hit]:
|
||||||
"""
|
"""
|
||||||
Stage 3: Run classifier on cigarette crops.
|
Stage 3: Run classifier on cigarette crops.
|
||||||
|
|
||||||
@@ -353,7 +357,7 @@ class SmokingDetectionPipeline:
|
|||||||
|
|
||||||
return image[y1:y2, x1:x2]
|
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."""
|
"""Create alert ticket from detection hit."""
|
||||||
person, cig, score, (ex1, ey1) = hit
|
person, cig, score, (ex1, ey1) = hit
|
||||||
logger.info("CONFIRMED SMOKING! Score: %.2f (Stage: %s)", score, stage)
|
logger.info("CONFIRMED SMOKING! Score: %.2f (Stage: %s)", score, stage)
|
||||||
|
|||||||
Reference in new issue
Block a user