コード例 #1
0
ファイル: DataAnalyzer.py プロジェクト: manu-tej/Kinect2
    def processVideos(self, index, rewrite):

        self._loadRegistration()

        # Create Video objects (low overhead even if video is not processed)
        self.videoObjs = [
            VP(self.projectID, x.mp4_file, self.localMasterDirectory,
               self.cloudMasterDirectory, self.transM) for x in self.lp.movies
        ]

        if index is None:
            vos = self.videoObjs
        else:
            vos = [self.videoObjs[x] for x in index]

        for vo in vos:
            if rewrite:
                vo.createHMM()
                vo.createClusters()
                #vo.createLabels()
                #vo.summarizeData()
                vo.cleanup()
            else:
                vo.createClusterClips()
                vo.cleanup()
コード例 #2
0
    def fixIssues(self, index, mlDirectory):
        self._loadRegistration()

        for x in index:
            vo = VP(self.projectID, self.lp.movies[x - 1],
                    self.localMasterDirectory, self.cloudMasterDirectory,
                    self.transM, self.depthObj)
            vo._fixData(mlDirectory)
            vo.cleanup()
コード例 #3
0
    def labelVideos(self, index, mainDT, cloudMLDirectory, number, initials):
        self._loadRegistration()

        # Create Video objects (low overhead even if video is not processed)
        for x in index:
            vo = VP(self.projectID, self.lp.movies[x - 1],
                    self.localMasterDirectory, self.cloudMasterDirectory,
                    self.transM, self.depthObj)
            vo.labelClusters(self.rewriteFlag, mainDT, cloudMLDirectory,
                             number, initials)
コード例 #4
0
ファイル: DataAnalyzer.py プロジェクト: manu-tej/Kinect2
    def predictLabels(self, index, modelLocation):
        print(modelLocation)
        self._loadRegistration()
        self.videoObjs = [
            VP(self.projectID, x.mp4_file, self.localMasterDirectory,
               self.cloudMasterDirectory, self.transM) for x in self.lp.movies
        ]
        if index is None:
            vos = self.videoObjs
        else:
            vos = [self.videoObjs[x] for x in index]

        for vo in vos:
            vo.predictLabels(modelLocation)
コード例 #5
0
ファイル: DataAnalyzer.py プロジェクト: manu-tej/Kinect2
    def labelVideos(self, index, mainDT, cloudMLDirectory):
        self._loadRegistration()
        # Create Video objects (low overhead even if video is not processed)
        self.videoObjs = [
            VP(self.projectID, x.mp4_file, self.localMasterDirectory,
               self.cloudMasterDirectory, self.transM) for x in self.lp.movies
        ]
        if index is None:
            vos = self.videoObjs
        else:
            vos = [self.videoObjs[x] for x in index]

        for vo in vos:
            vo.labelClusters(self.rewriteFlag, mainDT, cloudMLDirectory)
コード例 #6
0
    def countFish(self, index, cloudCountDirectory):
        self._loadVideoCrop()
        self._loadRegistration()
        self.videoObjs = [
            VP(self.projectID, x, self.localMasterDirectory,
               self.cloudMasterDirectory, self.transM, self.depthObj)
            for x in self.lp.movies
        ]
        if index is None:
            vos = self.videoObjs
        else:
            vos = [self.videoObjs[x - 1] for x in index]

        for vo in vos:
            vo.countFish(self.rewriteFlag, cloudCountDirectory, self.videoCrop)
コード例 #7
0
    def processVideos(self, index, rewriteClusters, rewriteSummaries):

        self._loadRegistration()

        # Create Video objects (low overhead even if video is not processed)
        for x in index:
            vo = VP(self.projectID, self.lp.movies[x - 1],
                    self.localMasterDirectory, self.cloudMasterDirectory,
                    self.transM, self.depthObj)
            if self.rewriteFlag:
                print('Rewriting all video data for ' + self.projectID +
                      ' and videos ' + str(index),
                      file=sys.stderr)
                vo.loadVideo()
                vo.createHMM()
                vo.createClusterSummary()
                vo.createClusterClips()
                #vo.summarizeData()
                vo.cleanup()
            elif rewriteClusters:
                print('Rewriting cluster data for ' + self.projectID +
                      ' and videos ' + str(index),
                      file=sys.stderr)
                vo.createClusters()
                vo.createClusterSummary()
                vo.createClusterClips()
                vo.cleanup()

            elif rewriteSummaries:
                print('Rewriting cluster summary and clips for ' +
                      self.projectID + ' and videos ' + str(index),
                      file=sys.stderr)
                vo.createClusterSummary()
                vo.createClusterClips()
                vo.cleanup()

            else:
                print('Rewriting cluster clips for ' + self.projectID +
                      ' and videos ' + str(index),
                      file=sys.stderr)
                vo.createClusterClips()
                vo.cleanup()
コード例 #8
0
    def predictLabels(self, index, modelLocation, modelIDs, classIndFile, GPU):
        self._loadRegistration()

        print(modelLocation)

        clusterData = []
        for x in index:
            vo = VP(self.projectID, self.lp.movies[x - 1],
                    self.localMasterDirectory, self.cloudMasterDirectory,
                    self.transM, self.depthObj)
            clusterData.append(
                vo.predictLabels(modelLocation, modelIDs, classIndFile, GPU))
            vo.cleanup()

        fullClusterData = pd.concat(clusterData, ignore_index=True)

        fullClusterData.to_csv(self.localMasterDirectory +
                               'VideoAnalysis/AllClusterData.csv',
                               sep=',')
        subprocess.call([
            'rclone', 'copy',
            self.localMasterDirectory + 'VideoAnalysis/AllClusterData.csv',
            self.cloudMasterDirectory + 'VideoAnalysis/'
        ])