def __init__(self, dir_path = 'dataset/data',csv_path='image_data.csv' ): self.image_size = tuple((500, 500)) self.features = [] self.image_path_list = [] self.mse_all = [] self.labels = [] #object of feature extractor self.fe_obj = fe.Global_feature_extraction() self.dir_path = dir_path self.data = pd.read_csv(csv_path,index_col=0)
def __init__(self): with open('conf/conf.json') as f: self.config = json.load(f) with open('conf/feature_names.json') as f: self.features_name = json.load(f) self.csv_path = self.config["csv_path"] self.data = pd.read_csv(self.csv_path, index_col=0) self.image_size = tuple((500, 500)) #objects of feature extractor self.fe_glb = fe.Global_feature_extraction() self.fe_lcl = fe.Local_feature_extractor()
def __init__(self): with open('conf/conf.json') as f: self.config = json.load(f) self.csv_path = self.config["csv_path"] self.image_size = tuple((500, 500)) self.features = [] self.image_path_list = [] self.mse_all = [] self.labels = [] #object of feature extractor self.fe_obj = fe.Global_feature_extraction() self.data = pd.read_csv(self.csv_path, index_col=0)
import numpy as np import cv2 import features as fe import glob import pickle as pkl import pandas as pd import json image_path2 = '/home/mahdi/Pictures/test/2.jpeg' image_path = '/home/mahdi/Pictures/test/3.jpeg' image_size = tuple((500, 500)) with open('conf/feature_names.json') as f: features_name = json.load(f) fe_glb = fe.Global_feature_extraction() args = ['shape', 'texture', 'sift'] feature_table = { 'shape': None, 'texture': None, 'color': None, 'SIFT': None, 'SURF': None, 'KAZE': None, 'Dense': None } Image = cv2.imread(image_path) Image = cv2.resize(Image, image_size) Shape = getattr(fe_glb, features_name['shape'])
def hstack_maker(*args): features = np.hstack(args) return features #################################################### ## this is the second way for feature selection ## #################################################### def feature_selector(first, second, third, **options): if options.get("action") == "sum": print("The sum is: %d" %(first + second + third)) if options.get("number") == "first": return first def foo(first, second, third, *therest): print("First: %s" %(first)) features = fe. shape = getattr(fe.Global_feature_extraction(),config['global_features'][0]) for i in config['global_features']: print(i) this_fea