nischi / MMM-Face-Reco-DNN

Face recognition with opencv and deep neural network
MIT License
90 stars 46 forks source link

Could not open any dmaHeap device #147

Closed chevellabv closed 7 months ago

chevellabv commented 7 months ago

Hi,

I'm facing the following error:

Dec 03 16:07:38 smart-mirror npm[755]: [03.12.2023 16:07.38.998] [ERROR] Whoops! There was an uncaught exception... Dec 03 16:07:39 smart-mirror npm[755]: [03.12.2023 16:07.39.006] [ERROR] PythonShellError: [0:00:59.058165279] [988] INFO Camera camera_manager.cpp:284 libcamera v0.1.0+118-563cd78e Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.167314334] [1040] WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.173666445] [1040] WARN RPI vc4.cpp:390 Mismatch between Unicam and CamHelper for embedded data usage! Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.177106427] [1040] INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media4 and ISP device /dev/media1 Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.177506631] [1040] INFO RPI pipeline_base.cpp:1142 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml' Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.185280279] [988] INFO Camera camera_manager.cpp:284 libcamera v0.1.0+118-563cd78e Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.281199519] [1043] WARN RPiSdn sdn.cpp:39 Using legacy SDN tuning - please consider moving SDN inside rpi.denoise Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.284523816] [1043] WARN RPI vc4.cpp:390 Mismatch between Unicam and CamHelper for embedded data usage! Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.285454334] [1043] INFO RPI vc4.cpp:444 Registered camera /base/soc/i2c0mux/i2c@1/imx219@10 to Unicam device /dev/media4 and ISP device /dev/media1 Dec 03 16:07:39 smart-mirror npm[755]: [0:00:59.285528056] [1043] INFO RPI pipeline_base.cpp:1142 Using configuration file '/usr/share/libcamera/pipeline/rpi/vc4/rpi_apps.yaml' Dec 03 16:07:39 smart-mirror npm[755]: Traceback (most recent call last): Dec 03 16:07:39 smart-mirror npm[755]: File "/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/tools/recognition.py", line 40, in Dec 03 16:07:39 smart-mirror npm[755]: picam2 = Picamera2() Dec 03 16:07:39 smart-mirror npm[755]: ^^^^^^^^^^^ Dec 03 16:07:39 smart-mirror npm[755]: File "/usr/lib/python3/dist-packages/picamera2/picamera2.py", line 274, in init Dec 03 16:07:39 smart-mirror npm[755]: self.allocator = DmaAllocator() Dec 03 16:07:39 smart-mirror npm[755]: ^^^^^^^^^^^^^^ Dec 03 16:07:39 smart-mirror npm[755]: File "/usr/lib/python3/dist-packages/picamera2/allocators/dmaallocator.py", line 21, in init Dec 03 16:07:39 smart-mirror npm[755]: self.dmaHeap = DmaHeap() Dec 03 16:07:39 smart-mirror npm[755]: ^^^^^^^^^ Dec 03 16:07:39 smart-mirror npm[755]: File "/usr/lib/python3/dist-packages/picamera2/dma_heap.py", line 87, in init Dec 03 16:07:39 smart-mirror npm[755]: raise RuntimeError("Could not open any dmaHeap device") Dec 03 16:07:39 smart-mirror npm[755]: RuntimeError: Could not open any dmaHeap device Dec 03 16:07:39 smart-mirror npm[755]: at PythonShell.parseError (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:311:21) Dec 03 16:07:39 smart-mirror npm[755]: at terminateIfNeeded (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:193:32) Dec 03 16:07:39 smart-mirror npm[755]: at ChildProcess. (/home/pi/MagicMirror/modules/MMM-Face-Reco-DNN/node_modules/python-shell/index.js:185:13) Dec 03 16:07:39 smart-mirror npm[755]: at ChildProcess.emit (node:events:513:28) Dec 03 16:07:39 smart-mirror npm[755]: at Process.onexit (node:internal/child_process:291:12) { Dec 03 16:07:39 smart-mirror npm[755]: executable: '/home/pi/python-facereco/bin/python3', Dec 03 16:07:39 smart-mirror npm[755]: options: null, Dec 03 16:07:39 smart-mirror npm[755]: script: 'modules/MMM-Face-Reco-DNN/tools/recognition.py', Dec 03 16:07:39 smart-mirror npm[755]: args: [ Dec 03 16:07:39 smart-mirror npm[755]: '--cascade=modules/MMM-Face-Reco-DNN/model/haarcascade_frontalface_default.xml', Dec 03 16:07:39 smart-mirror npm[755]: '--encodings=modules/MMM-Face-Reco-DNN/model/encodings.pickle', Dec 03 16:07:39 smart-mirror npm[755]: '--rotateCamera=-1', Dec 03 16:07:39 smart-mirror npm[755]: '--method=dnn', Dec 03 16:07:39 smart-mirror npm[755]: '--detectionMethod=hog', Dec 03 16:07:39 smart-mirror npm[755]: '--interval=2000', Dec 03 16:07:39 smart-mirror npm[755]: '--output=0', Dec 03 16:07:39 smart-mirror npm[755]: '--outputmm=0', Dec 03 16:07:39 smart-mirror npm[755]: '--extendDataset=False', Dec 03 16:07:39 smart-mirror npm[755]: '--dataset=modules/MMM-Face-Reco-DNN/dataset/', Dec 03 16:07:39 smart-mirror npm[755]: '--tolerance=0.6', Dec 03 16:07:39 smart-mirror npm[755]: '--brightness=0', Dec 03 16:07:39 smart-mirror npm[755]: '--contrast=0', Dec 03 16:07:39 smart-mirror npm[755]: '--resolution=1920,1080', Dec 03 16:07:39 smart-mirror npm[755]: '--processWidth=500' Dec 03 16:07:39 smart-mirror npm[755]: ], Dec 03 16:07:39 smart-mirror npm[755]: exitCode: 1 Dec 03 16:07:39 smart-mirror npm[755]: }

I followed the readme to install all the dependencies, switch back to 32bit bookwork instead of 64 bit but I'm not able to resolve this error.

Do you have any idea?

Thanks :)

nischi commented 7 months ago

Hi @chevellabv

Nice that you use my module. Sorry for the issues. What kind of camery do you use?

chevellabv commented 7 months ago

Hi @nischi ,

I've tested it with a Raspberry PI v2.1 camera and a Logitech webcam.

nischi commented 7 months ago

Hmm it seems they miss a dmaHeap device. I found following: https://github.com/raspberrypi/rpicam-apps/issues/218

Because i'm not good with linux, can you do something with it? Did you install the lite version maybe where this is not installed?

chevellabv commented 7 months ago

I'm using the OS Lite version. Looks like some packages are missing to make this work :)

nischi commented 7 months ago

Yes seems that this drivers for the kernel are missing in this case. Didn't know that. Do you have the possibility to try with the not lite version? Or install the drivers.

chevellabv commented 7 months ago

I did a comparison between the lite and full packages but it's a really long list :) Do you have an idea which driver is missing? Otherwise I would go for the full version.

Thanks.

nischi commented 7 months ago

Seems the "dma-heap drivers" are missing.

chevellabv commented 7 months ago

With the full OS the dma_heap is working, but I don't know via which package.

$ ls /dev/dma_heap/ linux,cma system vidbuf_cached

chevellabv commented 7 months ago

Found it. The /dev/dma_heap is removing linux/cma if you add cma=400M to the /boot/cmdline.txt. I've tried that due a cannot allocate memory issue. I've changed 1920,1024 to 800,600 in the module config and it's working now, also on the lite version :)

nischi commented 7 months ago

Perfect, thank you for sharing the solution. Then i will close this isssue and hope all is fine.