def testGenerator(self): CLUSTERS = 500 #from IPython.Debugger import Tracer; debug_here = Tracer() #debug_here() rce = self.createDescr() rce = armor.loadSlots('rce.pickle') km = armor.cluster.Kmeans(CLUSTERS) qt = armor.cluster.Quantize() hg = armor.histogram.Histogram(CLUSTERS) nz = armor.transforms.Normalize('none') tf = armor.transforms.Transform('none') nz2 = armor.transforms.Normalize('none') sc = armor.score.Score() pd = armor.score.PairwiseDistances(metric='euclidean') #km.inputSlot.registerInput(rce.outputSlot) km.inputSlot.registerInput(rce) armor.saveSlots('km.pickle', km.outputSlot) km = armor.loadSlots('km.pickle') #km = armor.loadSlots('km.pickle') qt.inputSlotCodebook.registerInput(km) qt.inputSlotVec.registerInput(rce) #qt.inputSlotVec.registerInput(rce.outputSlot) hg.inputSlot.registerInput(qt.outputSlot) nz.inputSlot.registerInput(hg.outputSlot) tf.inputSlotData.registerInput(nz.outputSlot) tf.inputSlotLabels.registerInput(self.imgDataset.outputSlotLabelsTrain) nz2.inputSlot.registerInput(tf.outputSlot) sc.inputSlotData.registerInput(nz2.outputSlot) sc.inputSlotLabels.registerInput(self.imgDataset.outputSlotLabelsTrain) #pd.inputSlot.registerInput(nz2.outputSlot) pd.inputSlot.registerInput(nz2.outputSlot) x = list(pd.outputSlot) print list(sc.outputSlot)
def browseFile(self, filters=None): """Display a FileDialog and select an existing file, or a dir (dir=1) or a new file (save=1). filters can be a list with all extensions to be displayed during browsing Returned is/are the selected item(s) with complete path.""" if not filters: filters = ["All (*.*)"] dialog = QFileDialog() dialog.setFileMode(QFileDialog.ExistingFile) dialog.setFilters(QStringList(filters)) dialog.setViewMode(QFileDialog.List) if not dialog.exec_(): return None selected = dialog.selectedFiles() fname = str(selected[0]) print fname slot = armor.loadSlots(fname) self.send("Data", slot)