def get_frrn_label(self): params, _ = self.voc filename, offset, _range = params voc = get_offset_range_patch(filename, offset, _range) # voc = (voc > FCN_VOC_THRESHOLD).astype('float') voc = voc.reshape((voc.shape[0], voc.shape[1], 1)) return (voc > FCN_VOC_THRESHOLD).astype('int32')
def _safe_write(self, data): # print(data) if isinstance(data, MixWithVocalResult): self.output_queue.put( (data.desc(), data._slice(), *data.get_rnn_label())) return if isinstance(data, InstWithVocalResult): self.output_queue.put( (data.desc(), data.mix(), *data.get_rnn_label())) return params, label = data filename, offset, _range = params aud = get_offset_range_patch(filename, offset, _range) if label == [1, 0]: y1 = aud.reshape((aud.shape[0], aud.shape[1], 1)) y2 = np.zeros((aud.shape[0], aud.shape[1], 1)) # label = np.concatenate((others, voc), axis=2) else: # voc = (aud > FCN_VOC_THRESHOLD).astype('float') y1 = np.zeros((aud.shape[0], aud.shape[1], 1)) y2 = aud.reshape((voc.shape[0], voc.shape[1], 1)) # label = np.concatenate((others, voc), axis=2) # voc = (voc > FCN_VOC_THRESHOLD).astype('int32') # label = voc # if np.isnan(aud).any() or np.isinf(aud).any(): if np.isnan(aud).any(): raise HasNanException() desc = str(params) self.output_queue.put((desc, aud, y1, y2))
def _safe_write(self, data): # print(data) if isinstance(data, MixWithVocalResult): self.output_queue.put( (data.desc(), data._slice(), data.get_label())) return if isinstance(data, InstWithVocalResult): self.output_queue.put((data.desc(), data.mix(), data.get_label())) return params, label = data filename, offset, _range = params aud = get_offset_range_patch(filename, offset, _range) # if np.isnan(aud).any() or np.isinf(aud).any(): if np.isnan(aud).any(): raise HasNanException() desc = str(params) self.output_queue.put((desc, aud, label))
def _slice(self): params, _ = self.voc filename, offset, _range = params ret = get_offset_range_patch(filename, offset, _range, self.mix) return ret