training_dict = classify_library.toDict(training) testing_dict = classify_library.toDict(testing) #################################################################### #################################################################### ################################## Script starts X_train_vids = classify_library.limited_input1(training_dict, 1000) X_test_vids = classify_library.limited_input1(testing_dict, 1000) #GET THE TRAINING AND TESTING DATA. X_train, Y_train = classify_library.make_FV_matrix(X_train_vids,training_output, class_index) X_test, Y_test = classify_library.make_FV_matrix(X_test_vids,testing_output, class_index) #PCA reduction training_PCA = classify_library.limited_input1(training_dict,40) X_PCA, _ = classify_library.make_FV_matrix(training_PCA,training_output, class_index) n_components = 1000 pca = PCA(n_components=n_components) pca.fit(X_PCA) X_train_PCA = pca.transform(X_train) X_test_PCA = pca.transform(X_test) #Exhaustive Grid Search C = [1, 10, 50, 100, 1000]
if filename.endswith('.fisher.npz') ] training_dict = classify_library.toDict(training) testing_dict = classify_library.toDict(testing) #################################################################### #################################################################### ################################## Script starts X_train_vids = classify_library.limited_input1(training_dict, 1000) X_test_vids = classify_library.limited_input1(testing_dict, 1000) #GET THE TRAINING AND TESTING DATA. X_train, Y_train = classify_library.make_FV_matrix(X_train_vids, training_output, class_index) X_test, Y_test = classify_library.make_FV_matrix(X_test_vids, testing_output, class_index) X_total = np.concatenate((X_train, X_test), 0) Y_total = np.concatenate((Y_train, Y_test), 0) if not args.no_pca: #PCA reduction training_PCA = classify_library.limited_input1(training_dict, 40) X_PCA, _ = classify_library.make_FV_matrix(training_PCA, training_output, class_index)
print(train_vid_class.keys()[:5]) print('len testing:', len(testing)) training_n_dict = classify_library.toDict(training_n, train_vid_class) training_s_dict = classify_library.toDict(training_s, train_vid_class) testing_dict = classify_library.toDict(testing, test_vid_class) # input('...') #GET THE TRAINING AND TESTING DATA. X_train_n_vids = classify_library.limited_input1(training_n_dict, args.per_class_num) X_train_s_vids = classify_library.limited_input1(training_s_dict, args.per_class_num) X_test_vids = classify_library.limited_input1(testing_dict, args.per_class_num) # X_train_vids, X_test_vids = classify_library.limited_input(training_dict, testing_dict, 101, 24) X_n_train, Y_n_train = classify_library.make_FV_matrix(X_train_n_vids, training_n_output, class_index, train_vid_class) X_s_train, Y_s_train = classify_library.make_FV_matrix(X_train_s_vids, training_s_output, class_index, train_vid_class) X_test, Y_test = classify_library.make_FV_matrix(X_test_vids, testing_output, class_index, test_vid_class) # pdb.set_trace() training_n_PCA = classify_library.limited_input1(training_n_dict,1) training_s_PCA = classify_library.limited_input1(training_s_dict,1) if not args.PCA_dim: X_n_train_PCA = X_n_train.tolist() X_s_train_PCA = X_s_train.tolist() X_n_test_PCA = X_test.tolist()