Skip to content

Commit 07870d7

Browse files
Slight speed up: NMS only on body parts
1 parent 6e81592 commit 07870d7

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

Diff for: doc/release_notes.md

+4
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,7 @@ OpenPose Library - Release Notes
169169

170170

171171
## Current version (future OpenPose 1.3.0)
172+
1. Main improvements:
173+
1. Output of `--write_json` uses less hard disk space (enters and tabs removed).
174+
2. Main bugs fixed:
175+
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.

Diff for: include/openpose/core/nmsCaffe.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace op
1919
virtual void LayerSetUp(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top);
2020

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

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

Diff for: include/openpose/filestream/wPeopleJsonSaver.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ namespace op
5858
const auto& tDatumFirst = (*tDatums)[0];
5959
const auto baseFileName = (!tDatumFirst.name.empty() ? tDatumFirst.name
6060
: std::to_string(tDatumFirst.id)) + "_keypoints";
61-
const bool humanReadable = true;
61+
const bool humanReadable = false;
6262
for (auto i = 0u ; i < tDatums->size() ; i++)
6363
{
6464
const auto& tDatum = (*tDatums)[i];

Diff for: src/openpose/core/nmsCaffe.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ namespace op
6363

6464
template <typename T>
6565
void NmsCaffe<T>::Reshape(const std::vector<caffe::Blob<T>*>& bottom, const std::vector<caffe::Blob<T>*>& top,
66-
const int maxPeaks)
66+
const int maxPeaks, const int outputChannels)
6767
{
6868
try
6969
{
@@ -76,7 +76,7 @@ namespace op
7676

7777
// Top shape
7878
std::vector<int> topShape{bottomShape};
79-
topShape[1] = bottomShape[1]-1; // Number parts + bck - 1
79+
topShape[1] = (outputChannels > 0 ? outputChannels : bottomShape[1]);
8080
topShape[2] = maxPeaks+1; // # maxPeaks + 1
8181
topShape[3] = 3; // X, Y, score
8282
topBlob->Reshape(topShape);

Diff for: src/openpose/pose/poseExtractorCaffe.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,8 @@ namespace op
8484
resizeAndMergeCaffe->Reshape(caffeNetOutputBlobs, {heatMapsBlob.get()},
8585
getPoseNetDecreaseFactor(poseModel), 1.f/scaleInputToNetInput);
8686
// Pose extractor blob and layer
87-
nmsCaffe->Reshape({heatMapsBlob.get()}, {peaksBlob.get()}, getPoseMaxPeaks(poseModel));
87+
nmsCaffe->Reshape({heatMapsBlob.get()}, {peaksBlob.get()}, getPoseMaxPeaks(poseModel),
88+
getPoseNumberBodyParts(poseModel));
8889
// Pose extractor blob and layer
8990
bodyPartConnectorCaffe->Reshape({heatMapsBlob.get(), peaksBlob.get()});
9091
// Cuda check

0 commit comments

Comments
 (0)