Skip to content

Commit

Permalink
Merge branch 'fabiofelix:main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiofelix authored Nov 6, 2024
2 parents a9f1cfa + f476f51 commit 64c154a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions step_recog/full/clip_patches.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
8 changes: 4 additions & 4 deletions tools/run_step_recog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]:
Expand All @@ -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:
Expand Down

0 comments on commit 64c154a

Please sign in to comment.