mirror of https://github.com/AlexeyAB/darknet.git
Update YoloCSharpWrapper to support batch_size (#8249)
YoloCSharpWrapper `InitializeYolo` declaration now matches the parameters of yolo_v2_class.hpp "init". Resolves "attempting to read/write corrupted memory" error when calling darknet.dll "detect" methods from C#.
This commit is contained in:
parent
108dc8b7fe
commit
0b2ebb7b9d
|
@ -9,7 +9,7 @@ namespace Darknet
|
||||||
private const int MaxObjects = 1000;
|
private const int MaxObjects = 1000;
|
||||||
|
|
||||||
[DllImport(YoloLibraryName, EntryPoint = "init")]
|
[DllImport(YoloLibraryName, EntryPoint = "init")]
|
||||||
private static extern int InitializeYolo(string configurationFilename, string weightsFilename, int gpu);
|
private static extern int InitializeYolo(string configurationFilename, string weightsFilename, int gpu, int batch_size);
|
||||||
|
|
||||||
[DllImport(YoloLibraryName, EntryPoint = "detect_image")]
|
[DllImport(YoloLibraryName, EntryPoint = "detect_image")]
|
||||||
private static extern int DetectImage(string filename, ref BboxContainer container);
|
private static extern int DetectImage(string filename, ref BboxContainer container);
|
||||||
|
@ -38,9 +38,9 @@ namespace Darknet
|
||||||
public bbox_t[] candidates;
|
public bbox_t[] candidates;
|
||||||
}
|
}
|
||||||
|
|
||||||
public YoloWrapper(string configurationFilename, string weightsFilename, int gpu)
|
public YoloWrapper(string configurationFilename, string weightsFilename, int gpu, int batch_size = 1)
|
||||||
{
|
{
|
||||||
InitializeYolo(configurationFilename, weightsFilename, gpu);
|
InitializeYolo(configurationFilename, weightsFilename, gpu, batch_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
|
|
Loading…
Reference in New Issue