Beispiel #1
0
 def __init__(self, patch, id):
     Feature.__init__(self, patch, id)
     self.HUE_MODEL = np.array([
         0., 0.00091991, 0.01559402, 0.06014748, 0.20452348, 0.55954024,
         0.15927488, 0., 0., 0., 0., 0., 0., 0., 0., 0.
     ])
     self.HUE_MODEL = normalize(self.HUE_MODEL, norm='l1')[0]
Beispiel #2
0
    def __init__(self, patch, id):
        Feature.__init__(self, patch, id)

        self.FEATURE_MODEL = utils.loadArray(
            "FeatureHeartShapeContourModel.npz")
        self.FEATURE_MODEL_NUM_CONTOURS = 2

        self._checkRep()
	def __init__(self, patch, id):
		Feature.__init__(self, patch, id)
		self.HISTBINNUM = 16
		self.FEATURE_MODEL = np.array([ 0.,          0.,          0.,          0.,          0.04649839,  0.13987842,
										  0.09450414,  0.,          0.,          0.,          0.,          0.,          0.,
										  0.,          0.,          0.        ])
		self.FEATURE_MODEL = np.concatenate((self.FEATURE_MODEL, np.zeros(len(range(4,7)))), axis = 1)
		self.FEATURE_MODEL = normalize(self.FEATURE_MODEL, norm='l1')[0] # normalize the histogram using l1
Beispiel #4
0
	def __init__(self, patch, id):
		Feature.__init__(self, patch, id)
		self.HISTBINNUM = 16
		# self.FEATURE_MODEL = np.array([0.00351539,  0.57596057,  0.06858266,  0.02048219,  0.02166264,  0.02258441,
		# 							  0.01227705,  0.01083268,  0.00764063,  0.01532651,  0.0044623,   0.,          0.,
		# 							  0.,         0.,          0.,          0.,          0.,           0. ])
		self.FEATURE_MODEL = np.zeros(14 + 3)
		self.FEATURE_MODEL[0] = 1.0
		self.FEATURE_MODEL = normalize(self.FEATURE_MODEL, norm='l1')[0] # normalize the histogram using l1
	def __init__(self, patch, id):
		Feature.__init__(self, patch, id)
		# other than the cutted bins of wanted HOG direction, all other HOG bins' values are zero
		self.FEATURE_MODEL_INNER = None
		self.FEATURE_MODEL_BORDER = None
			
		self.inner_HOG = None
		self.border_HOG = None
		self.GAUSSIAN_SCALE = 2
		self.GAUSSIAN_WINDOW_LENGTH_SIGMA = 4.0 # used for border feature case, window length = 4 sigma
Beispiel #6
0
 def __init__(self, patch, id):
     Feature.__init__(self, patch, id)
     self.FEATURE_MODEL = np.array([
         0., 1., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
         0., 0., 0., 0., 0., 0., 0., 0., 0., 0.34, 0.33, 0.33, 0., 0., 0.
     ])
     self.FEATURE_MODEL = np.concatenate(
         (self.FEATURE_MODEL, np.zeros(3 * len(range(1, 2)))), axis=1)
     self.FEATURE_MODEL = normalize(
         self.FEATURE_MODEL,
         norm='l1')[0]  # normalize the FEATURE_MODEL using l1
 def __init__(self, patch, id):
     Feature.__init__(self, patch, id)
     # other than the cutted bins of wanted HOG direction, all other HOG bins' values are zero
     self.FEATURE_MODEL = np.array([
         0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.05131246, 0.05356285,
         0., 0.067983, 0.04214793, 0., 0., 0., 0., 0., 0., 0.06094781, 0.,
         0., 0., 0., 0., 0., 0.1160895, 0., 0., 0., 0., 0., 0.
     ])
     self.FEATURE_MODEL = normalize(
         self.FEATURE_MODEL,
         norm='l1')[0]  # normalize the histogram using l1
     self._checkRep()
Beispiel #8
0
    def __init__(self, patch, id):
        Feature.__init__(self, patch, id)
        self.HISTBINNUM = 16
        self.GAUSSIAN_SCALE = 3  # default is 3, will detect from 3 to 1
        self.GAUSSIAN_WINDOW_LENGTH_SIGMA = 4.0  # used for border feature case, window length = 4 sigma

        self.HUE_START_INDEX = None
        self.HUE_END_INDEX = None
        self.SATURATION_START_INDEX = None
        self.SATURATION_END_INDEX = None

        self.SATURATION_FILTER_START_INDEX = None
        self.SATURATION_FILTER_END_INDEX = None

        self.FEATURE_MODEL = None
    def __init__(self, patch, id):
        Feature.__init__(self, patch, id)
        self.FEATURE_MODEL = np.array([
            0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 1., 0.,
            0., 0., 0.19443516, 0.23649953, 0.13200154, 0.23102906, 0.15323535,
            0.05279936, 0., 0., 0., 0., 0., 0., 0.
        ])

        # reinforce that the other sub patches must not have the hue/saturation for the target color
        self.FEATURE_MODEL = np.concatenate(
            (self.FEATURE_MODEL,
             np.zeros(3 * (len(range(15, 16)) + len(range(3, 9))))),
            axis=1)
        self.FEATURE_MODEL = normalize(
            self.FEATURE_MODEL,
            norm='l1')[0]  # normalize the FEATURE_MODEL using l1
Beispiel #10
0
	def __init__(self, patch, id):
		Feature.__init__(self, patch, id)
		# the distribution of hue and saturation needed for the subpatch of interest
		# self.FEATURE_MODEL = np.array([ 0.,          0.,          0.,          0.08106389,  0.11229446,  0.,          0.,
		# 								  0.,          0.,          0.,          0.,          0.,          0.,          0.,
		# 								  0.,          0.,          0.,          0.,          0.,          0.,          0.,
		# 								  0.,          0.,          0.02104336,  0.0664095,   0.02171191,  0.,          0.,
		# 								  0.,          0.,          0.,          0.        ]) 

		# hue model and saturation model normalized seperately:
		self.FEATURE_MODEL = np.array([ 0.,          0.,          0.,          0.15622393,  0.84377607,  0.,          0.,
										  0.,          0.,          0.,          0.,          0.,          0.,          0.,
										  0.,          0.,          1.0])
		# reinforce that the other sub patches must not have the hue/saturation for the green color
		self.FEATURE_MODEL = np.concatenate((self.FEATURE_MODEL, np.zeros(3 *(len(range(3,5))))), axis = 1)
		self.FEATURE_MODEL = normalize(self.FEATURE_MODEL, norm='l1')[0] # normalize the FEATURE_MODEL using l1
 def __init__(self, patch, id):
     Feature.__init__(self, patch, id)
     self.HISTBINNUM = 16
     self.FEATURE_MODEL = np.array([
         0.00000000e+00, 1.00000000e+00, 0.00000000e+00, 0.00000000e+00,
         0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
         0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
         0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
         0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
         0.00000000e+00, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00,
         0.00000000e+00, 0.00000000e+00, 7.38737277e-04, 4.13136744e-01,
         5.86124519e-01, 0.00000000e+00, 0.00000000e+00, 0.00000000e+00
     ])
     self.FEATURE_MODEL = np.concatenate(
         (self.FEATURE_MODEL, np.zeros(3 * len(range(1, 2)))), axis=1)
     self.FEATURE_MODEL = normalize(
         self.FEATURE_MODEL,
         norm='l1')[0]  # normalize the FEATURE_MODEL using l1
Beispiel #12
0
 def __init__(self, patch, id):
     Feature.__init__(self, patch, id)
     self.HISTBINNUM = 16
     self.FEATURE_MODEL_HUE = np.array([
         0., 0., 0.44326144, 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0., 0.,
         0.
     ])
     self.FEATURE_MODEL_SATURATION = np.array([
         0., 0., 0., 0., 0., 0., 0., 0.21110128, 0.21070874, 0., 0., 0., 0.,
         0., 0., 0.
     ])
     self.FEATURE_MODEL = np.concatenate(( \
      self.FEATURE_MODEL_HUE, \
      self.FEATURE_MODEL_SATURATION, \
      np.zeros(len(range(2,3)) + len(range(7,9)))), axis = 1) # append the expected border response
     self.FEATURE_MODEL = normalize(
         self.FEATURE_MODEL,
         norm='l1')[0]  # normalize the histogram using l1
    def __init__(self, patch, id):
        Feature.__init__(self, patch, id)
        self.HUE_START_INDEX = 8
        self.HUE_END_INDEX = 9
        self.SATURATION_START_INDEX = 7
        self.SATURATION_END_INDEX = 12

        self.OTHER_HUE_START_INDEX = 3
        self.OTHER_HUE_END_INDEX = 4
        self.OTHER_SATURATION_START_INDEX = 6
        self.OTHER_SATURATION_END_INDEX = 10

        # bottom left blue: hue model and saturation model normalized seperately:
        self.BLUE_FEATURE_MODEL = np.array([ 0.,          0.,          0.,          0.,          0.,          0. ,         0.,
                   0.,          1.,          0. ,         0.,          0.,          0.,          0.,
                   0.,          0. ,         \
                   0. ,         0.,          0.,          0.,          0.,
                   0.,          0.,     0.2,     0.2,         0.2,         0.2,
                   0.2,          0.,          0.,          0.,          0.        ])
        # reinforce that the other sub patches must be green
        self.GREEN_FEATURE_MODEL = np.array([ 0.,          0.,          0.,          1.,          0.,          0.,          0.,
                   0.,          0.,          0.,          0.,          0.,          0.,          0.,
                   0.,          0.,         \
                   0.,          0.,          0.,          0.,          0.,          0.,          0.25,
                   0.25,         0.25,         0.25,         0.,          0.,          0.,          0.,
                   0.,          0.        ]) # with this, can get the target patch as 4th best

        # """try changing the sum of targeted saturation to be = 1"""
        # self.BLUE_FEATURE_MODEL = np.array([ 0.,          0.,          0.,          0.,          0.,          0. ,         0.,
        # 									  0.,          1.,          0. ,         0.,          0.,          0.,          0.,
        # 									  0.,          0. ,         \
        # 									  1.           ])
        # # reinforce that the other sub patches must be green
        # self.GREEN_FEATURE_MODEL = np.array([ 0.,          0.,          0.,          1.,          0.,          0.,          0.,
        # 									  0.,          0.,          0.,          0.,          0.,          0.,          0.,
        # 									  0.,          0.,         \
        # 									  1.           ])

        self.FEATURE_MODEL = np.concatenate(\
         (self.BLUE_FEATURE_MODEL, self.GREEN_FEATURE_MODEL, self.GREEN_FEATURE_MODEL, self.GREEN_FEATURE_MODEL), \
         axis = 1)
        self.FEATURE_MODEL = normalize(
            self.FEATURE_MODEL,
            norm='l1')[0]  # normalize the FEATURE_MODEL using l1
Beispiel #14
0
    def __init__(self, patch, id):
        Feature.__init__(self, patch, id)
        self.HISTBINNUM = 16  # adjustable number of bins
        self.GAUSSIAN_SCALE = 3
        self.GAUSSIAN_WINDOW_LENGTH_SIGMA = 4.0  # used for border feature case, window length = 4 sigma

        self.HUE_START_INDEX = None
        self.HUE_END_INDEX = None
        self.SATURATION_START_INDEX = None
        self.SATURATION_END_INDEX = None
        """
		TODO 0: try aggragate Hue bins
			 1: try seperate indexes used to filter hue bins that are wrongly categorized within target bins (now saturation range is very wide, may introduce noise)
		     2: try change HISTBINNUM to 16
		     3: If border saturation is concentrated, then add that as well.
		     4: !try use Saturation * Hue as FEATURE_MODEL
		     5: try 2D histogram -> leads to the problem of dissimilarity metric
		     6: !try switch back to 36 bins, but for hue, widen up for border error detection
		     7: !! if current one still wrongly match, try adjust border_hist weight and increase border_hist saturation range!!!!
		"""
        self.SATURATION_FILTER_START_INDEX = None
        self.SATURATION_FILTER_END_INDEX = None

        self.SATURATION_BORDER_FILTER_START_INDEX = None
        self.SATURATION_BORDER_FILTER_END_INDEX = None

        self.FEATURE_MODEL_HUE = np.zeros(self.HISTBINNUM)

        self.FEATURE_MODEL_SATURATION = np.zeros(self.HISTBINNUM)

        self.FEATURE_MODEL = None

        self.border_hist_hue = None
        self.border_hist_saturation = None

        self.inner_hist_hue = None
        self.inner_hist_saturation = None

        # cutted and mannually crafted hist
        self.border_hist = None
    def __init__(self, patch, id):
        Feature.__init__(self, patch, id)
        self.HISTBINNUM = 16
        self.GAUSSIAN_SCALE = 3
        self.GAUSSIAN_WINDOW_LENGTH_SIGMA = 6.0  # window length = 6 sigma

        self.HUE_START_INDEX = None
        self.HUE_END_INDEX = None
        self.SATURATION_START_INDEX = None
        self.SATURATION_END_INDEX = None
        """TODO: try indexes used to filter hue bins that are wrongly categorized within target bins"""
        self.SATURATION_FILTER_START_INDEX = None
        self.SATURATION_FILTER_END_INDEX = None

        ### The patch of interest, one of TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT ###
        self.SUBPATCH_OF_INTEREST_INDEX = None

        self.FEATURE_MODEL_HUE = np.zeros(self.HISTBINNUM)

        self.FEATURE_MODEL_SATURATION = np.zeros(self.HISTBINNUM)

        self.FEATURE_MODEL = None
	def __init__(self, patch, id):
		Feature.__init__(self, patch, id)
		self.HISTBINNUM = 16
		
		self.HUE_START_INDEX = 9
		self.HUE_END_INDEX = 10
		self.SATURATION_START_INDEX = 8
		self.SATURATION_END_INDEX = 10
		
		self.FEATURE_MODEL_HUE = np.zeros(self.HISTBINNUM)
		self.FEATURE_MODEL_HUE[self.HUE_START_INDEX] = 1.0 # all in bin 9
		
		self.FEATURE_MODEL_SATURATION = np.zeros(self.HISTBINNUM)
		self.FEATURE_MODEL_SATURATION[self.SATURATION_START_INDEX] = 0.5 # all in bin 8 or bin 9
		self.FEATURE_MODEL_SATURATION[self.SATURATION_START_INDEX + 1] = 0.5 # all in bin 8 or bin 9

		self.FEATURE_MODEL = np.concatenate(( \
			self.FEATURE_MODEL_HUE, \
			self.FEATURE_MODEL_SATURATION, \
			np.zeros(len(range(self.HUE_START_INDEX,self.HUE_END_INDEX)) + \
			len(range(self.SATURATION_START_INDEX,self.SATURATION_END_INDEX)))), axis = 1) # append the expected border response
		self.FEATURE_MODEL = normalize(self.FEATURE_MODEL, norm='l1')[0] # normalize the histogram using l1
 def __init__(self, patch, id):
     Feature.__init__(self, patch, id)
     self.max_response = None
     self._checkRep()