YWL0720 / YOLO_ORB_SLAM3

This is an improved version of ORB-SLAM3 that adds an object detection module implemented with YOLOv5 to achieve SLAM in dynamic environments.
242 stars 29 forks source link

How to train & use custom model? #38

Open Windyw2 opened 2 months ago

Windyw2 commented 2 months ago

如何将yolov5s.torchscript.pt替换成自己训练的模型?直接替换的话会报如下错误: terminate called after throwing an instance of 'c10::Error' what(): isTuple()INTERNAL ASSERT FAILED at "../aten/src/ATen/core/ivalue_inl.h":1916, please report a bug to PyTorch. Expected Tuple but got String Exception raised from toTupleRef at ../aten/src/ATen/core/ivalue_inl.h:1916 (most recent call first): frame #0: c10::Error::Error(c10::SourceLocation, std::cxx11::basic_string<char, std::char_traits, std::allocator >) + 0x6b (0x7f9cfcd8f7ab in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libc10.so) frame #1: c10::detail::torchCheckFail(char const, char const, unsigned int, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0xce (0x7f9cfcd8b15e in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libc10.so) frame #2: c10::detail::torchInternalAssertFail(char const, char const, unsigned int, char const*, std::cxx11::basic_string<char, std::char_traits, std::allocator > const&) + 0x4e (0x7f9cfcd8cefe in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libc10.so) frame #3: + 0x35cb877 (0x7f9d0083a877 in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libtorch_cpu.so) frame #4: + 0x35cbad5 (0x7f9d0083aad5 in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libtorch_cpu.so) frame #5: torch::jit::format_stack_trace(std::ostream&, std::vector<torch::jit::StackEntry, std::allocator > const&) + 0x99 (0x7f9cfe47b079 in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libtorch_cpu.so) frame #6: + 0x34d9d13 (0x7f9d00748d13 in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libtorch_cpu.so) frame #7: + 0x34e685b (0x7f9d0075585b in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libtorch_cpu.so) frame #8: torch::jit::InterpreterState::run(std::vector<c10::IValue, std::allocator >&) + 0x52 (0x7f9d00742572 in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libtorch_cpu.so) frame #9: + 0x34c678d (0x7f9d0073578d in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libtorch_cpu.so) frame #10: torch::jit::Method::operator()(std::vector<c10::IValue, std::allocator >, std::unordered_map<std::cxx11::basic_string<char, std::char_traits, std::allocator >, c10::IValue, std::hash<std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::equal_to<std::cxx11::basic_string<char, std::char_traits, std::allocator > >, std::allocator<std::pair<std::cxx11::basic_string<char, std::char_traits, std::allocator > const, c10::IValue> > > const&) const + 0x194 (0x7f9d003e4d24 in /home/pc/Deps/1/ORB_SLAM3/Thirdparty/libtorch/lib/libtorch_cpu.so) frame #11: YoloDetection::Detect() + 0x9b6 (0x7f9d14f44ab6 in /home/pc/Deps/1/ORB_SLAM3/lib/libORB_SLAM3.so) frame #12: ORB_SLAM3::Tracking::GrabImageStereo(cv::Mat const&, cv::Mat const&, double const&, std::cxx11::basic_string<char, std::char_traits, std::allocator >, cv::Mat const&) + 0x2b9 (0x7f9d14d79c39 in /home/pc/Deps/1/ORB_SLAM3/lib/libORB_SLAM3.so) frame #13: ORB_SLAM3::System::TrackStereo(cv::Mat const&, cv::Mat const&, double const&, std::vector<ORB_SLAM3::IMU::Point, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) + 0xcfe (0x7f9d14d22bfe in /home/pc/Deps/1/ORB_SLAM3/lib/libORB_SLAM3.so) frame #14: main + 0x10e5 (0x563a36152235 in ./Stereo/stereo_haud) frame #15: libc_start_main + 0xf3 (0x7f9cfcea1083 in /lib/x86_64-linux-gnu/libc.so.6) frame #16: _start + 0x2e (0x563a36152dce in ./Stereo/stereo_haud)

ddkats commented 2 months ago

Hi @Windyw2. Did you resolve the issue?