-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pose Proposal Network Tested + Pre-Trained Models => Google Drive + D…
…ocumentation Update (#302) * Fix PPN post-processing * Fix PPN post-processing: re * Clean PPN header * Remove useless scripts * More details on TensorRT building * Doc Comment on PPN * Models => Google Drive | Update Documents * Format C++ codes Update CI Update Install Scripts Update Install Scripts Update Install Scripts * Fix FAKE
- Loading branch information
Showing
38 changed files
with
395 additions
and
388 deletions.
There are no files selected for viewing
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
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 |
---|---|---|
|
@@ -44,6 +44,7 @@ venv | |
_build | ||
docs/make.bat | ||
examples/user_codes/*.cpp | ||
debug.* | ||
|
||
!docs/Makefile | ||
!docs/markdown/images/* |
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
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
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
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 |
---|---|---|
|
@@ -13,8 +13,6 @@ | |
> **Environment**: [email protected], GPU@1070Ti, CPU@i7(12 logic cores). | ||
> | ||
> **Tested Video Source**: Crazy Updown Funk(resolution@640x360, frame_count@7458, source@[YouTube](https://www.youtube.com/watch?v=2DiQUX11YaY)) | ||
> | ||
> **Availability**: All model above are available [here](https://github.com/tensorlayer/pretrained-models/tree/master/models/hyperpose). | ||
> OpenPose performance is not tested with batch processing as it seems not to be implemented. (see [here](https://github.com/CMU-Perceptual-Computing-Lab/openpose/issues/100)) | ||
|
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
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
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
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
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
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
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
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
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,82 @@ | ||
#include "utils.hpp" | ||
#include <gflags/gflags.h> | ||
#include <hyperpose/hyperpose.hpp> | ||
|
||
// Model flags | ||
DEFINE_string(model_file, "../data/models/ppn-resnet50-V2-HW=384x384.onnx", "Path to uff model."); | ||
DEFINE_int32(input_width, 384, "Width of input image."); | ||
DEFINE_int32(input_height, 384, "Height of input image."); | ||
|
||
DEFINE_bool(logging, false, "Print the logging information or not."); | ||
|
||
DEFINE_string(input_video, "../data/media/video.avi", "The input video path."); | ||
DEFINE_bool(camera, false, "Using the camera as input video."); | ||
|
||
int main(int argc, char** argv) | ||
{ | ||
gflags::ParseCommandLineFlags(&argc, &argv, true); | ||
|
||
// * Input video. | ||
auto capture = FLAGS_camera ? cv::VideoCapture(0) : cv::VideoCapture(FLAGS_input_video); | ||
if (!capture.isOpened()) | ||
example_log() << "Cannot open cv::VideoCapture."; | ||
|
||
// * Create TensorRT engine. | ||
namespace hp = hyperpose; | ||
if (FLAGS_logging) | ||
hp::enable_logging(); | ||
|
||
auto engine = [&] { | ||
using namespace hp::dnn; | ||
constexpr std::string_view onnx_suffix = ".onnx"; | ||
constexpr std::string_view uff_suffix = ".uff"; | ||
|
||
if (std::equal(onnx_suffix.crbegin(), onnx_suffix.crend(), FLAGS_model_file.crbegin())) | ||
return tensorrt(onnx{ FLAGS_model_file }, { FLAGS_input_width, FLAGS_input_height }, 1); | ||
|
||
example_log() << "Your model file's suffix is not [.onnx | .uff]. Your model file path: " << FLAGS_model_file; | ||
example_log() << "Trying to be viewed as a serialized TensorRT model."; | ||
|
||
return tensorrt(tensorrt_serialized{ FLAGS_model_file }, { FLAGS_input_width, FLAGS_input_height }, 1); | ||
}(); | ||
|
||
// * post-processing: Using Pose Proposal. | ||
hp::parser::pose_proposal parser{ engine.input_size() }; | ||
|
||
using clk_t = std::chrono::high_resolution_clock; | ||
|
||
example_log() << "Inference Started. Use ESC to quit."; | ||
|
||
while (capture.isOpened()) { | ||
|
||
cv::Mat mat; | ||
capture >> mat; | ||
if (mat.empty()) { | ||
example_log() << "Got empty cv::Mat"; | ||
break; | ||
} | ||
|
||
auto beg = clk_t::now(); | ||
|
||
{ | ||
// * TensorRT Inference. | ||
auto feature_maps = engine.inference({ mat }); | ||
|
||
// * Post-Processing. | ||
auto poses = parser.process(feature_maps.front()); | ||
|
||
for (auto&& pose : poses) | ||
hp::draw_human(mat, pose); | ||
} | ||
|
||
double fps = 1000. / std::chrono::duration<double, std::milli>(clk_t::now() - beg).count(); | ||
|
||
cv::putText(mat, "FPS: " + std::to_string(fps), { 10, 10 }, cv::FONT_HERSHEY_SIMPLEX, 0.5, { 0, 255, 0 }, 2); | ||
cv::imshow("HyperPose Prediction", mat); | ||
|
||
if (cv::waitKey(1) == 27) | ||
break; | ||
} | ||
|
||
example_log() << "Inference Done!"; | ||
} |
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
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
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
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
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
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
Oops, something went wrong.