ptrblck:

ToTensor normalizes the tensor, so that all values lie in [0, 1] .
If you’ve used it in the PyTorch script, you should definitely add it in your CoreML model.
I’m not familiar with CoreML and don’t know, how easy that is.
If you have trouble implementing it there, you might consider adding your preprocessing to the forward method of your model.


@ptrblck I know in PyTorch it never support image preprocess, so when you convert to CoreML , you must manually do it by yourself, I must add preprocess_args when converting to CoreML. But the doubt about it I am meeting is I don’t know the correct preprocess_args because the model is not trained by me. The guy trained the model had left. So for this scene how to apply the preprocess_args
I set the args as below:
image_scale:1/255.0
red_bias/green_bias/blue_bias: 0.
Is it right?
I searched the document and then it never told me about it .
I know the preprocess_args as below:
image_scale = 1.0/std
red_bias = -red_mean /std
green_bias = - green_mean /std
blue_bias = - blue_mean/std
But I don’t know the value mean for every color.