|
本帖最后由 nickliu973 于 2023-3-17 23:55 编辑
我们在做retinanet模型时遇到了segmentation fault,
模型的backbone是resent18, framework是pytrorch,先是通过下面的代码倒出pt文件。
- 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')
- print(traced_script_module)
接着通过如下的代码转换模型,
- 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])
- 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')
在执行rknn.build这个函数的时候报了segmetation fault的错误:
- W __init__: rknn-toolkit2 version: 1.4.0-22dcfef4
- --> Config model
- W config: 'target_platform' is None, use rk3566 as default, Please set according to the actual platform!
- 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)
想请教一下会不会是模型太大了导致了这种错误?
以及应该如何debug?
谢谢!
|
|