Segmentation fault while converting RetinaNet to rknn model

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 = ''
retinanet = torch.load(net_path, map_location=torch.device('cpu'))
data = torch.rand(1, 3, 320, 1056)
traced_script_module = torch.jit.trace(retinanet, example), '')

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 = './'
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")

# Load model
 print('--> Loading model')
 ret = rknn.load_pytorch(model=model, input_size_list=input_size_list)
 if ret != 0:
        print('Load model failed!')

    # Build model
 print('--> Building model')
 ret =, dataset='./dataset.txt')

while running the function, it caused “segmetation fault”:

W __init__: rknn-toolkit2 version: 1.4.0-22dcfef4
--> Config model
--> Loading model
PtParse: ███████████████████████████████████████████████▌  | 1214/1277 PtParse: 100%|█████████████████████████████████████████████████| 1277/1277 [00:09<00:00, 133.85it/s]
--> 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!

Mad dog bite everywhere.

[quote=“JonGroff, post:4, topic:15343”]
That’s ok, you don’t have be ashamed of your failure and ineptitude. I am sure your dad and his boyfriend are proud of yo
That’s ok, you don’t have be ashamed of your failure and ineptitude to find the github for the rknn yolov8. I am sure your dad and his boyfriend are proud of you.

Literally have no idea what’s going on here, since I’m not touching npu, but

Have you checked this one? There is a few hints in the readme

Thanks so much, Dante4!

The first link is a great finding to me:) I figured this out through partition the RetinaNet from scratch which is very close to the partition the function in the link.