def updateCooccurenceGraph(self, beaconCoocMatRat, beaconCoocMatFrame, listToUpdate, coocThres=0.75): print "Update beacon cooccurence between videos" nModel = len(self.sfmModel) listDone = [] for i in listToUpdate: for j in range(0, nModel): if [i, j] in listDone or [j, i] in listDone: continue else: listDone.append([i, j]) # find smaller and larger model if len(self.sfmModel[i].reconFrame) < len( self.sfmModel[j].reconFrame): smallerModel = self.sfmModel[i] largerModel = self.sfmModel[j] else: smallerModel = self.sfmModel[j] largerModel = self.sfmModel[i] # calculate beacon cooccurence beaconCooc = IBeaconUtils.findNumImgByBeaconIntersect( smallerModel.beaconFileLoc, largerModel.beaconFileLoc, coocThres, # minimum beacon signal cooccurence valQ=smallerModel.reconFrame) # save value frame beaconCoocMatFrame[i, j] = beaconCooc beaconCoocMatFrame[j, i] = beaconCooc beaconCooc = (beaconCooc + 0.0) / len(smallerModel.reconFrame) # save values ratio beaconCoocMatRat[i, j] = beaconCooc beaconCoocMatRat[j, i] = beaconCooc print "Update calculating beacon cooccurrence" return beaconCoocMatRat, beaconCoocMatFrame
def updateCooccurenceGraph(self,beaconCoocMatRat,beaconCoocMatFrame,listToUpdate,coocThres=0.75): print "Update beacon cooccurence between videos" nModel = len(self.sfmModel) listDone = [] for i in listToUpdate: for j in range(0,nModel): if [i,j] in listDone or [j,i] in listDone: continue else: listDone.append([i,j]) # find smaller and larger model if len(self.sfmModel[i].reconFrame) < len(self.sfmModel[j].reconFrame): smallerModel = self.sfmModel[i] largerModel = self.sfmModel[j] else: smallerModel = self.sfmModel[j] largerModel = self.sfmModel[i] # calculate beacon cooccurence beaconCooc = IBeaconUtils.findNumImgByBeaconIntersect( smallerModel.beaconFileLoc, largerModel.beaconFileLoc, coocThres, # minimum beacon signal cooccurence valQ=smallerModel.reconFrame) # save value frame beaconCoocMatFrame[i,j] = beaconCooc beaconCoocMatFrame[j,i] = beaconCooc beaconCooc = (beaconCooc+0.0)/len(smallerModel.reconFrame) # save values ratio beaconCoocMatRat[i,j] = beaconCooc beaconCoocMatRat[j,i] = beaconCooc print "Update calculating beacon cooccurrence" return beaconCoocMatRat,beaconCoocMatFrame
def calCooccurenceGraph(self, coocThres=0.5): print "Calculating beacon cooccurence between videos" nModel = len(self.sfmModel) beaconCoocMatRat = np.zeros((nModel, nModel), dtype=np.float32) beaconCoocMatFrame = np.zeros((nModel, nModel), dtype=np.int16) for i in range(0, nModel - 1): for j in range(i + 1, nModel): # find smaller and larger model if len(self.sfmModel[i].reconFrame) < len( self.sfmModel[j].reconFrame): smallerModel = self.sfmModel[i] largerModel = self.sfmModel[j] else: smallerModel = self.sfmModel[j] largerModel = self.sfmModel[i] # calculate beacon cooccurence beaconCooc = IBeaconUtils.findNumImgByBeaconIntersect( smallerModel.beaconFileLoc, largerModel.beaconFileLoc, coocThres, # minimum beacon signal cooccurence valQ=smallerModel.reconFrame) # save value frame beaconCoocMatFrame[i, j] = beaconCooc beaconCoocMatFrame[j, i] = beaconCooc beaconCooc = (beaconCooc + 0.0) / len(smallerModel.reconFrame) # save values ratio beaconCoocMatRat[i, j] = beaconCooc beaconCoocMatRat[j, i] = beaconCooc print "Complete calculating beacon cooccurrence" return beaconCoocMatRat, beaconCoocMatFrame
def calCooccurenceGraph(self,coocThres=0.5): print "Calculating beacon cooccurence between videos" nModel = len(self.sfmModel) beaconCoocMatRat = np.zeros((nModel,nModel),dtype=np.float32) beaconCoocMatFrame = np.zeros((nModel,nModel),dtype=np.int16) for i in range(0,nModel-1): for j in range(i+1,nModel): # find smaller and larger model if len(self.sfmModel[i].reconFrame) < len(self.sfmModel[j].reconFrame): smallerModel = self.sfmModel[i] largerModel = self.sfmModel[j] else: smallerModel = self.sfmModel[j] largerModel = self.sfmModel[i] # calculate beacon cooccurence beaconCooc = IBeaconUtils.findNumImgByBeaconIntersect( smallerModel.beaconFileLoc, largerModel.beaconFileLoc, coocThres, # minimum beacon signal cooccurence valQ=smallerModel.reconFrame) # save value frame beaconCoocMatFrame[i,j] = beaconCooc beaconCoocMatFrame[j,i] = beaconCooc beaconCooc = (beaconCooc+0.0)/len(smallerModel.reconFrame) # save values ratio beaconCoocMatRat[i,j] = beaconCooc beaconCoocMatRat[j,i] = beaconCooc print "Complete calculating beacon cooccurrence" return beaconCoocMatRat,beaconCoocMatFrame