std::shared_ptr<MetaInfo> getInputMetaInfo();
template<typename T> void perform(mv_source_h &mv_src, std::shared_ptr<MetaInfo> metaInfo);
template<typename T> void performAsync(ObjectDetectionInput &input, std::shared_ptr<MetaInfo> metaInfo);
+ template<typename T> void inferenceThreadLoop();
protected:
std::unique_ptr<mediavision::inference::Inference> _inference;
void parseMetaFile(std::string meta_file_name);
template<typename T> void inference(std::vector<std::vector<T> > &inputVectors);
virtual ObjectDetectionResult &result() = 0;
- template<typename T> friend void inferenceThreadLoop(ObjectDetection *object);
public:
ObjectDetection(ObjectDetectionTaskType task_type);
throw InvalidOperation("Invalid model data type.");
}
-template<typename T> void inferenceThreadLoop(ObjectDetection *object)
+template<typename T> void ObjectDetection::inferenceThreadLoop()
{
// If user called destroy API then this thread loop will be terminated.
- while (!object->_exit_thread) {
+ while (!_exit_thread) {
// If input queue is empty then skip inference request.
- if (object->isInputQueueEmpty<T>())
+ if (isInputQueueEmpty<T>())
continue;
- ObjectDetectionQueue<T> input = object->popFromInput<T>();
+ ObjectDetectionQueue<T> input = popFromInput<T>();
LOGD("Popped : input frame number = %lu", input.frame_number);
- object->inference<T>(input.inputs);
+ inference<T>(input.inputs);
- ObjectDetectionResult &result = object->result();
- result.frame_number = input.frame_number;
+ ObjectDetectionResult &resultQueue = result();
+ resultQueue.frame_number = input.frame_number;
- object->pushToOutput(result);
+ pushToOutput(resultQueue);
}
// waitforOutputQueue function could wait for the notify event after while loop is exited.
// So make sure to call notify_one() here.
- object->_cv_event.notify_one();
+ _cv_event.notify_one();
}
template<typename T> void ObjectDetection::performAsync(ObjectDetectionInput &input, shared_ptr<MetaInfo> metaInfo)
LOGD("Pushed : input frame number = %lu", in_queue.frame_number);
if (!_thread_handle)
- _thread_handle = make_unique<thread>(&inferenceThreadLoop<T>, this);
+ _thread_handle = make_unique<thread>(&ObjectDetection::inferenceThreadLoop<T>, this);
}
void ObjectDetection::performAsync(ObjectDetectionInput &input)
template void ObjectDetection::pushToInput<unsigned char>(ObjectDetectionQueue<unsigned char> &inputQueue);
template ObjectDetectionQueue<unsigned char> ObjectDetection::popFromInput();
template bool ObjectDetection::isInputQueueEmpty<unsigned char>();
-
template void ObjectDetection::performAsync<unsigned char>(ObjectDetectionInput &input, shared_ptr<MetaInfo> metaInfo);
}