简体   繁体   中英

CoreML initialization fails: MTLTextureDescriptor has width greater than the maximum allowed size

I have a Keras CNN model that I converted to CoreML using coremltools . It works perfectly on simulator but not on the iPhone X. It crashes just on initialization:

let cnn = MyCnn()

…with error:

MTLTextureDescriptor has width (44100) greater than the maximum allowed size of 16384.

After having read SO posts with similar errors, I thought that maybe this is a GPU issue, so I tried to set

usesCPUOnly = true 

However, I can only send options during prediction time and there seems to be no way to set this before initialization—where the crash occurs.

Any ideas what I can do?

You can set it during initialization by passing in an MLModelConfiguration object.

But it's probably a good idea to make your model smaller. It sounds like this is just way too big for a mobile phone.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM