Thanks @Engineer for taking a look.
As suggested we used a FLOAT32 compute_precision and it didn't help meaning that we still saw jitteriness on device inference versus Pytorch inference on a server.
**
One interesting fact ** - we took the Core ML model (that was originally converted from PyTorch using coremltools) and ran it in Python using Core ML tools' libraries and didn't encounter the jitteriness! So our best guess at this stage is that it has something to do with running the CoreML model on the device itself (tested on iPhone 14/iOS 17 and M2 Mac OS Sonoma 14.5 as an iPad app).
Do you think the above noted warning copied below has something to do with it?
Validation failure: Invalid Pool kernel width (9), must be [1-8] or 20.
Validation failure: Invalid Pool kernel width (13), must be [1-8] or 20.
Validation failure: Invalid Pool kernel width (9), must be [1-8] or 20.
Validation failure: Invalid Pool kernel width (13), must be [1-8] or 20.
This neural network model does not have a parameter for requested key 'precisionRecallCurves'. Note: only updatable neural network models can provide parameter values and these values are only accessible in the context of an MLUpdateTask completion or progress handler.
Post
Replies
Boosts
Views
Activity
One learning - my project is very similar to Apple's WWDC sample available for download here: https://developer.apple.com/documentation/avfoundation/additional_data_capture/capturing_depth_using_the_lidar_camera.
Only difference is that instead of using a metal texture, I'm using a AVCaptureVideoPreviewLayer to show the camera view. After much comparison/experimentation, I'm finding that not adding my preview layer is allowing the video and depth data to flow reliably. When I add it, it flows correctly about 50% of the time.
This appears to be the most likely issue - any clues as to why this can happen?
Here's the console output referenced above.
Selected video format: <AVCaptureDeviceFormat: 0x283edddd0 'vide'/'420f' 1280x 720, { 1- 60 fps}, photo dims:{1280x720,4224x2376}, fov:64.717, supports vis (max strength:Low), max zoom:123.75 (upscales @3.00), AF System:2, ISO:18.0-1728.0, SS:0.000024-1.000000, supports wide color, supports depth>
Selected depth format: Optional('dpth'/'hdep' 320x 180, { 1- 30 fps}, photo dims:{}, fov:64.717)
no depth data at time 4660461719679
received depth data 4660461721647
no depth data at time 4660461721931
received depth data 4660461722090
no depth data at time 4660461722241
received depth data 4660461722574
no depth data at time 4660461733834
received depth data 4660461754095
no depth data at time 4660484422372
received depth data 4660484427828
no depth data at time 4660484551473
no depth data at time 4660484557872
received depth data 4660484560137
received depth data 4660484587264
received depth data 4660484625637
received depth data 4660484723590
received depth data 4660484890588
received depth data 4660484894113
received depth data 4660485028919
received depth data 4660485065300
received depth data 4660485108980
received depth data 4660485117934
received depth data 4660485311522
received depth data 4660485374234
received depth data 4660485409137
received depth data 4660485587031
received depth data 4660485717468
received depth data 4660485774764
received depth data 4660485965976
received depth data 4660486050028
received depth data 4660486050960
received depth data 4660486141976
no depth data at time 4660486148485
received depth data 4660486255161
received depth data 4660486255353
received depth data 4660486255451
received depth data 4660486255518
received depth data 4660486255590
received depth data 4660486255661
received depth data 4660486323853
received depth data 4660486343897
received depth data 4660486346269
received depth data 4660486586520
received depth data 4660486739514
received depth data 4660486845554
received depth data 4660486925583
received depth data 4660487127930
received depth data 4660487324394
received depth data 4660487377842
received depth data 4660487413297
received depth data 4660487533840
received depth data 4660487539837
received depth data 4660487539986
received depth data 4660487606854
received depth data 4660487730023
received depth data 4660487731258
received depth data 4660487731424
received depth data 4660487943556
received depth data 4660487945158
received depth data 4660488042570
received depth data 4660488089371
received depth data 4660488089543
received depth data 4660488161973
no depth data at time 4660488378041
no video data at time 4660488378151
no depth data at time 4660488795023
no video data at time 4660488795134
no depth data at time 4660488925324
no video data at time 4660488925465
no depth data at time 4660488931173
no video data at time 4660488931281
no depth data at time 4660489036864
no video data at time 4660489036974
no depth data at time 4660489098026
no video data at time 4660489098133
no depth data at time 4660489177999
no video data at time 4660489178109
no depth data at time 4660489181387
no video data at time 4660489181546
no depth data at time 4660489239588
no video data at time 4660489239690
no depth data at time 4660489455661
no video data at time 4660489455773
no depth data at time 4660489565211
no video data at time 4660489565315
no depth data at time 4660489683372
no video data at time 4660489683486
no depth data at time 4660489912688
no video data at time 4660489912809
no depth data at time 4660489925852
no video data at time 4660489926002
no depth data at time 4660490016836
no video data at time 4660490016941
no depth data at time 4660490017016
no video data at time 4660490017061
...
Some more information on when I see the error being triggered. It happens pretty consistently after the second fragment interval time has elapsed. So if I set the fragment interval time to be 60 seconds, it almost always happens after the 2 minute mark. So it seems like something is going wrong when the second fragment is being written to the movie file.
Hope this provides some insights. Happy to file a radar if its a bug but want to confirm that it is in the first place and that I'm not doing something wrong with my setup (see code above).
Thanks
Ok false alarm. While I had background app refresh enabled at the app level, it wasn't enabled at the global level. As soon as I did that, it's all working as expected. whew.