add data to training set

The provided train data may not sufficient to get good pose recognization results. In case the pose is not recognized correctly, this data can be manually added to the train data.

Defined Poses

  • Stand: the weight is supported by the feet and the torso is upright.
  • StandInit: the torso is upright, and legs are bended (be ready to walk)
  • Sitting: the buttock is in contact with the ground and the torso is upright.
  • Crouch: sit on its feet
  • Belly: fall, stretched and facing down
  • Back: fall, stretched and facing up
  • Forg: fall, facing down with the trunk lifted.
  • HeadBack: fall, facing up with the trunk lifted.
  • Left: fall and facing to its left side
  • Right: fall and facing to its right side

There are images in robot_pose_image folder as examples for predefined poses.


In [7]:
%pylab inline
imshow(imread('robot_pose_image/Stand.png'))


Populating the interactive namespace from numpy and matplotlib
Out[7]:
<matplotlib.image.AxesImage at 0x7fa1552dca90>

Load avaiable data


In [8]:
import pickle
from os import path

pose_name = 'Back'
data_file = path.join('robot_pose_data', pose_name)
data = pickle.load(open(data_file))

In [9]:
print data


[[-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7180380821228027, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8945322036743164, -0.008992496877908707, -1.516520619392395], [-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7180380821228027, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8960661888122559, -0.006883446592837572, -1.5203558206558228], [-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7165040969848633, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8945322036743164, -0.006883446592837572, -1.520164132118225], [-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7165040969848633, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8945322036743164, -0.007075135130435228, -1.5199724435806274], [-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7165040969848633, -0.05058002471923828, -0.1487560272216797, -0.9296460151672363, 1.8945322036743164, -0.007266823668032885, -1.5199724435806274], [-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7180380821228027, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8945322036743164, -0.007266823668032885, -1.5197802782058716], [-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7165040969848633, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8945322036743164, -0.006883446592837572, -1.5216976404190063], [-0.05058002471923828, -0.22852396965026855, -0.8298521041870117, 1.7165040969848633, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8960661888122559, -0.008992496877908707, -1.5134526491165161], [-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7165040969848633, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8960661888122559, -0.008992496877908707, -1.5161372423171997], [-0.05058002471923828, -0.2269899845123291, -0.8298521041870117, 1.7180380821228027, -0.05058002471923828, -0.1487560272216797, -0.9311800003051758, 1.8945322036743164, -0.009951416403055191, -1.5161372423171997], [0, 0, 0, 0, 0, 0, 0, 0, 0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966], [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, -1.5707963267948966]]

Add new data


In [10]:
new_data = [0, 0, 0, 0, 0, 0, 0, 0, 0, -1.5707963267948966]
data.append(new_data)
pickle.dump(data, open(data_file, 'w'))

Now, you have to retrain your classifier learn_posture.ipynb again.


In [ ]: