You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2019/09/27 19:40:36 UTC

[GitHub] [incubator-mxnet] loweew opened a new issue #7933: CoreML conversion with finetuned model

loweew opened a new issue #7933: CoreML conversion with finetuned model 
URL: https://github.com/apache/incubator-mxnet/issues/7933
 
 
   I have successfully converted the squeezenet and resnet50 models from the examples to CoreML using mxnet-to-coreml. However, when converting a model after fine-tuning using my own data, the predictions are seemingly random. The model is fine-tuned using finetune.py from the examples. The model performs well prior to conversion to CoreML. After conversion to CoreML, the model predicts the same probabilities regardless of the image. The pre-trained model I'm using for fine-tuning is the imagenet11k-places resnet50 model.
   
   I've tried:
   
   1. subtracting channel biases as is performed during fine-tuning. (--pre-processing-arguments='{"image_input_names":"data","red_bias":123.68,"blue_bias":103.939,"green_bias":116.779}')
   
   2. subtracting channel biases and scaling 1/255  (--pre-processing-arguments='{"image_input_names":"data","red_bias":123.68,"blue_bias":103.939,"green_bias":116.779, "image_scale":0.00392156862}')
   
   3. subtracting scaled channel biases because I was unsure about when coreml performed the scaling  (--pre-processing-arguments='{"image_input_names":["data"],"red_bias":0.485019,"blue_bias":0.407603,"green_bias":0.457956, "image_scale":0.00392156862}')
   
   4. not scaling or biasing channels
   
   Has anyone successfully converted a model after fine-tuning using a different data set? Any ideas would be greatly appreciated. I'm fairly certain there's something simple that I'm overlooking... 
   
   I've also examined the converted model using Model_pb2 to make sure the preprocessing flags are being respected, and they appear to be:
   
   print(model.neuralNetworkClassifier.preprocessing)
   
   [featureName: "data"
   scaler {
     channelScale: 0.00380000006407
     blueBias: 103.939
     greenBias: 116.779
     redBias: 123.68
   }
   ]
   
   here's the entire cmd line: 
   
   mxnet_coreml_converter.py --model-prefix='imagenet11k-places-resnet-50' --epoch=47 --input-shape='{"data":"3,224,224"}' --mode=classifier --class-labels myclass_labels.txt --output-file="mxnetimagenet11kplaces50resnet.mlmodel"  --pre-processing-arguments='{"image_input_names":"data","red_bias":123.68,"blue_bias":103.939,"green_bias":116.779, "image_scale":0.00392156862}'
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services