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:
Johann Klemmack 2021-11-23 06:39:12 -08:00 committed by GitHub
parent 108dc8b7fe
commit 0b2ebb7b9d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 3 deletions

View File

@ -9,7 +9,7 @@ namespace Darknet
private const int MaxObjects = 1000;
[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")]
private static extern int DetectImage(string filename, ref BboxContainer container);
@ -38,9 +38,9 @@ namespace Darknet
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()