huggingface / coreml-examples

Swift Core ML Examples
Apache License 2.0
124 stars 11 forks source link

depth-anything on VisionOS #2

Closed adizhol-str closed 1 week ago

adizhol-str commented 1 month ago

Hello,

Has anyone tried to run the depth-anything on VisionOS? I tried using VNCoreMLRequest, but I get a black image. I'm not sure if the output is not normalized or the model is not working...

The output PixelBuffer is

<CVPixelBuffer 0x600003501ad0 width=518 height=392 bytesPerRow=1088 pixelFormat=L00h iosurface=0x60000000eb00 poolName=CoreVideo surfaceid=481 attributes={
    BytesPerRowAlignment = 64;
    Height = 392;
    IOSurfaceProperties =     {
        IOSurfacePurgeWhenNotInUse = 1;
    };
    PixelFormatType = 1278226536;
    Width = 518;
} propagatedAttachments={
} nonPropagatedAttachments={
}>

and after converting it to CGImage, which seems to be an RGB image.

<CGImage 0x105b2b3b0> (DP)
    <<CGColorSpace 0x600002604420> (kCGColorSpaceDeviceRGB)>
        headroom = 1.000000  
        width = 518, height = 392, bpc = 8, bpp = 32, row bytes = 2112 
        kCGImageAlphaNoneSkipLast | 0 (default byte order)  | kCGImagePixelFormatPacked 
        is mask? No, has masking color? No, has soft mask? No, has matte? No, should interpolate? Yes