luxonis / depthai-experiments

Experimental projects we've done with DepthAI.
MIT License
842 stars 370 forks source link

[184430101152691200] [158.903] [system] [critical] Fatal error #309

Closed rexn8r closed 2 years ago

rexn8r commented 2 years ago

Hello,

I have Oak-D AI kit camera and also just got Oak-D lite and ran the Age & Gender sample (without changing any source code).

While the face is leaving the preview (either on left or right), it crashes with following error;

[184430101152691200] [158.903] [system] [critical] Fatal error. Please report to developers. Log: 'ImgPreproc' '261'

The error occurs both on Oak-D and Lite cameras.

I would like to use the camera in retail environment where the face detection will be done while object is walking in the direction of the camera and leaving either from right or left side.

Any pointer to fix this?

thanks

rexn8r commented 2 years ago

hello

one more error when the face detection is at the edge of the camera vision; Screenshot from 2022-02-21 16-53-25

The script/window then crash out.

is there a way to catch this critical error or how to fix this?

To use OAK-D camera in our software solution is based on resolution of these critical error.

thanks rex

themarpe commented 2 years ago

Hi @rexn8r Sorry for late response on this.

The issue at hand is when a crop is out of bounds. This is a limitation of current ImageManip, and unfortunatelly not well documented (error message wise).

We do have a branch that vastly improves ImageManip capabilities and removes many limitations such as this one image_manip_refactor.

Feel free to test it out, by installing it with the following command:

python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai==2.13.3.0.dev0+0f65424c3deb66ef8f334d6723648c99f46536c7

Let me know how this works for you.

EDIT: Updated installation command - version was wrong

rexn8r commented 2 years ago

Hi @themarpe

thanks a lot for the response. much appreciate.

yes now the imagemanip error is gone. but lost the depth reading.

detection.spatialCoordinates is always 0.00

Screenshot from 2022-02-22 10-07-13

how to resolve this?

thanks rex

themarpe commented 2 years ago

@rexn8r thanks for reporting

I think this is the issue with the refactored ImageManip not sending over all necessary information to be combined with depth.

I'll update image_manip_refactor tomorrow and will address this issue as well

rexn8r commented 2 years ago

Hi @themarpe

I was wondering if the dev branch is merged into main? I did a depthai 2.14 installation on a fresh pc and ran the main.py of age and gender and the detection.spatialCoordinates returns 0

In the production environment, I would like to use the OAK-D lite placed @ 90 degree rotation. When i rotate the camera at 90 degree, the gender result coming out wrong.

image

The face cropped image also not showing the face.

I have attached modified demo main.py. can you please check the code and let me know if the rotation code is implemented correctly and how to resolve the cropped face and gender detection?

main.zip

looking forward to your assistance.

thanks rex

themarpe commented 2 years ago

@rexn8r

I was wondering if the dev branch is merged into main?

No, develop branch gets merged to main on each release (eg. main carries latest release codebase)

I did a depthai 2.14 installation on a fresh pc and ran the main.py of age and gender and the detection.spatialCoordinates returns 0

Interesting, thanks for reporting.

Also thanks for supplying the code to reproduce - @Erol444 can you please check this out and let me know if it boils down to bug in core?

We'll get to the bottom of this:)

rexn8r commented 2 years ago

hi Guys

I just installed Windows 10 IoT Enterprise on a fresh PC.

Followed Windows 10 Installation instructions from documentation page i.e. installed chocolaty, python and other pre-requisite using windows powershell.

I then downloaded Age & Gender Demo and installed the requirements using python command. While installing the requirements, I removed the depthai version from the requirements.txt file so latest version gets installed.

I have modified the main.py script to add imagemanip rotation code to rotate the view @ -90 degree.

When the face is on the right or left edge of the camera view, the program crash without warning.

if the following branch is merged into the latest version, should this problem still exists?

python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai==2.13.3.0.dev0+0f65424c3deb66ef8f334d6723648c99f46536c7

I have tried depthai latest version on 2 windows pc and on both pc, the program crash in similar fashion.

below is my code:

cam = pipeline.create(dai.node.ColorCamera) cam.setPreviewSize(640, 400) cam.setResolution(dai.ColorCameraProperties.SensorResolution.THE_1080_P) cam.setInterleaved(False) cam.setBoardSocket(dai.CameraBoardSocket.RGB) cam.setPreviewKeepAspectRatio(False)

rgbRr = dai.RotatedRect()
rgbRr.center.x, rgbRr.center.y = cam.getPreviewWidth() // 2, cam.getPreviewHeight() // 2
rgbRr.size.width, rgbRr.size.height = cam.getPreviewHeight(), cam.getPreviewWidth()
rgbRr.angle = -90

manipRgb = pipeline.create(dai.node.ImageManip)
manipRgb.initialConfig.setCropRotatedRect(rgbRr, False)
cam.preview.link(manipRgb.inputImage)

cam_xout = pipeline.createXLinkOut()
cam_xout.setStreamName("cam_out")
manipRgb.out.link(cam_xout.input)

face_det_manip = pipeline.create(dai.node.ImageManip)
face_det_manip.initialConfig.setResize(300, 300)
face_det_manip.initialConfig.setFrameType(dai.RawImgFrame.Type.RGB888p)
face_det_manip.initialConfig.setCropRotatedRect(rgbRr, False)

monoLeft = pipeline.create(dai.node.MonoCamera)
monoLeft.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
monoLeft.setBoardSocket(dai.CameraBoardSocket.LEFT)
monoRight = pipeline.create(dai.node.MonoCamera)
monoRight.setResolution(dai.MonoCameraProperties.SensorResolution.THE_400_P)
monoRight.setBoardSocket(dai.CameraBoardSocket.RIGHT)

stereo = pipeline.create(dai.node.StereoDepth)
stereo.setDefaultProfilePreset(dai.node.StereoDepth.PresetMode.HIGH_DENSITY)
stereo.setLeftRightCheck(True)
stereo.setExtendedDisparity(True)
stereo.setSubpixel(False)

manipLeft = pipeline.create(dai.node.ImageManip)
rr = dai.RotatedRect()
rr.center.x, rr.center.y = monoLeft.getResolutionWidth() // 2, monoLeft.getResolutionHeight() // 2
rr.size.width, rr.size.height = monoLeft.getResolutionHeight(), monoLeft.getResolutionWidth()
rr.angle = -90
manipLeft.initialConfig.setCropRotatedRect(rr, False)
monoLeft.out.link(manipLeft.inputImage)

manipRight = pipeline.create(dai.node.ImageManip)
rr2 = dai.RotatedRect()
rr2.center.x, rr2.center.y = monoRight.getResolutionWidth() // 2, monoRight.getResolutionHeight() // 2
rr2.size.width, rr2.size.height = monoRight.getResolutionHeight(), monoRight.getResolutionWidth()
rr2.angle = -90
manipRight.initialConfig.setCropRotatedRect(rr2, False)
monoRight.out.link(manipRight.inputImage)

monoLeft.out.link(stereo.left)
monoRight.out.link(stereo.right)

age_gender_manip = pipeline.create(dai.node.ImageManip)
age_gender_manip.initialConfig.setResize(62, 62)
age_gender_manip.initialConfig.setCropRotatedRect(rgbRr, False)
image_manip_script.outputs['manip_cfg'].link(age_gender_manip.inputConfig)
image_manip_script.outputs['manip_img'].link(age_gender_manip.inputImage)

So all the imagemanip objects are rotated.

Is there something wrong with the above code which might be causing the crash?

thanks raxit

Erol444 commented 2 years ago

Hello @rexn8r!

1) Regarding the out-of-image crash, I would suggest limiting the ROI coordinates between 0.001 and 0.999, as done here. I see that we haven't done that on age-gender demo, and will do that now and create PR.

2) Regarding face rotation, have you checked how we implemented that in our face-recognition demo? From what I know we don't have any crashes on rotating frames there.

Thanks, Erik

Erol444 commented 2 years ago

Fix for age-gender demo here. Thanks again for reporting @rexn8r !

rexn8r commented 2 years ago

thanks. much appreciate.