예제 #1
0
    def __init__(self, sync_directory, classifier_name, mode):

        ### Step 1: filename management ###
        print_inner_status("Initialization",
                           "Looking at file " + sync_directory)
        self.jvid_filename_raw = os.path.join(sync_directory, 'Raw/video.jvid')
        self.jvid_filename_pops_marked = os.path.join(sync_directory,
                                                      'Marked/video.jvid')
        self.jvid_filename_synchronized = os.path.join(sync_directory,
                                                       'Synced/video.jvid')

        ### Step 2: get the original skeletons ###
        print_inner_status("Initialization", "Getting input skeletons")
        self.original_skeletons = read_in_skeletons(self.jvid_filename_raw)

        ### Step 3: add derivatives to them ###
        print_inner_status("Initialization", "Adding derivatives to skeletons")
        self.original_skeletons = add_derivatives_to_skeletons(
            self.original_skeletons, 5, 10, 5, 10)

        ### Step 4: set up the classifier filename ###
        self.classifier_filename = os.path.join(
            os.getcwd(), 'python_backend/classifiers/' + classifier_name)

        ### Step 5.0: if synchronize mode, load the classifier and mark probabilities ###
        if mode == 'synchronize':

            print_inner_status("Initialization", "Loading the classifier")
            self.load_classifier(
                '/Users/jhack/Programming/NI/ni_template/python_backend/classifiers/toprock_front_training.obj'
            )

            print_inner_status("Initialization",
                               "Adding pop probabilities to skeletons")
            self.original_skeletons = mark_pop_probabilities(
                self.original_skeletons, self.classifier)

        ### Step 5.1: if train mode, train the classifier and save it ###
        elif mode == 'train':

            print_inner_status("Initialization", "Training the classifier")
            self.train_classifier()

            print_inner_status("Initialization", "Saving the classifier")
            self.save_classifier()

        return
예제 #2
0
	def __init__ (self, sync_directory, classifier_name, mode):

		### Step 1: filename management ###
		print_inner_status ("Initialization", "Looking at file " + sync_directory)
		self.jvid_filename_raw 				= os.path.join(sync_directory, 'Raw/video.jvid')
		self.jvid_filename_pops_marked 		= os.path.join(sync_directory, 'Marked/video.jvid')
		self.jvid_filename_synchronized 	= os.path.join(sync_directory, 'Synced/video.jvid')

		### Step 2: get the original skeletons ###
		print_inner_status ("Initialization", "Getting input skeletons")
		self.original_skeletons = read_in_skeletons (self.jvid_filename_raw)

		### Step 3: add derivatives to them ###
		print_inner_status ("Initialization", "Adding derivatives to skeletons")		
		self.original_skeletons = add_derivatives_to_skeletons(self.original_skeletons, 5, 10, 5, 10)

		### Step 4: set up the classifier filename ###
		self.classifier_filename = os.path.join (os.getcwd(), 'python_backend/classifiers/' + classifier_name)

		### Step 5.0: if synchronize mode, load the classifier and mark probabilities ###
		if mode == 'synchronize':
	
			print_inner_status ("Initialization", "Loading the classifier")
			self.load_classifier ('/Users/jhack/Programming/NI/ni_template/python_backend/classifiers/toprock_front_training.obj')

			print_inner_status ("Initialization", "Adding pop probabilities to skeletons")			
			self.original_skeletons = mark_pop_probabilities (self.original_skeletons, self.classifier)

		### Step 5.1: if train mode, train the classifier and save it ###
		elif mode == 'train':

			print_inner_status ("Initialization", "Training the classifier")
			self.train_classifier ()

			print_inner_status ("Initialization", "Saving the classifier")
			self.save_classifier ()

		return
예제 #3
0
	def __init__ (self, sync_directory, classifier_name):

		### Step 1: filename management ###
		print_inner_status ("Initialization", "Looking at file " + sync_directory)
		self.jvid_filename_raw 				= os.path.join(sync_directory, 'Raw/video.jvid')
		self.jvid_filename_pops_marked 		= os.path.join(sync_directory, 'Marked/video.jvid')
		self.jvid_filename_synchronized 	= os.path.join(sync_directory, 'Synced/video.jvid')

		### Step 2: load the classifier ###
		print_inner_status ("Initialization", "Unpickling the classifier")
		self.classifier = pickle.load (open('/Users/jhack/Programming/NI/ni_template/python_backend/classifiers/toprock_front_training.obj', 'r'))

		### Step 2: get the original skeletons ###
		print_inner_status ("Initialization", "Getting input skeletons")
		self.original_skeletons = read_in_skeletons (self.jvid_filename_raw)

		### Step 3: add derivatives to them ###
		print_inner_status ("Initialization", "Adding derivatives to skeletons")		
		self.original_skeletons = add_derivatives_to_skeletons(self.original_skeletons, 5, 10, 5, 10)

		### Step 4: add pop probabilities to them ###
		print_inner_status ("Initialization", "Adding pop probabilities to skeletons")
		self.original_skeletons = mark_pop_probabilities (self.original_skeletons, self.classifier)