Skip to content

Commit

Permalink
Merge pull request #24 from PTG-Kitware/dev/pose_repeat_rate
Browse files Browse the repository at this point in the history
Add pose_repeat_rate to data generator to mimic online data
  • Loading branch information
hdefazio authored May 16, 2024
2 parents 33a8c92 + 818c848 commit fe03abe
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 22 deletions.
32 changes: 21 additions & 11 deletions configs/experiment/r18/feat_v5.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ model:
dim: 33 # length of feature vector when top_k_objects=1
#dim: xx # length of feature vector when top_k_objects=2

# LIVE HZ
IMAGE_HZ: 30 # zed bags
#IMAGE_HZ: 15 # BBN hololens live
OBJECT_DET_HZ: 15
POSE_HZ: 4

# GENERATE TRAINING DATA
data_gen:
top_k_objects: 1
pose_repeat_rate: 0 # Not applicable for this feature version

data_type: "pro"
dataset_kwcoco: "/data/PTG/medical/training/yolo_object_detector/detect/r18_all/r18_all_all_obj_results_with_dets_and_pose.mscoco.json"
Expand All @@ -61,36 +67,40 @@ data_gen:
activity_config_fn: "/home/local/KHQ/hannah.defazio/angel_system/config/activity_labels/medical/r18.yaml"

# This matches the folder name created in the data generator
exp_name: "${task}_${data_gen.data_type}_data_top_${data_gen.top_k_objects}_objs_feat_v${feature_version}"
exp_ext: "_NEW_ORDER_fix_overlap_gt" # anything unique about this run that isn't already in exp_name
exp_name: "${task}_${data_gen.data_type}_data_top_${data_gen.top_k_objects}_objs_feat_v${feature_version}_pose_rate_${data_gen.pose_repeat_rate}${data_gen.exp_ext}"

# TRAINING
exp_name: ${data_gen.exp_name}_win_25

paths:
data_dir: "/data/PTG/medical/training/activity_classifier/TCN_data/${task}/${data_gen.exp_name}"
root_dir: "/data/PTG/medical/training/activity_classifier/TCN_HPL/"

data:
num_classes: 6 # activities: includes background
batch_size: 512
num_workers: 0
epoch_length: 20000
window_size: 45
sample_rate: 1
window_size: 25
sample_rate: 2 # ${IMAGE_HZ} / ${OBJECT_DET_HZ}

# AUGMENTATIONS
all_transforms:
train_order: [] #["MoveCenterPts", "NormalizePixelPts"]
test_order: [] #["NormalizePixelPts"]
MoveCenterPts:
feat_version: ${feature_version}
num_obj_classes: 6 # not including background
num_obj_classes: 6 # not including background, includes hands
top_k_objects: ${data_gen.top_k_objects}
NormalizeFromCenter:
feat_version: ${feature_version}
num_obj_classes: 6 # not including background, includes hands
top_k_objects: ${data_gen.top_k_objects}
NormalizePixelPts:
feat_version: ${feature_version}
num_obj_classes: 6 # not including background
num_obj_classes: 6 # not including background, includes hands
top_k_objects: ${data_gen.top_k_objects}

exp_name: ${data_gen.exp_name}_win_${data.window_size}_obj_sample_${data.sample_rate}

paths:
data_dir: "/data/PTG/medical/training/activity_classifier/TCN_data/${task}/${data_gen.exp_name}"
root_dir: "/data/PTG/medical/training/activity_classifier/TCN_HPL/"

logger:
aim:
Expand Down
30 changes: 20 additions & 10 deletions configs/experiment/r18/feat_v6.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ model:
dim: 297 # length of feature vector when top_k_objects=1
#dim: 506 # length of feature vector when top_k_objects=2

# LIVE HZ
IMAGE_HZ: 30 # zed bags
#IMAGE_HZ: 15 # BBN hololens live
OBJECT_DET_HZ: 15
POSE_HZ: 4

# GENERATE TRAINING DATA
data_gen:
top_k_objects: 1
pose_repeat_rate: 7.5 # ${IMAGE_HZ} / ${POSE_HZ}

data_type: "pro"
dataset_kwcoco: "/data/PTG/medical/training/yolo_object_detector/detect/r18_all/r18_all_all_obj_results_with_dets_and_pose.mscoco.json"
Expand All @@ -61,37 +67,41 @@ data_gen:
activity_config_fn: "/home/local/KHQ/hannah.defazio/angel_system/config/activity_labels/medical/r18.yaml"

# This matches the folder name created in the data generator
exp_name: "${task}_${data_gen.data_type}_data_top_${data_gen.top_k_objects}_objs_feat_v${feature_version}_NEW_ORDER"
exp_ext: "_NEW_ORDER_fix_overlap_gt" # anything unique about this run that isn't already in ``exp_name``
exp_name: "${task}_${data_gen.data_type}_data_top_${data_gen.top_k_objects}_objs_feat_v${feature_version}_pose_rate_${data_gen.pose_repeat_rate}${data_gen.exp_ext}"

# TRAINING
exp_name: ${data_gen.exp_name}_win_25_norm

paths:
data_dir: "/data/PTG/medical/training/activity_classifier/TCN_data/${task}/${data_gen.exp_name}"
root_dir: "/data/PTG/medical/training/activity_classifier/TCN_HPL/"

data:
num_classes: 6 # activities: includes background
batch_size: 512
num_workers: 0
epoch_length: 20000
window_size: 25
sample_rate: 1
sample_rate: 2 # ${IMAGE_HZ} / ${OBJECT_DET_HZ}

# AUGMENTATIONS
all_transforms:
train_order: ["MoveCenterPts", "NormalizePixelPts"]
test_order: ["NormalizePixelPts"]
train_order: [] #["MoveCenterPts", "NormalizePixelPts"]
test_order: [] #["NormalizePixelPts"]
MoveCenterPts:
feat_version: ${feature_version}
num_obj_classes: 6 # not including background, includes hands
top_k_objects: ${data_gen.top_k_objects}
NormalizeFromCenter:
feat_version: ${feature_version}
num_obj_classes: 6 # not including background, includes hands
top_k_objects: ${data_gen.top_k_objects}
NormalizePixelPts:
feat_version: ${feature_version}
num_obj_classes: 6 # not including background, includes hands
top_k_objects: ${data_gen.top_k_objects}

exp_name: ${data_gen.exp_name}_win_${data.window_size}_obj_sample_${data.sample_rate}

paths:
data_dir: "/data/PTG/medical/training/activity_classifier/TCN_data/${task}/${data_gen.exp_name}"
root_dir: "/data/PTG/medical/training/activity_classifier/TCN_HPL/"

logger:
aim:
experiment: ${exp_name}
Expand Down
5 changes: 4 additions & 1 deletion tcn_hpl/data/utils/ptg_datagenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ def create_training_data(config_path):
blue_glove_vids = config["data_gen"].get("blue_glove_vids", [])
activity_config_fn = config["data_gen"]["activity_config_fn"]
top_k_objects = config["data_gen"]["top_k_objects"]
pose_repeat_rate = config["data_gen"]["pose_repeat_rate"]
exp_ext = config["data_gen"]["exp_ext"]

dset = kwcoco.CocoDataset(config["data_gen"]["dataset_kwcoco"])
# Check if the dest has activity gt, if it doesn't then add it
Expand Down Expand Up @@ -86,7 +88,7 @@ def filter_dset_by_split(split):
#####################
# Output
#####################
exp_name = f"{task_name}_{task_data_type}_data_top_{top_k_objects}_objs_feat_v{feat_version}_NEW_ORDER"
exp_name = f"{task_name}_{task_data_type}_data_top_{top_k_objects}_objs_feat_v{feat_version}_pose_rate_{pose_repeat_rate}{exp_ext}"
data_dir = f"/data/PTG/{topic}/training/activity_classifier"
output_data_dir = f"{data_dir}/TCN_data/{task_name}/{exp_name}"
print(output_data_dir)
Expand Down Expand Up @@ -190,6 +192,7 @@ def filter_dset_by_split(split):
ann_by_image,
feat_version=feat_version,
top_k_objects=top_k_objects,
pose_repeat_rate=pose_repeat_rate
)
print(X.shape)

Expand Down

0 comments on commit fe03abe

Please sign in to comment.