|
我按照语音识别的例子,将文字转换成梅尔声谱图,然后作为输入,输入进模型,准备做TTS,为什么显示无法将图片进行转换。求明白人告知 E UnicodeDecodeError: 'utf-8' codec can't decode byte 0x93 in position 0: invalid start byte
rknn.config(channel_mean_value='123.675 116.28 103.53 58.395', reorder_channel='0 1 2')
print('done')
# Load pytorch model
print('--> Loading model')
ret = rknn.load_pytorch(model=model, input_size_list=input_size_list)
if ret != 0:
print('Load pytorch model failed!')
exit(ret)
print('done')
# Build model
print('--> Building model')
ret = rknn.build(dataset='./ljspeech-mel-00001.npy')
if ret != 0:
print('Build pytorch failed!')
# Export rknn model
print('--> Export RKNN model')
ret = rknn.export_rknn('./checkpoint_2000.rknn')
if ret != 0:
print('Export resnet_18.rknn failed!')
exit(ret)
print('done')
ret = rknn.load_rknn('./checkpoint_2000.rknn')
# Set inputs
img = cv2.imread('./ljspeech-mel-00002.npy')
print('--> Init runtime environment')
ret = rknn.init_runtime()
if ret != 0:
print('Init runtime environment failed')
exit(ret)
print('done')
# Inference
print('--> Running model')
outputs = rknn.inference(inputs=[img])
show_outputs(softmax(np.array(outputs[0][0])))
print('done')
|
|