catiR commited on
Commit
8594b98
·
1 Parent(s): 7f57015

adjust plot

Browse files
Files changed (1) hide show
  1. scripts/clusterprosody.py +8 -8
scripts/clusterprosody.py CHANGED
@@ -552,14 +552,14 @@ def plot_rmse_tts(speech_data,tts_data, tts_align,words,seg_aligns,cluster_id, v
552
  realign = np.mean([word_times[0][2],word_times[1][1]])
553
  rmse_xvals = [x - realign for x in rmse_xvals]
554
  word_times = [(w,s-realign,e-realign) for w,s,e in word_times]
555
- plt.axvline(x= 0, color="gray", linestyle='-', linewidth=1, label=f"{word_times[0][0]} -> {word_times[1][0]} boundary")
556
 
557
  if len(word_times)>2:
558
  for i in range(1,len(word_times)-1):
559
  bound_line = np.mean([word_times[i][2],word_times[i+1][1]])
560
- plt.axvline(x=bound_line, color=colors[cc], linestyle='-', linewidth=1, label=f"Speaker {spk} -> {word_times[i+1][0]}")
561
 
562
- plt.scatter(rmse_xvals, rmse, color=colors[cc], label=f"Speaker {spk}")
563
  cc += 1
564
  if cc >= len(colors):
565
  cc=0
@@ -575,8 +575,8 @@ def plot_rmse_tts(speech_data,tts_data, tts_align,words,seg_aligns,cluster_id, v
575
  if len(tts_align)>2:
576
  for i in range(2,len(tts_align)):
577
  bound_line = tts_align[i][1]
578
- plt.axvline(x=bound_line, color="black", linestyle='-', linewidth=1, label=f"TTS -> {tts_align[i][0]}")
579
- plt.scatter(t_xvals, trmse, color="black", label=f"TTS {voice}")
580
 
581
 
582
  #plt.legend()
@@ -589,7 +589,7 @@ def plot_rmse_tts(speech_data,tts_data, tts_align,words,seg_aligns,cluster_id, v
589
  def plot_rmse_cluster(speech_data,words,seg_aligns,cluster_id):
590
  colors = ["red", "green", "blue", "orange", "purple", "pink", "brown", "gray", "cyan"]
591
  cc = 0
592
- fig = plt.figure(figsize=(10, 5))
593
  plt.title(f"{words} - Energy - Cluster {cluster_id}")
594
  for k,v in speech_data.items():
595
 
@@ -607,14 +607,14 @@ def plot_rmse_cluster(speech_data,words,seg_aligns,cluster_id):
607
  realign = np.mean([word_times[0][2],word_times[1][1]])
608
  rmse_xvals = [x - realign for x in rmse_xvals]
609
  word_times = [(w,s-realign,e-realign) for w,s,e in word_times]
610
- plt.axvline(x= 0, color="gray", linestyle='-', linewidth=1, label=f"{word_times[0][0]} -> {word_times[1][0]} boundary")
611
 
612
  if len(word_times)>2:
613
  for i in range(1,len(word_times)-1):
614
  bound_line = np.mean([word_times[i][2],word_times[i+1][1]])
615
  plt.axvline(x=bound_line, color=colors[cc], linestyle='--', linewidth=1, label=f"Speaker {spk} -> {word_times[i+1][0]}")
616
 
617
- plt.scatter(rmse_xvals, rmse, color=colors[cc], label=f"Speaker {spk}")
618
  cc += 1
619
  if cc >= len(colors):
620
  cc=0
 
552
  realign = np.mean([word_times[0][2],word_times[1][1]])
553
  rmse_xvals = [x - realign for x in rmse_xvals]
554
  word_times = [(w,s-realign,e-realign) for w,s,e in word_times]
555
+ plt.axvline(x= 0, color="gray", linestyle='--', linewidth=1, label=f"{word_times[0][0]} -> {word_times[1][0]} boundary")
556
 
557
  if len(word_times)>2:
558
  for i in range(1,len(word_times)-1):
559
  bound_line = np.mean([word_times[i][2],word_times[i+1][1]])
560
+ plt.axvline(x=bound_line, color=colors[cc], linestyle='--', linewidth=1, label=f"Speaker {spk} -> {word_times[i+1][0]}")
561
 
562
+ plt.plot(rmse_xvals, rmse, color=colors[cc], label=f"Speaker {spk}")
563
  cc += 1
564
  if cc >= len(colors):
565
  cc=0
 
575
  if len(tts_align)>2:
576
  for i in range(2,len(tts_align)):
577
  bound_line = tts_align[i][1]
578
+ plt.axvline(x=bound_line, color="black", linestyle='--', linewidth=1, label=f"TTS -> {tts_align[i][0]}")
579
+ plt.plot(t_xvals, trmse, color="black", label=f"TTS {voice}")
580
 
581
 
582
  #plt.legend()
 
589
  def plot_rmse_cluster(speech_data,words,seg_aligns,cluster_id):
590
  colors = ["red", "green", "blue", "orange", "purple", "pink", "brown", "gray", "cyan"]
591
  cc = 0
592
+ fig, ax1 = plt.figure(figsize=(10, 5))
593
  plt.title(f"{words} - Energy - Cluster {cluster_id}")
594
  for k,v in speech_data.items():
595
 
 
607
  realign = np.mean([word_times[0][2],word_times[1][1]])
608
  rmse_xvals = [x - realign for x in rmse_xvals]
609
  word_times = [(w,s-realign,e-realign) for w,s,e in word_times]
610
+ plt.axvline(x= 0, color="gray", linestyle='--', linewidth=1, label=f"{word_times[0][0]} -> {word_times[1][0]} boundary")
611
 
612
  if len(word_times)>2:
613
  for i in range(1,len(word_times)-1):
614
  bound_line = np.mean([word_times[i][2],word_times[i+1][1]])
615
  plt.axvline(x=bound_line, color=colors[cc], linestyle='--', linewidth=1, label=f"Speaker {spk} -> {word_times[i+1][0]}")
616
 
617
+ plt.plot(rmse_xvals, rmse, color=colors[cc], label=f"Speaker {spk}")
618
  cc += 1
619
  if cc >= len(colors):
620
  cc=0