utility.py
def generate_stats(self, statfolder: str = './etc'):
        '''generate all user's statitics used for calutate normalized
           input like sp, f0
           step 1: generate coded_sp mean std
           step 2: generate f0 mean std
         '''
        etc_path = os.path.join(os.path.realpath('.'), statfolder)
        if not os.path.exists(etc_path):
            os.makedirs(etc_path, exist_ok=True)

        for one_speaker in self.include_dict.keys():
            coded_sps = []

            arr = self.include_dict[one_speaker]
            if len(arr) == 0:
                continue
            for one_file in arr:
                t = np.load(os.path.join(self.folder, one_file))
                # print(t.shape)
                coded_sps.append(t)

            coded_sps_mean, coded_sps_std = self.coded_sp_statistics(coded_sps)
            # print(f'sp_mean: {coded_sps_mean.shape} \
            # sp_std: {coded_sps_std.shape}')

            f0s = []
            arr01 = self.include_dict_npz[one_speaker]
            if len(arr01) == 0:
                continue
            for one_file in arr01:
                t = np.load(os.path.join(self.folder, one_file))
                d = t.f.arr_0.item()
                f0_ = np.reshape(d['f0'], [-1, 1])
                # print(f'f0 shape: {f0_.shape}')
                f0s.append(f0_)
            log_f0s_mean, log_f0s_std = self.logf0_statistics(f0s)
            print(log_f0s_mean, log_f0s_std)

            tempdict = {'log_f0s_mean': log_f0s_mean, 'log_f0s_std': log_f0s_std, 'coded_sps_mean': coded_sps_mean, 'coded_sps_std': coded_sps_std}

            filename = os.path.join(etc_path, f'{one_speaker}-stats.npz')
            print(f'save: {filename}')
            np.savez(filename, tempdict)
generate all user's statitics used for calutate normalized
           input like sp, f0
           step 1: generate coded_sp mean std
           step 2: generate f0 mean std
         
generate all user's statitics used for calutate normalized
input like sp, f0
step 1: generate coded_sp mean std
step 2: generate f0 mean std
generate all user ' s statitics used for calutate normalized input like sp f0 step 1 : generate coded_sp mean std step 2 : generate f0 mean std
def generate_stats(self, statfolder: str = './etc'):
        etc_path = os.path.join(os.path.realpath('.'), statfolder)
        if not os.path.exists(etc_path):
            os.makedirs(etc_path, exist_ok=True)
        for one_speaker in self.include_dict.keys():
            coded_sps = []
            arr = self.include_dict[one_speaker]
            if len(arr) == 0:
                continue
            for one_file in arr:
                t = np.load(os.path.join(self.folder, one_file))
                coded_sps.append(t)
            coded_sps_mean, coded_sps_std = self.coded_sp_statistics(coded_sps)
            f0s = []
            arr01 = self.include_dict_npz[one_speaker]
            if len(arr01) == 0:
                continue
            for one_file in arr01:
                t = np.load(os.path.join(self.folder, one_file))
                d = t.f.arr_0.item()
                f0_ = np.reshape(d['f0'], [-1, 1])
                f0s.append(f0_)
            log_f0s_mean, log_f0s_std = self.logf0_statistics(f0s)
            print(log_f0s_mean, log_f0s_std)
            tempdict = {'log_f0s_mean': log_f0s_mean, 'log_f0s_std': log_f0s_std, 'coded_sps_mean': coded_sps_mean, 'coded_sps_std': coded_sps_std}
            filename = os.path.join(etc_path, f'{one_speaker}-stats.npz')
            print(f'save: {filename}')
            np.savez(filename, tempdict)
def generate_stats ( self , statfolder : str = './etc' ) : etc_path = os . path . join ( os . path . realpath ( '.' ) , statfolder ) if not os . path . exists ( etc_path ) : os . makedirs ( etc_path , exist_ok = True ) for one_speaker in self . include_dict . keys ( ) : coded_sps = [ ] arr = self . include_dict [ one_speaker ] if len ( arr ) == 0 : continue for one_file in arr : t = np . load ( os . path . join ( self . folder , one_file ) ) coded_sps . append ( t ) coded_sps_mean , coded_sps_std = self . coded_sp_statistics ( coded_sps ) f0s = [ ] arr01 = self . include_dict_npz [ one_speaker ] if len ( arr01 ) == 0 : continue for one_file in arr01 : t = np . load ( os . path . join ( self . folder , one_file ) ) d = t . f . arr_0 . item ( ) f0_ = np . reshape ( d [ 'f0' ] , [ - 1 , 1 ] ) f0s . append ( f0_ ) log_f0s_mean , log_f0s_std = self . logf0_statistics ( f0s ) print ( log_f0s_mean , log_f0s_std ) tempdict = { 'log_f0s_mean' : log_f0s_mean , 'log_f0s_std' : log_f0s_std , 'coded_sps_mean' : coded_sps_mean , 'coded_sps_std' : coded_sps_std } filename = os . path . join ( etc_path , f'{one_speaker}-stats.npz' ) print ( f'save: {filename}' ) np . savez ( filename , tempdict )
generate all user's statitics used for calutate normalized
input like sp, f0
step 1: generate coded_sp mean std
step 2: generate f0 mean std
generate all user ' s statitics used for calutate normalized input like sp f0 step 1 : generate coded_sp mean std step 2 : generate f0 mean std
'''generate all user's statitics used for calutate normalized
           input like sp, f0
           step 1: generate coded_sp mean std
           step 2: generate f0 mean std
         ''' # print(t.shape) # print(f'sp_mean: {coded_sps_mean.shape} \ # sp_std: {coded_sps_std.shape}') # print(f'f0 shape: {f0_.shape}')
self
statfolder
str