depthai-experiments icon indicating copy to clipboard operation
depthai-experiments copied to clipboard

data collection does not seems to work :(

Open abhatikar opened this issue 3 years ago • 8 comments

python main.py XLink initialized. Sending internal device firmware Successfully connected to device. Loading config file Attempting to open stream config_d2h watchdog started Successfully opened stream config_d2h with ID #0! Closing stream config_d2h: ... Closing stream config_d2h: DONE. EEPROM data: valid (v3) Board name : BW1098OBC Board rev : R0M0E0 HFOV L/R : 71.86 deg HFOV RGB : 68.7938 deg L-R distance : 7.5 cm L-RGB distance : 3.75 cm L/R swapped : yes L/R crop region: center Calibration homography: 1.011238, -0.021879, -10.484687, 0.026843, 1.010301, -22.506275, 0.000004, 0.000005, 1.000000, CNN configurations read: /home/iotuser/oakd/depthai-experiments/collecting-training-data/mobilenet-ssd/mobilenet-ssd.json depthai: Calibration file is not specified, will use default setting; config_h2d json: {"_board":{"_homography_right_to_left":[0.988068163394928,0.0029474012553691864,5.067617416381836,-0.008765067905187607,0.9921473264694214,-8.795275688171387,-8.449587767245248e-06,-3.603489403758431e-06,1.0]},"_load_inBlob":true,"_pipeline":{"_streams":[{"name":"left"},{"name":"right"},{"name":"previewout"},{"name":"disparity"}]},"ai":{"NCEs":1,"blob0_size":14489664,"blob1_size":0,"calc_dist_to_bb":false,"camera_input":"rgb","cmx_slices":7,"keep_aspect_ratio":true,"num_stages":1,"shaves":7},"app":{"sync_video_meta_streams":false},"board":{"clear-eeprom":false,"left_fov_deg":69.0,"left_to_rgb_distance_m":0.0,"left_to_right_distance_m":0.03500000014901161,"name":"","override-eeprom":false,"revision":"","rgb_fov_deg":69.0,"stereo_center_crop":false,"store-to-eeprom":false,"swap-left-and-right-cameras":false},"camera":{"mono":{"fps":30.0,"resolution_h":720,"resolution_w":1280},"rgb":{"fps":30.0,"resolution_h":1080,"resolution_w":1920}},"depth":{"confidence_threshold":0.5,"depth_limit_mm":10000,"padding_factor":0.30000001192092896},"ot":{"confidence_threshold":0.5,"max_tracklets":20}} Attempting to open stream config_h2d Successfully opened stream config_h2d with ID #1! Writing 5000 bytes to config_h2d !!! XLink write successful: config_h2d (5000) Closing stream config_h2d: ... Closing stream config_h2d: DONE. Creating observer stream host_capture: ... Attempting to open stream host_capture Successfully opened stream host_capture with ID #0! Creating observer stream host_capture: DONE. Read: 14489664 Attempting to open stream inBlob Successfully opened stream inBlob with ID #1! Writing 14489664 bytes to inBlob !!! XLink write successful: inBlob (14489664) Closing stream inBlob: ... Closing stream inBlob: DONE. depthai: done sending Blob file /home/iotuser/oakd/depthai-experiments/collecting-training-data/mobilenet-ssd/mobilenet-ssd.blob Attempting to open stream outBlob Successfully opened stream outBlob with ID #2! Closing stream outBlob: ... Closing stream outBlob: DONE. CNN input width: 300 CNN input height: 300 CNN input num channels: 3 CNN to depth bounding-box mapping: start(318, 38), max_size(643, 643) Host stream start:left Opening stream for read: left Attempting to open stream left Successfully opened stream left with ID #1! Starting thread for stream: left Host stream start:right Opening stream for read: right Attempting to open stream right Started thread for stream: left Successfully opened stream right with ID #2! Starting thread for stream: right Started thread for stream: right Host stream start:previewout Opening stream for read: previewout Attempting to open stream previewout Successfully opened stream previewout with ID #3! Starting thread for stream: previewout Started thread for stream: previewout Opening stream for read: disparity Attempting to open stream disparity Successfully opened stream disparity with ID #4! Starting thread for stream: disparity Started thread for stream: disparity depthai: INIT OK! previewout 35.058774208 1 previewout previewout 35.092103955 2 previewout previewout 35.12543381 3 previewout previewout 35.158761742 4 previewout previewout 35.192089875 5 previewout previewout 35.225418364 6 previewout previewout 35.258747274 7 previewout previewout 35.292075922 8 previewout previewout 35.325404692 9 previewout previewout 35.358733174 10 previewout previewout 35.392061451000004 11 previewout previewout 35.425391135 12 previewout previewout 35.458720438 13 previewout previewout 35.492051115 14 previewout previewout 35.525376275 15 previewout previewout 35.558704762 16 previewout previewout 35.592033577 17 previewout previewout 35.625362382 18 previewout previewout 35.658689817 19 previewout previewout 35.692018335 20 previewout previewout 35.725347987 21 previewout previewout 35.758676428 22 previewout previewout 35.79200528 23 previewout previewout 35.825334102 24 previewout previewout 35.858662675 25 previewout previewout 35.891991267 26 previewout previewout 35.925320787 27 previewout previewout 35.958651684 28 previewout previewout 35.99197622 29 previewout previewout 36.0253047 30 previewout previewout 36.058634515 31 previewout previewout 36.091967362 32 previewout previewout 36.125291681 33 previewout previewout 36.158626598 34 previewout previewout 36.191948952 35 previewout previewout 36.225277564 36 previewout previewout 36.258606224 37 previewout previewout 36.291935172 38 previewout previewout 36.325262637 39 previewout previewout 36.358591198 40 previewout previewout 36.391920652 41 previewout previewout 36.425251405 42 previewout previewout 36.458578498 43 previewout previewout 36.491906894 44 previewout previewout 36.525235354 45 previewout previewout 36.558563964 46 previewout previewout 36.591892842 47 previewout previewout 36.625222194 48 previewout previewout 36.658549788 49 previewout previewout 36.6918775 50 previewout previewout 36.725207052 51 previewout previewout 36.758536677 52 previewout previewout 36.791864477 53 previewout previewout 36.825193174 54 previewout previewout 36.858523621 55 previewout previewout 36.8918504 56 previewout previewout 36.925182752 57 previewout previewout 36.958507818 58 previewout previewout 36.991835745 59 previewout previewout 37.02516402 60 previewout previewout 37.05849328 61 previewout previewout 37.091822035 62 previewout previewout 37.125151017 63 previewout previewout 37.158480012 64 previewout previewout 37.191808152 65 previewout previewout 37.225136797 66 previewout previewout 37.258466784 67 previewout previewout 37.291795132 68 previewout previewout 37.325121918 69 previewout previewout 37.358451511 70 previewout previewout 37.39178542 71 previewout previewout 37.425109257 72 previewout previewout 37.45843728 73 previewout previewout 37.491765974 74 previewout previewout 37.525094554 75 previewout previewout 37.558423462 76 previewout previewout 37.59175412 77 previewout previewout 37.625080721 78 previewout previewout 37.658408318 79 previewout previewout 37.691736797 80 previewout previewout 37.72506608 81 previewout previewout 37.758394715 82 previewout previewout 37.791728524 83 previewout previewout 37.825066584 84 previewout previewout 37.858380832 85 previewout previewout 37.891709482 86 previewout previewout 37.925038291999996 87 previewout previewout 37.958366975 88 previewout previewout 37.991694798 89 previewout previewout 38.025024235 90 previewout previewout 38.05835226 91 previewout previewout 38.091680197 92 previewout left 38.11159051 1 left right 38.111600905 1 right previewout 38.125014062 93 previewout disparity_color Traceback (most recent call last): File "main.py", line 69, in print(packet.getMetadata().getTimestamp(), packet.getMetadata().getSequenceNum(), packet.stream_name) AttributeError: 'NoneType' object has no attribute 'getTimestamp' === New data in observer stream host_capture, size: 4 Writing 4 bytes to host_capture !!! XLink write successful: host_capture (4) Stopping threads: ... Closing stream right: ... E: [global] [ 715628] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_READ_REL_REQ

E: [xLink] [ 715628] [Scheduler00Thr] sendEvents:1027 Event sending failed E: [global] [ 715628] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 715628] [Scheduler00Thr] sendEvents:1027 Event sending failedE: [global] [ 715628] [python] addEvent:262 E: [global] [ 715628] [Scheduler00Thr] dispatcherEventSend:53 Condition failed: event->header.flags.bitField.ack != 1Write failed (header) (err -4) | event XLINK_READ_REL_REQ

Closing stream right: DONE. Thread for right finished. E: [global] [ 715628] [python] addEventWithPerf:276 addEvent(event) method call failed with an error: 3 E: [global] [ 715628] [python] XLinkReadData:156 Condition failed: (addEventWithPerf(&event, &opTime)) Device get data failed: 7 Closing stream left: ... E: [xLink] [ 715628] [Scheduler00Thr] sendEvents:1027 Event sending failed E: [global] [ 715628] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 715628] [Scheduler00Thr] sendEvents:1027 Event sending failedClosing stream left: DONE. Thread for left finished.

Closing stream previewout: ... E: [global] [ 715629] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

Closing stream previewout: DONE. Thread for previewout finished. E: [xLink] [ 715629] [Scheduler00Thr] sendEvents:1027 Event sending failed Closing stream disparity: ... E: [global] [ 715629] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 715629] [Scheduler00Thr] sendEvents:1027 Closing stream disparity: DONE. Thread for disparity finished. Event sending failed Stopping threads: DONE 0.758s. Closing all observer streams: ... Closing stream host_capture: ... Closing stream host_capture: DONE. Closing all observer streams: DONE. Reseting device: 0. E: [global] [ 715629] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_RESET_REQ

E: [xLink] [ 715629] [Scheduler00Thr] sendEvents:1027 Event sending failed Reseting: DONE.

abhatikar avatar Sep 12 '20 20:09 abhatikar

Hi @abhatikar, thanks for submitting the issue and sorry for my late response, I must have missed the notification.

I've updated the data collecting script, and it should work much better now, the issue you've posted should also be fixed.

Could you try the latest version if it works on your side?

VanDavv avatar Sep 22 '20 09:09 VanDavv

If it still does occur please reopen this issue - thanks!

VanDavv avatar Sep 26 '20 14:09 VanDavv

I tried to run this but got the same error I think.

Is it perhaps the API version in the requirement.txt file that is old or something?

upon running python main.py (after installing requirements etc)

I got the following output. XLink initialized. Sending internal device firmware Successfully connected to device. Loading config file Attempting to open stream config_d2h watchdog started Successfully opened stream config_d2h with ID #0! Closing stream config_d2h: ... Closing stream config_d2h: DONE. EEPROM data: valid (v5) Board name : BW1098OBC Board rev : R0M0E0 HFOV L/R : 71.86 deg HFOV RGB : 68.7938 deg L-R distance : 7.5 cm L-RGB distance : 3.75 cm L/R swapped : yes L/R crop region: center Rectification Rotation R1 (left): 0.999864, 0.016232, 0.002884, -0.016238, 0.999866, 0.002230, -0.002848, -0.002277, 0.999993, Rectification Rotation R2 (right): 0.999999, 0.000080, -0.001562, -0.000084, 0.999997, -0.002253, 0.001561, 0.002253, 0.999996, Calibration intrinsic matrix M1 (left): 859.917786, 0.000000, 645.017822, 0.000000, 860.377319, 406.043121, 0.000000, 0.000000, 1.000000, Calibration intrinsic matrix M2 (right): 859.195618, 0.000000, 645.630066, 0.000000, 859.641479, 410.341980, 0.000000, 0.000000, 1.000000, Calibration rotation matrix R: 0.999860, 0.016145, 0.004445, -0.016165, 0.999859, 0.004484, -0.004372, -0.004555, 0.999980, Calibration translation matrix T: -7.468040, -0.000597, 0.011661, Calibration Distortion Coeff d1 (Left): -5.557055, 19.712475, -0.001085, -0.000592, -22.634150, -5.610113, 19.916449, -22.829298, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, Calibration Distortion Coeff d2 (Right): -4.775003, 15.271010, -0.001516, -0.001070, -16.158022, -4.832639, 15.489353, -16.363111, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, 0.000000, Traceback (most recent call last): File "/home/jonititan/Projects/DepthAI/depthai-experiments/collecting-training-data/main.py", line 19, in device.request_af_mode(getattr(depthai.AutofocusMode, args.autofocus, depthai.AutofocusMode.AF_MODE_AUTO)) TypeError: getattr(): attribute name must be string Stopping threads: ... Stopping threads: DONE 0.000s. Closing all observer streams: ... Closing all observer streams: DONE. Reseting device: 0. Reseting: DONE.

Camera seems to work fine with most of the other experiment examples.

jonititan avatar Feb 02 '21 13:02 jonititan

Thanks for checking @jonititan, indeed I incorrectly handled the None case of the -af flag. This PR should resolve this issue, tested it on my side and it works now

VanDavv avatar Feb 02 '21 14:02 VanDavv

Thanks for that it does run now that autofocus flag issue is sorted but doesn't capture frames. Some sort of write error. cv2.imshow never triggers and no frames get displayed.

See a section of the output.

CNN to depth bounding-box mapping: start(318, 38), max_size(643, 643) Host stream start:left Opening stream for read: left Attempting to open stream left Successfully opened stream left with ID #1! Starting thread for stream: left Host stream start:right Opening stream for read: right Attempting to open stream right Started thread for stream: left Successfully opened stream right with ID #2! Starting thread for stream: right Host stream start:color Started thread for stream: right Opening stream for read: color Attempting to open stream color Successfully opened stream color with ID #3! Starting thread for stream: color Started thread for stream: color Opening stream for read: disparity Attempting to open stream disparity Successfully opened stream disparity with ID #4! Starting thread for stream: disparity Started thread for stream: disparity depthai: INIT OK! color 5.230357994 1 E: [global] [ 160302] [EventRead00Thr] handleIncomingEvent:563 handleIncomingEvent() Read failed -4

E: [global] [ 160302] [python] addEvent:262 Condition failed: event->header.flags.bitField.ack != 1 E: [global] [ 160302] [python] addEventWithPerf:276 addEvent(event) method call failed with an error: 3 E: [global] [ 160302] [python] XLinkReadData:156 Condition failed: (addEventWithPerf(&event, &opTime)) Device get data failed: 7 E: [global] [ 160302] [python] addEvent:262 Closing stream right: ... E: [global] [ 160302] [python] addEvent:262 Condition failed: event->header.flags.bitField.ack != 1 E: [global] [ 160302] [python] addEventWithPerf:276 addEvent(event) method call failed with an error: 3 Condition failed: event->header.flags.bitField.ack != 1 E: [global] [ 160302] [python] addEventWithPerf:276 addEvent(event) method call failed with an error: 3 E: [global] [ 160302] [python] XLinkReadData:156 Condition failed: (addEventWithPerf(&event, &opTime)) Device get data failed: 7 E: [global] [ 160302] [python] XLinkReadData:156 Closing stream disparity: ... E: [global] [ 160302] [Scheduler00Thr] dispatcherEventSend:53 Closing stream right: DONE. Thread for right finished. Condition failed: (addEventWithPerf(&event, &opTime)) Device get data failed: 7 Closing stream color: ... Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [global] [ 160302] [python] addEvent:262 Condition failed: event->header.flags.bitField.ack != 1 E: [xLink] [ 160302] [Scheduler00Thr] sendEvents:1027 Event sending failed E: [global] [ 160302] [python] addEventWithPerf:276 addEvent(event) method call failed with an error: 3 E: [global] [ 160302] [python] XLinkReadData:156 Condition failed: (addEventWithPerf(&event, &opTime)) Device get data failed: 7 Closing stream disparity: DONE. Thread for disparity finished. Closing stream left: ... E: [global] [ 160302] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 160302] [Scheduler00Thr] sendEvents:1027 Event sending failed E: [global] [ 160302] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 160302] [Scheduler00Thr] sendEvents:1027 Event sending failed Closing stream color: DONE. Closing stream left: DONE. Thread for left finished. Thread for color finished. E: [global] [ 160302] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 160302] [Scheduler00Thr] sendEvents:1027 Event sending failed watchdog triggered === New data in observer stream host_capture, size: 4 Writing 4 bytes to host_capture E: [global] [ 165244] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_WRITE_REQ

!!! XLink write successful: host_capture (4) Stopping threads: ... E: [xLink] [ 165244] [Scheduler00Thr] sendEvents:1027 Event sending failed Stopping threads: DONE 0.000s. Closing all observer streams: ... Closing stream host_capture: ... Closing stream host_capture: DONE. Closing all observer streams: DONE. Reseting device: 0. E: [global] [ 165244] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_RESET_REQ

E: [xLink] [ 165244] [Scheduler00Thr] sendEvents:1027 Event sending failed

jonititan avatar Feb 02 '21 15:02 jonititan

@jonititan Seems like a device issue, could you try to unplug the device and plug it back again, with USB cable attached directly to the host (not via e.g. USB hub) And CC @themarpe in case you see something relevant here

VanDavv avatar Feb 02 '21 16:02 VanDavv

You're quite correct.

Moved from hub and it started logging perfectly for a little while and then had segfault. Apologies thats probably an unrelated issue.

Edited to add: I ran it a couple more times and it hasn't segfaulted again so far. I'll continue testing but i think that may be unrelated. Thanks for your help

right 33.46965762 357 left 33.502950631 358 color 33.20561807 349 right 33.50296578 358 disparity_color 33.702839108 364 left 33.569578191 360 color 33.238946441 350 right 33.602907667 361 left 33.669523174 361 color 33.338933184 353 disparity_color 33.802784162 367 right 33.702850508 364 left 33.702839108 364 color 33.405393445 355 right 33.736178624 364 disparity_color 33.869414392 369 left 33.802784162 367 color 33.47205097 357 right 33.802809852 367 disparity_color 33.969356452 370 color 33.505380647 358 left 33.836098981 368 right 33.86943725 369 color 33.571842095 360 left 33.869414392 369 right 33.902754054 370 color 33.605170511 361 disparity_color 34.102617955 375 left 33.969356452 370 right 33.969364655 370 color 33.705157555 364 left 34.0026728 373 right 34.069310597 375 color 33.804750881 367 left 34.102617955 375 disparity_color 34.202562401 379 right 34.102649088 375 color 33.838079475 368 left 34.135930554 375 right 34.169271937 378 color 33.871212532 369 left 34.202562401 379 right 34.20258762 379 color 33.904541238 370 left 34.335819527 380 right 34.369142192 380 disparity_color 34.502397968 388 color 34.004527515 373 left 34.435765905 386 right 34.46909646 387 disparity_color 34.56902529 390 color 34.070994218 375 E: [global] [ 109839] [EventRead00Thr] handleIncomingEvent:563 handleIncomingEvent() Read failed -4

E: [global] [ 109847] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_READ_REL_REQ

E: [xLink] [ 109847] [Scheduler00Thr] sendEvents:1027 Event sending failed E: [global] [ 109847] [python] addEvent:262 Condition failed: event->header.flags.bitField.ack != 1 E: [global] [ 109847] [python] addEventWithPerf:276 addEvent(event) method call failed with an error: 3 E: [global] [ 109847] [python] XLinkReadData:156 Condition failed: (addEventWithPerf(&event, &opTime)) E: [global] [ 109847] [python] addEvent:262 Condition failed: event->header.flags.bitField.ack != 1 E: [global] [ 109848] [python] addEventWithPerf:276 addEvent(event) method call failed with an error: 3 E: [global] [ 109848] [python] XLinkReadData:156 Condition failed: (addEventWithPerf(&event, &opTime)) Device get data failed: 7 Device get data failed: 7 Closing stream left: ... Closing stream right: ... E: [global] [ 109848] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 109848] [Scheduler00Thr] sendEvents:1027 Event sending failed E: [global] [ 109848] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 109848] [Scheduler00Thr] sendEvents:1027 Event sending failed Closing stream left: DONE. Thread for left finished. Closing stream right: DONE. Thread for right finished. E: [global] [ 109848] [python] addEvent:262 Condition failed: event->header.flags.bitField.ack != 1 E: [global] [ 109849] [python] addEventWithPerf:276 addEvent(event) method call failed with an error: 3 E: [global] [ 109849] [python] XLinkReadData:156 Condition failed: (addEventWithPerf(&event, &opTime)) Device get data failed: 7 Closing stream disparity: ... E: [global] [ 109849] [Scheduler00Thr] dispatcherEventSend:53 Write failed (header) (err -4) | event XLINK_CLOSE_STREAM_REQ

E: [xLink] [ 109849] [Scheduler00Thr] sendEvents:1027 Event sending failed E: [global] [ 109849] [python] addEvent:262 Condition failed: event->header.flags.bitField.ack != 1 E: [global] [ 109849] [python] XLinkCloseStream:115 Condition failed: (addEvent(&event)) Segmentation fault (core dumped)

jonititan avatar Feb 02 '21 17:02 jonititan

Thanks, both!

Luxonis-Brandon avatar Feb 02 '21 19:02 Luxonis-Brandon