AlturosDestinations / Alturos.Yolo

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

Can anybody help me to make the GPU act! #148

Open PHHUANG1970 opened 4 years ago

PHHUANG1970 commented 4 years ago

Dear all: Can anybody help me to make the GPU act! I am trying to perform live streaming detection using TinyYolov2. However I am only able to use CPU to perform the live stream, and it takes around 1-2 second to detect objects in a frame. I confirm that my CUDA setting is no problem. But the output screen shows the Used GPU is 0.

Follows are the output screen of the project:

mask_scale: Using default '1.000000' Total BFLOPS 6.977 avg_outputs = 454208 Allocate additional workspace_size = 104.86 MB Loading weights from .\yolov2-tiny-voc.weights... seen 32, trained: 2566 K-images (40 Kilo-batches_64)

try to allocate additional workspace_size = 104.86 MB CUDA allocate done! Used GPU 0 net.optimized_memory = 0 batch = 1, time_steps = 1, train = 0 Done! Loaded 16 layers from weights-file compute_capability = 610, cudnn_half = 0

My main code is as follows:

private void Detect1() { var configurationDetector = new YoloConfigurationDetector(); var config = configurationDetector.Detect(); var gpuConfig = new GpuConfig(); var yolo = new YoloWrapper(config, gpuConfig); var memoryStream = new MemoryStream(); pictureBox1.Image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png); var _items = yolo.Detect(memoryStream.ToArray()).ToList(); AddDetailstoPictureBox(pictureBox1, _items); }

Colonel-Latte commented 4 years ago

did you copy cudnn64_7.dll file in your bin/debug folder? this should automatically enable YOLO to run with GPU

example path: C:\Users\Latte\source\repos\ProjectName\ProjectaName\bin\Debug