-
Notifications
You must be signed in to change notification settings - Fork 654
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Feature] Sync csharp apis with newly added c apis && demo (#1718)
* sync c api to c# * fix typo * add pose tracker c# demo * udpate gitignore * remove print * fix lint * update rotated detection api * update rotated detection demo * rename pose_tracking -> pose_tracker * use input size as default
- Loading branch information
Showing
17 changed files
with
1,146 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
namespace MMDeploy | ||
{ | ||
/// <summary> | ||
/// Context. | ||
/// </summary> | ||
public class Context : DisposableObject | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Context"/> class. | ||
/// </summary> | ||
public Context() | ||
{ | ||
ThrowException(NativeMethods.mmdeploy_context_create(out _handle)); | ||
} | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Context"/> class with device. | ||
/// </summary> | ||
/// <param name="device">device.</param> | ||
public Context(Device device) : this() | ||
{ | ||
Add(device); | ||
} | ||
|
||
/// <summary> | ||
/// Add model to the context. | ||
/// </summary> | ||
/// <param name="name">name.</param> | ||
/// <param name="model">model.</param> | ||
public void Add(string name, Model model) | ||
{ | ||
ThrowException(NativeMethods.mmdeploy_context_add(this, (int)ContextType.MODEL, name, model)); | ||
} | ||
|
||
/// <summary> | ||
/// Add scheduler to the context. | ||
/// </summary> | ||
/// <param name="name">name.</param> | ||
/// <param name="scheduler">scheduler.</param> | ||
public void Add(string name, Scheduler scheduler) | ||
{ | ||
ThrowException(NativeMethods.mmdeploy_context_add(this, (int)ContextType.SCHEDULER, name, scheduler)); | ||
} | ||
|
||
/// <summary> | ||
/// Add device to the context. | ||
/// </summary> | ||
/// <param name="device">device.</param> | ||
public void Add(Device device) | ||
{ | ||
ThrowException(NativeMethods.mmdeploy_context_add(this, (int)ContextType.DEVICE, "", device)); | ||
} | ||
|
||
/// <summary> | ||
/// Add profiler to the context. | ||
/// </summary> | ||
/// <param name="profiler">profiler.</param> | ||
public void Add(Profiler profiler) | ||
{ | ||
ThrowException(NativeMethods.mmdeploy_context_add(this, (int)ContextType.PROFILER, "", profiler)); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void ReleaseHandle() | ||
{ | ||
NativeMethods.mmdeploy_model_destroy(_handle); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
namespace MMDeploy | ||
{ | ||
/// <summary> | ||
/// Device. | ||
/// </summary> | ||
public class Device : DisposableObject | ||
{ | ||
private readonly string _name; | ||
private readonly int _index; | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Device"/> class. | ||
/// </summary> | ||
/// <param name="name">device name.</param> | ||
/// <param name="index">device index.</param> | ||
public Device(string name, int index = 0) | ||
{ | ||
this._name = name; | ||
this._index = index; | ||
ThrowException(NativeMethods.mmdeploy_device_create(name, index, out _handle)); | ||
} | ||
|
||
/// <summary> | ||
/// Gets device name. | ||
/// </summary> | ||
public string Name { get => _name; } | ||
|
||
/// <summary> | ||
/// Gets device index. | ||
/// </summary> | ||
public int Index { get => _index; } | ||
|
||
/// <inheritdoc/> | ||
protected override void ReleaseHandle() | ||
{ | ||
NativeMethods.mmdeploy_device_destroy(_handle); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
namespace MMDeploy | ||
{ | ||
/// <summary> | ||
/// model. | ||
/// </summary> | ||
public class Model : DisposableObject | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Model"/> class. | ||
/// </summary> | ||
/// <param name="modelPath">model path.</param> | ||
public Model(string modelPath) | ||
{ | ||
ThrowException(NativeMethods.mmdeploy_model_create_by_path(modelPath, out _handle)); | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void ReleaseHandle() | ||
{ | ||
NativeMethods.mmdeploy_model_destroy(_handle); | ||
} | ||
} | ||
} |
Oops, something went wrong.