From 2bb27c182c8eed033dde57e3d67f8685da6a61db Mon Sep 17 00:00:00 2001 From: juraev Date: Fri, 25 Aug 2023 18:32:52 +0500 Subject: [PATCH] Update darknet_images.py (#8559) Safer and better type check. --- darknet_images.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/darknet_images.py b/darknet_images.py index 8ec3f8ee..bfdd88c9 100644 --- a/darknet_images.py +++ b/darknet_images.py @@ -101,7 +101,7 @@ def image_detection(image_or_path, network, class_names, class_colors, thresh): height = darknet.network_height(network) darknet_image = darknet.make_image(width, height, 3) - if type(image_or_path) == "str": + if isinstance(image_or_path, str): image = cv2.imread(image_or_path) else: image = image_or_path