ncnn yolov5s 转pnnx

7xzttuei  于 4个月前  发布在  其他
关注(0)|答案(2)|浏览(43)

./bin/pnnx yolov5s.pt inputshape=1,3,640,640 inputshape2=1,3,320,320 device=gpu moduleop=yolov5.models.common.Focus,models.yolo.Detect device=cpu
pnnxparam = yolov5s.pnnx.param
pnnxbin = yolov5s.pnnx.bin
pnnxpy = yolov5s_pnnx.py
ncnnparam = yolov5s.ncnn.param
ncnnbin = yolov5s.ncnn.bin
ncnnpy = yolov5s_ncnn.py
optlevel = 2
device = cpu
inputshape = [1,3,640,640]
inputshape2 = [1,3,320,320]
customop =
moduleop = yolov5.models.common.Focus,models.yolo.Detect
libc++abi: terminating with uncaught exception of type c10::Error: PytorchStreamReader failed locating file constants.pkl: file not found
Exception raised from valid at ../caffe2/serialize/inline_container.cc:158 (most recent call first):
frame #0: c10::Error::Error(c10::SourceLocation, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >) + 98 (0x104b74522 in libc10.dylib)
frame #1 : c10::detail::torchCheckFail(char const*, char const*, unsigned int, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 106 (0x104b72c3a in libc10.dylib)
frame #2 : caffe2::serialize::PyTorchStreamReader::valid(char const*, char const*) + 128 (0x129c94300 in libtorch_cpu.dylib)
frame #3 : caffe2::serialize::PyTorchStreamReader::getRecordID(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 98 (0x129c94d22 in libtorch_cpu.dylib)
frame #4 : caffe2::serialize::PyTorchStreamReader::getRecord(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 70 (0x129c94466 in libtorch_cpu.dylib)
frame #5 : torch::jit::readArchiveAndTensors(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, c10::optional<std::__1::function<c10::StrongTypePtr (c10::QualifiedName const&)> >, c10::optional<std::__1::function<c10::intrusive_ptr<c10::ivalue::Object, c10::detail::intrusive_target_default_null_typec10::ivalue::Object > (c10::StrongTypePtr, c10::IValue)> >, c10::optionalc10::Device, caffe2::serialize::PyTorchStreamReader&, std::__1::shared_ptrtorch::jit::DeserializationStorageContext) + 235 (0x12b6e54fb in libtorch_cpu.dylib)
frame #6 : torch::jit::(anonymous namespace)::ScriptModuleDeserializer::readArchive(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&) + 209 (0x12b6e2221 in libtorch_cpu.dylib)
frame #7 : torch::jit::(anonymous namespace)::ScriptModuleDeserializer::deserialize(c10::optionalc10::Device, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > >&) + 766 (0x12b6e016e in libtorch_cpu.dylib)
frame #8 : torch::jit::load(std::__1::shared_ptrcaffe2::serialize::ReadAdapterInterface, c10::optionalc10::Device, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > >&) + 613 (0x12b6e1bc5 in libtorch_cpu.dylib)
frame #9 : torch::jit::load(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, c10::optionalc10::Device, std::__1::unordered_map<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::hash<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::equal_to<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::pair<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > >&) + 119 (0x12b6e1df7 in libtorch_cpu.dylib)
frame #10 : torch::jit::load(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, c10::optionalc10::Device) + 43 (0x12b6e1ceb in libtorch_cpu.dylib)
frame #11 : main + 4136 (0x1042975a8 in pnnx)
frame #12 : start + 462 (0x1123fa4fe in dyld)

[1] 13352 abort ./bin/pnnx yolov5s.pt inputshape=1,3,640,640 inputshape2=1,3,320,320

efzxgjgh

efzxgjgh1#

@wm901115nwpu 提供一下pth模型

cidc1ykv

cidc1ykv2#

我这边转好了,之前用的是pytorch pth的模型,我该用torchscript就可以了,是不是只能用torchscript

相关问题