SharpAI / DeepCamera

Open-Source AI Camera. Empower any camera/CCTV with state-of-the-art AI, including facial recognition, person recognition(RE-ID) car detection, fall detection and more
https://sharpai.github.io/DeepCamera/
MIT License
1.87k stars 317 forks source link

Help to solve DeepCamera installation issues #64

Closed craqShen closed 2 years ago

craqShen commented 3 years ago

Describe the bug 我尝试在centos7虚拟机上运行deepcamera,在运行到api_server的时候报了一个错误,下面是api_server docker容器的日志,使用的是api_server:3.4.1镜像。

=> Started proxy => Started MongoDB => Errors prevented startup: While selecting package versions: error: Package version not in catalog: crosswalk 1.7.1 While refreshing package catalog to resolve previous errors: error: Network error: wss://packages.meteor.com/websocket: certificate has expired => Your application has errors. Waiting for file change.

To Reproduce Steps to reproduce the behavior:

  1. git clone https://github.com/SharpAI/DeepCamera
  2. ./run-on-linux.sh start

Desktop (please complete the following information):

Additional context 另外还有个问题想请教下,环境是同样的linux centos7.9。在部署私有云系统的时候,执行了./start-cloud.sh start 执行到最后的日志为下,(日志里面没有任何Error),是否表示已经成功部署?但是没有自动结束这个部署脚本。 api_server | I20211028-06:56:04.253(0)? log: [ [Object], [Object] ] } ] api_server | I20211028-06:56:04.325(0)? [] api_server | I20211028-06:56:05.544(0)? ----setup smtp server--- api_server | I20211028-06:56:05.575(0) (percolate_synced-cron.js:87) SyncedCron: Scheduled "send report email 12:00 am every day" next run @Thu Oct 28 2021 06:56:05 GMT+0000 (U api_server | => Started your app. api_server | api_server | => App running at: http://localhost:3000/ api_server | I20211028-07:00:00.009(0) (percolate_synced-cron.js:87) SyncedCron: Starting "send report email 12:00 am every day". api_server | I20211028-07:00:00.013(0)? send email out api_server | I20211028-07:00:00.015(0) (percolate_synced-cron.js:87) SyncedCron: Finished "send report email 12:00 am every day". api_server | I20211028-07:01:18.812(0)? send offline notification api_server | I20211028-07:01:18.815(0)? { clientId: 'test_client_id_1111' } api_server | I20211028-07:01:18.815(0)? send offline notification to test_client_id_1111 api_server | I20211028-08:00:00.010(0) (percolate_synced-cron.js:87) SyncedCron: Starting "send report email 12:00 am every day". api_server | I20211028-08:00:00.016(0)? send email out

solderzzc commented 3 years ago

Hi, @craqShen

For question 2, the api_server is already deployed successfully. Let's write down the api_server's IP address.

For question 1, I'm assuming you are trying to deploy edge node on x86 for evaluation. Please let me know if following command works:

git clone https://github.com/SharpAI/DeepCamera
cd DeepCamera
git checkout master

Then you need edit docker/servers.env

If you are running start_cloud.sh on IP A.A.A.A

You need modify as following:

MQTT_BROKER_ADDRESS=A.A.A.A
MQTT_BROKER_PORT=1883
MQTT_BROKER_TRANSPORT=tcp
API_SERVER_ADDRESS=A.A.A.A
API_SERVER_PORT=3000
./run-on-linux.sh start

Please ignore the error on this machine since you are connecting to cloud server A.A.A.A.

craqShen commented 3 years ago

@solderzzc hi,抱歉隔了好几天才回复您。 我把一台新的树莓派4B 作为边缘设备,打算在上面运行DeepCamera,以下是它的系统信息: uname -a Linux raspberrypi 5.10.63-v7l+ #1459 SMP Wed Oct 6 16:41:57 BST 2021 armv7l GNU/Linux

在apt-get update && apt-get upgrade 后执行以下操作: 1、安装docker:curl -sSL https://get.docker.com | sh 2、安装依赖:sudo apt-get install -y libffi-dev libssl-dev, sudo apt-get install -y python3 python3-pip sudo apt-get remove python-configparser 3、安装docker-compose:sudo pip3 -v install docker-compose

接着安照上面的回复,检查分支、在servers.env修改了对应的信息后,在root角色下运行./run-on-rpi.sh start。但是redis容器显示状态restarting,exited(139), 这是否可能是树莓派4B的硬件问题或者是其他问题,麻烦您看看有什么解决办法?

以下是redis日志:

------ INFO OUTPUT ------ 9:C 07 Mar 1970 07:22:05.000 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 9:C 07 Mar 1970 07:22:05.000 # Redis version=6.2.6, bits=32, commit=00000000, modified=0, pid=9, just started 9:C 07 Mar 1970 07:22:05.000 # Configuration loaded

=== REDIS BUG REPORT START: Cut & paste starting from here === 9:M -12645 Jan 1970 -3:-53:-20.5903 # Redis 6.2.6 crashed by signal: 6, si_code: -6 9:M -12645 Jan 1970 -3:-53:-20.5903 # Killed by PID: 9, UID: 0 9:M -12645 Jan 1970 -3:-53:-20.5903 # Crashed running the instruction at: 0xb6b0bc66

------ STACK TRACE ------ EIP: /lib/arm-linux-gnueabihf/libc.so.6(+0x1ac66)[0xb6b0bc66]

Backtrace: /lib/arm-linux-gnueabihf/libc.so.6(+0x2acc0)[0xb6b1bcc0] /lib/arm-linux-gnueabihf/libc.so.6(+0x1ac66)[0xb6b0bc66] /lib/arm-linux-gnueabihf/libc.so.6(gsignal+0x7b)[0xb6b1aea0]

------ REGISTERS ------ 9:M -14221 Jan 1970 -10:-45:-16.000 # R10:00000000006c24d0 R9 :00000000005c2500 R8 :00000000005c24e4 R7 :00000000000000af R6 :0000000000000001 R5 :00000000bedfd884 R4 :0000000000000000 R3 :0000000000000008 R2 :0000000000000000 R1 :00000000bedfd884 R0 :0000000000000000 EC :0000000000000000 fp: 00000000bedfdd70 ip:00000000000000af pc:00000000b6b0bc66 sp:00000000bedfd878 cpsr:0000000000010030 fault_address:0000000000000000

9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd887) -> 00000000 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd886) -> bedfd983 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd885) -> 0057a719 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd884) -> 00000000 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd883) -> b6efd728 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd882) -> 005e1000 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd881) -> 000000bc 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd880) -> 2800f000 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd87f) -> bedfd982 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd87e) -> 00010000 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd87d) -> 00000002 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd87c) -> 00000000 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd87b) -> 00000000 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd87a) -> bedfd983 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd879) -> b6b1aea1 9:M -14221 Jan 1970 -10:-45:-16.000 # (bedfd878) -> 00000095

solderzzc commented 3 years ago

Hi, @craqShen Are you using nano branch, you should checkout to Raspberry branch by following command:

git checkout raspberry_pi_stable
craqShen commented 3 years ago

Hi, @craqShen Are you using nano branch, you should checkout to Raspberry branch by following command:

git checkout raspberry_pi_stable

我删掉容器后重启树莓派,重新拉取了代码并切换到raspberry_pi_stable分支,修改了servers.env,再在root角色下运行./run-on-rpi.sh start,redis仍无法启动,日志类似上面回复中的内容。

以下是操作内容: docker-compose -f docker-compose-rpi.yml down -v reboot git clone https://github.com/SharpAI/DeepCamera cd DeepCamera && git checkout raspberry_pi_stable vim docker/servers.env ./run-on-rpi.sh start

以下是一些系统信息: cat /etc/os-release PRETTY_NAME="Raspbian GNU/Linux 10 (buster)" NAME="Raspbian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=raspbian ID_LIKE=debian HOME_URL="http://www.raspbian.org/" SUPPORT_URL="http://www.raspbian.org/RaspbianForums" BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"

32位Raspbian系统 getconf LONG_BIT 32

solderzzc commented 3 years ago

The redis is pulled from public repo, could you try to tun this command:

docker run -ti arm32v7/redis:latest redis-server

if it failed, we need build one from source, let me know if you need it, then I can work on that.

solderzzc commented 3 years ago

if the latest version doesn't work, you can try this one:

docker run -ti arm32v7/redis:3.2.11 redis-server

if still not work, you need build it locally:

cd DeepCamera/docker/build/redis/
docker build . -t redis_local_build:latest .

then modify the docker compose yaml file to load this image for redis

https://github.com/SharpAI/DeepCamera/blob/raspberry_pi_stable/docker/docker-compose-rpi.yml#L4

change arm32v7/redis:latest to redis_local_build:latest

craqShen commented 3 years ago

我使用了镜像arm32v7/redis:3.2.11,DeepCamera成功运行了,十分感谢!

我在手机app上测试识别结果的时候,在group下的device下一直获取不到识别的人脸图片。 查看树莓派上的detector_plugin日志时,从日志上看 人脸应该是识别到了,但是好像上传图片失败了,是要上传到私有云系统的minio里吗? 在树莓派上启动deepcamera的时候配置文件servers.env里没有配置minio的地方,日志里的minio地址显示是“http://minio:9000/

以下是detector_plugin的部分日志 (10.0.4.120是私有云系统服务器ip)

============================= upload errr, need retry 1st upload err, retry after 5s upload errr, need retry 2nd upload err, retry after 15s Lorex_1] tid: 1636447076024 person num: 1 face num: 1 cost: 1523 JSON.parse(result.result)= { result: { style: 'front', face_fuzziness: 650.7703841597476, recognized: false, detected: true, key: '5775414e-4138-11ec-9b5e-0242ac12000a', face_id: '16364470760240000', accuracy: 0 }, api_data: { api_url: 'http://10.0.4.120:3000/restapi/workai?accuracy=%20&fuzziness=650.77038416', payload: { img_ts: 1636447076024, style: 'front', uuid: 'e45f013c9e56', fuzziness: 650.7703841597476, type: 'face', event_type: 'danger', p_ids: null, waiting: false, current_ts: 1636447078292, tid: '1636447076024', position: '', group_id: '99e11d0141386caf9f3a2a8f', img_url: 'http://workaiossqn.tiegushi.com/5775414e-4138-11ec-9b5e-0242ac12000a', id: '16364470760240000', sqlid: 0, accuracy: 0 } } } json.result.key[ 5775414e-4138-11ec-9b5e-0242ac12000a ]task_info.path /opt/nvr/detector/images/deepeye_1636447076017_0.png { trackerid: 1636447076024, style: 'front', blury: 650.7703841597476, width: 713, totalPeople: 1, path: '/opt/nvr/detector/images/deepeye_1636447076017_0.png', ts: 1636447076024, cameraId: 'Lorex_1', height: 713, embedding_path: '/opt/nvr/detector/images/deepeye_1636447076017_0.png.txt' } classify result json: { result: { style: 'front', face_fuzziness: 650.7703841597476, recognized: false, detected: true, face_id: '16364470760240000', accuracy: 0, url: 'http://minio:9000/faces/5775414e-4138-11ec-9b5e-0242ac12000a' }, api_data: { api_url: 'http://10.0.4.120:3000/restapi/workai?accuracy=%20&fuzziness=650.77038416', payload: { img_ts: 1636447076024, style: 'front', uuid: 'e45f013c9e56', fuzziness: 650.7703841597476, type: 'face', event_type: 'danger', p_ids: null, waiting: false, current_ts: 1636447078292, tid: '1636447076024', position: '', group_id: '99e11d0141386caf9f3a2a8f', img_url: 'http://workaiossqn.tiegushi.com/5775414e-4138-11ec-9b5e-0242ac12000a', id: '16364470760240000', sqlid: 0, accuracy: 0 } } } recognitions result---- { style: 'front', face_fuzziness: 650.7703841597476, recognized: false, detected: true, face_id: '16364470760240000', accuracy: 0, url: 'http://minio:9000/faces/5775414e-4138-11ec-9b5e-0242ac12000a' } { style: 'front', face_fuzziness: 650.7703841597476, recognized: false, detected: true, face_id: '16364470760240000', accuracy: 0, url: 'http://minio:9000/faces/5775414e-4138-11ec-9b5e-0242ac12000a' } unknown message { style: 'front', face_fuzziness: 650.7703841597476, recognized: false, detected: true, face_id: '16364470760240000', accuracy: 0, url: 'http://minio:9000/faces/5775414e-4138-11

solderzzc commented 3 years ago

Hi, @craqShen you need to chance the server addresses in file: https://github.com/SharpAI/DeepCamera/blob/raspberry_pi_stable/docker/aws.env

AWS_END_POINT=minio
AWS_PORT=9000
AWS_USE_SSL=false
AWS_ACCESS_KEY=QUA2IU17RHOKE6NUZ7T2
AWS_SECRET_KEY=MQniMc5K3lsRbv9OPaUbJN9ft2eTQJ1rh4Yx6C17
AWS_BUCKET=faces
AWS_READABLE_PREFIX=http://minio:9000/faces/

change minio to 10.0.4.120

AWS_END_POINT=minio
AWS_READABLE_PREFIX=http://minio:9000/faces/
craqShen commented 3 years ago

我修改了aws.env的内容,重新执行了./run-on-rpi.sh start,日志里还是显示上传失败。 后来发现在私有云系统的minio里没有"faces"的bucket,创建了bucket之后app上可以收到识别的图像了,十分感谢您的帮助!

我下载的APP是debug.apk https://github.com/SharpAI/SharpAIMobileApp/releases/download/3.0.2/debug.apk app使用过程中有一些疑问,比如: 1、在我第一次进入group的时候,有一个询问框询问是否进入部署评测,选择进入后,提示“您的设备未连接”,但是app上是能够收到图像的。 2、一开始操作的时候,标记了15张较为清晰的人脸图像,embedding容器里没有"insert into db"的日志,也没能识别familiar的人脸; 之后我尝试在树莓派上的minio,添加了faces的bucket,并且把原先就有的shapai的bucket权限设成了read and write,embedding容器里看到了"insert into db"的日志,多次标记后可以识别familiar人脸了。 3、如果看到了familiar的人脸,在app的MESSAGE-group群组里不会收到“识别到熟悉的人”的类似消息;在app通知里会出现消息,但短时间内多次识别成功只有一次消息。

可能是我选择的app版本不对,可以推荐一个比较适合的app版本吗?

solderzzc commented 3 years ago

Hi, @craqShen Thanks for the evaluation and the bug fixing.

  1. The Deployment Evaluation feature was disabled. Since heart beat on the edge device was not implemented yet.
  2. I'll check what's the root cause of this issue
  3. Because of security concern, face image will not show in chat message, could you try to connect to API server and get the recognition message with FaceBox API? Connect to edge device with facebox_sdk https://github.com/SharpAI/facebox_sdk#known-person--stranger-events-format convert face id to display name by API server rest api: https://github.com/SharpAI/ApiServer/blob/master/API.md#getperson
solderzzc commented 3 years ago

Also, you can try to run the previous version 2.1.0.1 which has no privacy protection at that time: https://github.com/SharpAI/SharpAIMobileApp/releases/download/2.1.0.1/sharpai-app.apk

solderzzc commented 2 years ago

close because we covered the installation pain point by one command line:

sharpai-cli deepcamera start