-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathdensenet_classification_server.cpp
51 lines (40 loc) · 1.42 KB
/
densenet_classification_server.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
/************************************************
* Copyright MaybeShewill-CV. All Rights Reserved.
* Author: MaybeShewill-CV
* File: densenet_classification_server.cpp
* Date: 22-7-1
************************************************/
// densenet classification server tool
#include <glog/logging.h>
#include <workflow/WFFacilities.h>
#include "factory/classification_task.h"
using jinq::factory::classification::create_densenet_cls_server;
int main(int argc, char **argv) {
google::InitGoogleLogging(argv[0]);
google::InstallFailureSignalHandler();
google::SetStderrLogging(google::GLOG_INFO);
FLAGS_alsologtostderr = true;
FLAGS_colorlogtostderr = true;
if (argc != 2) {
LOG(INFO) << "usage:";
LOG(INFO) << "exe cfg_path";
return -1;
}
static WFFacilities::WaitGroup wait_group(1);
std::string config_file_path = argv[1];
LOG(INFO) << "cfg file path: " << config_file_path;
auto config = toml::parse(config_file_path);
const auto &server_cfg = config.at("DENSENET_CLASSIFICATION_SERVER");
auto port = server_cfg.at("port").as_integer();
LOG(INFO) << "serve on port: " << port;
auto server = create_densenet_cls_server("densenet_cls_server");
server->init(config);
if (server->start(port) == 0) {
wait_group.wait();
server->stop();
} else {
LOG(ERROR) << "Cannot start server";
return -1;
}
return 0;
}