Пример #1
0
import utils.kinect.angleExtraction as ae
import utils.stitching.stitching.quantization as qu
import matplotlib.pyplot as plt
import utils.oldKinectExtractor as ke
import utils.stitching.stitching as st
import utils.stitching.stitching.mineByPattern as mbp
from numpy import linalg as LA
import copy

fileName = 'inputs/ran_5_2_14_840.skl'
joint = 'AnkleRight_X'
time, values = ae.getAngleVec(fileName, joint, True)
disFactor=0.2
numOfClusters = 6
minimalCluster = 10
fracs = ke.clusterByTime(time, values, False, minimalCluster)
#originalFracs = copy.deepcopy(fracs)
prob = 0.05
fracs = ke.filterOutliers(fracs, False, prob)
i=0
parts, kuku = ke.cleanFracs(fracs, False)
pattern = [14, 15, 17, 19, 24, 28, 33, 33, 33, 33, \
           33, 33, 28, 24, 19, 17, 15, 14,\
           12, 12, 14, 15, 16, 17.5, 17.5, 17.5, \
           16, 15, 14, 13, 12, 12]


i=1
framSize = 4
groupSize = framSize**2
minedParts = []
Пример #2
0
import numpy as np
import algorithm.quantization as qu
import utils.utils as pe
import copy
import utils.MovingAverage as ma
import algorithm.partitionizing as prt
from tsp_solver.greedy import solve_tsp
import algorithm.mineByPattern as mp
#Reading from file
fileName = 'myKinect/v2RanLong.skl'
joint = 'KneeLeft_X'
time, frameNumbers, angles= ae.getAngleVec(fileName, joint, True, 'NEW')

#Extracting clean fractions
minimalCluster=20
fracs = ke.clusterByTime(time, frameNumbers, angles, False, minimalCluster)
prob = 0.1
fracs = ke.filterOutliers(fracs, False, prob)
i=0
cleanedParts, _ = ke.cleanFracs(fracs, False, 5, 1.5)
st.plotParts(cleanedParts)

#Creating pattern to mine for
lenOfCycle = 35
pattern = mp.createFlippedUpattern(angles, lenOfCycle, 3)

#Mining the pattern from the input
fig = plt.figure()
framSize= np.ceil(np.sqrt(len(cleanedParts)))
minedParts = []
minedPartsAsList = []
Пример #3
0
import utils.angleExtraction as ae
import matplotlib.pyplot as plt
import utils.oldKinectExtractor as ke
import utils.stitching.stitching.quantization as qu
import utils.stitching.stitching as st



fileName = 'inputs/ran_5_2_14_840.skl'#asc_gyro_l.skl'
joint = 'AnkleRight_X'
time, angles, kuku = ae.getAngleVec(fileName, joint, False)
#plt.plot(angles)
minimalCluster=15
fracs = ke.clusterByTime(time, angles, False, minimalCluster)
prob = 0.3
fracs = ke.filterOutliers(fracs, False, prob)
cleanedParts, kuku = ke.cleanFracs(fracs, False)
angles = [item for sublist in cleanedParts for item in sublist]
#bins = qu.getEquallyWeighetedBins(angles, alphabetSize)

#wholeStr = qu.createStr(bins, angles)
#vec = qu.fromStr2Vec(bins, wholeStr)
#ngrams_statistics_sorted = qu.getSortedNgrams(wholeStr, n)
atoms = [
             [14, 15, 17, 19, 24, 28, 33, 33, 33, 33],
             [33, 33, 33, 33, 28, 24, 19, 17, 15, 14],
             [15, 14, 12, 12, 14, 15, 16, 17.5, 17.5, 17.5],
             [17.5, 17.5, 16, 15, 14, 13, 12, 12, 14, 15]
        ]
"""
str = qu.appendAtom(atoms[0], atoms[1])
Пример #4
0
subjects = []
sizeOfAtom = 10
minimalCluster = sizeOfAtom
start =0 

for end in seperators:
#end = 8466828
    tmpTime = []
    tmpAngles = []
    for t, a in zip(time, angles):
        if t > start and t < end:
            tmpTime.append(t)
            tmpAngles.append(a) 
    start = end
    
    fracs = ke.clusterByTime(tmpTime, tmpAngles, False, minimalCluster)
    originalFracs = copy.deepcopy(fracs)
    prob = 0.05
    fracs = ke.filterOutliers(fracs, False, prob)
    i=0
    cleanedParts, kuku = ke.cleanFracs(fracs, False)
    """
    for (t, a), part in zip(originalFracs,cleanedParts):
        frameSize = math.ceil(np.sqrt(len(fracs)))
        curr = fig.add_subplot(frameSize,frameSize,i+1)
        plt.title(str(i))
        plt.xlabel('Time in miliseconds')
        plt.ylabel('Right knee angle in degrees')
        curr.plot(xrange(len(a)), a, c='b')
        curr.plot(part, c='g')
        i+=1