From d718b247e23bff7357c91a7add7609c706e6770a Mon Sep 17 00:00:00 2001 From: Michiaki Tatsubori Date: Sun, 3 Mar 2024 05:35:31 +0900 Subject: [PATCH] Skip downloading when not in pre-sampled coords (#1821) * Skip downloading an entry if it is not in the given pre-sampled list. * Add warning message when skipping --------- Co-authored-by: Michiaki Tatsubori Co-authored-by: Adam J. Stewart --- experiments/ssl4eo/download_ssl4eo.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/experiments/ssl4eo/download_ssl4eo.py b/experiments/ssl4eo/download_ssl4eo.py index ae312e63aca..7389dbf24f0 100755 --- a/experiments/ssl4eo/download_ssl4eo.py +++ b/experiments/ssl4eo/download_ssl4eo.py @@ -52,6 +52,7 @@ import json import os import time +import warnings from collections import defaultdict from datetime import date, timedelta from multiprocessing.dummy import Lock, Pool @@ -473,9 +474,15 @@ def update(self, delta: int = 1) -> int: counter = Counter() def worker(idx: int) -> None: + # Skip if idx has already been downloaded if idx in ext_coords.keys(): return + # Skip if idx is not in pre-sampled coordinates + if idx not in match_coords.keys(): + warnings.warn(f"{idx} not found in {args.match_file}, skipping.") + return + worker_start = time.time() patches, center_coord = get_random_patches_match( idx,