Commit 0d218501aca82a10d32d2ee8e51897bc72bd91a9

Authored by Mathias
1 parent 3338829123
Exists in master

Add an option to specify which file is the list of ids

Showing 1 changed file with 17 additions and 1 deletions Side-by-side Diff

scripts/evaluations/clustering.py
... ... @@ -23,6 +23,14 @@
23 23 parser.add_argument("utt2",
24 24 type=str,
25 25 help="file with [utt] [value]")
  26 + parser.add_argument("--idsfrom",
  27 + type=str,
  28 + default="utt2",
  29 + choices=[
  30 + "features",
  31 + "utt2"
  32 + ],
  33 + help="from features or from utt2?")
26 34 parser.add_argument("--prefix",
27 35 type=str,
28 36 help="prefix of saved files")
... ... @@ -41,7 +49,15 @@
41 49 features = read_features(args.features)
42 50 utt2 = read_lst(args.utt2)
43 51  
44   - ids = list(features.keys())
  52 + # Take id list
  53 + if args.idsfrom == "features":
  54 + ids = list(features.keys())
  55 + elif args.idsfrom == "utt2":
  56 + ids = list(utt2.keys())
  57 + else:
  58 + print(f"idsfrom is not good: {args.idsfrom}")
  59 + exit(1)
  60 +
45 61 feats = np.vstack([ features[id_] for id_ in ids ])
46 62 classes = [ utt2[id_] for id_ in ids ]
47 63