Skip to content

Commit

Permalink
fix: Adding .tiff images and vizualization tools with tqdm
Browse files Browse the repository at this point in the history
  • Loading branch information
Fernanda Lecaros Saavedra authored and Fernanda Lecaros Saavedra committed Apr 22, 2024
1 parent ea92e2f commit d0b99e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,5 @@ matplotlib==3.7.0
numba==0.57
ephem
jupyter
tqdm
os-sys>=0.1
7 changes: 4 additions & 3 deletions sdcat/detect/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from pathlib import Path

import click
from tqdm import tqdm
import cv2
import pandas as pd
import torch
Expand Down Expand Up @@ -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}')
Expand Down Expand Up @@ -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,
Expand All @@ -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]
Expand Down

0 comments on commit d0b99e2

Please sign in to comment.