Skip to content

Commit

Permalink
Added updates to ads parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
digbose92 committed Apr 5, 2023
1 parent 5895c80 commit 29f4817
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
10 changes: 5 additions & 5 deletions configs/config_MHA_single_task_classifier_shot_level.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
data:
csv_file: '/data/digbose92/ads_complete_repo/ads_codes/SAIM-ADS/data/SAIM_data/SAIM_multi_task_tone_soc_message_topic_data_no_zero_files.csv'
base_folder: '/data/digbose92/ads_complete_repo/ads_features/shot_embeddings/vit_features'
base_folder: '/data/digbose92/ads_complete_repo/ads_features/shot_embeddings/clip_features_4fps/'

parameters:
batch_size: 16
Expand Down Expand Up @@ -31,11 +31,11 @@ optimizer:
verbose: True

model:
model_type: 'MHA_attn_single_task_classifier_shot_level'
input_dim: 768
model_type: 'MHA_attn_single_task_classifier_CLIP_features_shot_level'
input_dim: 512
model_dim: 256
num_heads: 2
num_layers: 2
num_heads: 4
num_layers: 4
input_dropout: 0.2
output_dropout: 0.2
model_dropout: 0.2
Expand Down
11 changes: 5 additions & 6 deletions configs/config_MHA_topic_classifier_shot_level.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
data:
csv_file: '/data/digbose92/ads_complete_repo/ads_codes/SAIM-ADS/data/SAIM_data/SAIM_multi_task_tone_soc_message_topic_data_no_zero_files.csv'
topic_file: '/data/digbose92/ads_complete_repo/ads_codes/SAIM-ADS/data/topic_list_18.json'
base_folder: '/data/digbose92/ads_complete_repo/ads_features/shot_embeddings/vit_features'
base_folder: '/data/digbose92/ads_complete_repo/ads_features/shot_embeddings/clip_features_4fps/'
#'/data/digbose92/ads_complete_repo/ads_features/shot_embeddings/vit_features'

parameters:
batch_size: 16
Expand All @@ -24,17 +25,15 @@ optimizer:
lr: 1e-4
gamma: 0.5
step_size: 15
#scheduler: 'step_lr'
#mode: 'max'
decay: 0.001
patience: 5
factor: 0.5
verbose: True

model:
model_type: 'MHA_attn_single_task_classifier_shot_level'
input_dim: 768
model_dim: 128
model_type: 'MHA_attn_single_task_classifier_CLIP_features_shot_level'
input_dim: 512
model_dim: 256
num_heads: 4
num_layers: 4
input_dropout: 0.2
Expand Down
Binary file modified datasets/__pycache__/dataset.cpython-38.pyc
Binary file not shown.
8 changes: 5 additions & 3 deletions datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,9 +251,11 @@ def __getitem__(self,idx):
#print(filename)

#load the feature file

with open(filename, 'rb') as f:
shot_features = pickle.load(f)
try:
with open(filename, 'rb') as f:
shot_features = pickle.load(f)
except:
print(filename)

#get the keys
keys=sorted(list(shot_features.keys()))
Expand Down
4 changes: 2 additions & 2 deletions feature_extraction/extract_clip_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,8 @@ def run_shot_inference(shot_folder,model,device,preprocess,destination_folder):
#destination file
destination_file=os.path.join(destination_folder,pkl_filename)

if(os.path.exists(destination_file) is False):

if(destination_file=='/data/digbose92/ads_complete_repo/ads_features/shot_embeddings/clip_features_4fps/arm_hammer_arm_hammer_clump_seal_cat_litter.pkl'):
#if(os.path.exists(destination_file) is False):
shot_list=os.listdir(video_subfolder) #list of shots
shot_dict=dict()
for shot_file in tqdm(shot_list):
Expand Down

0 comments on commit 29f4817

Please sign in to comment.