def OnLoadClassifier(self, event=None): from PYME.Analysis import svmSegment filename = wx.FileSelector("Load Classifier:", wildcard="*.pkl", flags=wx.FD_OPEN) if not filename == '': self.cf = svmSegment.svmClassifier(filename=filename)
def _loadClassifier(self): from PYME.Analysis import svmSegment if not (('_cf' in dir(self)) and (self._classifier == self.classifier)): self._classifier = self.classifier with unifiedIO.local_or_temp_filename(self.classifier) as fn: self._cf = svmSegment.svmClassifier(filename=fn)
def OnSVMTrain(self, event): from PYME.Analysis import svmSegment #from PYME.IO.image import ImageStack #from PYME.DSView import ViewIm3D if not 'cf' in dir(self): self.cf = svmSegment.svmClassifier() self.cf.train(self.image.data[:, :, self.do.zp, 0].squeeze(), self.image.labels[:, :, self.do.zp]) self.OnSVMSegment(None)
def train_svm(self, event=None): from PYME.Analysis import svmSegment #from PYME.IO.image import ImageStack #from PYME.DSView import ViewIm3D if not 'cf' in dir(self): self.cf = svmSegment.svmClassifier() self.cf.train(self.dsviewer.image.data[:, :, self.do.zp, 0].squeeze(), self.rasterize(self.do.zp)) self.svm_segment()
def train_naive_bayes(self, event=None): from PYME.Analysis import svmSegment from sklearn.naive_bayes import GaussianNB #from PYME.IO.image import ImageStack #from PYME.DSView import ViewIm3D clf = GaussianNB() #if not 'cf' in dir(self): #if not 'cf' in dir(self): self.cf = svmSegment.svmClassifier(clf=clf) self.cf.train(self.dsviewer.image.data[:, :, self.do.zp, 0].squeeze(), self.rasterize(self.do.zp)) self.svm_segment()
def _loadClassifier(self): from PYME.Analysis import svmSegment if not '_cf' in dir(self): self._cf = svmSegment.svmClassifier(filename=self.classifier)