Update darknet_images.py (#8559)

Safer and better type check.
This commit is contained in:
juraev 2023-08-25 18:32:52 +05:00 committed by GitHub
parent 38a5b489da
commit 2bb27c182c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -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