提交 d66882b9 编写于 作者: G gineshidalgo99

Added tracking module structure

上级 e086e6fc
......@@ -36,10 +36,10 @@ You might select multiple topics, delete the rest:
### Your System Configuration
**Operating system** (`lsb_release -a` in Ubuntu):
**Installation mode**: CMake, sh script, or manual Makefile installation (Ubuntu); VS2015, VS2017, CMake, ... (Windows)
**Installation mode**: CMake, sh script, manual Makefile installation, ... (Ubuntu); VS2015, VS2017, CMake, ... (Windows); ...?
**CUDA version** (`cat /usr/local/cuda/version.txt` in most cases):
**cuDNN version**:
**GPU model** (`nvidia-smi` in Ubuntu):
**Caffe version**: Default from OpenPose or custom version.
**OpenCV version**: pre-compiled `apt-get install libopencv-dev` (only Ubuntu); OpenPose default (only Windows); compiled from source: 2.4.9, 2.4.12, 3.1, 3.2, ...
**Caffe version**: Default from OpenPose, custom version, ...?
**OpenCV version**: pre-compiled `apt-get install libopencv-dev` (only Ubuntu); OpenPose default (only Windows); compiled from source? If so, 2.4.9, 2.4.12, 3.1, 3.2?; ...?
Compiler (`gcc --version` in Ubuntu):
<div align="center">
<img src=".github/Logo_main_black.png", width="480">
<img src=".github/Logo_main_black.png", width="240">
</div>
-----------------
[![Build Status](https://travis-ci.org/CMU-Perceptual-Computing-Lab/openpose.svg?branch=master)](https://travis-ci.org/CMU-Perceptual-Computing-Lab/openpose)
| **`Linux`** |
|-------------|
|[![Build Status](https://travis-ci.org/CMU-Perceptual-Computing-Lab/openpose.svg?branch=master)](https://travis-ci.org/CMU-Perceptual-Computing-Lab/openpose)|
OpenPose is a **library for real-time multi-person keypoint detection and multi-threading written in C++** using OpenCV and Caffe.
<p align="center">
<img src="doc/media/pose_face_hands.gif", width="480">
</p>
OpenPose represents the **first real-time multi-person system to jointly detect human body, hand and facial keypoints (in total 130 keypoints) on single images**. **Functionality**:
- **Real-time multi-person keypoint detection**.
- 15 or **18-keypoint body estimation**. **Running time invariant to number of detected people**.
- **2x21-keypoint hand** estimation. Currently, **running time depends** on **number of detected people**.
- **70-keypoint face** estimation. Currently, **running time depends** on **number of detected people**.
- Inputs: Image, video, webcam, and IP camera. Included C++ demos to add your custom input.
- Outputs: Basic GUI display, keypoint saving (JSON, XML, YML, ...), and/or rendered image/video + keypoint saving (PNG, JPG, AVI, ...).
- Available: command-line demo, C++ wrapper, and C++ API.
- OS: Ubuntu, Windows, Nvidia TX2.
## Latest News
......@@ -24,76 +35,51 @@ OpenPose is a **library for real-time multi-person keypoint detection and multi-
## Results
### Body Estimation
<p align="center">
<img src="doc/media/dance.gif", width="480">
</p>
### Body + Face + Hands Estimation
<p align="center">
<img src="doc/media/pose_face.gif", width="480">
</p>
### Body + Hands
<p align="center">
<img src="doc/media/pose_hands.gif", width="480">
</p>
## Contents
1. [Latest News](#latest-news)
2. [Results](#results)
3. [Introduction](#introduction)
4. [Functionality](#functionality)
5. [Installation, Reinstallation and Uninstallation](#installation-reinstallation-and-uninstallation)
6. [Quick Start](#quick-start)
3. [Installation, Reinstallation and Uninstallation](#installation-reinstallation-and-uninstallation)
4. [Quick Start](#quick-start)
1. [Demo](#demo)
2. [OpenPose Wrapper](#openpose-wrapper)
3. [Adding An Extra Module](#Adding-an-extra-module)
4. [OpenPose C++ API](#openpose-c++-api)
7. [Output](#output)
8. [Standalone Face Or Hand Keypoint Detector](#standalone-face-or-hand-keypoint-detector)
9. [Speed Up Openpose And Benchmark](#speed-up-openpose-and-benchmark)
10. [Send Us Failure Cases!](#send-us-failure-cases)
11. [Send Us Your Feedback!](#send-us-your-feedback)
12. [Citation](#citation)
12. [Other Contributors](#other-contributors)
3. [Adding An Extra Module](#adding-an-extra-module)
4. [OpenPose C++ API](#openpose-c-api)
5. [Standalone Face Or Hand Detector](#standalone-face-or-hand-detector)
6. [Library Dependencies](#library-dependencies)
5. [Output](#output)
6. [Speeding Up OpenPose and Benchmark](#speeding-up-openpose-and-benchmark)
7. [Send Us Failure Cases and Feedback!](#send-us-failure-cases-and-feedback)
8. [Authors and Contributors](#authors-and-contributors)
9. [Citation](#citation)
10. [License](#license)
## Introduction
OpenPose represents the **first real-time system to jointly detect human body, hand and facial keypoints (in total 130 keypoints) on single images**. In addition, the system computational performance on body keypoint estimation is invariant to the number of detected people in the image. It uses Caffe, but it could easily be ported to other frameworks (Tensorflow, Torch, etc.). If you implement any of those, feel free to make a pull request!
OpenPose is authored by [Gines Hidalgo](https://www.gineshidalgo.com/), [Zhe Cao](http://www.andrew.cmu.edu/user/zhecao), [Tomas Simon](http://www.cs.cmu.edu/~tsimon/), [Shih-En Wei](https://scholar.google.com/citations?user=sFQD3k4AAAAJ&hl=en), [Hanbyul Joo](http://www.cs.cmu.edu/~hanbyulj/), and [Yaser Sheikh](http://www.cs.cmu.edu/~yaser/). Currently, it is being maintained by [Gines Hidalgo](https://www.gineshidalgo.com/) and [Bikramjot Hanzra](https://www.linkedin.com/in/bikz05).
It is freely available for free non-commercial use, and may be redistributed under these conditions. Please, see the [license](LICENSE) for further details. [Interested in a commercial license? Check this link](https://flintbox.com/public/project/47343/). For commercial queries, contact [Yaser Sheikh](http://www.cs.cmu.edu/~yaser/).
In addition, OpenPose would not be possible without the [CMU Panoptic Studio](http://domedb.perception.cs.cmu.edu/).
The pose estimation work is based on the C++ code from [the ECCV 2016 demo](https://github.com/CMU-Perceptual-Computing-Lab/caffe_rtpose), "Realtime Multiperson Pose Estimation", [Zhe Cao](http://www.andrew.cmu.edu/user/zhecao), [Tomas Simon](http://www.cs.cmu.edu/~tsimon/), [Shih-En Wei](https://scholar.google.com/citations?user=sFQD3k4AAAAJ&hl=en), [Yaser Sheikh](http://www.cs.cmu.edu/~yaser/). The [original repo](https://github.com/ZheC/Multi-Person-Pose-Estimation) includes Matlab and Python version, as well as the training code.
## Results
### Body Estimation
<p align="center">
<img src="doc/media/dance.gif", width="360">
</p>
### Body, Face, and Hands Estimation
<p align="center">
<img src="doc/media/pose_face.gif", width="360">
</p>
## Functionality
- Multi-person 15 or **18-keypoint body pose** estimation and rendering. **Running time invariant to number of people** on the image.
- Multi-person **2x21-keypoint hand** estimation and rendering. Note: In this initial version, **running time** linearly **depends** on the **number of people** on the image.
- Multi-person **70-keypoint face** estimation and rendering. Note: In this initial version, **running time** linearly **depends** on the **number of people** on the image.
- Flexible and easy-to-configure **multi-threading** module.
- Image, video, webcam and IP camera reader.
- Able to save and load the results in various formats (JSON, XML, PNG, JPG, ...).
- Small display and GUI for simple result visualization.
- All the functionality is wrapped into a **simple-to-use OpenPose Wrapper class**.
### Body and Hands Estimation
<p align="center">
<img src="doc/media/pose_hands.gif", width="360">
</p>
## Installation, Reinstallation and Uninstallation
You can find the installation, reinstallation and uninstallation steps on: [doc/installation.md](doc/installation.md).
See [doc/installation.md](doc/installation.md) for instructions on how to build from source or how to download our portable binaries.
## Quick Start
Most users do not need the [OpenPose C++ API](#openpose-c++-api), but they can simply use the basic [Demo](#demo) and/or [OpenPose Wrapper](#openpose-wrapper).
Most users do not need the [OpenPose C++ API](#openpose-c-api), but they can simply use the basic [Demo](#demo) and/or [OpenPose Wrapper](#openpose-wrapper).
### Demo
Ideal to process images/video/webcam and display/save the results. Check [doc/demo_overview.md](doc/demo_overview.md).
......@@ -107,44 +93,46 @@ Learn how to easily add an extra module to OpenPose in [doc/library_add_new_modu
### OpenPose C++ API
Your case if you want to use the C++ API. See [doc/library_introduction.md](doc/library_introduction.md).
## Output
Output (format, keypoint index ordering, etc.) in [doc/output.md](doc/output.md).
## Standalone Face Or Hand Keypoint Detector
### Standalone Face Or Hand Detector
If you do not need the body detector and want to speed up the face keypoint detection, you can use the OpenCV-based approach, see [doc/standalone_face_or_hand_keypoint_detector.md](doc/standalone_face_or_hand_keypoint_detector.md).
You can also use the OpenPose hand and/or face keypoint detectors with your own face or hand detectors, rather than using the body detector. E.g. useful for camera views at which the hands are visible but not the body, so that the OpenPose detector would fail. See [doc/standalone_face_or_hand_keypoint_detector.md](doc/standalone_face_or_hand_keypoint_detector.md).
### Library Dependencies
OpenPose currently uses OpenCV and Caffe, as well as any Caffe dependency. The demos additionally use GFlags. It could easily be ported to other deep learning frameworks (Tensorflow, Torch, ...). Feel free to make a pull request if you implement any of those!
## Speed Up OpenPose and Benchmark
Check the OpenPose Benchmark and some hints to speed up OpenPose on [doc/installation.md#faq](doc/installation.md#faq).
## Output
Output (format, keypoint index ordering, etc.) in [doc/output.md](doc/output.md).
## Send Us Failure Cases!
If you find videos or images where OpenPose does not seems to work well, feel free to send them to openposecmu@gmail.com (email only for failure cases!), we will use them to improve the quality of the algorithm. Thanks!
## Speeding Up OpenPose and Benchmark
Check the OpenPose Benchmark and some hints to speed up OpenPose on [doc/installation.md#faq](doc/installation.md#faq).
## Send Us Your Feedback!
## Send Us Failure Cases and Feedback!
Our library is open source for research purposes, and we want to continuously improve it! So please, let us know if...
1. ... you find any bug (in functionality or speed).
1. ... you find videos or images where OpenPose does not seems to work well. Feel free to send them to openposecmu@gmail.com (email only for failure cases!), we will use them to improve the quality of the algorithm!
2. ... you find any bug (in functionality or speed).
3. ... you added some functionality to some class or some new Worker<T> subclass which we might potentially incorporate.
4. ... you know how to speed up or improve any part of the library.
5. ... you have a request about possible functionality.
6. ... etc.
2. ... you added some functionality to some class or some new Worker<T> subclass which we might potentially incorporate.
Just comment on GitHub or make a pull request and we will answer as soon as possible! Send us an email if you use the library to make a cool demo or YouTube video!
3. ... you know how to speed up or improve any part of the library.
4. ... you have a request about possible functionality.
5. ... etc.
## Authors and Contributors
OpenPose is authored by [Gines Hidalgo](https://www.gineshidalgo.com/), [Zhe Cao](http://www.andrew.cmu.edu/user/zhecao), [Tomas Simon](http://www.cs.cmu.edu/~tsimon/), [Shih-En Wei](https://scholar.google.com/citations?user=sFQD3k4AAAAJ&hl=en), [Hanbyul Joo](http://www.cs.cmu.edu/~hanbyulj/), and [Yaser Sheikh](http://www.cs.cmu.edu/~yaser/). Currently, it is being maintained by [Gines Hidalgo](https://www.gineshidalgo.com/) and [Bikramjot Hanzra](https://www.linkedin.com/in/bikz05). The [original CVPR 2017 repo](https://github.com/ZheC/Multi-Person-Pose-Estimation) includes Matlab and Python versions, as well as the training code. The body pose estimation work is based on [the original ECCV 2016 demo](https://github.com/CMU-Perceptual-Computing-Lab/caffe_rtpose).
Just comment on GitHub or make a pull request and we will answer as soon as possible! Send us an email if you use the library to make a cool demo or YouTube video!
In addition, OpenPose would not be possible without the [CMU Panoptic Studio dataset](http://domedb.perception.cs.cmu.edu/).
We would also like to thank all the people who helped OpenPose in any way. The main contributors are listed in [doc/contributors.md](doc/contributors.md).
......@@ -174,5 +162,5 @@ Please cite these papers in your publications if it helps your research (the fac
## Other Contributors
We would like to thank all the people who helped OpenPose in any way. The main contributors are listed in [doc/contributors.md](doc/contributors.md).
## License
OpenPose is freely available for free non-commercial use, and may be redistributed under these conditions. Please, see the [license](LICENSE) for further details. [Interested in a commercial license? Check this link](https://flintbox.com/public/project/47343/). For commercial queries, contact [Yaser Sheikh](http://www.cs.cmu.edu/~yaser/).
......@@ -71,6 +71,7 @@ DEFINE_int32(keypoint_scale, 0, "Scaling of the (x,y) co
" size (set with `net_resolution`), `2` to scale it to the final output size (set with"
" `resolution`), `3` to scale it in the range [0,1], and 4 for range [-1,1]. Non related"
" with `scale_number` and `scale_gap`.");
DEFINE_bool(identification, false, "Whether to enable people identification across frames. Not available yet, coming soon.");
// OpenPose Body Pose
DEFINE_bool(body_disable, false, "Disable body keypoint detection. Option only possible for faster (but less accurate) face"
" keypoint detection.");
......@@ -217,7 +218,8 @@ int openPoseDemo()
poseModel, !FLAGS_disable_blending, (float)FLAGS_alpha_pose,
(float)FLAGS_alpha_heatmap, FLAGS_part_to_show, FLAGS_model_folder,
heatMapTypes, op::ScaleMode::UnsignedChar,
(float)FLAGS_render_threshold, enableGoogleLogging};
(float)FLAGS_render_threshold, enableGoogleLogging,
FLAGS_identification};
// Face configuration (use op::WrapperStructFace{} to disable it)
const op::WrapperStructFace wrapperStructFace{FLAGS_face, faceNetInputSize,
op::flagsToRenderMode(FLAGS_face_render, FLAGS_render_pose),
......
......@@ -33,7 +33,7 @@ namespace op
* Original image to be processed in Array<float> format.
* It has been resized to the net input resolution, as well as reformatted Array<float> format to be compatible
* with the net.
* In case of >1 scales, then each scale is right- and bottom-padded to fill the greatest resolution. The
* If >1 scales, each scale is right- and bottom-padded to fill the greatest resolution. The
* scales are sorted from bigger to smaller.
* Vector size: #scales
* Each array size: 3 x input_net_height x input_net_width
......@@ -43,7 +43,7 @@ namespace op
/**
* Rendered image in Array<float> format.
* It consists of a blending of the cvInputData and the pose/body part(s) heatmap/PAF(s).
* If rendering is disabled (e.g. `no_render_pose` flag in the demo), then outputData will be empty.
* If rendering is disabled (e.g. `no_render_pose` flag in the demo), outputData will be empty.
* Size: 3 x output_net_height x output_net_width
*/
Array<float> outputData;
......@@ -51,7 +51,7 @@ namespace op
/**
* Rendered image in cv::Mat uchar format.
* It has been resized to the desired output resolution (e.g. `resolution` flag in the demo).
* If outputData is empty, then cvOutputData will also be empty.
* If outputData is empty, cvOutputData will also be empty.
* Size: (output_height x output_width) x 3 channels
*/
cv::Mat cvOutputData;
......@@ -64,12 +64,21 @@ namespace op
*/
Array<float> poseKeypoints;
/**
* People ID
* It returns a person ID for each body pose, providing temporal consistency. The ID will be the same one
* for a person across frames. I.e. this ID allows to keep track of the same person in time.
* If either person identification is disabled or poseKeypoints is empty, poseIds will also be empty.
* Size: #people
*/
Array<long long> poseIds;
/**
* Body pose global confidence/score for each person in the image.
* It does not only consider the score of each body keypoint, but also the score of each PAF association.
* Optimized for COCO evaluation metric.
* It will highly penalyze people with missing body parts (e.g. cropped people on the borders of the image).
* If poseKeypoints is empty, then poseScores will also be empty.
* If poseKeypoints is empty, poseScores will also be empty.
* Size: #people
*/
Array<float> poseScores;
......
#ifndef OPENPOSE_EXPERIMENTAL_HEADERS_HPP
#define OPENPOSE_EXPERIMENTAL_HEADERS_HPP
// producer module
// experimental modules
// #include <openpose/experimental/producer/headers.hpp>
#include <openpose/experimental/tracking/headers.hpp>
#endif // OPENPOSE_EXPERIMENTAL_HEADERS_HPP
#ifndef OPENPOSE_TRACKING_HEADERS_HPP
#define OPENPOSE_TRACKING_HEADERS_HPP
// tracking module
#include <openpose/experimental/tracking/personIdExtractor.hpp>
#include <openpose/experimental/tracking/wPersonIdExtractor.hpp>
#endif // OPENPOSE_TRACKING_HEADERS_HPP
#ifndef OPENPOSE_TRACKING_PERSON_ID_EXTRACTOR_HPP
#define OPENPOSE_TRACKING_PERSON_ID_EXTRACTOR_HPP
#include <openpose/core/common.hpp>
namespace op
{
class OP_API PersonIdExtractor
{
public:
PersonIdExtractor();
virtual ~PersonIdExtractor();
Array<long long> extractIds(const Array<float>& poseKeypoints);
private:
long long mNextPersonId;
DELETE_COPY(PersonIdExtractor);
};
}
#endif // OPENPOSE_TRACKING_PERSON_ID_EXTRACTOR_HPP
#ifndef OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP
#define OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP
#include <openpose/core/common.hpp>
#include <openpose/thread/worker.hpp>
#include <openpose/experimental/tracking/personIdExtractor.hpp>
namespace op
{
template<typename TDatums>
class WPersonIdExtractor : public Worker<TDatums>
{
public:
explicit WPersonIdExtractor(const std::shared_ptr<PersonIdExtractor>& personIdExtractorSharedPtr);
void initializationOnThread();
void work(TDatums& tDatums);
private:
std::shared_ptr<PersonIdExtractor> spPersonIdExtractor;
DELETE_COPY(WPersonIdExtractor);
};
}
// Implementation
#include <openpose/utilities/pointerContainer.hpp>
namespace op
{
template<typename TDatums>
WPersonIdExtractor<TDatums>::WPersonIdExtractor(const std::shared_ptr<PersonIdExtractor>& personIdExtractorSharedPtr) :
spPersonIdExtractor{personIdExtractorSharedPtr}
{
}
template<typename TDatums>
void WPersonIdExtractor<TDatums>::initializationOnThread()
{
}
template<typename TDatums>
void WPersonIdExtractor<TDatums>::work(TDatums& tDatums)
{
try
{
if (checkNoNullNorEmpty(tDatums))
{
// Debugging log
dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
// Profiling speed
const auto profilerKey = Profiler::timerInit(__LINE__, __FUNCTION__, __FILE__);
// Render people pose
for (auto& tDatum : *tDatums)
tDatum.poseIds = spPersonIdExtractor->extractIds(tDatum.poseKeypoints);
// Profiling speed
Profiler::timerEnd(profilerKey);
Profiler::printAveragedTimeMsOnIterationX(profilerKey, __LINE__, __FUNCTION__, __FILE__);
// Debugging log
dLog("", Priority::Low, __LINE__, __FUNCTION__, __FILE__);
}
}
catch (const std::exception& e)
{
this->stop();
tDatums = nullptr;
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
}
}
COMPILE_TEMPLATE_DATUM(WPersonIdExtractor);
}
#endif // OPENPOSE_TRACKING_W_PERSON_ID_EXTRACTOR_HPP
......@@ -276,6 +276,7 @@ namespace op
#include <openpose/hand/headers.hpp>
#include <openpose/pose/headers.hpp>
#include <openpose/producer/headers.hpp>
#include <openpose/experimental/tracking/headers.hpp>
#include <openpose/utilities/cuda.hpp>
#include <openpose/utilities/fileSystem.hpp>
namespace op
......@@ -818,6 +819,12 @@ namespace op
// Frame buffer and ordering
if (spWPoses.size() > 1u)
mPostProcessingWs.emplace_back(std::make_shared<WQueueOrderer<TDatumsPtr>>());
// Person ID identification
if (wrapperStructPose.identification)
{
const auto personIdExtractor = std::make_shared<PersonIdExtractor>();
mPostProcessingWs.emplace_back(std::make_shared<WPersonIdExtractor<TDatumsPtr>>(personIdExtractor));
}
// Frames processor (OpenPose format -> cv::Mat format)
if (renderOutput)
{
......
......@@ -150,6 +150,11 @@ namespace op
*/
bool enableGoogleLogging;
/**
* Whether to return a person ID for each body skeleton, providing temporal consistency.
*/
bool identification;
/**
* Constructor of the struct.
* It has the recommended and default values we recommend for each element of the struct.
......@@ -166,8 +171,8 @@ namespace op
const int defaultPartToRender = 0, const std::string& modelFolder = "models/",
const std::vector<HeatMapType>& heatMapTypes = {},
const ScaleMode heatMapScale = ScaleMode::ZeroToOne,
const float renderThreshold = 0.05f,
const bool enableGoogleLogging = true);
const float renderThreshold = 0.05f, const bool enableGoogleLogging = true,
const bool identification = false);
};
}
......
add_subdirectory(core)
add_subdirectory(experimental)
add_subdirectory(filestream)
add_subdirectory(gui)
add_subdirectory(pose)
......@@ -8,9 +9,9 @@ add_subdirectory(thread)
add_subdirectory(face)
add_subdirectory(hand)
add_subdirectory(wrapper)
set_target_properties(openpose_core openpose_filestream openpose_gui openpose_pose
openpose_utilities openpose_producer openpose_thread openpose_face openpose_hand
openpose_wrapper
set_target_properties(openpose_core openpose_face openpose_filestream
openpose_gui openpose_hand openpose_pose openpose_producer
openpose_utilities openpose_thread openpose_tracking openpose_wrapper
PROPERTIES COMPILE_FLAGS ${OP_CXX_FLAGS})
# make the openpose.so
......
......@@ -20,10 +20,10 @@ cuda_add_library(openpose_core
resizeAndMergeBase.cpp
resizeAndMergeBase.cu
resizeAndMergeCaffe.cpp
scaleAndSizeExtractor)
scaleAndSizeExtractor.cpp)
add_library(caffe SHARED IMPORTED)
set_property(TARGET caffe PROPERTY IMPORTED_LOCATION ${Caffe_LIBS})
set_property(TARGET caffe PROPERTY IMPORTED_LOCATION ${Caffe_LIBS})
target_link_libraries(openpose_core caffe)
......
......@@ -3,7 +3,9 @@
namespace op
{
Datum::Datum()
Datum::Datum() :
id{std::numeric_limits<unsigned long long>::max()},
poseIds{-1}
{
}
......@@ -19,6 +21,7 @@ namespace op
cvOutputData{datum.cvOutputData},
// Resulting Array<float> data
poseKeypoints{datum.poseKeypoints},
poseIds{datum.poseIds},
poseScores{datum.poseScores},
poseHeatMaps{datum.poseHeatMaps},
faceRectangles{datum.faceRectangles},
......@@ -49,6 +52,7 @@ namespace op
cvOutputData = datum.cvOutputData;
// Resulting Array<float> data
poseKeypoints = datum.poseKeypoints;
poseIds = datum.poseIds,
poseScores = datum.poseScores,
poseHeatMaps = datum.poseHeatMaps,
faceRectangles = datum.faceRectangles,
......@@ -90,6 +94,7 @@ namespace op
std::swap(cvOutputData, datum.cvOutputData);
// Resulting Array<float> data
std::swap(poseKeypoints, datum.poseKeypoints);
std::swap(poseIds, datum.poseIds);
std::swap(poseScores, datum.poseScores);
std::swap(poseHeatMaps, datum.poseHeatMaps);
std::swap(faceRectangles, datum.faceRectangles);
......@@ -122,6 +127,7 @@ namespace op
std::swap(cvOutputData, datum.cvOutputData);
// Resulting Array<float> data
std::swap(poseKeypoints, datum.poseKeypoints);
std::swap(poseIds, datum.poseIds);
std::swap(poseScores, datum.poseScores);
std::swap(poseHeatMaps, datum.poseHeatMaps);
std::swap(faceRectangles, datum.faceRectangles);
......@@ -164,6 +170,7 @@ namespace op
datum.cvOutputData = cvOutputData.clone();
// Resulting Array<float> data
datum.poseKeypoints = poseKeypoints.clone();
datum.poseIds = poseIds.clone();
datum.poseScores = poseScores.clone();
datum.poseHeatMaps = poseHeatMaps.clone();
datum.faceRectangles = faceRectangles;
......
set(SOURCES
defineTemplates.cpp
personIdExtractor.cpp)
add_library(openpose_tracking ${SOURCES})
install(TARGETS openpose_tracking
EXPORT OpenPose
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib/openpose)
#include <openpose/experimental/tracking/headers.hpp>
namespace op
{
DEFINE_TEMPLATE_DATUM(WPersonIdExtractor);
}
#include <openpose/experimental/tracking/personIdExtractor.hpp>
namespace op
{
PersonIdExtractor::PersonIdExtractor() :
mNextPersonId{0ll}
{
try
{
error("PersonIdExtractor (`identification` flag) not available yet, but we are working on it! Coming"
" soon!", __LINE__, __FUNCTION__, __FILE__);
}
catch (const std::exception& e)
{
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
}
}
PersonIdExtractor::~PersonIdExtractor()
{
}
Array<long long> PersonIdExtractor::extractIds(const Array<float>& poseKeypoints)
{
try
{
// Dummy: giving a new id to each element
Array<long long> poseIds{poseKeypoints.getSize(0), -1};
for (auto i = 0u ; i < poseIds.getVolume() ; i++)
poseIds[i] = mNextPersonId++;
return poseIds;
}
catch (const std::exception& e)
{
error(e.what(), __LINE__, __FUNCTION__, __FILE__);
return Array<long long>{};
}
}
}
......@@ -15,7 +15,7 @@ if (BUILD_CAFFE)
add_dependencies(openpose_face openpose_caffe)
endif (BUILD_CAFFE)
install(TARGETS openpose_face
install(TARGETS openpose_face
EXPORT OpenPose
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
......
set(SOURCES
set(SOURCES
defineTemplates.cpp
handDetector.cpp
handDetectorFromTxt.cpp
......
set(SOURCES
set(SOURCES
bodyPartConnectorBase.cpp
bodyPartConnectorBase.cu
bodyPartConnectorCaffe.cpp
......
......@@ -8,8 +8,8 @@ set(SOURCES
webcamReader.cpp)
add_library(openpose_producer ${SOURCES})
target_link_libraries(openpose_producer ${OpenCV_LIBS} openpose_core
openpose_thread openpose_filestream)
target_link_libraries(openpose_producer ${OpenCV_LIBS} openpose_core
openpose_filestream openpose_thread)
install(TARGETS openpose_producer
EXPORT OpenPose
......
......@@ -3,7 +3,7 @@ set(SOURCES
add_library(openpose_thread ${SOURCES})
install(TARGETS openpose_thread
install(TARGETS openpose_thread
EXPORT OpenPose
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
......
set(SOURCES
set(SOURCES
cuda.cpp
errorAndLog.cpp
fileSystem.cpp
......@@ -9,9 +9,9 @@ set(SOURCES
string.cpp)
find_package(Boost COMPONENTS system filesystem REQUIRED)
cuda_add_library(openpose_utilities ${SOURCES})
target_link_libraries(openpose_utilities openpose_producer openpose_filestream
target_link_libraries(openpose_utilities openpose_filestream openpose_producer
${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
install(TARGETS openpose_utilities
......
......@@ -7,9 +7,9 @@ set(SOURCES
wrapperStructPose.cpp)
add_library(openpose_wrapper ${SOURCES})
target_link_libraries(openpose_wrapper openpose_thread openpose_pose openpose_hand
openpose_core openpose_face openpose_filestream openpose_gui openpose_producer
openpose_utilities)
target_link_libraries(openpose_wrapper openpose_core openpose_face openpose_filestream
openpose_gui openpose_hand openpose_pose openpose_producer openpose_thread
openpose_tracking openpose_utilities)
install(TARGETS openpose_wrapper
EXPORT OpenPose
......
......@@ -12,7 +12,7 @@ namespace op
const std::string& modelFolder_,
const std::vector<HeatMapType>& heatMapTypes_,
const ScaleMode heatMapScale_, const float renderThreshold_,
const bool enableGoogleLogging_) :
const bool enableGoogleLogging_, const bool identification_) :
enable{enable_},
netInputSize{netInputSize_},
outputSize{outputSize_},
......@@ -31,7 +31,8 @@ namespace op
heatMapTypes{heatMapTypes_},
heatMapScale{heatMapScale_},
renderThreshold{renderThreshold_},
enableGoogleLogging{enableGoogleLogging_}
enableGoogleLogging{enableGoogleLogging_},
identification{identification_}
{
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册