From d0b99e20e1c1a27eee3ba210d0d6724c4e509a1d Mon Sep 17 00:00:00 2001 From: Fernanda Lecaros Saavedra Date: Mon, 22 Apr 2024 10:10:29 -0700 Subject: [PATCH] fix: Adding .tiff images and vizualization tools with tqdm --- requirements.txt | 2 ++ sdcat/detect/commands.py | 7 ++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 17e14fd..0d8c764 100644 --- a/requirements.txt +++ b/requirements.txt @@ -28,3 +28,5 @@ matplotlib==3.7.0 numba==0.57 ephem jupyter +tqdm +os-sys>=0.1 diff --git a/sdcat/detect/commands.py b/sdcat/detect/commands.py index 22571fe..747626f 100644 --- a/sdcat/detect/commands.py +++ b/sdcat/detect/commands.py @@ -4,6 +4,7 @@ from pathlib import Path import click +from tqdm import tqdm import cv2 import pandas as pd import torch @@ -150,7 +151,7 @@ def run_detect(show: bool, image_dir: str, save_dir: str, model: str, # Run on all images recursively # Find all valid images images = [file for file in images_path.rglob('*') - if file.as_posix().endswith(('jpeg', 'png', 'jpg', 'JPEG', 'PNG', 'JPG', 'tif'))] + if file.as_posix().endswith(('jpeg', 'png', 'jpg', 'JPEG', 'PNG', 'JPG', 'tif', 'tiff'))] num_images = len(images) info(f'Found {num_images} images in {images_path}') @@ -190,7 +191,7 @@ def run_detect(show: bool, image_dir: str, save_dir: str, model: str, pool.starmap(run_sahi_detect_bulk, args) pool.close() else: - for f in images: + for f in tqdm(images): if not skip_saliency: run_saliency_detect(spec_remove, scale_percent, @@ -209,7 +210,7 @@ def run_detect(show: bool, image_dir: str, save_dir: str, model: str, class_agnostic) # Combine all the detections into a single dataframe per image - for f in images: + for f in tqdm(images): # Get the width and height of the image img_color = cv2.imread(f.as_posix()) height, width = img_color.shape[:2]