Skip to content

Commit

Permalink
Slight speed up: NMS only on body parts
Browse files Browse the repository at this point in the history
  • Loading branch information
gineshidalgo99 committed Jan 9, 2018
1 parent 6e81592 commit 07870d7
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
4 changes: 4 additions & 0 deletions doc/release_notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,3 +169,7 @@ OpenPose Library - Release Notes


## Current version (future OpenPose 1.3.0)
1. Main improvements:
1. Output of `--write_json` uses less hard disk space (enters and tabs removed).
2. Main bugs fixed:
1. Slight speed up (~1%) for performing the non-maximum suppression stage only in the body part heatmaps channels, and not also in the PAF channels.
2 changes: 1 addition & 1 deletion include/openpose/core/nmsCaffe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace op
virtual void LayerSetUp(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);

virtual void Reshape(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top,
const int maxPeaks);
const int maxPeaks, const int outputChannels = -1);

virtual inline const char* type() const { return "Nms"; }

Expand Down
2 changes: 1 addition & 1 deletion include/openpose/filestream/wPeopleJsonSaver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace op
const auto& tDatumFirst = (*tDatums)[0];
const auto baseFileName = (!tDatumFirst.name.empty() ? tDatumFirst.name
: std::to_string(tDatumFirst.id)) + "_keypoints";
const bool humanReadable = true;
const bool humanReadable = false;
for (auto i = 0u ; i < tDatums->size() ; i++)
{
const auto& tDatum = (*tDatums)[i];
Expand Down
4 changes: 2 additions & 2 deletions src/openpose/core/nmsCaffe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace op

template <typename T>
void NmsCaffe<T>::Reshape(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top,
const int maxPeaks)
const int maxPeaks, const int outputChannels)
{
try
{
Expand All @@ -76,7 +76,7 @@ namespace op

// Top shape
std::vector<int> topShape{bottomShape};
topShape[1] = bottomShape[1]-1; // Number parts + bck - 1
topShape[1] = (outputChannels > 0 ? outputChannels : bottomShape[1]);
topShape[2] = maxPeaks+1; // # maxPeaks + 1
topShape[3] = 3; // X, Y, score
topBlob->Reshape(topShape);
Expand Down
3 changes: 2 additions & 1 deletion src/openpose/pose/poseExtractorCaffe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,8 @@ namespace op
resizeAndMergeCaffe->Reshape(caffeNetOutputBlobs, {heatMapsBlob.get()},
getPoseNetDecreaseFactor(poseModel), 1.f/scaleInputToNetInput);
// Pose extractor blob and layer
nmsCaffe->Reshape({heatMapsBlob.get()}, {peaksBlob.get()}, getPoseMaxPeaks(poseModel));
nmsCaffe->Reshape({heatMapsBlob.get()}, {peaksBlob.get()}, getPoseMaxPeaks(poseModel),
getPoseNumberBodyParts(poseModel));
// Pose extractor blob and layer
bodyPartConnectorCaffe->Reshape({heatMapsBlob.get(), peaksBlob.get()});
// Cuda check
Expand Down

0 comments on commit 07870d7

Please sign in to comment.