Yes it's possible. However you would need to manually alter the converted Core ML model afterwards, since coremltools as of version 2.1 does not provide any conversion option for this.
In a nutshell, here's what you need to do after converting the model to Core ML format. These should be done on the Python side by calling the lower-level APIs of coremltools.
- Load the converted CoreML model into Python using
coremltools
- Append a new
ActivationLinear layer at the end of the chain, just after your original model's output layer. You can also perform linear transformations using this layer, such as converting ranges from 0..1 to 0..255 and/or adding a bias.
- Configure that new layer as an image output layer by setting its
type property.
- Save the updated model into a new Core ML model.
- Load it back in and test using a sample from the training data set, as a sanity check.
For Step 5 to work, you'll need to run the Python script on a Mac, since it uses the native Core ML libraries to run the model.
For details, you can read my post on getting Core ML to produce images as output.