mirror of
https://github.com/wassname/pyrobolearn.git
synced 2026-09-09 11:31:38 +08:00
add dataset parsers
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
## 3D datasets
|
||||
|
||||
This repo contains a brief description of 3D datasets that I could find online. It also contains the Python code to load, parse, and plot some of these datasets.
|
||||
|
||||
|
||||
### List of datasets
|
||||
|
||||
Here is a non-exhaustive list of datasets that could be used:
|
||||
|
||||
* [**TUM Kitchen**: "The TUM Kitchen Data Set of Everyday Manipulation Activities for Motion Tracking and Action Recognition", 2009](https://ias.in.tum.de/dokuwiki/software/kitchen-activity-data)
|
||||
* scenarios: "everyday manipulation activities in a natural kitchen environment"
|
||||
* labeled segmented data: 51 DOF articulated human model, 3D joint positions, videos and labels
|
||||
* [**CMU-MMAC**: "Guide to the Carnegie Mellon University Multimodal Activity database", 2009](http://kitchen.cs.cmu.edu/)
|
||||
* scenarios: human activity of subjects performing the tasks involved in cooking and food preparation
|
||||
* [**HumanEva**: "HumanEva: Synchronized Video and Motion Capture Dataset and Baseline Algorithm for Evaluation of Articulated Human Motion", 2010](http://humaneva.is.tue.mpg.de/)
|
||||
* 6 scenarios: walking, jogging, gesturing, throwing and catching a ball, boxing, combo (=walking+jogging+balancing)
|
||||
* nb of subjects: 4
|
||||
* data: 2D and 3D pose estimation
|
||||
* [**MPII Cooking**: "A database for fine grained activity detection of cooking activities", 2012](https://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal-computing/research/human-activity-recognition/mpii-cooking-activities-dataset/)
|
||||
<img src="figures/MPIICooking-comparison-datasets.png" alt="Datasets" style="width: 400px;"/>
|
||||
* nb of subjects: 12
|
||||
* 65 fine-grained cooking activities: background activity, change temperature, cut apart, cut dice, cut in, cut off ends, cut out inside, cut slices, cut stripes, dry, fill water from tap, grate, lid: put on, lid: remove, mix, move from X to Y, open egg, open tin, open/close cupboard, open/close drawer, open/close fridge, open/close oven, package X, peel, plug in/out, pour, pull out, puree, put in bowl, put in pan/pot, put on bread/dough, put on cutting-board, put on plate, read, remove from package, rip open, scratch off, screw close, screw open, shake, smell, spice, spread, squeeze, stamp, stir, strew, take & put in cupboard, take & put in drawer, take & put in fridge, take & put in oven, take & put in spice holder, take ingredient apart, take out from cupboard, take out from drawer, take out from fridge, take out from oven, take out from spice holder, taste, throw in garbage, unroll dough, wash hands, wash objects, whisk, wipe clean
|
||||
* labeled and segmented data: 2D body joint positions
|
||||
* [**J-HMDB**: "Joint-annotated Human Motion Data Base", 2013](http://jhmdb.is.tue.mpg.de/)
|
||||
<img src="figures/JHMDB-comparison-datasets.png" alt="Datasets" style="width: 400px;"/>
|
||||
* 21 scenarios: brush hair, catch, clap, climb stairs, golf, jump, kick ball, pick, pour, pull-up, push, run, shoot
|
||||
ball, shoot bow, shoot gun, sit, stand, swing baseball, throw, walk, wave
|
||||
* labeled and segmented data: 36-55 clips per action class with each clip containing 15-40 frames + 2D joint positions. 10 body parts connected by 13 joints (shoulder, elbow, wrist, hip, knee, ankle, neck) and two landmarks (face and belly).
|
||||
* [**Human 3.6M**: "Human3.6M: Large Scale Datasets and Predictive Methods for 3D Human Sensing in Natural Environments", 2014](http://vision.imar.ro/human3.6m/description.php)
|
||||
* 3.6 million 3D human poses and corresponding images
|
||||
* nb of subjects: 11
|
||||
* 15 scenarios: direction, discussion, eating, activitie while seated, greeting, taking photo, posing, making purchases, smoking, waiting, walking, sitting on chair, talking on the phone, walking dog, walking together
|
||||
* data: 3D joint positions and joint angles
|
||||
* [**UTD-MHAD**: "UTD-MHAD: A Multimodal Dataset for Human Action Recognition utilizing a Depth Camera and a Wearable Inertial Sensor", 2015](http://www.utdallas.edu/~kehtar/UTD-MHAD.html)
|
||||
* nb of subjects: 8
|
||||
* 27 different actions: (1) right arm swipe to the left, (2) right arm swipe to the right, (3) right hand wave, (4) two hand front clap, (5) right arm throw, (6) cross arms in the chest, (7) basketball shoot, (8) right hand draw x, (9) right hand draw circle (clockwise), (10) right hand draw circle (counter clockwise), (11) draw triangle, (12) bowling (right hand), (13) front boxing, (14) baseball swing from right, (15) tennis right hand forehand swing, (16) arm curl (two arms), (17) tennis serve, (18) two hand push, (19) right hand knock on door, (20) right hand catch an object, (21) right hand pick up and throw, (22) jogging in place, (23) walking in place, (24) sit to stand, (25) stand to sit, (26) forward lunge (left foot forward), (27) squat (two arms stretch out).
|
||||
* labeled and segmented data: 861 data sequences, 3D skeleton joint positions
|
||||
* [**G3D**: "G3D: A Gaming Action Dataset and Real Time Action Recognition Evaluation Framework", 2012](http://dipersec.king.ac.uk/G3D/index.html)
|
||||
* nb of subjects: 10
|
||||
* 20 gaming actions: punch right, punch left, kick right, kick left, defend, golf swing, tennis swing forehand, tennis swing backhand, tennis serve, throw bowling ball, aim and fire gun, walk, run, jump, climb, crouch, steer a car, wave, flap and clap
|
||||
* data: 3D joint positions
|
||||
* [**CMU-Datasets**](mocap.cs.cmu.edu/search.php)
|
||||
* dataset: very diverse, contains data such as sport activities (soccer, dancing, etc), everyday movements/activities, locomotion (walk/run, jump, etc), interaction with environment and other agents, human subjects imitating animal behaviors (such as snake, dog, chicken, etc), stretching, finegrained movements, and so on.
|
||||
* data: 3D joint positions and videos.
|
||||
* Others: MSRC-12 Kinect Gesture Datase, MPI HDM05 Motion Capture Database, MSR Action3D Database, VGG Human Pose Estimation datasets, etc.
|
||||
|
||||
|
||||
|
||||
### Python Code
|
||||
|
||||
The python code to load, parse, and plot (using animations) has been implemented for the following datasets:
|
||||
|
||||
* UTD-MHAD: see `utd-mhad.ipynb`
|
||||
* CMU-Datasets: see `cmu.ipynb`
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,338 @@
|
||||
# AST/ASF file generated using VICON BodyLanguage
|
||||
# -----------------------------------------------
|
||||
:version 1.10
|
||||
:name VICON
|
||||
:units
|
||||
mass 1.0
|
||||
length 0.45
|
||||
angle deg
|
||||
:documentation
|
||||
.ast/.asf automatically generated from VICON data using
|
||||
VICON BodyBuilder and BodyLanguage model FoxedUp or BRILLIANT.MOD
|
||||
:root
|
||||
order TX TY TZ RX RY RZ
|
||||
axis XYZ
|
||||
position 0 0 0
|
||||
orientation 0 0 0
|
||||
:bonedata
|
||||
begin
|
||||
id 1
|
||||
name lhipjoint
|
||||
direction 0.655637 -0.713449 0.247245
|
||||
length 2.52691
|
||||
axis 0 0 0 XYZ
|
||||
end
|
||||
begin
|
||||
id 2
|
||||
name lfemur
|
||||
direction 0.34202 -0.939693 0
|
||||
length 7.59371
|
||||
axis 0 0 20 XYZ
|
||||
dof rx ry rz
|
||||
limits (-160.0 20.0)
|
||||
(-70.0 70.0)
|
||||
(-60.0 70.0)
|
||||
end
|
||||
begin
|
||||
id 3
|
||||
name ltibia
|
||||
direction 0.34202 -0.939693 0
|
||||
length 7.28717
|
||||
axis 0 0 20 XYZ
|
||||
dof rx
|
||||
limits (-10.0 170.0)
|
||||
end
|
||||
begin
|
||||
id 4
|
||||
name lfoot
|
||||
direction 0.0886837 -0.243657 0.965798
|
||||
length 2.2218
|
||||
axis -90 7.62852e-016 20 XYZ
|
||||
dof rx rz
|
||||
limits (-45.0 90.0)
|
||||
(-70.0 20.0)
|
||||
end
|
||||
begin
|
||||
id 5
|
||||
name ltoes
|
||||
direction 1.53547e-011 -4.22004e-011 1
|
||||
length 1.11249
|
||||
axis -90 7.62852e-016 20 XYZ
|
||||
dof rx
|
||||
limits (-90.0 20.0)
|
||||
end
|
||||
begin
|
||||
id 6
|
||||
name rhipjoint
|
||||
direction -0.645062 -0.722004 0.250209
|
||||
length 2.49697
|
||||
axis 0 0 0 XYZ
|
||||
end
|
||||
begin
|
||||
id 7
|
||||
name rfemur
|
||||
direction -0.34202 -0.939693 0
|
||||
length 7.58734
|
||||
axis 0 0 -20 XYZ
|
||||
dof rx ry rz
|
||||
limits (-160.0 20.0)
|
||||
(-70.0 70.0)
|
||||
(-70.0 60.0)
|
||||
end
|
||||
begin
|
||||
id 8
|
||||
name rtibia
|
||||
direction -0.34202 -0.939693 0
|
||||
length 7.21538
|
||||
axis 0 0 -20 XYZ
|
||||
dof rx
|
||||
limits (-10.0 170.0)
|
||||
end
|
||||
begin
|
||||
id 9
|
||||
name rfoot
|
||||
direction -0.102907 -0.282735 0.953662
|
||||
length 2.23735
|
||||
axis -90 -7.62852e-016 -20 XYZ
|
||||
dof rx rz
|
||||
limits (-45.0 90.0)
|
||||
(-20.0 70.0)
|
||||
end
|
||||
begin
|
||||
id 10
|
||||
name rtoes
|
||||
direction -1.5354e-011 -4.21751e-011 1
|
||||
length 1.11569
|
||||
axis -90 -7.62852e-016 -20 XYZ
|
||||
dof rx
|
||||
limits (-90.0 20.0)
|
||||
end
|
||||
begin
|
||||
id 11
|
||||
name lowerback
|
||||
direction 0.00952301 0.997604 -0.0685217
|
||||
length 2.05943
|
||||
axis 0 0 0 XYZ
|
||||
dof rx ry rz
|
||||
limits (-20.0 45.0)
|
||||
(-30.0 30.0)
|
||||
(-30.0 30.0)
|
||||
end
|
||||
begin
|
||||
id 12
|
||||
name upperback
|
||||
direction 0.00494399 0.999577 -0.0286701
|
||||
length 2.06523
|
||||
axis 0 0 0 XYZ
|
||||
dof rx ry rz
|
||||
limits (-20.0 45.0)
|
||||
(-30.0 30.0)
|
||||
(-30.0 30.0)
|
||||
end
|
||||
begin
|
||||
id 13
|
||||
name thorax
|
||||
direction 0.000729686 0.999992 0.00388603
|
||||
length 2.06807
|
||||
axis 0 0 0 XYZ
|
||||
dof rx ry rz
|
||||
limits (-20.0 45.0)
|
||||
(-30.0 30.0)
|
||||
(-30.0 30.0)
|
||||
end
|
||||
begin
|
||||
id 14
|
||||
name lowerneck
|
||||
direction 0.00452882 0.995459 0.0950816
|
||||
length 1.57426
|
||||
axis 0 0 0 XYZ
|
||||
dof rx ry rz
|
||||
limits (-20.0 45.0)
|
||||
(-30.0 30.0)
|
||||
(-30.0 30.0)
|
||||
end
|
||||
begin
|
||||
id 15
|
||||
name upperneck
|
||||
direction 0.021922 0.997711 -0.0639762
|
||||
length 1.56399
|
||||
axis 0 0 0 XYZ
|
||||
dof rx ry rz
|
||||
limits (-20.0 45.0)
|
||||
(-30.0 30.0)
|
||||
(-30.0 30.0)
|
||||
end
|
||||
begin
|
||||
id 16
|
||||
name head
|
||||
direction 0.008024 0.999444 -0.0323691
|
||||
length 1.6265
|
||||
axis 0 0 0 XYZ
|
||||
dof rx ry rz
|
||||
limits (-20.0 45.0)
|
||||
(-30.0 30.0)
|
||||
(-30.0 30.0)
|
||||
end
|
||||
begin
|
||||
id 17
|
||||
name lclavicle
|
||||
direction 0.967826 0.247107 -0.0474446
|
||||
length 3.6598
|
||||
axis 0 0 0 XYZ
|
||||
dof ry rz
|
||||
limits (-20.0 10.0)
|
||||
(0.0 20.0)
|
||||
end
|
||||
begin
|
||||
id 18
|
||||
name lhumerus
|
||||
direction 1 -4.48971e-011 -2.90544e-027
|
||||
length 4.86513
|
||||
axis 180 -30 -90 XYZ
|
||||
dof rx ry rz
|
||||
limits (-60.0 90.0)
|
||||
(-90.0 90.0)
|
||||
(-90.0 90.0)
|
||||
end
|
||||
begin
|
||||
id 19
|
||||
name lradius
|
||||
direction 1 -4.48958e-011 1.79638e-026
|
||||
length 3.35554
|
||||
axis 180 -30 -90 XYZ
|
||||
dof rx
|
||||
limits (-10.0 170.0)
|
||||
end
|
||||
begin
|
||||
id 20
|
||||
name lwrist
|
||||
direction 1 -4.48952e-011 3.34345e-026
|
||||
length 1.67777
|
||||
axis -2.22354e-014 90 90 XYZ
|
||||
dof ry
|
||||
limits (-180.0 0.0)
|
||||
end
|
||||
begin
|
||||
id 21
|
||||
name lhand
|
||||
direction 1 -4.49055e-011 6.6869e-026
|
||||
length 0.661175
|
||||
axis -4.26681e-014 90 90 XYZ
|
||||
dof rx rz
|
||||
limits (-90.0 90.0)
|
||||
(-45.0 45.0)
|
||||
end
|
||||
begin
|
||||
id 22
|
||||
name lfingers
|
||||
direction 1 -4.48731e-011 1.33738e-025
|
||||
length 0.533057
|
||||
axis -8.53362e-014 90 90 XYZ
|
||||
dof rx
|
||||
limits (0.0 90.0)
|
||||
end
|
||||
begin
|
||||
id 23
|
||||
name lthumb
|
||||
direction 0.707107 -6.35005e-011 0.707107
|
||||
length 0.765366
|
||||
axis -90 45 2.85299e-015 XYZ
|
||||
dof rx rz
|
||||
limits (-45.0 45.0)
|
||||
(-45.0 45.0)
|
||||
end
|
||||
begin
|
||||
id 24
|
||||
name rclavicle
|
||||
direction -0.973174 0.211421 -0.0907389
|
||||
length 3.59444
|
||||
axis 0 0 0 XYZ
|
||||
dof ry rz
|
||||
limits (-10.0 20.0)
|
||||
(-20.0 0.0)
|
||||
end
|
||||
begin
|
||||
id 25
|
||||
name rhumerus
|
||||
direction -1 -4.48964e-011 1.56311e-027
|
||||
length 5.02649
|
||||
axis 180 30 90 XYZ
|
||||
dof rx ry rz
|
||||
limits (-90.0 60.0)
|
||||
(-90.0 90.0)
|
||||
(-90.0 90.0)
|
||||
end
|
||||
begin
|
||||
id 26
|
||||
name rradius
|
||||
direction -1 -4.48948e-011 2.01724e-026
|
||||
length 3.36431
|
||||
axis 180 30 90 XYZ
|
||||
dof rx
|
||||
limits (-10.0 170.0)
|
||||
end
|
||||
begin
|
||||
id 27
|
||||
name rwrist
|
||||
direction -1 -4.49008e-011 3.34345e-026
|
||||
length 1.68216
|
||||
axis -2.22354e-014 -90 -90 XYZ
|
||||
dof ry
|
||||
limits (-180.0 0.0)
|
||||
end
|
||||
begin
|
||||
id 28
|
||||
name rhand
|
||||
direction -1 -4.49013e-011 6.6869e-026
|
||||
length 0.730406
|
||||
axis -4.26681e-014 -90 -90 XYZ
|
||||
dof rx rz
|
||||
limits (-90.0 90.0)
|
||||
(-45.0 45.0)
|
||||
end
|
||||
begin
|
||||
id 29
|
||||
name rfingers
|
||||
direction -1 -4.48867e-011 1.33738e-025
|
||||
length 0.588872
|
||||
axis -8.53362e-014 -90 -90 XYZ
|
||||
dof rx
|
||||
limits (0.0 90.0)
|
||||
end
|
||||
begin
|
||||
id 30
|
||||
name rthumb
|
||||
direction -0.707107 -6.34907e-011 0.707107
|
||||
length 0.845506
|
||||
axis -90 -45 -2.85299e-015 XYZ
|
||||
dof rx rz
|
||||
limits (-45.0 45.0)
|
||||
(-45.0 45.0)
|
||||
end
|
||||
:hierarchy
|
||||
begin
|
||||
root lhipjoint rhipjoint lowerback
|
||||
lhipjoint lfemur
|
||||
lfemur ltibia
|
||||
ltibia lfoot
|
||||
lfoot ltoes
|
||||
rhipjoint rfemur
|
||||
rfemur rtibia
|
||||
rtibia rfoot
|
||||
rfoot rtoes
|
||||
lowerback upperback
|
||||
upperback thorax
|
||||
thorax lowerneck lclavicle rclavicle
|
||||
lowerneck upperneck
|
||||
upperneck head
|
||||
lclavicle lhumerus
|
||||
lhumerus lradius
|
||||
lradius lwrist
|
||||
lwrist lhand lthumb
|
||||
lhand lfingers
|
||||
rclavicle rhumerus
|
||||
rhumerus rradius
|
||||
rradius rwrist
|
||||
rwrist rhand rthumb
|
||||
rhand rfingers
|
||||
end
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,3 @@
|
||||
# CMU Dataset
|
||||
|
||||
* webpage (link to download the dataset): mocap.cs.cmu.edu/search.php
|
||||
@@ -0,0 +1,15 @@
|
||||
|
||||
Subject #2 (various expressions and human behaviors)
|
||||
|
||||
02_01 02_01.tvd 02_01.c3d 02_01.amc 02_01.avi walk
|
||||
02_02 02_02.tvd 02_02.c3d 02_02.amc 02_02.mpg 02_02.avi walk
|
||||
02_03 02_03.tvd 02_03.c3d 02_03.amc 02_03.mpg 02_03.avi run/jog
|
||||
02_04 02_04.tvd 02_04.c3d 02_04.amc 02_04.mpg 02_04.avi jump, balance
|
||||
02_05 02_05.tvd 02_05.c3d 02_05.amc 02_05.mpg 02_05.avi punch/strike
|
||||
02_06 02_06.tvd 02_06.c3d 02_06.amc 02_06.mpg 02_06.avi bend over, scoop up, rise, lift arm
|
||||
02_07 02_07.tvd 02_07.c3d 02_07.amc 02_07.mpg 02_07.avi swordplay
|
||||
02_08 02_08.tvd 02_08.c3d 02_08.amc 02_08.mpg 02_08.avi swordplay
|
||||
02_09 02_09.tvd 02_09.c3d 02_09.amc 02_09.mpg 02_09.avi swordplay
|
||||
02_10 02_10.tvd 02_10.c3d 02_10.amc 02_10.mpg 02_10.avi wash self
|
||||
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
The skeleton joint order in UTD-MAD dataset:
|
||||
|
||||
1. head;
|
||||
2. shoulder_center;
|
||||
3. spine;
|
||||
4. hip_center;
|
||||
5. left_shoulder;
|
||||
6. left_elbow;
|
||||
7. left_wrist;
|
||||
8. left_hand;
|
||||
9. right_shoulder;
|
||||
10. right_elbow;
|
||||
11. right_wrist;
|
||||
12. right_hand;
|
||||
13. left_hip;
|
||||
14. left_knee;
|
||||
15. left_ankle;
|
||||
16. left_foot;
|
||||
17. right_hip;
|
||||
18. right_knee;
|
||||
19. right_ankle;
|
||||
20. right_foot;
|
||||
|
||||
Each skeleton data is a 20 x 3 x num_frame matrix. Each row of a skeleton frame corresponds to three spatial coordinates of a joint.
|
||||
@@ -0,0 +1,3 @@
|
||||
# UTD-MHAD Dataset
|
||||
|
||||
* webpage (link to download the dataset): http://www.utdallas.edu/~kehtar/UTD-MHAD.html
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 90 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 108 KiB |
@@ -0,0 +1,230 @@
|
||||
import numpy as np
|
||||
from scipy.interpolate import CubicSpline
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
class MocapParser(object):
|
||||
|
||||
def __init__(self, filename):
|
||||
"""
|
||||
Parser for motion capture. By default, if the data is described in Cartesian space, the x-axis should
|
||||
be pointing in front of the human, the y-axis on his/her left, and z-axis upward.
|
||||
:param filename:
|
||||
"""
|
||||
self.filename = filename
|
||||
self.num_samples = 0
|
||||
self.joint_names = []
|
||||
self.link_names = []
|
||||
self.marker_names = []
|
||||
|
||||
self.data = self.loadFile(filename)
|
||||
|
||||
|
||||
def loadFile(self, filename):
|
||||
raise NotImplementedError("loadFile is not implemented.")
|
||||
|
||||
def interpolate(self, data, method='cubic', axis=-1)
|
||||
"""
|
||||
Interpolate the Mocap data such that it is between 0 and 1, along the given axis.
|
||||
|
||||
:param data: mocap data
|
||||
:param method: 'linear', 'cubic', 'hermite' interpolation
|
||||
:param axis: The axis on which to interpolate. The length should be equal to the number of samples in the
|
||||
mocap data
|
||||
:return: Interpolator - function that given the time [0,1] will give the corresponding data
|
||||
"""
|
||||
self.num_samples = data.shape[axis]
|
||||
x = np.linspace(0., 1., self.num_samples)
|
||||
interpolator = CubicSpline(x, self.data, axis=axis)
|
||||
return interpolator
|
||||
|
||||
def getMarkerName(self, marker_idx=None):
|
||||
if marker_idx is None:
|
||||
return self.getMarkerNames()
|
||||
else:
|
||||
return self.marker_names[marker_idx]
|
||||
|
||||
def getMarkerNames(self):
|
||||
return self.marker_names
|
||||
|
||||
def getJointName(self, joint_idx=None):
|
||||
if joint_idx is None:
|
||||
return self.getJointNames()
|
||||
else:
|
||||
return self.joint_names[joint_idx]
|
||||
|
||||
def getJointNames(self):
|
||||
return self.joint_names
|
||||
|
||||
def getLinkName(self, link_idx=None):
|
||||
if link_idx is None:
|
||||
return self.getLinkNames()
|
||||
else:
|
||||
return self.link_names[link_idx]
|
||||
|
||||
def getLinkNames(self):
|
||||
return self.link_names
|
||||
|
||||
def getMarkerPosition(self, marker_idx=None):
|
||||
if marker_idx is None:
|
||||
return self.getMarkerPositions()
|
||||
else:
|
||||
pass
|
||||
|
||||
def getMarkerPositions(self):
|
||||
pass
|
||||
|
||||
def getJointPosition(self, joint_idx=None):
|
||||
if joint_idx is None:
|
||||
return self.getJointPositions()
|
||||
else:
|
||||
pass
|
||||
|
||||
def getJointPositions(self):
|
||||
pass
|
||||
|
||||
def getJointVelocity(self, joint_idx=None):
|
||||
if joint_idx is None:
|
||||
return self.getJointVelocities()
|
||||
else:
|
||||
pass
|
||||
|
||||
def getJointVelocities(self):
|
||||
pass
|
||||
|
||||
def getLinkPosition(self, link_idx=None):
|
||||
if link_idx is None:
|
||||
return self.getLinkPositions()
|
||||
else:
|
||||
pass
|
||||
|
||||
def getLinkPositions(self):
|
||||
pass
|
||||
|
||||
def getLinkVelocity(self, link_idx=None):
|
||||
if link_idx is None:
|
||||
return self.getLinkVelocities()
|
||||
else:
|
||||
pass
|
||||
|
||||
def getLinkVelocities(self):
|
||||
pass
|
||||
|
||||
def getLinkOrientation(self, link_idx=None):
|
||||
if link_idx is None:
|
||||
return self.getLinkOrientations()
|
||||
else:
|
||||
pass
|
||||
|
||||
def getLinkOrientations(self):
|
||||
pass
|
||||
|
||||
def getLinkAngularVelocity(self, link_idx=None):
|
||||
if link_idx is None:
|
||||
return self.getLinkAngularVelocities()
|
||||
else:
|
||||
pass
|
||||
|
||||
def getLinkAngularVelocities(self):
|
||||
pass
|
||||
|
||||
|
||||
## Plotting ##
|
||||
def plot3d(self, ax=None):
|
||||
pass
|
||||
|
||||
def plotJointProfile(self, ax=None, joint_idx=None, pos=True, vel=True, acc=True):
|
||||
pass
|
||||
|
||||
def plotLinkProfile(self, ax=None, link_idx=None, pos=True, vel=True, acc=True, wrt='world'):
|
||||
pass
|
||||
|
||||
def plotMarkerProfile(self, ax=None, link_idx=None, pos=True, vel=True, acc=True, wrt='world'):
|
||||
pass
|
||||
|
||||
def animate3d(self, ax=None, title=None):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
from amcparser.skeleton import Skeleton
|
||||
from amcparser.motion import SkelMotion
|
||||
|
||||
class CMUMocapParser(MocapParser):
|
||||
|
||||
def __init__(self, skeleton_filename, motion_filename, skeleton_scale=1.0):
|
||||
super(CMUMocapParser, self).__init__(motion_filename)
|
||||
self.joint_names = ['head', 'upperneck', 'lowerneck', 'upperback', 'thorax', 'lowerback', 'root', # Spine
|
||||
'rclavicle', 'rhumerus', 'rradius', 'rwrist', 'rhand', 'rthumb', 'rfingers', # Right arm
|
||||
'lclavicle', 'lhumerus', 'lradius', 'lwrist', 'lhand', 'lthumb', 'lfingers', # Left arm
|
||||
'rhipjoint', 'rfemur', 'rtibia', 'rfoot', 'rtoes', # Right leg
|
||||
'lhipjoint', 'lfemur', 'ltibia', 'lfoot', 'ltoes'] # Left leg
|
||||
self.link_names = self.joint_names
|
||||
self.marker_names = self.joint_names
|
||||
self.base_name = 'root'
|
||||
|
||||
# Load skeleton
|
||||
self.skeleton = Skeleton(skeleton_filename, scale=skeleton_scale)
|
||||
|
||||
def loadFile(self, filename, framerate=120.):
|
||||
self.skeleton_motion = SkelMotion(self.skeleton, filename, (1./framerate))
|
||||
# compute trajectories
|
||||
#self.data = self.skeleton_motion.traverse(bone, start, end)
|
||||
self.data = self.skeleton_motion.traverse(None, 0, -1)
|
||||
# make sure that given axis
|
||||
|
||||
def animate3d(self, ax=None, title=None):
|
||||
if ax is None:
|
||||
fig = plt.figure()
|
||||
ax = fig.gca(projection='3d')
|
||||
|
||||
# Rescaling such that the skeleton it is in the right proportion and at the middle
|
||||
xmin, xmax = X[..., 2].min(), X[..., 2].max()
|
||||
ymin, ymax = X[..., 0].min(), X[..., 0].max()
|
||||
zmin, zmax = X[..., 1].min(), X[..., 1].max()
|
||||
x_len, y_len, z_len = (xmax - xmin), (ymax - ymin), (zmax - zmin)
|
||||
max_len = max([x_len, y_len, z_len])
|
||||
xmin, xmax = xmin + (x_len - max_len) / 2., xmin + (x_len + max_len) / 2.
|
||||
ymin, ymax = ymin + (y_len - max_len) / 2., ymin + (y_len + max_len) / 2.
|
||||
zmin, zmax = zmin + (z_len - max_len) / 2., zmin + (z_len + max_len) / 2.
|
||||
|
||||
# Plot trajectories
|
||||
x, y, z = skel.bones['rhand'].xyz_data.T
|
||||
T = len(x)
|
||||
|
||||
def init():
|
||||
ax.set_title('movement')
|
||||
ax.set_xlabel('x')
|
||||
ax.set_xlim(xmin, xmax)
|
||||
ax.set_ylabel('y')
|
||||
ax.set_ylim(ymin, ymax)
|
||||
ax.set_zlabel('z')
|
||||
ax.set_zlim(zmin, zmax)
|
||||
# ax.scatter(x[0], y[0], z[0], marker='o')
|
||||
return fig,
|
||||
|
||||
def animate(i):
|
||||
# ax.view_init(elev=10., azim=i)
|
||||
ax.scatter(x[i], y[i], z[i], marker='o')
|
||||
return fig,
|
||||
|
||||
def animate_skeleton(i):
|
||||
ax.clear()
|
||||
init()
|
||||
# ax.scatter(X[:,2,i], X[:,0,i], X[:,1,i], marker='o', c='b')
|
||||
for d in [X_TO, X_RA, X_LA, X_RL, X_LL]:
|
||||
ax.plot(d[:, i, 2], d[:, i, 0], d[:, i, 1], marker='o', c='b')
|
||||
return [fig] # fig,
|
||||
|
||||
# Animate
|
||||
# anim = animation.FuncAnimation(fig, animate, init_func=init,
|
||||
# frames=T, interval=20, blit=True)
|
||||
anim = animation.FuncAnimation(fig, animate_skeleton, init_func=init,
|
||||
frames=T, interval=20, blit=False)
|
||||
|
||||
plt.show()
|
||||
|
||||
|
||||
# Test
|
||||
if __name__ == "__main__":
|
||||
pass
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,4 @@
|
||||
# HWRT Database of Handwritten symbols
|
||||
|
||||
* webpage: www.martin-thoma.de/write-math/data/
|
||||
* link to download the dataset: i13pc106.ira.uka.de/~mthoma/hwrt/2015-01-28-data.tar
|
||||
@@ -0,0 +1,7 @@
|
||||
# IAM Online Handwriting Database
|
||||
|
||||
* webpage: www.fki.inf.unibe.ch/databases/iam-on-line-handwriting-database
|
||||
* link to download the dataset: http://www.fki.inf.unibe.ch/databases/iam-on-line-handwriting-database/download-the-iam-on-line-handwriting-database
|
||||
|
||||
Note that you need to register in order to download the datasets.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# ICDAR2013 - Handwriting Stroke Recovery from Offline Data (Kaggle)
|
||||
|
||||
* webpage: https://www.kaggle.com/c/icdar2013-stroke-recovery-from-offline-data
|
||||
* link to download the dataset: https://www.kaggle.com/c/icdar2013-stroke-recovery-from-offline-data/data
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
## Online Handwritten Datasets
|
||||
|
||||
This repo contains the python code to load, parse and plot online handwritten characters.
|
||||
|
||||
In this folder, I focus on the following datasets:
|
||||
|
||||
1. Character Trajectories Data Set (2,858): https://archive.ics.uci.edu/ml/datasets/Character+Trajectories
|
||||
2. UJI Pen Characters (V2) Data Set (11,640): archive.ics.uci.edu/ml/datasets/UJI+Pen+Characters+(Version+2)
|
||||
3. HWRT Database of Handwritten symbols: www.martin-thoma.de/write-math/data/
|
||||
4. ICDAR2013 - Handwriting Stroke Recovery from Offline Data (Kaggle): https://www.kaggle.com/c/icdar2013-stroke-recovery-from-offline-data
|
||||
5. IAM Online Handwriting Database: www.fki.inf.unibe.ch/databases/iam-on-line-handwriting-database
|
||||
|
||||
|
||||
There are of course other datasets (mostly offline) that could be used such as:
|
||||
|
||||
* MNIST dataset (Offline)
|
||||
* NIST Handprinted Forms and Characters Database (Offline)
|
||||
* The IRESTE On/Off Dual Handwriting Database (75€): www.irccyn.ec-nantes.fr/~viardgau/IRONOFF/ICDAR99.htm
|
||||
* UCI online datasets:
|
||||
* Online Handwritten Assamese Characters Dataset (8,235): archive.ics.uci.edu/ml/datasets/Online+Handwritten+Assamese+Characters+Dataset
|
||||
* Pen-Based Recognition of Handwritten Digits Dataset (10,992): archive.ics.uci.edu/ml/datasets/Pen-Based+Recognition+of+Handwritten+Digits
|
||||
* CASIA online and offline chinese handwriting Databases: www.nlpr.ia.ac.cn/databases/handwriting/Online_database.html
|
||||
* CEDAR Handwriting (Offline)
|
||||
|
||||
|
||||
## How to use it?
|
||||
|
||||
The whole python code to load and parse the different datasets is inside the jupyter notebook `handwritten-data.ipynb`. To open the jupyter notebook, you will first need to install jupyter. For each dataset, I plotted 25 random samples to give you a general feeling about the dataset. You will need to download the dataset that you which to use (and put it in the corresponding folder if you do not wish to modify the python code).
|
||||
|
||||
|
||||
## FAQs
|
||||
|
||||
* What is the meaning of 'online'? Online in this case means that you also have the trajectories (x,y), while offline would mean that you only have pictures of handwritten characters/words/sentences.
|
||||
|
||||
* Do I need to cite the dataset that I am using? Yes, you should cite the corresponding paper which can usually be found on the website where you downloaded the dataset.
|
||||
|
||||
* For what can I use these datasets? Mostly for demonstration / supervised learning. You could, for instance, use one of the following models to learn the trajectories: Gaussian Processes, Gaussian Mixture Models, Hidden Markov Models, (Deep) Neural Networks, Dynamic Movement Primitives, etc.
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
# Character Trajectories Data Set
|
||||
|
||||
* webpage: https://archive.ics.uci.edu/ml/datasets/Character+Trajectories
|
||||
* link to download the dataset: https://archive.ics.uci.edu/ml/machine-learning-databases/character-trajectories/
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
# UJI Pen Characters (V2) Data Set
|
||||
|
||||
* webpage: archive.ics.uci.edu/ml/datasets/UJI+Pen+Characters+(Version+2)
|
||||
* link to download the dataset: http://archive.ics.uci.edu/ml/machine-learning-databases/uji-penchars/version2/
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user