Skip to content

Commit 3f06016

Browse files
glogiotatidisageitgey
authored andcommitted
Convert 1600 to a float.
If `unknown_image.shape[1] > 1600` then `scale_factor` will be always calculated `0` because `1600 / unknown_image.shape[1]` is an `int` over `int` division which in turn will always raise a ValueError in `PIL.Image.resize`. Making `1600` a float (1600.0) fixes the issue.
1 parent 8322e7c commit 3f06016

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

face_recognition/cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def test_image(image_to_check, known_names, known_face_encodings):
3434

3535
# Scale down image if it's giant so things run a little faster
3636
if unknown_image.shape[1] > 1600:
37-
scale_factor = 1600 / unknown_image.shape[1]
37+
scale_factor = 1600.0 / unknown_image.shape[1]
3838
with warnings.catch_warnings():
3939
warnings.simplefilter("ignore")
4040
unknown_image = scipy.misc.imresize(unknown_image, scale_factor)

0 commit comments

Comments
 (0)