Greengrass组件无法打开摄像头

0

【以下的问题经过翻译处理】 你好。 我已将Greengrass v2的组件部署到Raspberry Pi(树莓派)上。我的制品中包含S3桶中的人脸识别推理代码。所以我创建并部署了这些组件。树莓派的状态正常,并且组件已经成功部署。但我遇到了一个错误。在我的推断代码中,有一个任务要打开并执行连接到Raspberry Pi 4的摄像头。 但是当我将其部署为组件时,它无法打开摄像头。我该怎么办? 在树莓派4上运行代码时,它运行良好,但是当我将其部署为组件时,它不会运行。 请帮帮我! 连接到我的树莓派4的摄像头是 Intel Realsense F450。 谢谢你。请帮帮我。 <组件日志> 2022-10-24T14:57:40.205Z [INFO] (pool-2-thread-28) com.example.jamesML: shell-runner-start. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=STARTING, command=["cd /home/pi&&. pracvenv/bin/activate&&cd james_ml&&python3 practice.py"]} 2022-10-24T14:58:11.981Z [WARN] (Copier) com.example.jamesML: stderr. /home/pi/pracvenv/lib/python3.7/site-packages/h5py/init.py:40: UserWarning: h5py is running against HDF5 1.10.6 when it was built against 1.10.4, this may cause problems. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:11.982Z [WARN] (Copier) com.example.jamesML: stderr. '{0}.{1}.{2}'.format(*version.hdf5_built_version_tuple). {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:11.982Z [WARN] (Copier) com.example.jamesML: stderr. WARNING:tensorflow:No training configuration found in the save file, so the model was not compiled. Compile it manually.. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:11.998Z [WARN] (Copier) com.example.jamesML: stderr. [ WARN:0@15.489] global /tmp/pip-wheel-8c7uejek/opencv-python_88dbbad412c5416b992ae69de26299d6/opencv/modules/videoio/src/cap_v4l.cpp (902) open VIDEOIO(V4L2:/dev/video0): can't open camera by index. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:12.005Z [INFO] (Copier) com.example.jamesML: stdout. Could not open webcam. {scriptName=services.com.example.jamesML.lifecycle.run.script, serviceName=com.example.jamesML, currentState=RUNNING} 2022-10-24T14:58:13.240Z [INFO] (Copier) com.example.jamesML: Run script exited. {exitCode=0, serviceName=com.example.jamesML, currentState=RUNNING}

<返回报文> { "RecipeFormatVersion": "2020-01-25", "ComponentName": "com.example.jamesML", "ComponentVersion": "1.0.19", "ComponentType": "aws.greengrass.generic", "ComponentDescription": "Capstone Design james machine learning.", "ComponentPublisher": "Me", "ComponentConfiguration": { "DefaultConfiguration": { "accessControl": { "aws.greengrass.ipc.mqttproxy": { "com.example.jamesML:mqttproxy:1": { "policyDescription": "Allows access to publish via topic ml/dlr/image-classification.", "operations": [ "aws.greengrass#PublishToIoTCore" ], "resources": [ "ml/dlr/image-classification" ] } } } } }, "Manifests": [ { "Platform": { "os": "linux", "architecture": "arm" }, "Lifecycle": { "install": { "Script": "" }, "run": { "script": "cd /home/pi&&. pracvenv/bin/activate&&cd james_ml&&python3 practice.py" } }, "Artifacts": [ { "Uri": "s3://greengrass-sagemaker-0930/james_ml.zip", "Digest": "Bc8JmqcuVXamFOuXHeEGMoNovRTgwo9sJQEcsgpqoDo=", "Algorithm": "SHA-256", "Unarchive": "ZIP", "Permission": { "Read": "OWNER", "Execute": "NONE" } } ] } ], "Lifecycle": {} }

1 Antwort
0

【以下的回答经过翻译处理】 Hi,hyorim。

当我在树莓派4上运行代码时,运行得很好,但是当我部署它作为组件时,就不能运行了。

当作为组件运行时,它将作为不同的用户运行,最常见的是ggc_user。请检查ggc_user是否在video group中(groups ggc_user),如果不在,请将它添加到该组中。

profile picture
EXPERTE
beantwortet vor 6 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen