예제 #1
0
 def confirmPush(self):
     angle_list = []
     for p in self.selection:
         if self.selection[p] == 1:
             angle_list.append(p)
     homedir = os.getcwd()
     # filt = af.Filter(homedir)
     # filt.data_process()
     self.pbar.setValue(25)
     select = RandomSelector(homedir)
     select.dataProcess()
     self.pbar.setValue(50)
     dt = DynamicAnalyzer(homedir,angle_list)
     dt.dataProcess()
     self.pbar.setValue(75)
     c = Classifier(homedir)
     count,rate,total,result = c.dynamicClassify()
     self.pbar.setValue(100)
     reply = QtGui.QMessageBox.question(self, 'Dynamic Analysis Result',"Total number is %d"%(total)+"\nCorrect number is %d"%(count)+"\nCorrect rate is %f"%(100*rate)+"%", QtGui.QMessageBox.Yes)
     self.pbar.setValue(0)
    def confirmPush(self):
        checked = self.staticRecognition.isChecked() or self.dynamicRecognition.isChecked() or self.fusionRecognition.isChecked()
        if not checked:
            reply = QtGui.QMessageBox.question(self, 'Analysis Result',"Select One", QtGui.QMessageBox.Yes)
            return

        homdir = os.getcwd()
        trainGaitPath = homdir+"\\Dataset\\TrainDataset\\TrainGaitDataset"
        if (os.path.exists(trainGaitPath)):
            shutil.rmtree(trainGaitPath)
            os.mkdir(trainGaitPath)
        else:
            os.mkdir(trainGaitPath)
        filterFilePath = homdir+"\\Dataset\\FilteredGaitDataset"
        files = os.listdir(filterFilePath)
        for f in files:
            fpath = filterFilePath + "\\"+f
            dstGaitPath = trainGaitPath+"\\"+f
            shutil.copytree(fpath,dstGaitPath)

        testGaitPath = homdir+"\\Dataset\\TestDataset\\TestGaitDataset"
        if (os.path.exists(testGaitPath)):
            shutil.rmtree(testGaitPath)
            os.mkdir(testGaitPath)
        else:
            os.mkdir(testGaitPath)
        
        exePath = "C:\Users\Niko\Documents\BodyBasics-D2D\Debug\BodyBasics-D2D "
        homdir = os.getcwd()
        outputFilePath = homdir+"\\test.txt"
        # outputFile = open(outputFilePath,'w')
        # outputFile.close()
        # os.system(exePath+outputFilePath)

        dstOutputPersonPath = homdir+"\\Dataset\\TestDataset\\TestGaitDataset\\Person001"
        os.mkdir(dstOutputPersonPath)
        dstOutputPath = dstOutputPersonPath+"\\1.txt"
        shutil.copy(outputFilePath,dstOutputPath)

        self.pbar.setValue(50)
        if self.staticRecognition.isChecked():
            self.pbar.setValue(75)
            st = StaticAnalyzer(homdir,limbDescriptors)
            st.dataProcess()
            c = Classifier(homdir)
            count,rate,total,result = c.staticClassify()
            self.pbar.setValue(100)
            name = self.findName(result[0])
            reply = QtGui.QMessageBox.question(self, 'Static Analysis Result',"This is "+name, QtGui.QMessageBox.Yes)
            
        elif self.dynamicRecognition.isChecked():
            self.pbar.setValue(75)
            dy = DynamicAnalyzer(homdir,angleDescriptors)
            dy.dataProcess()
            c = Classifier(homdir)
            count,rate,total = c.dynamicClassify()
            self.pbar.setValue(100)
            reply = QtGui.QMessageBox.question(self, 'Dynamic Analysis Result',"Total number is %d"%(total)+"\nCorrect number is %d"%(count)+"\nCorrect rate is %f"%(100*rate)+"%", QtGui.QMessageBox.Yes)
        else:
            self.pbar.setValue(75)
            dy = DynamicAnalyzer(homdir,angleDescriptors)
            dy.dataProcess()
            st = StaticAnalyzer(homdir,limbDescriptors)
            st.dataProcess()
            c = Classifier(homdir)
            count,rate,total = c.fusionClassify()
            self.pbar.setValue(100)
            reply = QtGui.QMessageBox.question(self, 'Fusion Analysis Result',"Total number is %d"%(total)+"\nCorrect number is %d"%(count)+"\nCorrect rate is %f"%(100*rate)+"%", QtGui.QMessageBox.Yes)