_taskManager->addEdge("startpoint", "face_detection");
_taskManager->addEdge("face_detection", "endpoint");
+
+ _taskManager->verify();
}
void AutoZoom::configure(InputConfigBase &config)
std::vector<std::shared_ptr<BaseResultType> > _results;
std::queue<std::shared_ptr<std::thread> > _threads;
std::unordered_set<INode *> _is_thread_created;
+ bool _is_graph_verifed { false };
std::mutex _thread_mutex;
void addInput(BaseDataType &input);
void setBypass(const std::string &node_name, bool bypass = true, bool clearResult = false);
std::vector<std::shared_ptr<BaseDataType> > &getInputs();
+ void verify();
void run();
std::vector<std::shared_ptr<BaseResultType> > &output();
void clear();
SINGLEO_LOGE("Invalid graph.(%zu!= %zu)", visitedCount, _nodes.size());
throw InvalidOperation("Invalid graph.");
}
+
+ _is_graph_verifed = true;
+}
+
+void TaskManager::verify()
+{
+ verifyGraph();
}
void TaskManager::run()
throw InvalidOperation("No input source.");
}
- // TODO. move below function to other API. It isn't needed to call them every time run is called.
- verifyGraph();
+ if (!_is_graph_verifed) {
+ SINGLEO_LOGE("Graph is not verified.");
+ throw InvalidOperation("Graph is not verified.");
+ }
auto inputBuffer = make_shared<SharedBuffer>();
void TaskManager::addEdge(const string &node_a_name, const string &node_b_name)
{
+ if (_is_graph_verifed) {
+ SINGLEO_LOGE("Graph has been freezed.");
+ throw InvalidOperation("Graph has been freezed.");
+ }
+
auto &node_a = _nodes_map[node_a_name];
auto &node_b = _nodes_map[node_b_name];
_nodes.clear();
_results.clear();
_is_thread_created.clear();
+ _is_graph_verifed = false;
SharedBuffer::checkMemoryLeak();
}
taskManager->addEdge("bridge", "face_landmark");
taskManager->addEdge("face_landmark", "endpoint");
+ taskManager->verify();
+
for (unsigned int cnt = 0; cnt < maxIteration; ++cnt) {
taskManager->addInput(image_data);
taskManager->run();
taskManager->addEdge("bridge", "face_landmark");
taskManager->addEdge("face_landmark", "endpoint");
+ taskManager->verify();
+
for (unsigned int cnt = 0; cnt < maxIteration; ++cnt) {
taskManager->addInput(image_data);
taskManager->run();
taskManager->addEdge("face_detection", "endpoint");
taskManager->addEdge("face_landmark", "endpoint");
+ taskManager->verify();
+
for (unsigned int cnt = 0; cnt < maxIteration; ++cnt) {
taskManager->addInput(image_data);
taskManager->run();
taskManager->addEdge("face_detection_b", "endpoint");
taskManager->addEdge("face_landmark", "endpoint");
+ taskManager->verify();
+
for (unsigned int cnt = 0; cnt < maxIteration; ++cnt) {
taskManager->addInput(image_data);
taskManager->run();
taskManager->addEdge("object_detection", "endpoint");
taskManager->addEdge("image_classification_2", "endpoint");
+ taskManager->verify();
+
for (unsigned int cnt = 0; cnt < maxIteration; ++cnt) {
taskManager->addInput(image_data);
taskManager->run();
taskManager->addEdge("face_landmark", "endpoint");
taskManager->addEdge("image_classification", "endpoint");
+ taskManager->verify();
+
for (unsigned int cnt = 0; cnt < maxIteration; ++cnt) {
taskManager->addInput(image_data);
taskManager->run();