testor.py 1.97 KB
__author__ = 'hadoop'

import sys
from imager.test import test_jpeg, test_steg, test_feat, test_data, test_model


if __name__ == '__main__':
    input_info = sys.argv[1]
    base_dir = 'ILSVRC2013_DET_val'
    (type_name,table_name,img_dir,model_name,label_name, feat_type) = input_info.split(',') 
    if type_name == 'train':
        if label_name == 'null':
	    #embed data
	    test_data.train_embed_and_feat_spark(category = img_dir,feat_type=feat_type)
	    test_data.train_new_model(table_name = base_dir+'-'+img_dir,model_path=model_name)
            pass
	else:
            #with label
	    test_data.train_feat_label_spark(category=img_dir,label_file =label_name, feat_type= feat_type)
            test_data.train_new_model(table_name=base_dir+'-'+img_dir, model_path = model_name)
	    pass
    if type_name == 'analysis':
        if img_dir == 'null':
	    #test from hbase data
	    test_data.analysis_hbase_data_spark(table_name = table_name,model_path = model_name, feat_type = feat_type)
    	    pass
	else:
	    #test from local
	    test_data.analysis_local_data_spark(category= img_dir,table_name = table_name, model_path = model_name, feat_type = feat_type )
	    pass
    #test_data.test_ILSVRC(category='Test_100')
    #test_data.test_ILSVRC_S_LOCAL(category)

    #test_data.test_ILSVRC_S_SPARK(category='Train_100', label_file = 'Train_100.csv')
    #test_data.train_ILSVRC_S_SPARK(category='Train_100', label_file = 'Train_100.csv', model_path = 'res/svm_sklearn1.model')
    #test_data.take_feat_ILSVRC_S_SPARK(category='Train_100',label_file = 'Train_100.csv')
    #test_data.train_ILSVRC(category='Train_100',model_path = 'res/svm_sklearn1.model')
    # model
    # test_model.test_SVM_ILSVRC(category)
    #test_model.test_SVM_ILSVRC_S(category)
    #test_model.test_SVM_ILSVRC_SPARK(category='Train_100', label_file = 'Train_100.csv')

    # analysis
    # test_data.test_ILSVRC_S_ANALYSIS(category)
    # test_data.test_ILSVRC_S_ANALYSIS2(category,tablename='MSPIDER')


    pass