-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9043ba9
commit d586ced
Showing
1 changed file
with
54 additions
and
0 deletions.
There are no files selected for viewing
54 changes: 54 additions & 0 deletions
54
src/apps/server/scene_segmentation/hrnet_segmentation_server.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/************************************************ | ||
* Copyright MaybeShewill-CV. All Rights Reserved. | ||
* Author: MaybeShewill-CV | ||
* File: hrnet_segmentation_server.cpp | ||
* Date: 24-1-30 | ||
************************************************/ | ||
// hrnet segmentation server tool | ||
|
||
#include <glog/logging.h> | ||
#include <workflow/WFFacilities.h> | ||
|
||
#include "factory/scene_segmentation_task.h" | ||
|
||
using jinq::factory::scene_segmentation::create_hrnet_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("HRNET_SERVER"); | ||
auto port = server_cfg.at("port").as_integer(); | ||
LOG(INFO) << "serve on port: " << port; | ||
|
||
auto server = create_hrnet_server("hrnet_segmentation_server"); | ||
auto status = server->init(config); | ||
if (status != jinq::common::StatusCode::OK) { | ||
LOG(INFO) << "hrnet segmentation server init failed"; | ||
return -1; | ||
} | ||
if (server->start(port) == 0) { | ||
wait_group.wait(); | ||
server->stop(); | ||
} else { | ||
LOG(ERROR) << "Cannot start server"; | ||
return -1; | ||
} | ||
|
||
return 0; | ||
} |