def parse_args(argv, params):
    """
    Parses input argument to determine if the code trains or tests a model and whether or not 
        the task is semantic segmentation or single-view depth prediction.
    :param argv: input arguments from main
    :param params: input parameters from params.py
    :return: modes of operation
    """
    
    isTrain = None
    
    argOptions1 = '1st argument options: train, test.'
    argOptions2 = '2nd argument options: semantic, single-view.'
    noArgStr = 'No arguments provided.' 
    incorrectArgStr = 'Incorrect argument provided.'
    insufficientArgStr = 'Not enough arguments provided.'
    exampleUsageStr = 'python runBaseline.py train semantic'
    
    try:
        trainStr = argv[1].lower()
    except:
        raise ValueError('%s %s %s' % (noArgStr,argOptions1,exampleUsageStr))
    
    try:
        modeStr = argv[2].lower()
    except:
        raise ValueError('%s %s %s' % (insufficientArgStr,argOptions2,exampleUsageStr))
        
    if trainStr == 'train':
        isTrain = True
    elif trainStr == 'test':
        isTrain = False
    else:
        raise ValueError('%s %s %s' % (incorrectArgStr,argOptions1,exampleUsageStr))
 
    if modeStr == 'semantic':
        mode = params.SEMANTIC_MODE
    elif modeStr == 'single-view':
        mode = params.SINGLEVIEW_MODE
    else:
        raise ValueError('%s %s %s' % (incorrectArgStr,argOptions2,exampleUsageStr))
        
    if (mode==params.SEMANTIC_MODE) and (params.NUM_CATEGORIES==1) and (params.SEMANTIC_LOSS=='categorical_crossentropy'):
        _=input('Warning: NUM_CATEGORIES is 1, but loss is not binary_crossentropy. You should probably change this in params.py, but press enter to continue.')
        
    return isTrain,mode