Hi,
I’m trying to convert Retinanet into rknn model for running on RK3588 NPU.
But I came across the segmentation fault while converting.
The backbone of retinanet is resent18 and is implemented with pytrorch.
I first use the following code to generate the *.pt file for rknn-toolkit2.
net_path = 'kitti_retinanet_78.pt'
retinanet = torch.load(net_path, map_location=torch.device('cpu'))
data = torch.rand(1, 3, 320, 1056)
retinanet.eval()
traced_script_module = torch.jit.trace(retinanet, example) torch.jit.save(traced_script_module, 'rknn_retinanet.pt')
And then, I used the following code to convert the model.
import numpy as np
import cv2
from rknn.api import RKNN
import torchvision.models as models
import torch
import os
model = './rknn_retinanet.pt'
input_size_list = [[1, 3, 320, 1056]]
# Create RKNN object
rknn = RKNN(verbose=True)
# Pre-process config
print('--> Config model')
rknn.config(mean_values=[0, 0, 0], std_values=[58.395, 58.395, 58.395], target_platform="rk3588")
print('done')
# Load model
print('--> Loading model')
ret = rknn.load_pytorch(model=model, input_size_list=input_size_list)
if ret != 0:
print('Load model failed!')
exit(ret)
print('done')
# Build model
print('--> Building model')
ret = rknn.build(do_quantization=False, dataset='./dataset.txt')
while running the rknn.build function, it caused “segmetation fault”:
W __init__: rknn-toolkit2 version: 1.4.0-22dcfef4
--> Config model
done
--> Loading model
PtParse: ███████████████████████████████████████████████▌ | 1214/1277 PtParse: 100%|█████████████████████████████████████████████████| 1277/1277 [00:09<00:00, 133.85it/s]
done
--> Building model
I base_optimize ...
Segmentation fault (core dumped)
Is this caused by model is too large?
I’m wondering is there anyway to debug this issue?
Any idea would be appreciated!