class DenseTrajBOW: def __init__(self): self.bowHOG = BOW() self.bowHOF = BOW() self.bowMBFx = BOW() self.bowMBFy = BOW() self.dimHOG = 96 self.dimHOF = 108 self.dimMBFx = 96 self.dimMBFy = 96 self.vocszHOG = 128 self.vocszHOF = 128 self.vocszMBFx = 128 self.vocszMBFy = 128 def build(self,dataHOG,dataHOF,dataMBFx,dataMBFy): self.bowHOG.vq(data=dataHOG,voc_size=self.vocszHOG,gt_labels=None) def calcFeatures(self,dataHOG,dataHOF,dataMBFx,dataMBFy): self.bowHOG.calc_bow_representation(fv=dataHOG) return self.bowHOG.bow
#B_gt_labels = np.ones(N_B,dtype='int') #feat = np.concatenate((A,B), axis=0) #gt_labels = np.concatenate((A_gt_labels,B_gt_labels), axis=0) # Test Case 2: Tiny dataset # desc = []; desc.append([1,1]) desc.append([1.5,1]) desc.append([1,15]) desc.append([1.5,1]) desc.append([1,1.5]) desc.append([1,1.6]) desc.append([10,10]) desc.append([12,10]) desc.append([10,13]) desc.append([14,10]) desc.append([10,15]) feat = sp.vstack(tuple(desc)) gt_labels = np.array([0,0,1,0,0,0,1,1,1,1,1]) V = BOW(data=feat,voc_size=2,gt_labels=gt_labels) #print V.vq_data feat2 = np.concatenate((feat,feat),axis=0) V.calc_bow_representation(fv=feat2) print V.bow