From c48255a236c4cce54395db50c06e668b220a1544 Mon Sep 17 00:00:00 2001 From: Brandon Amos Date: Tue, 24 Nov 2015 09:57:33 -0500 Subject: [PATCH] Add better error handling when the Torch model is passed as the classification model. --- demos/classifier.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/demos/classifier.py b/demos/classifier.py index 095e400..7ab80a1 100755 --- a/demos/classifier.py +++ b/demos/classifier.py @@ -138,12 +138,25 @@ if __name__ == '__main__': inferParser = subparsers.add_parser('infer', help='Predict who an image contains from a trained classifier.') - inferParser.add_argument('classifierModel', type=str) + inferParser.add_argument('classifierModel', type=str, + help='The Python pickle representing the classifier. This is NOT the Torch network model, which can be set with --networkModel.') inferParser.add_argument('img', type=str, help="Input image.") args = parser.parse_args() + if args.classifierModel.endswith(".t7"): + raise Exception(""" +Torch network model passed as the classification model. + +See the documentation for the distinction between the Torch +network and classification models: + + http://cmusatyalab.github.io/openface/demo-3-classifier/ + http://cmusatyalab.github.io/openface/training-new-models/ + +Use `--networkModel` to set a non-standard Torch network model.""") + sys.path.append(args.dlibRoot) import dlib from openface.alignment import NaiveDlib # Depends on dlib.