code: def __init__(
      self,
      tsv_path,
      km_path,
      substring,
      spk,
      spk2id,
      gst,
      gst2id,
      f0_bins,
      f0_bin_type,
      f0_smoothing,
      f0_norm,
      f0_log,
  ):
      lines = open(tsv_path, "r").readlines()
      self.root, self.tsv = lines[0], lines[1:]
      self.root = self.root.strip()
      self.km = open(km_path, "r").readlines()
      print(f"loaded {len(self.km)} files")
  
      self.spk = spk
      self.spk2id = spk2id
      self.gst = gst
      self.gst2id = gst2id
  
      self.f0_bins = f0_bins
      self.f0_smoothing = f0_smoothing
      self.f0_norm = f0_norm
      self.f0_log = f0_log
  
      if substring != "":
          tsv, km = [], []
          for tsv_line, km_line in zip(self.tsv, self.km):
              if substring.lower() in tsv_line.lower():
                  tsv.append(tsv_line)
                  km.append(km_line)
          self.tsv, self.km = tsv, km
          print(f"after filtering: {len(self.km)} files")
  
      self.speaker_stats = self._compute_f0_stats()
      self.f0_min, self.f0_max = self._compute_f0_minmax()
      if f0_bin_type == "adaptive":
          self.f0_bins = quantize_f0(
              self.speaker_stats,
              self.f0_bins,
              self.f0_norm,
              self.f0_log,
          )
      elif f0_bin_type == "uniform":
          self.f0_bins = torch.linspace(
              self.f0_min, self.f0_max, self.f0_bins + 1
          )[1:-1]
      else:
          raise NotImplementedError
      print(f"f0 min: {self.f0_min}, f0 max: {self.f0_max}")
      print(f"bins: {self.f0_bins} (shape: {self.f0_bins.shape})")
  
imports: import logging
  import os
  import random
  import sys
  from collections import defaultdict
  import hydra
  import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from einops import rearrange
  from einops.layers.torch import Rearrange
  from scipy.io.wavfile import read
  from scipy.ndimage import gaussian_filter1d
  from torch.utils.data import DataLoader, Dataset
  from tqdm import tqdm
  from dataset import parse_speaker, parse_style
  from .utils import F0Stat
label_desc: Use image node_id 1 to create a new PitchDataset object from inherited base classes: Dataset with example: obj = PitchDataset(tsv_path, km_path, substring, spk, spk2id, gst, gst2id, f0_bins, f0_bin_type, f0_smoothing, f0_norm, f0_log)