# 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')