-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: only CSV's images when -all arg is False
- Loading branch information
1 parent
addbc9b
commit c0bfc31
Showing
1 changed file
with
5 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,7 +8,7 @@ | |
Please contact the author Alexandre Delplanque ([email protected]) for any questions. | ||
Last modification: March 29, 2023 | ||
Last modification: June 17, 2023 | ||
""" | ||
__author__ = "Alexandre Delplanque" | ||
__license__ = "CC BY-NC-SA 4.0" | ||
|
@@ -21,6 +21,7 @@ | |
import torchvision | ||
import numpy | ||
import cv2 | ||
import pandas | ||
|
||
from albumentations import PadIfNeeded | ||
|
||
|
@@ -57,6 +58,9 @@ def main(): | |
patches_buffer = PatchesBuffer(args.csv, args.root, (args.height, args.width), overlap=args.overlap, min_visibility=args.min).buffer | ||
patches_buffer.drop(columns='limits').to_csv(os.path.join(args.dest, 'gt.csv'), index=False) | ||
|
||
if not args.all: | ||
images_paths = [os.path.join(args.root, x) for x in pandas.read_csv(args.csv)['images'].unique()] | ||
|
||
for img_path in tqdm(images_paths, desc='Exporting patches'): | ||
pil_img = PIL.Image.open(img_path) | ||
img_tensor = torchvision.transforms.ToTensor()(pil_img) | ||
|