Add better error handling when the Torch model is passed as the classification model.

This commit is contained in:
Brandon Amos 2015-11-24 09:57:33 -05:00
parent df89d749d1
commit c48255a236
1 changed files with 14 additions and 1 deletions

View File

@ -138,12 +138,25 @@ if __name__ == '__main__':
inferParser = subparsers.add_parser('infer', inferParser = subparsers.add_parser('infer',
help='Predict who an image contains from a trained classifier.') 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, inferParser.add_argument('img', type=str,
help="Input image.") help="Input image.")
args = parser.parse_args() 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) sys.path.append(args.dlibRoot)
import dlib import dlib
from openface.alignment import NaiveDlib # Depends on dlib. from openface.alignment import NaiveDlib # Depends on dlib.