Skip to content

Commit ff90bd8

Browse files
committed
demos/interactive_face_detection: fix slices
1 parent 0d23ffa commit ff90bd8

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

demos/interactive_face_detection_demo/cpp/detectors.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ void AntispoofingClassifier::enqueue(const cv::Mat& face) {
207207
}
208208
ov::Tensor batch = request.get_input_tensor();
209209
batch.set_shape(inShape);
210-
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces, inShape[1], inShape[2], inShape[3]}});
210+
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces + 1, inShape[1], inShape[2], inShape[3]}});
211211
enquedFaces++;
212212
}
213213

@@ -248,7 +248,7 @@ AgeGenderDetection::AgeGenderDetection(const std::string &pathToModel,
248248
void AgeGenderDetection::submitRequest() {
249249
if (!enquedFaces)
250250
return;
251-
request.set_input_tensor(ov::Tensor{request.get_input_tensor(), {0, 0, 0, 0}, {enquedFaces, inShape[1], inShape[2], inShape[3]}});
251+
request.set_input_tensor(ov::Tensor{request.get_input_tensor(), {0, 0, 0, 0}, {enquedFaces + 1, inShape[1], inShape[2], inShape[3]}});
252252
request.start_async();
253253
enquedFaces = 0;
254254
}
@@ -259,7 +259,7 @@ void AgeGenderDetection::enqueue(const cv::Mat &face) {
259259
}
260260
ov::Tensor batch = request.get_input_tensor();
261261
batch.set_shape(inShape);
262-
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces, inShape[1], inShape[2], inShape[3]}});
262+
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces + 1, inShape[1], inShape[2], inShape[3]}});
263263
enquedFaces++;
264264
}
265265

@@ -306,7 +306,7 @@ HeadPoseDetection::HeadPoseDetection(const std::string &pathToModel,
306306

307307
void HeadPoseDetection::submitRequest() {
308308
if (!enquedFaces) return;
309-
request.set_input_tensor(ov::Tensor{request.get_input_tensor(), {0, 0, 0, 0}, {enquedFaces, inShape[1], inShape[2], inShape[3]}});
309+
request.set_input_tensor(ov::Tensor{request.get_input_tensor(), {0, 0, 0, 0}, {enquedFaces + 1, inShape[1], inShape[2], inShape[3]}});
310310
request.start_async();
311311
enquedFaces = 0;
312312
}
@@ -317,7 +317,7 @@ void HeadPoseDetection::enqueue(const cv::Mat &face) {
317317
}
318318
ov::Tensor batch = request.get_input_tensor();
319319
batch.set_shape(inShape);
320-
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces, inShape[1], inShape[2], inShape[3]}});
320+
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces + 1, inShape[1], inShape[2], inShape[3]}});
321321
enquedFaces++;
322322
}
323323

@@ -363,7 +363,7 @@ EmotionsDetection::EmotionsDetection(const std::string &pathToModel,
363363

364364
void EmotionsDetection::submitRequest() {
365365
if (!enquedFaces) return;
366-
request.set_input_tensor(ov::Tensor{request.get_input_tensor(), {0, 0, 0, 0}, {enquedFaces, inShape[1], inShape[2], inShape[3]}});
366+
request.set_input_tensor(ov::Tensor{request.get_input_tensor(), {0, 0, 0, 0}, {enquedFaces + 1, inShape[1], inShape[2], inShape[3]}});
367367
request.start_async();
368368
enquedFaces = 0;
369369
}
@@ -374,7 +374,7 @@ void EmotionsDetection::enqueue(const cv::Mat &face) {
374374
}
375375
ov::Tensor batch = request.get_input_tensor();
376376
batch.set_shape(inShape);
377-
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces, inShape[1], inShape[2], inShape[3]}});
377+
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces + 1, inShape[1], inShape[2], inShape[3]}});
378378
enquedFaces++;
379379
}
380380

@@ -452,7 +452,7 @@ void FacialLandmarksDetection::enqueue(const cv::Mat &face) {
452452
}
453453
ov::Tensor batch = request.get_input_tensor();
454454
batch.set_shape(inShape);
455-
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces, inShape[1], inShape[2], inShape[3]}});
455+
resize2tensor(face, ov::Tensor{batch, {enquedFaces, 0, 0, 0}, {enquedFaces + 1, inShape[1], inShape[2], inShape[3]}});
456456
enquedFaces++;
457457
}
458458

0 commit comments

Comments
 (0)