From ca3e66f6551f973217c276d87648cfe0ccc9c644 Mon Sep 17 00:00:00 2001 From: Fabio Date: Tue, 5 Nov 2024 19:48:23 -0500 Subject: [PATCH] General commit --- step_recog/full/clip_patches.py | 4 ++++ tools/run_step_recog.py | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/step_recog/full/clip_patches.py b/step_recog/full/clip_patches.py index fe8dd1a..e453f37 100644 --- a/step_recog/full/clip_patches.py +++ b/step_recog/full/clip_patches.py @@ -62,12 +62,16 @@ def extract_image_patch(image, bbox, patch_shape=None): bbox[2] = new_width # convert to top left, bottom right + # (x1, y1, w, h) => (x1, y1, x1 + w, y1 + h) => (x1, y1, x2, y2) bbox[2:] += bbox[:2] bbox = bbox.astype(int) # clip at image boundaries + # (x1, y1) >= (0, 0) bbox[:2] = np.maximum(0, bbox[:2]) + # (x2, y2) < image.shape bbox[2:] = np.minimum(np.asarray(image.shape[:2][::-1]) - 1, bbox[2:]) + # x2 > x1 and y2 > y1 if np.any(bbox[:2] >= bbox[2:]): return None, bbox # diff --git a/tools/run_step_recog.py b/tools/run_step_recog.py index cdeaba2..d385852 100644 --- a/tools/run_step_recog.py +++ b/tools/run_step_recog.py @@ -93,15 +93,15 @@ def my_train_test_split(cfg, videos): if "M1" in cfg.SKILLS[0]["NAME"]: videos, video_test = train_test_split(videos, test_size=0.10, random_state=2343) #M1 elif "M2" in cfg.SKILLS[0]["NAME"]: - videos, video_test = train_test_split(videos, test_size=0.10, random_state=2156) #M2 1007: only data until june demo 2252: only with BBN 3_tourns_122023.zip + videos, video_test = train_test_split(videos, test_size=0.10, random_state=2308) #M2 2156: only with data until 07/09/2024; 1007: only data until june demo 2252: only with BBN 3_tourns_122023.zip elif "M3" in cfg.SKILLS[0]["NAME"]: videos, video_test = train_test_split(videos, test_size=0.10, random_state=2343) #M3 2359: only data until june demo 1740: only with BBN pressure_videos.zip elif "M5" in cfg.SKILLS[0]["NAME"]: videos, video_test = train_test_split(videos, test_size=0.10, random_state=2351) #M5 2359: only data until june demo 1030: only with BBN 041624.zip elif "R18" in cfg.SKILLS[0]["NAME"]: - videos, video_test = train_test_split(videos, test_size=0.10, random_state=2322) #R18 2343 only data until 07/31/2024 1740: only with BBN seal_videos.zip + videos, video_test = train_test_split(videos, test_size=0.10, random_state=2356) #R18 2322: only data until 07/09/2024; 2343 only data until 07/31/2024 1740: only with BBN seal_videos.zip elif "A8" in cfg.SKILLS[0]["NAME"]: - videos, video_test = train_test_split(videos, test_size=0.10, random_state=2303) #A8: 2328 only data until 09/27/24; 2317: only data until 09/02/24; 2329: only with data until 07/31/2024; 1030: first test + videos, video_test = train_test_split(videos, test_size=0.10, random_state=2250) #A8: 2303: only ata until 10/11/2024; 2328 only data until 09/27/24; 2317: only data until 09/02/24; 2329: only with data until 07/31/2024; 1030: first test elif "R19" in cfg.SKILLS[0]["NAME"]: videos, video_test = train_test_split(videos, test_size=0.10, random_state=2328) #R19: 2321: only data until 09/02/24; 1030: first test elif "R16" in cfg.SKILLS[0]["NAME"]: @@ -119,7 +119,7 @@ def train_kfold(cfg, args, k = 10): data = pd.read_csv(cfg.DATASET.TR_ANNOTATIONS_FILE) videos = data.video_id.unique() main_path = cfg.OUTPUT.LOCATION - videos, video_test = my_train_test_split(cfg, videos) + videos, video_test = my_train_test_split(cfg, videos) for idx, (train_idx, val_idx) in enumerate(kf_train_val.split(videos), 1): if args.forced_iteration is None or idx == args.forced_iteration: