Matthijs Hollemans

Results 226 comments of Matthijs Hollemans

This change now gives the following error message for me (using the main branch): ``` Exception ignored in: Traceback (most recent call last): File "/Users/matthijs/anaconda3/envs/hf2/lib/python3.9/site-packages/coremltools/models/model.py", line 380, in __del__ if...

CGImage should work both on iOS and macOS. It looks like you forgot to unwrap `self.cgImage`, since the error message is about using an optional, not about CGImage itself.

Ah I see what's going on, `NSImage.cgImage` is not a property but a function. Namely the function: func cgImage(forProposedRect proposedDestRect: UnsafeMutablePointer?, context referenceContext: NSGraphicsContext?, hints: [NSImageRep.HintKey : Any]?) -> CGImage?...

Check out this StackOverflow answer: https://stackoverflow.com/questions/11949250/how-to-resize-nsimage

There are some example programs on Apple's developer site in the Core ML section. For example, this one: https://developer.apple.com/documentation/vision/classifying_images_with_vision_and_core_ml There's no guarantee Core ML will actually run this on the...

I have no official knowledge of the insides of Core ML but just because something is multiple layers in the mlmodel, doesn't mean it's also executed like this at runtime....

In the past I've used this instead of `UIGraphicsPushContext`: ``` NSGraphicsContext.saveGraphicsState() let nscg = NSGraphicsContext(cgContext: context, flipped: true) NSGraphicsContext.current = nscg ``` And this instead of `UIGraphicsPopContext`: ``` NSGraphicsContext.restoreGraphicsState() ```

It's already in the correct shape. You can ignore a dimension that is 1.

Easiest way is to add a transpose / permute layer to the model at the end.

The text says that it's O(1) on average, or "O(1) amortized". Same as appending to an array. When it happens it's slow but it only happens rarely, so it doesn't...