coremltools icon indicating copy to clipboard operation
coremltools copied to clipboard

Differences between neuralnetwork and mlprogram

Open 119458 opened this issue 9 months ago • 3 comments

❓Question

The 160-size data set is trained with 8, 16 and 32 times downsampling. Under pt weight, the target can be classified and identified by adding post-processing to the model. When neuralnetwork conversion mode is adopted, the target can be recognized normally, but when mlprogram is adopted, the target cannot be recognized normally and a bunch of detection boxes will be given. Almost all the detection images are covered.

neuralnetwork == coremltools==6.0 mlprogram == coremltools==7.0

119458 avatar Apr 10 '25 01:04 119458

same issue not resolved: https://github.com/apple/coremltools/issues/2301

daikankan avatar Jun 09 '25 10:06 daikankan

Hello @119458, could you provide your steps to re-produce the inconsistent results? Thanks!

junpeiz avatar Jun 11 '25 21:06 junpeiz

@junpeiz I have checked my cases, and found for some models, ct.convert(convert_to="mlprogram", compute_precision=ct.precision.FLOAT16) have big problem of precision, while ct.convert(convert_to="mlprogram", compute_precision=ct.precision.FLOAT32) is correct. also ct.convert(convert_to="neuralnetwork") along with quantization_utils.quantize_weights(model_ct, nbits=16) is correct.

daikankan avatar Oct 11 '25 09:10 daikankan