Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoyang1998 committed Aug 22, 2024
1 parent 01a85c5 commit 2982301
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions egs/audioset/AT/local/compute_weight.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,25 +25,24 @@
import lhotse
from lhotse import load_manifest


def get_parser():
parser = argparse.ArgumentParser(
formatter_class=argparse.ArgumentDefaultsHelpFormatter
)

parser.add_argument(
"--input-manifest",
type=str,
default="data/fbank/cuts_audioset_full.jsonl.gz"
"--input-manifest", type=str, default="data/fbank/cuts_audioset_full.jsonl.gz"
)

parser.add_argument(
"--output",
type=str,
required=True,

)
return parser


def main():
# Reference: https://github.com/YuanGongND/ast/blob/master/egs/audioset/gen_weight_file.py
parser = get_parser()
Expand All @@ -53,7 +52,7 @@ def main():

print(f"A total of {len(cuts)} cuts.")

label_count = [0] * 527 # a total of 527 classes
label_count = [0] * 527 # a total of 527 classes
for c in cuts:
audio_event = c.supervisions[0].audio_event
labels = list(map(int, audio_event.split(";")))
Expand All @@ -68,6 +67,7 @@ def main():
for label in labels:
weight += 1000 / (label_count[label] + 0.01)
f.write(f"{c.id} {weight}\n")



if __name__ == "__main__":
main()

0 comments on commit 2982301

Please sign in to comment.