-
-
Notifications
You must be signed in to change notification settings - Fork 140
Expand file tree
/
Copy pathPoseEstimationImageDrawTests.cs
More file actions
52 lines (42 loc) · 1.39 KB
/
PoseEstimationImageDrawTests.cs
File metadata and controls
52 lines (42 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
namespace YoloDotNet.Benchmarks.ImageExtensionTests
{
[MemoryDiagnoser]
public class PoseEstimationImageDrawTests
{
#region Fields
private readonly string _model = SharedConfig.GetTestModelV8(ModelType.PoseEstimation);
private readonly string _testImage = SharedConfig.GetTestImage(ImageType.Crosswalk);
private Yolo _cpuYolo;
private SKImage _image;
private List<PoseEstimation> _poseEstimations;
#endregion Fields
#region Methods
[GlobalSetup]
public void GlobalSetup()
{
var options = new YoloOptions
{
OnnxModel = _model,
ModelType = ModelType.PoseEstimation,
HwAccelerator = HwAcceleratorType.None
};
_cpuYolo = new Yolo(options);
_image = SKImage.FromEncodedData(_testImage);
_poseEstimations = _cpuYolo.RunPoseEstimation(_image);
}
[GlobalCleanup]
public void CleanUp()
{
_cpuYolo.Dispose();
_image.Dispose();
}
[Params(true, false)]
public bool DrawConfidence { get; set; }
[Benchmark]
public SKImage DrawPoseEstimation()
{
return _image.Draw(_poseEstimations, CustomKeyPointColorMap.KeyPointOptions, DrawConfidence);
}
#endregion Methods
}
}