| 107 | } |
| 108 | |
| 109 | int main(int argc, char* argv[]) |
| 110 | { |
| 111 | int ret = -1; |
| 112 | const std::string root_path = get_root_path(); |
| 113 | std::string proto_file; |
| 114 | std::string model_file; |
| 115 | std::string image_file; |
| 116 | std::string save_name = "save.jpg"; |
| 117 | |
| 118 | int res; |
| 119 | while((res = getopt(argc, argv, "p:m:i:")) != -1) |
| 120 | { |
| 121 | switch(res) |
| 122 | { |
| 123 | case 'p': |
| 124 | proto_file = optarg; |
| 125 | break; |
| 126 | case 'm': |
| 127 | model_file = optarg; |
| 128 | break; |
| 129 | case 'i': |
| 130 | image_file = optarg; |
| 131 | break; |
| 132 | default: |
| 133 | break; |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | // init tengine |
| 138 | if(init_tengine() < 0) |
| 139 | { |
| 140 | std::cout << " init tengine failed\n"; |
| 141 | return 1; |
| 142 | } |
| 143 | if(request_tengine_version("0.9") < 0) |
| 144 | { |
| 145 | std::cout << " request tengine version failed\n"; |
| 146 | return 1; |
| 147 | } |
| 148 | |
| 149 | if(proto_file.empty()) |
| 150 | { |
| 151 | proto_file = root_path + DEF_PROTO; |
| 152 | std::cout << "proto file not specified,using " << proto_file << " by default\n"; |
| 153 | } |
| 154 | if(model_file.empty()) |
| 155 | { |
| 156 | model_file = root_path + DEF_MODEL; |
| 157 | std::cout << "model file not specified,using " << model_file << " by default\n"; |
| 158 | } |
| 159 | if(image_file.empty()) |
| 160 | { |
| 161 | image_file = root_path + DEF_IMAGE; |
| 162 | std::cout << "image file not specified,using " << image_file << " by default\n"; |
| 163 | } |
| 164 | // check file |
| 165 | if(!check_file_exist(proto_file) or (!check_file_exist(model_file) or !check_file_exist(image_file))) |
| 166 | { |
nothing calls this directly
no test coverage detected