Skip to content

Commit 00a1aed

Browse files
Move a cascade creation outside the for loop.
1 parent 0c5fb8f commit 00a1aed

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

stage0_starting_script/face_detect.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818
join("..", "sample_images", "owls.jpg")
1919
]
2020

21+
# Load the trained file from the module root.
22+
trained_file = data.lbp_frontal_face_cascade_filename()
23+
24+
# Initialize the detector cascade.
25+
detector = Cascade(trained_file)
26+
2127
for path in image_paths:
2228
img = PIL.Image.open(path)
2329

2430
img_metadata = {TAGS[k]: v for k, v in img._getexif().items() if k in TAGS}
2531

2632
# Detect faces ------------------------------------------------------------
2733

28-
# Load the trained file from the module root.
29-
trained_file = data.lbp_frontal_face_cascade_filename()
30-
31-
# Initialize the detector cascade.
32-
detector = Cascade(trained_file)
33-
3434
detected = detector.detect_multi_scale(img=np.asarray(img),
3535
scale_factor=1.2,
3636
step_ratio=1,

0 commit comments

Comments
 (0)