| 50 | } |
| 51 | |
| 52 | int main(int argc, char** argv) |
| 53 | { |
| 54 | cv::CommandLineParser parser(argc, argv, |
| 55 | { |
| 56 | "{model || tensorrt model file }" |
| 57 | "{size || image (h, w), eg: 640}" |
| 58 | "{batch_size|| batch size }" |
| 59 | "{video || video's path }" |
| 60 | "{img || image's path }" |
| 61 | "{cam_id || camera's device id }" |
| 62 | "{show || if show the result }" |
| 63 | "{savePath || save path, can be ignore}" |
| 64 | }); |
| 65 | // parameters |
| 66 | utils::InitParameter param; |
| 67 | setParameters(param); |
| 68 | // path |
| 69 | std::string model_path = "../../data/efficientdet/efficientdet0.trt"; |
| 70 | std::string video_path = "../../data/people.mp4"; |
| 71 | std::string image_path = "../../data/6406403.jpg"; |
| 72 | int camera_id = 0; // camera' id |
| 73 | |
| 74 | // get input |
| 75 | utils::InputStream source; |
| 76 | //source = utils::InputStream::IMAGE; |
| 77 | source = utils::InputStream::VIDEO; |
| 78 | //source = utils::InputStream::CAMERA; |
| 79 | |
| 80 | // update params from command line parser |
| 81 | int size = -1; // w or h |
| 82 | int batch_size = 8; |
| 83 | bool is_show = false; |
| 84 | bool is_save = false; |
| 85 | if(parser.has("model")) |
| 86 | { |
| 87 | model_path = parser.get<std::string>("model"); |
| 88 | sample::gLogInfo << "model_path = " << model_path << std::endl; |
| 89 | } |
| 90 | if(parser.has("size")) |
| 91 | { |
| 92 | size = parser.get<int>("size"); |
| 93 | sample::gLogInfo << "size = " << size << std::endl; |
| 94 | param.dst_h = param.dst_w = size; |
| 95 | } |
| 96 | if(parser.has("batch_size")) |
| 97 | { |
| 98 | batch_size = parser.get<int>("batch_size"); |
| 99 | sample::gLogInfo << "batch_size = " << batch_size << std::endl; |
| 100 | param.batch_size = batch_size; |
| 101 | } |
| 102 | if(parser.has("video")) |
| 103 | { |
| 104 | source = utils::InputStream::VIDEO; |
| 105 | video_path = parser.get<std::string>("video"); |
| 106 | sample::gLogInfo << "video_path = " << video_path << std::endl; |
| 107 | } |
| 108 | if(parser.has("img")) |
| 109 | { |
nothing calls this directly
no test coverage detected