Skip to content

Commit

Permalink
change i to index in var name and renaming the preprocess_signs function
Browse files Browse the repository at this point in the history
  • Loading branch information
RotemZilberman committed Feb 25, 2024
1 parent 5cd8616 commit 05f8def
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 13 deletions.
5 changes: 2 additions & 3 deletions signwriting_transcription/pose_to_signwriting/bin.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def download_model(experiment_dir: Path, model_name: str):
create_test_config(str(experiment_dir), str(experiment_dir))


def preprocessing_signs(preprocessed_pose: Pose, sign_annotations: list, strategy: str, temp_dir: str):
def preprocess_signs(preprocessed_pose: Pose, sign_annotations: list, strategy: str, temp_dir: str):
temp_files = [] # list of temporary files
start_point = 0
temp_path = Path(temp_dir)
Expand Down Expand Up @@ -97,9 +97,8 @@ def main():

print('Predicting signs...')
with tempfile.TemporaryDirectory() as temp_dir:
temp_files = preprocessing_signs(preprocessed_pose, sign_annotations, args.strategy, temp_dir)
temp_files = preprocess_signs(preprocessed_pose, sign_annotations, args.strategy, temp_dir)
hyp_list = translate('experiment/config.yaml', temp_files)
print('Cleaning up...')

for index, (start, end, _) in enumerate(sign_annotations):
eaf.remove_annotation('SIGN', start)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ def get_zip_manifest(zip_path: Path, npy_root: Optional[Path] = None):
with zipfile.ZipFile(zip_path, mode="r") as file:
info = file.infolist()
# retrieve offsets
for i in tqdm(info):
utt_id = Path(i.filename).stem
offset, file_size = i.header_offset + 30 + len(i.filename), i.file_size
for index in tqdm(info):
utt_id = Path(index.filename).stem
offset, file_size = index.header_offset + 30 + len(index.filename), index.file_size
with zip_path.open("rb") as file:
file.seek(offset)
data = file.read(file_size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,14 @@ def get_split_data(dataset, feature_root, pumping):
if EXPANDED_DATASET > len(all_data) and pumping:
print("Pumping dataset...")
backup = all_data.copy()
for i in range(EXPANDED_DATASET - len(backup)):
utt_id = backup[i % len(backup)]["id"]
n_frames = backup[i % len(backup)]["n_frames"]
trg = backup[i % len(backup)]["trg"]
src = backup[i % len(backup)]["src"]
split = backup[i % len(backup)]["split"]
for index in range(EXPANDED_DATASET - len(backup)):
utt_id = backup[index % len(backup)]["id"]
n_frames = backup[index % len(backup)]["n_frames"]
trg = backup[index % len(backup)]["trg"]
src = backup[index % len(backup)]["src"]
split = backup[index % len(backup)]["split"]
all_data.append({
"id": f'{utt_id}({i})', # unique id
"id": f'{utt_id}({index})', # unique id
"src": src,
"n_frames": n_frames,
"trg": trg,
Expand Down

0 comments on commit 05f8def

Please sign in to comment.