MCPcopy Create free account
hub / github.com/MoonInTheRiver/DiffSinger / spec_f0_to_figure

Function spec_f0_to_figure

utils/plot.py:16–27  ·  view source on GitHub ↗
(spec, f0s, figsize=None)

Source from the content-addressed store, hash-verified

14
15
16def spec_f0_to_figure(spec, f0s, figsize=None):
17 max_y = spec.shape[1]
18 if isinstance(spec, torch.Tensor):
19 spec = spec.detach().cpu().numpy()
20 f0s = {k: f0.detach().cpu().numpy() for k, f0 in f0s.items()}
21 f0s = {k: f0 / 10 for k, f0 in f0s.items()}
22 fig = plt.figure(figsize=(12, 6) if figsize is None else figsize)
23 plt.pcolor(spec.T)
24 for i, (k, f0) in enumerate(f0s.items()):
25 plt.plot(f0.clip(0, max_y), label=k, c=LINE_COLORS[i], linewidth=1, alpha=0.8)
26 plt.legend()
27 return fig
28
29
30def dur_to_figure(dur_gt, dur_pred, txt):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected