AlturosDestinations / Alturos.Yolo

C# Yolo Darknet Wrapper (real-time object detection)
MIT License
426 stars 132 forks source link

Add support for non-Windows platforms #138

Open jgcjoec opened 4 years ago

jgcjoec commented 4 years ago

I attempted to run my app on a non-Windows machine (Ubuntu Linux using .NET Core 3.1) and received the following runtime error:

System.TypeInitializationException: The type initializer for 'Microsoft.Win32.Registry' threw an exception. ---> System.PlatformNotSupportedException: Registry is not supported on this platform. at Microsoft.Win32.RegistryKey.OpenBaseKeyCore(RegistryHive hKey, RegistryView view) at Microsoft.Win32.Registry..cctor() --- End of inner exception stack trace --- at Alturos.Yolo.YoloWrapper.IsMicrosoftVisualCPlusPlus2017Available() at Alturos.Yolo.YoloWrapper.GetEnvironmentReport() at Alturos.Yolo.YoloWrapper.Initialize(String configurationFilename, String weightsFilename, String namesFilename, Int32 gpu, Boolean ignoreGpu, Boolean ignoreCPlusPlusDetection) at Alturos.Yolo.YoloWrapper..ctor(String configurationFilename, String weightsFilename, String namesFilename, Int32 gpu, Boolean ignoreGpu)

It appears that Yolo itself will run on Windows or Linux. This library should probably mirror the platforms supported by Yolo.

jgcjoec commented 4 years ago

I combed through the commit history and see that Linux support was added in the 3.x preview series. I upgraded to the latest preview package (3.0.6 I think?) and it is working now.

jgcjoec commented 4 years ago

I spoke too soon... is there something else I need to do besides being on the latest preview release?

I'm getting this at runtime on Ubuntu on an Intel CPU. This is after publishing for a linux-x64 platform on Alturos.Yolo v3.0.6 System.NotImplementedException: C++ dll compiled incorrectly at Alturos.Yolo.YoloWrapper.Detect(Byte[] imageData)

jgcjoec commented 4 years ago

Anyone have any ideas how to get this working on Linux?

tonyle8 commented 4 years ago

C++ dll compiled incorrectly - Same issue. no luck here with docker and linux container as instructed in the readme file

jgcjoec commented 3 years ago

Anyone have any ideas how to solve this issue?

jgcjoec commented 3 years ago

Just following up - anyone able to resolve this issue?

tonyle8 commented 3 years ago

I finally got it working running on docker linux container. It seems the one provided by version 3.0.6 alpha is compatible with the docker image I was using. Tested with dotnetcore 3.1 & Alturos.Yolo version 3.0.6 alpha

What I had to do. 1) Follow this guide to build DarkNet in a linux system using cmake https://github.com/AlexeyAB/darknet#how-to-use-yolo-as-dll-and-so-libraries

2) Replace the yolo_cpp_dll_cpu.so file that is built with Alturos.Yolo once you do a nuget

3) You may need these dependencies # apt-get -y install vim libgomp1 nano build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libopencv-dev libssl-dev

sukanzubair commented 2 years ago

I finally got it working running on docker linux container. It seems the one provided by version 3.0.6 alpha is compatible with the docker image I was using. Tested with dotnetcore 3.1 & Alturos.Yolo version 3.0.6 alpha

What I had to do.

  1. Follow this guide to build DarkNet in a linux system using cmake https://github.com/AlexeyAB/darknet#how-to-use-yolo-as-dll-and-so-libraries
  2. Replace the yolo_cpp_dll_cpu.so file that is built with Alturos.Yolo once you do a nuget
  3. You may need these dependencies # apt-get -y install vim libgomp1 nano build-essential cmake git libgtk2.0-dev pkg-config libavcodec-dev libavformat-dev libswscale-dev libopencv-dev libssl-dev

Hi Tonyle8

Any chance you can add the newly built so file or make it available for download?

tonyle8 commented 2 years ago

This is what I am using. The real challenge is getting the container the proper dependencies... I was not able to use the built file using newer dotnetcore 3.1 images

sukanzubair commented 2 years ago

I realized that, after I saw that you integrated the new so into the repo.(Fix linux static object library). I copied the new so and now I am getting dependency issues and it seems like you need a specific version of open CV (3.2).