Skip to content

Commit

Permalink
Merge pull request #171 from LewisLiuPub/prep_v0.7.0
Browse files Browse the repository at this point in the history
Prep v0.7.0
  • Loading branch information
LewisLiuPub authored Dec 9, 2019
2 parents bc1327c + 684dad0 commit 25bddbb
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 33 deletions.
2 changes: 1 addition & 1 deletion dynamic_vino_lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ set(CMAKE_CXX_FLAGS "-std=c++14 ${CMAKE_CXX_FLAGS}")


message(STATUS "Looking for inference engine configuration file at: ${CMAKE_PREFIX_PATH}")
find_package(InferenceEngine 1.1)
find_package(InferenceEngine REQUIRED)
if(NOT InferenceEngine_FOUND)
message(FATAL_ERROR "")
endif()
Expand Down
10 changes: 6 additions & 4 deletions dynamic_vino_lib/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ limitations under the License.

<package format="2">
<name>dynamic_vino_lib</name>
<version>0.3.0</version>
<version>0.7.0</version>
<description>a ROS2 wrapper package for Intel OpenVINO</description>
<maintainer email="[email protected]">Weizhi Liu</maintainer>
<maintainer email="[email protected]">Chao Li</maintainer>
<maintainer email="[email protected]">Hongkun Chen</maintainer>
<maintainer email="[email protected]">Yang Lu</maintainer>
<author email="[email protected]">Chao Li</author>
<author email="[email protected]">Hongkun Chen</author>
<author email="[email protected]">Yang Lu</author>
<author email="[email protected]">Xuyang Chen</author>
<author email="[email protected]">Rachel Ren</author>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
3 changes: 3 additions & 0 deletions dynamic_vino_lib/src/engines/engine_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ std::shared_ptr<Engines::Engine> Engines::EngineManager::createEngine_V2019R2_pl
const std::string & device, const std::shared_ptr<Models::BaseModel> & model)
{
InferenceEngine::Core core;
if ((device.find("CPU") != std::string::npos)) {
core.AddExtension(std::make_shared<InferenceEngine::Extensions::Cpu::CpuExtensions>(), device);
}
auto executable_network = core.LoadNetwork(model->getNetReader()->getNetwork(), device);
auto request = executable_network.CreateInferRequestPtr();

Expand Down
41 changes: 19 additions & 22 deletions dynamic_vino_lib/src/pipeline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,31 +186,28 @@ void Pipeline::runOnce()
{
initInferenceCounter();

// auto t0 = std::chrono::high_resolution_clock::now();
if(width_ != 0 || height_ != 0){
for (auto pos = next_.equal_range(input_device_name_); pos.first != pos.second; ++pos.first) {
std::string detection_name = pos.first->second;
auto detection_ptr = name_to_detection_map_[detection_name];
detection_ptr->enqueue(frame_, cv::Rect(width_ / 2, height_ / 2, width_, height_));
increaseInferenceCounter();
detection_ptr->submitRequest();
}

for (auto & pair : name_to_output_map_) {
pair.second->feedFrame(frame_);
}
countFPS();
}

if (!input_device_->read(&frame_)) {
// throw std::logic_error("Failed to get frame from cv::VideoCapture");
// slog::warn << "Failed to get frame from input_device." << slog::endl;
width_ = 0;
height_ = 0;
} else {
width_ = frame_.cols;
height_ = frame_.rows;
return; //do nothing if now frame read out
}
width_ = frame_.cols;
height_ = frame_.rows;

// auto t0 = std::chrono::high_resolution_clock::now();
for (auto pos = next_.equal_range(input_device_name_); pos.first != pos.second; ++pos.first) {
std::string detection_name = pos.first->second;
auto detection_ptr = name_to_detection_map_[detection_name];
detection_ptr->enqueue(frame_, cv::Rect(width_ / 2, height_ / 2, width_, height_));
increaseInferenceCounter();
detection_ptr->submitRequest();
}

for (auto &pair : name_to_output_map_)
{
pair.second->feedFrame(frame_);
}
countFPS();

std::unique_lock<std::mutex> lock(counter_mutex_);
cv_.wait(lock, [self = this]() {return self->counter_ == 0;});
Expand Down Expand Up @@ -306,7 +303,7 @@ void Pipeline::decreaseInferenceCounter()
}

void Pipeline::countFPS()
{
{
frame_cnt_++;
auto t_end = std::chrono::high_resolution_clock::now();
typedef std::chrono::duration<double, std::ratio<1, 1000>> ms;
Expand Down
2 changes: 1 addition & 1 deletion people_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ limitations under the License.

<package format="3">
<name>people_msgs</name>
<version>0.3.0</version>
<version>0.7.0</version>
<description>A package containing people message definitions.</description>
<author email="[email protected]">Weizhi Liu</author>
<author email="[email protected]">Chao Li</author>
Expand Down
3 changes: 1 addition & 2 deletions pipeline_srv_msgs/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,13 @@ limitations under the License.

<package format="3">
<name>pipeline_srv_msgs</name>
<version>0.3.0</version>
<version>0.7.0</version>
<description>A package containing pipeline service message definitions.</description>
<author email="[email protected]">Yang Lu</author>
<author email="[email protected]">Weizhi Liu</author>
<author email="[email protected]">Chao Li</author>
<author email="[email protected]">Hongkun Chen</author>
<maintainer email="[email protected]">Weizhi Liu</maintainer>
<maintainer email="[email protected]">Weizhi Li</maintainer>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down
7 changes: 4 additions & 3 deletions sample/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ limitations under the License.

<package format="2">
<name>dynamic_vino_sample</name>
<version>0.3.0</version>
<version>0.7.0</version>
<description>a ROS2 wrapper package for Intel OpenVINO</description>
<maintainer email="[email protected]">Weizhi Liu</maintainer>
<maintainer email="[email protected]">Chao Li</maintainer>
<maintainer email="[email protected]">Yang Lu</maintainer>
<author email="[email protected]">Chao Li</author>
<author email="[email protected]">Yang Lu</author>
<author email="[email protected]">Rachel Ren</author>
<license>Apache License 2.0</license>

<buildtool_depend>ament_cmake</buildtool_depend>
Expand Down

0 comments on commit 25bddbb

Please sign in to comment.