You can convert your model to ONNX, TFLite or Torchscript. There’s an informative thread over here: From simple imageClassification model to android/ios app? - #7 by dnth
With respect to the “out of domain” question, there’s three options (top of my head):
- hope the model predicts out of domain images with low confidence, but I have rarely seen this to be the case.
- Create an additional category filled with out of domain images. Could work, but creates the burden of deciding what images go into that category.
- Use
BCEWithLogitsLossFlat
loss, there’s good write up in walkwithfastai: Lesson 3 - Unknown Labels (Pets Revisited) | walkwithfastai
Curious to know the results