mirror of
https://github.com/SheffieldML/GPy.git
synced 2026-07-23 17:01:06 +02:00
Mocap dataset automatic download
This commit is contained in:
parent
ba11a4525c
commit
dc545bd9cc
2 changed files with 21 additions and 5 deletions
|
|
@ -19,7 +19,7 @@ def sample_class(f):
|
||||||
|
|
||||||
def fetch_dataset(resource, save_name = None, save_file = True, messages = True):
|
def fetch_dataset(resource, save_name = None, save_file = True, messages = True):
|
||||||
if messages:
|
if messages:
|
||||||
print "Downloading resource: " , resource, " ... "
|
print "Downloading resource: " , resource, " ... ",
|
||||||
response = url.urlopen(resource)
|
response = url.urlopen(resource)
|
||||||
# TODO: Some error checking...
|
# TODO: Some error checking...
|
||||||
# ...
|
# ...
|
||||||
|
|
|
||||||
|
|
@ -702,15 +702,31 @@ def fetch_data(base_url = 'http://mocap.cs.cmu.edu:8080/subjects', skel_store_di
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
# Download the data, do not return anything
|
# Download the data, do not return anything
|
||||||
GPy.util.mocap.fetch_data(subj_motions = (['35'],[['01','02','03']]), return_motions = False)
|
GPy.util.mocap.fetch_data(subj_motions = ([35],[[1,2,3]]), return_motions = False)
|
||||||
# Fetch and return the data in a list. Do not store them anywhere
|
# Fetch and return the data in a list. Do not store them anywhere
|
||||||
GPy.util.mocap.fetch_data(subj_motions = (['35'],[['01','02','03']]), return_motions = True, store_motions = False)
|
GPy.util.mocap.fetch_data(subj_motions = ([35],[[1,2,3]]), return_motions = True, store_motions = False)
|
||||||
|
|
||||||
In both cases above, if the data do exist in the given skel_store_dir and motion_store_dir, they are just loaded from there.
|
In both cases above, if the data do exist in the given skel_store_dir and motion_store_dir, they are just loaded from there.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
subjects = subj_motions[0]
|
subjectsNum = subj_motions[0]
|
||||||
motions = subj_motions[1]
|
motionsNum = subj_motions[1]
|
||||||
|
|
||||||
|
# Convert numbers to strings
|
||||||
|
subjects = []
|
||||||
|
motions = [list() for _ in range(len(subjectsNum))]
|
||||||
|
for i in range(len(subjectsNum)):
|
||||||
|
curSubj = str(int(subjectsNum[i]))
|
||||||
|
if subjectsNum[i] < 10:
|
||||||
|
curSubj = '0' + curSubj
|
||||||
|
subjects.append(curSubj)
|
||||||
|
for j in range(len(motionsNum[i])):
|
||||||
|
curMot = str(int(motionsNum[i][j]))
|
||||||
|
if motionsNum[i][j] < 10:
|
||||||
|
curMot = '0' + curMot
|
||||||
|
motions[i].append(curMot)
|
||||||
|
|
||||||
|
|
||||||
all_skels = []
|
all_skels = []
|
||||||
|
|
||||||
assert len(subjects) == len(motions)
|
assert len(subjects) == len(motions)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue