DlibDotNet

repository·master·Indexed 19 days ago

https://github.com/takuya-takeuchi/dlibdotnet

A C# wrapper for the dlib C++ machine learning toolkit, providing computer vision and data analysis tools for the .NET ecosystem. The library includes examples for 3D point clouds, DNN face recognition, DNN Inception, instance segmentation, and integration with EmguCV and OpenCVSharp.

Tokens
14.7K
Snippets
81
Records
107
Agent score
66%

What's inside DlibDotNet

  1. Understand DlibDotNet dependencies

    master

    DlibDotNet is a C# wrapper around the dlib C++ toolkit. It relies on several native libraries for image processing and machine learning tasks:

    • dlib: The core machine learning and data analysis toolkit.
    • giflib: Used for reading and writing GIF image files.
    • libjpeg: Used for reading and writing JPEG image files.
    • libpng: Used for reading and writing PNG image files.
    • zlib: Required by libpng and linked by DlibDotNet.Native.
  2. Build the Random Cropper example

    master

    To build the Random Cropper program, use the .NET CLI from the project directory. After building, you must manually copy the core DlibDotNet native libraries to the output directory for the application to run correctly.

    Steps:

    1. Navigate to the <RandomCropper_dir> in your command prompt.
    2. Run the build command:
      dotnet build -c Release
    3. Copy DlibDotNet.dll, DlibDotNetNative.dll, and DlibDotNetNativeDnn.dll into the output directory: <RandomCropper_dir>\bin\Release\netcoreapp2.0.

    Important Notes:

    • For GPU acceleration, ensure DlibDotNetNative.dll and DlibDotNetNativeDnn.dll are built with CUDA support.
    • For Linux or MacOS, you must build DlibDotNet first following the platform-specific tutorials.
    dotnet build -c Release
  3. Build the MatToArray2D example

    master

    To build the MatToArray2D example, navigate to the <MatToArray2D_dir> in your command prompt and run the dotnet build command.

    Important Requirements:

    • You must copy DlibDotNet.dll, DlibDotNetNative.dll, and DlibDotNetNativeDnn.dll to the output directory: <MatToArray2D_dir>\bin\Release\netcoreapp2.0.
    • For GPU acceleration, you should build DlibDotNetNative.dll and DlibDotNetNativeDnn.dll with CUDA.
    • If you are on Linux or MacOS, ensure you have built DlibDotNet first following the platform-specific tutorials.
    cd <MatToArray2D_dir>
    dotnet build -c Release
  4. Build the DnnMmodTrainFindCars example

    master

    To build the DnnMmodTrainFindCars program, use the .NET CLI. Note that this program requires high-performance hardware (e.g., GeForce GTX 1080 Ti) and significant memory.

    1. Open a command prompt and navigate to the <DnnMmodTrainFindCars_dir>.
    2. Execute the build command:
    dotnet build -c Release
    1. After building, you must manually copy the following DLLs to the output directory (<DnnMmodTrainFindCars_dir>\bin\Release\netcoreapp2.0):
      • DlibDotNet.dll
      • DlibDotNetNative.dll
      • DlibDotNetNativeDnn.dll

    Important Requirements:

    • DlibDotNetNative.dll and DlibDotNetNativeDnn.dll must be built with CUDA support for GPU acceleration.
    • For Linux or MacOS, you must build DlibDotNet first following the platform-specific tutorials, then copy the extracted files into the <DnnMmodTrainFindCars_dir> directory.
  5. Build the Kernel Recursive Least Squares (KRLS) example

    master

    To build the KRLS example, use the .NET CLI from the example directory. After building, you must manually ensure the required native Dlib libraries are present in the output directory for the application to run.

    1. Open a command prompt and navigate to the <Krls_dir>.
    2. Execute the build command:
      dotnet build -c Release
    3. Copy DlibDotNet.dll, DlibDotNetNative.dll, and DlibDotNetNativeDnn.dll to the output directory: <Krls_dir>\bin\Release\netcoreapp2.0.

    Important Notes:

    • If you require CUDA support, you should build DlibDotNetNative.dll and DlibDotNetNativeDnn.dll with CUDA.
    • For Linux and MacOS, you must build DlibDotNet first. Refer to the official Linux or MacOS tutorials for specific instructions.
    dotnet build -c Release
  6. Build the DNN Semantic Segmentation Train example

    master

    To build the DNN Semantic Segmentation Train program, follow these steps:

    1. Open a command prompt and navigate to the <DnnSemanticSegmentationTrainOld_dir> directory.
    2. Execute the build command:
      dotnet build -c Release
    3. Manual DLL Copying: You must manually copy the following files to the output directory (<DnnSemanticSegmentationTrainOld_dir>\bin\Release\netcoreapp2.0):
      • DlibDotNet.dll
      • DlibDotNetNative.dll
      • DlibDotNetNativeDnn.dll

    Important Requirements:

    • CUDA Support: You should build DlibDotNetNative.dll and DlibDotNetNativeDnn.dll with CUDA enabled for optimal performance.
    • Linux/MacOS: If running on Linux or MacOS, you must build DlibDotNet first (refer to the project's Linux or MacOS tutorials) and copy the extracted files into the <DnnSemanticSegmentationTrainOld_dir>.
    dotnet build -c Release
  7. Build the Face Detection example

    master

    To build the Face Detection example, navigate to the <FaceDetection_dir> in your command prompt and run the dotnet build command.

    Important Post-Build Steps: After building, you must manually copy the following DLLs to the output directory (<FaceDetection_dir>\bin\Release\netcoreapp2.0):

    • DlibDotNet.dll
    • DlibDotNetNative.dll
    • DlibDotNetNativeDnn.dll

    Platform Specifics:

    • CUDA: For optimal performance, you should build DlibDotNetNative.dll and DlibDotNetNativeDnn.dll with CUDA support.
    • Linux/MacOS: You must build DlibDotNet first before running the example. Refer to the project's specific Linux or MacOS tutorials for guidance.
    cd <FaceDetection_dir>
    dotnet build -c Release
  8. Build the FHog Object Detector example

    master

    To build the FHog Object Detector, use the .NET CLI. Note that for optimal performance, you should build DlibDotNetNative.dll and DlibDotNetNativeDnn.dll with CUDA support. If you are on Linux or MacOS, ensure you have built DlibDotNet following the platform-specific tutorials first.

    After building, you must manually copy the following DLLs to the output directory (<FHogObjectDetector_dir>\bin\Release\netcoreapp2.0):

    • DlibDotNet.dll
    • DlibDotNetNative.dll
    • DlibDotNetNativeDnn.dll
    # Navigate to the example directory
    cd <FHogObjectDetector_dir>
    
    # Build in Release mode
    dotnet build -c Release
  9. Build the SVM example project

    master

    To build the SVM example, use the .NET CLI. Note that for Linux and MacOS, you must build the DlibDotNet library first by following the platform-specific tutorials.

    1. Open a command prompt and navigate to the SVM directory.
    2. Run the build command.
    3. Crucial Step: Copy the following native DLLs to the output directory (<Svm_dir>\bin\Release\netcoreapp2.0):
      • DlibDotNet.dll
      • DlibDotNetNative.dll
      • DlibDotNetNativeDnn.dll

    Note: If you require CUDA support, ensure DlibDotNetNative.dll and DlibDotNetNativeDnn.dll are built with CUDA.

    # Navigate to the directory
    cd <Svm_dir>
    
    # Build the project
    dotnet build -c Release
  10. Build the DNN Instance Segmentation Train example

    master

    To build the DNN Instance Segmentation Train program, follow these steps:

    1. Open a command prompt and navigate to the <DnnInstanceSegmentationTrain_dir>.
    2. Execute the build command:
      dotnet build -c Release
    3. Manual DLL Copy: You must manually copy the following files to the output directory (<DnnInstanceSegmentationTrain_dir>\bin\Release\netcoreapp2.0):
      • DlibDotNet.dll
      • DlibDotNetNative.dll
      • DlibDotNetNativeDnn.dll

    Important Requirements:

    • CUDA Support: You should build DlibDotNetNative.dll and DlibDotNetNativeDnn.dll with CUDA enabled for optimal performance.
    • Linux/MacOS: If running on Linux or MacOS, you must build DlibDotNet first. Refer to the official Tutorial for Linux or Tutorial for MacOS for instructions, then copy the extracted files to the <DnnInstanceSegmentationTrain_dir>.
    dotnet build -c Release