Skip to content

Commit

Permalink
Use the correct size for predictions
Browse files Browse the repository at this point in the history
  • Loading branch information
tvlenin committed Feb 6, 2020
1 parent b22ac76 commit 1b20c3a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions gst-libs/gst/r2inference/gstbackend.cc
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ gst_backend_process_frame (GstBackend *self, GstVideoFrame *input_frame,
*prediction_size = prediction->GetResultSize ();

/*could we avoid memory copy ?*/
*prediction_data = g_malloc(*prediction_size);
memcpy(*prediction_data, prediction->GetResultData(), *prediction_size);
*prediction_data = g_malloc(*prediction_size * sizeof(gfloat));
memcpy(*prediction_data, prediction->GetResultData(), *prediction_size * sizeof(gfloat));

GST_LOG_OBJECT (self, "Size of prediction %p is %lu",
*prediction_data, *prediction_size);
Expand Down
2 changes: 1 addition & 1 deletion gst-libs/gst/r2inference/gstinferencepostprocess.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ gst_fill_classification_meta (GstClassificationMeta * class_meta,
g_return_val_if_fail (class_meta != NULL, FALSE);
g_return_val_if_fail (prediction != NULL, FALSE);

class_meta->num_labels = predsize / sizeof (gfloat);
class_meta->num_labels = predsize;
class_meta->label_probs =
g_malloc (class_meta->num_labels * sizeof (gdouble));
for (gint i = 0; i < class_meta->num_labels; ++i) {
Expand Down

0 comments on commit 1b20c3a

Please sign in to comment.