Skip to content

Commit c2886eb

Browse files
committed
v1.0.3 Added YOLOv8PoseEstimationExample.
1 parent 64cb5fe commit c2886eb

14 files changed

+3079
-10
lines changed

Assets/YOLOv8WithOpenCVForUnityExample/Scripts/YOLOv8WithOpenCVForUnity/YOLOv8ClassPredictor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ public virtual Mat infer(Mat image)
123123
output_blob[i].Dispose();
124124
}
125125

126-
return results;
126+
return results;// [1, num_classes]
127127
}
128128

129129
protected virtual Mat postprocess(List<Mat> output_blob, Size original_shape)

Assets/YOLOv8WithOpenCVForUnityExample/Scripts/YOLOv8WithOpenCVForUnity/YOLOv8ObjectDetector.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public virtual Mat infer(Mat image)
156156
output_blob[i].Dispose();
157157
}
158158

159-
return results;
159+
return results;// [n, 6] (xyxy, conf, cls)
160160
}
161161

162162
protected virtual Mat postprocess(Mat output_blob, Size original_shape)

Assets/YOLOv8WithOpenCVForUnityExample/Scripts/YOLOv8WithOpenCVForUnity/YOLOv8PoseEstimater.cs

Lines changed: 607 additions & 0 deletions
Large diffs are not rendered by default.

Assets/YOLOv8WithOpenCVForUnityExample/Scripts/YOLOv8WithOpenCVForUnity/YOLOv8PoseEstimater.cs.meta

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Assets/YOLOv8WithOpenCVForUnityExample/Scripts/YOLOv8WithOpenCVForUnity/YOLOv8SegmentPredictor.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,14 @@ public virtual List<Mat> infer(Mat image)
177177

178178
det.Dispose();
179179

180+
180181
List<Mat> results = new List<Mat>();
181182
results.Add(det_c0_c6);
182183
results.Add(masks);
183184

185+
186+
// results[0] = [n, 6] (xyxy, conf, cls)
187+
// results[1] = [n, 160, 160] or [n, 640, 640] (masks)
184188
return results;
185189
}
186190

@@ -227,7 +231,7 @@ protected virtual Mat postprocess(Mat output_blob, Size original_shape)
227231
float[] box_arr = new float[4];
228232
box_delta.get(i, 0, box_arr);
229233

230-
pickup_blob_numx6mask.put(ind, 0, new float[] { box_arr[0], box_arr[1], box_arr[2], box_arr[3], ((float)minmax.maxVal * conf), (float)minmax.maxLoc.x });
234+
pickup_blob_numx6mask.put(ind, 0, new float[] { box_arr[0], box_arr[1], box_arr[2], box_arr[3], conf, (float)minmax.maxLoc.x });
231235

232236
float[] mask_arr = new float[num_masks];
233237
mask_delta.get(i, 0, mask_arr);
@@ -498,9 +502,9 @@ public virtual void visualize_mask(Mat image, Mat det, Mat masks, float alpha =
498502
if (masks.empty())
499503
return;
500504

501-
int n = masks.size(0);// 3
502-
int h = masks.size(1);// 160
503-
int w = masks.size(2);// 160
505+
int n = masks.size(0);
506+
int h = masks.size(1);
507+
int w = masks.size(2);
504508

505509
float maxSize = Mathf.Max((float)image.size().width, (float)image.size().height);
506510
int mask_w = (int)(w * image.width() / maxSize);

Assets/YOLOv8WithOpenCVForUnityExample/YOLOv8PoseEstimationExample.meta

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)