from sklearn.model_selection import train_test_split import matplotlib.pyplot as plt import matplotlib.patches as patches from sklearn.ensemble import ExtraTreesClassifier from sklearn.feature_selection import SelectFromModel from pandas_ml import ConfusionMatrix from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import accuracy_score from sklearn import svm from sklearn.neighbors import KNeighborsClassifier # Input data print("------------------------") print("Input data") print("------------------------") input = Pavia_Input.Pavia_Input() print("Training pixels", np.count_nonzero(input.train_data)) print("Test pixels", np.count_nonzero(input.test_data)) print("------------------------") # Configurable parameters config = {} patch_size = 5 feature_selection = False apply_filter = False classifiers = ["RF", "SVM", "1NN", "3NN", "5NN"] classifier = classifiers[0] seed = None folder = 'Pavia/' rotation_oversampling = True
from SanFrancisco import SanFrancisco_Input from Salinas import Salinas_Input import time import numpy as np from collections import Counter from spectral import imshow, save_rgb import CV_Decoder, CV_Postprocessing import os import pandas as pd import CNNTrain_2D # Input data images = ["IndianPines", "Pavia", "Flevoland", "SanFrancisco", "Salinas"] images_inputs = { "IndianPines": IndianPines_Input.IndianPines_Input(), "Pavia": Pavia_Input.Pavia_Input(), "Flevoland": Flevoland_Input.Flevoland_Input(), "SanFrancisco": SanFrancisco_Input.SanFrancisco_Input(), "Salinas": Salinas_Input.Salinas_Input() } # Select image to test selected_img = images[3] input = images_inputs[selected_img] print("Image:" + selected_img) for patch_size in [5]: config = {} config['patch_size'] = patch_size