LiuLimingCode / HFNet_SLAM

HFNet-SLAM: An accurate and real-time monocular SLAM system with deep features
79 stars 15 forks source link

Map Save but No Load #14

Open OsamaRyees opened 4 months ago

OsamaRyees commented 4 months ago

dear Liu, I see great potintial in this algorithm as it detect more features then ORB Slam3. I run the EuroCar dataset with System.SaveAtlasToFile: "mapeuro"

it save when we finish the whole seq an osa file, however, when I tried to enable loadAtlas function similar to ORB Slam3, I got segmentation fault. here is the code:

`
mpKeyFrameDatabase = new KeyFrameDatabase(); if(mStrLoadAtlasFromFile.empty()){ //Create the Atlas cout << "Initialization of Atlas from scratch " << endl; mpAtlas = new Atlas(0); }else{ //user gave a path

//why ORB Slam3 not init a pointer for Atlas if loading data ??! // 0 will be mnLastInitKFidMap(initKFid), which will be passed to new Map(mnLastInitKFidMap) //mpAtlas = new Atlas(0);

        mpKeyFrameDatabase = new KeyFrameDatabase();
        bool isRead =LoadAtlas(FileType::BINARY_FILE);
        if(!isRead){
            exit(-1);
        }
        loadedAtlas = true;
    mpAtlas->CreateNewMap();

}`

sometimes segmentation fault does not happen if I Don't call CreateNewMap (but I get left with view black screen)

could you please fix the issue as training on a map and loading it later is great for many applications

below is the gdb back trace output:

`[New Thread 0xffffb0ae5900 (LWP 22255)] [New Thread 0xffff9c962900 (LWP 22257)] [New Thread 0xffffb06e4900 (LWP 22256)] [New Thread 0xffff906e8900 (LWP 22260)] [New Thread 0xffff90ae9900 (LWP 22259)] [New Thread 0xffff9c561900 (LWP 22258)] [New Thread 0xffff83ff4900 (LWP 22261)] [New Thread 0xffff83682900 (LWP 22262)]

Thread 1 "mono_euroc" received signal SIGSEGV, Segmentation fault. 0x0000fffff7e9e028 in ORBSLAM3::TwoViewReconstruction::Reconstruct(std::vector<cv::KeyPoint, std::allocator > const&, std::vector<cv::KeyPoint, std::allocator > const&, std::vector<int, std::allocator > const&, Sophus::SE3<float, 0>&, std::vector<cv::Point3, std::allocator<cv::Point3_ > >&, std::vector<bool, std::allocator >&) () from /home/os/HFNET_SLAM/HFNet_SLAM/lib/libHFNet_SLAM.so (gdb) tr Tracepoint 4 at 0xfffff7e9e028 (gdb) trace ba Function "ba" not defined. Make tracepoint pending on future shared library load? (y or [n]) n (gdb) bt

0 0x0000fffff7e9e028 in ORBSLAM3::TwoViewReconstruction::Reconstruct(std::vector<cv::KeyPoint, std::allocator > const&, std::vector<cv::KeyPoint, std::allocator > const&, std::vector<int, std::allocator > const&, Sophus::SE3<float, 0>&, std::vector<cv::Point3, std::allocator<cv::Point3_ > >&, std::vector<bool, std::allocator >&) ()

at /home/os/HFNET_SLAM/HFNet_SLAM/lib/libHFNet_SLAM.so

1 0x0000fffff7e71f90 in ORBSLAM3::Pinhole::ReconstructWithTwoViews(std::vector<cv::KeyPoint, std::allocator > const&, std::vector<cv::KeyPoint, std::allocator > const&, std::vector<int, std::allocator > const&, Sophus::SE3<float, 0>&, std::vector<cv::Point3, std::allocator<cv::Point3_ > >&, std::vector<bool, std::allocator >&) ()

at /home/os/HFNET_SLAM/HFNet_SLAM/lib/libHFNet_SLAM.so

2 0x0000fffff7d55ccc in ORB_SLAM3::Tracking::MonocularInitialization() ()

at /home/os/HFNET_SLAM/HFNet_SLAM/lib/libHFNet_SLAM.so

3 0x0000fffff7d57710 in ORB_SLAM3::Tracking::Track() ()

at /home/os/HFNET_SLAM/HFNet_SLAM/lib/libHFNet_SLAM.so

4 0x0000fffff7d58e7c in ORB_SLAM3::Tracking::GrabImageMonocular(cv::Mat const&, double const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) ()

at /home/os/HFNET_SLAM/HFNet_SLAM/lib/libHFNet_SLAM.so

5 0x0000fffff7d1b0bc in ORB_SLAM3::System::TrackMonocular(cv::Mat const&, double const&, std::vector<ORB_SLAM3::IMU::Point, std::allocator > const&, std::__cxx11::basic_string<char, std::char_traits, std::allocator >) ()

at /home/os/HFNET_SLAM/HFNet_SLAM/lib/libHFNet_SLAM.so

6 0x0000aaaaaaaa952c in main ()

`