-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsuperVO.cpp
51 lines (46 loc) · 2.37 KB
/
superVO.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#include <tracker.h>
#define UNDISTORT 0
int main(int argc, char** argv)
{
if(argc < 3)
{
std::cerr << "Arguments not right!" << std::endl;
std::cerr << "./superVO -s setting/xxx.yaml // serialize model to plan file" << std::endl;
std::cerr << "./superVO -d setting/xxx.yaml PATH_TO_SEQUENCE_FOLDER // deserialize plan file and run inference" << std::endl;
return -1;
}
if(argv[1] == "-s" && argc != 3)
{
std::cerr << "Arguments not right!" << std::endl;
std::cerr << "./superVO -s setting/xxx.yaml // serialize model to plan file" << std::endl;
return -1;
}
if(argv[1] == "-d" && argc != 4)
{
std::cerr << "Arguments not right!" << std::endl;
std::cerr << "./superVO -d setting/xxx.yaml PATH_TO_SEQUENCE_FOLDER // deserialize plan file and run inference" << std::endl;
return -1;
}
if(std::string(argv[1]) == "-s")
{
// load camera setting
std::shared_ptr<superVO::dataLoader> spDataLoader(new superVO::dataLoader(argv[2]));
// load tensorRT engine
std::shared_ptr<superVO::trtEngine> spTrtEngine(new superVO::trtEngine(spDataLoader->INPUT_H(), spDataLoader->INPUT_W(), 1, "./build/superpoint_kitti.engine"));
spTrtEngine->buildTRTEngine("./weights/superpoint_v1.wts");
}
else if(std::string(argv[1]) == "-d")
{
// load camera setting
std::shared_ptr<superVO::dataLoader> spDataLoader(new superVO::dataLoader(argv[2], argv[3]));
// load tensorRT engine
std::shared_ptr<superVO::trtEngine> spTrtEngine(new superVO::trtEngine(spDataLoader->INPUT_H(), spDataLoader->INPUT_W(), 1, "./build/superpoint_kitti.engine"));
std::shared_ptr<superVO::map> spMap(new superVO::map(spDataLoader->K()));
std::shared_ptr<superVO::keyFrame> spKeyFrame(new superVO::keyFrame(spTrtEngine, spMap, spDataLoader->K(), spDataLoader->D(), spDataLoader->extrisic(), UNDISTORT));
std::shared_ptr<superVO::frame> spFrame(new superVO::frame(spKeyFrame, spDataLoader->K(), spDataLoader->D(), UNDISTORT));
std::shared_ptr<superVO::optimizer> spOptimizer(new superVO::optimizer(spMap));
std::shared_ptr<superVO::mapDrawer> spDrawer(new superVO::mapDrawer());
superVO::tracker spTracker(spTrtEngine, spDataLoader, spFrame, spKeyFrame, spMap, spOptimizer, spDrawer);
}
return 0;
}