DanielTakeshi / gym-cloth

Code for IROS 2020 paper: https://arxiv.org/abs/1910.04854
26 stars 11 forks source link

Data Generation for RGBD #2

Open DanielTakeshi opened 4 years ago

DanielTakeshi commented 4 years ago

How to Generate Data for RGBD Training, w/Domain Randomization

After 9ad4ba463b3ee02e451d0c45e288068221b06f44 I ran:

python examples/analytic.py oracle --max_episodes=5 --seed=1337 --tier=2

to get episodes in

logs/demos-2020-02-09-15-59-pol-oracle-seed-1337-obs-blender-depth-False-rgbd-True-tier2_epis_5.pkl

The images in /tmp/blender will be 224x224. To see what the neural net would get, we can resize.

Then I ran:

python analysis/check_demo_data.py

to get these episodes, these are correctly 100x100 and have noise injected, etc:

First ep:

img_resized_ep_000_t_00_rew_-0 0_act_-0 11_0 17_0 50_0 37_c img_resized_ep_000_t_01_rew_0 1_act_0 08_0 99_-0 48_0 00_c img_resized_ep_000_t_02_rew_0 1_act_-0 37_-0 15_-0 28_-0 38_c img_resized_ep_000_t_03_rew_0 1_act_0 24_-0 82_0 34_-0 08_c img_resized_ep_000_t_04_rew_5 1_act_-0 72_-0 43_-0 13_-0 26_c img_resized_ep_000_t_05_lastobs_c

img_resized_ep_000_t_00_rew_-0 0_act_-0 11_0 17_0 50_0 37_d img_resized_ep_000_t_01_rew_0 1_act_0 08_0 99_-0 48_0 00_d img_resized_ep_000_t_02_rew_0 1_act_-0 37_-0 15_-0 28_-0 38_d img_resized_ep_000_t_03_rew_0 1_act_0 24_-0 82_0 34_-0 08_d img_resized_ep_000_t_04_rew_5 1_act_-0 72_-0 43_-0 13_-0 26_d img_resized_ep_000_t_05_lastobs_d

Second:

img_resized_ep_001_t_00_rew_0 3_act_0 00_-0 29_-0 45_-0 32_c img_resized_ep_001_t_01_rew_5 1_act_-0 30_0 66_-0 32_0 15_c img_resized_ep_001_t_02_lastobs_c

img_resized_ep_001_t_00_rew_0 3_act_0 00_-0 29_-0 45_-0 32_d img_resized_ep_001_t_01_rew_5 1_act_-0 30_0 66_-0 32_0 15_d img_resized_ep_001_t_02_lastobs_d

Third:

img_resized_ep_002_t_00_rew_0 0_act_0 10_-0 35_-0 50_-0 29_c img_resized_ep_002_t_01_rew_0 1_act_0 39_-1 05_0 27_0 02_c img_resized_ep_002_t_02_rew_0 1_act_-0 51_0 72_-0 22_0 13_c img_resized_ep_002_t_03_rew_5 1_act_0 62_0 61_0 17_0 18_c img_resized_ep_002_t_04_lastobs_c

img_resized_ep_002_t_00_rew_0 0_act_0 10_-0 35_-0 50_-0 29_d img_resized_ep_002_t_01_rew_0 1_act_0 39_-1 05_0 27_0 02_d img_resized_ep_002_t_02_rew_0 1_act_-0 51_0 72_-0 22_0 13_d img_resized_ep_002_t_03_rew_5 1_act_0 62_0 61_0 17_0 18_d img_resized_ep_002_t_04_lastobs_d

Fourth:

img_resized_ep_003_t_00_rew_0 2_act_-0 00_0 38_0 45_0 28_c img_resized_ep_003_t_01_rew_5 1_act_0 39_-0 55_0 27_-0 20_c img_resized_ep_003_t_02_lastobs_c

img_resized_ep_003_t_00_rew_0 2_act_-0 00_0 38_0 45_0 28_d img_resized_ep_003_t_01_rew_5 1_act_0 39_-0 55_0 27_-0 20_d img_resized_ep_003_t_02_lastobs_d

Fifth:

img_resized_ep_004_t_00_rew_-0 2_act_-0 05_0 56_0 47_0 20_c img_resized_ep_004_t_01_rew_0 1_act_-0 14_1 13_-0 39_-0 06_c img_resized_ep_004_t_02_rew_0 2_act_-0 60_-0 34_-0 18_-0 30_c img_resized_ep_004_t_03_rew_-0 0_act_0 75_-0 46_0 11_-0 25_c img_resized_ep_004_t_04_rew_0 0_act_0 66_0 46_0 15_0 24_c img_resized_ep_004_t_05_rew_0 1_act_-0 49_0 88_-0 23_0 05_c img_resized_ep_004_t_06_rew_5 1_act_-0 68_-0 79_-0 14_-0 09_c img_resized_ep_004_t_07_lastobs_c

img_resized_ep_004_t_00_rew_-0 2_act_-0 05_0 56_0 47_0 20_d img_resized_ep_004_t_01_rew_0 1_act_-0 14_1 13_-0 39_-0 06_d img_resized_ep_004_t_02_rew_0 2_act_-0 60_-0 34_-0 18_-0 30_d img_resized_ep_004_t_03_rew_-0 0_act_0 75_-0 46_0 11_-0 25_d img_resized_ep_004_t_04_rew_0 0_act_0 66_0 46_0 15_0 24_d img_resized_ep_004_t_05_rew_0 1_act_-0 49_0 88_-0 23_0 05_d img_resized_ep_004_t_06_rew_5 1_act_-0 68_-0 79_-0 14_-0 09_d img_resized_ep_004_t_07_lastobs_d

All right seems reasonable. Now let's scale this up. DON'T FORGET TO python setup.py install BEFOREHAND!!

python examples/analytic.py oracle --max_episodes=400 --seed=1336 --tier=1
python examples/analytic.py oracle --max_episodes=400 --seed=1337 --tier=1
python examples/analytic.py oracle --max_episodes=400 --seed=1338 --tier=1
python examples/analytic.py oracle --max_episodes=400 --seed=1339 --tier=1
python examples/analytic.py oracle --max_episodes=400 --seed=1340 --tier=1

python examples/analytic.py oracle --max_episodes=400 --seed=1336 --tier=2
python examples/analytic.py oracle --max_episodes=400 --seed=1337 --tier=2
python examples/analytic.py oracle --max_episodes=400 --seed=1338 --tier=2
python examples/analytic.py oracle --max_episodes=400 --seed=1339 --tier=2
python examples/analytic.py oracle --max_episodes=400 --seed=1340 --tier=2

python examples/analytic.py oracle --max_episodes=400 --seed=1336 --tier=3
python examples/analytic.py oracle --max_episodes=400 --seed=1337 --tier=3
python examples/analytic.py oracle --max_episodes=400 --seed=1338 --tier=3
python examples/analytic.py oracle --max_episodes=400 --seed=1339 --tier=3
python examples/analytic.py oracle --max_episodes=400 --seed=1340 --tier=3

[I copied the data all to be on Triton4 and Mason ... and should do another machine soon just in case.]

Update: all the datasets are available on Triton4:

(py3-iros-2020) seita@triton4:~/gym-cloth (master) $ python analysis/combine_demo_data.py
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1336-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1337-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1338-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1339-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1340-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
saving at logs/demos-2020-02-09-16-31-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier1_epis_2000_COMBO.pkl, len 2000
(py3-iros-2020) seita@triton4:~/gym-cloth (master) $ python analysis/combine_demo_data.py
  just loaded demos-2020-02-10-15-00-pol-oracle-seed-1336-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-01-pol-oracle-seed-1337-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-01-pol-oracle-seed-1338-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-02-pol-oracle-seed-1339-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-02-pol-oracle-seed-1340-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
saving at logs/demos-2020-02-10-15-02-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier2_epis_2000_COMBO.pkl, len 2000
(py3-iros-2020) seita@triton4:~/gym-cloth (master) $ python analysis/combine_demo_data.py
  just loaded demos-2020-02-10-15-04-pol-oracle-seed-1336-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-04-pol-oracle-seed-1337-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-04-pol-oracle-seed-1338-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-04-pol-oracle-seed-1339-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-05-pol-oracle-seed-1340-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
saving at logs/demos-2020-02-10-15-05-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier3_epis_2000_COMBO.pkl, len 2000
(py3-iros-2020) seita@triton4:~/gym-cloth (master) $

Data Statistics

Currently these are 1.1G, 1.9G, and 2.2G, respectively, for the three tiers:

demos-2020-02-09-16-31-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier1_epis_2000_COMBO.pkl
demos-2020-02-10-15-02-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier2_epis_2000_COMBO.pkl
demos-2020-02-10-15-05-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier3_epis_2000_COMBO.pkl

And then running the analysis script analysis/check_demo_data.py I am getting this for T1:

loaded data, length (i.e., episodes) 2000
episode lengths (wrt t): max / min / mean: 6.0 / 1.0 / 1.80 +/- 0.8
num_oob: 0
num_tear: 0
num coverage below 0.9: 0
total transitions: 3599
coverage at start: 78.0 +/- 7.1
coverage at end:   95.6 +/- 2.1
inv-var at start:  0.962 +/- 0.5
inv-var at end:    11.582 +/- 41.6
actions, len 14396, max 1.423, min -1.316, mean -0.008

average values across three channels
  chan. 1: 157.9 +/- 69.0
  chan. 2: 107.7 +/- 32.0
  chan. 3: 78.7 +/- 14.2

and this for T2:

loaded data, length (i.e., episodes) 2000
episode lengths (wrt t): max / min / mean: 10.0 / 1.0 / 3.94 +/- 2.0
num_oob: 6
num_tear: 0
num coverage below 0.9: 51
total transitions: 7878
coverage at start: 57.5 +/- 6.1
coverage at end:   94.5 +/- 5.1
inv-var at start:  0.745 +/- 0.1
inv-var at end:    10.177 +/- 14.0
actions, len 31512, max 1.312, min -1.333, mean 0.001

average values across three channels
  chan. 1: 155.5 +/- 66.6
  chan. 2: 110.5 +/- 34.6
  chan. 3: 85.0 +/- 19.6

and this for T3:

loaded data, length (i.e., episodes) 2000
episode lengths (wrt t): max / min / mean: 10.0 / 1.0 / 4.64 +/- 1.1
num_oob: 3
num_tear: 0
num coverage below 0.9: 7
total transitions: 9276
coverage at start: 41.2 +/- 3.4
coverage at end:   95.0 +/- 2.7
inv-var at start:  0.231 +/- 0.1
inv-var at end:    9.329 +/- 15.4
actions, len 37104, max 1.247, min -1.263, mean -0.001

average values across three channels
  chan. 1: 151.9 +/- 65.5
  chan. 2: 113.1 +/- 37.0
  chan. 3: 90.5 +/- 24.5

Makes sense! Similar to results that I was getting before.

Now the next step is to start training ...

DanielTakeshi commented 4 years ago

Update September 2020: the file doesn't accept --tier as an argument. Pass in the appropriate tier based on the cfg/ file.

In the cfg file, you can change the num_width_points and num_height_points. However, will that change downstream code? The config file tells me to keep them the same. :D

DanielTakeshi commented 3 years ago

Update October 2020: the three files:

demos-2020-02-09-16-31-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier1_epis_2000_COMBO.pkl
demos-2020-02-10-15-02-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier2_epis_2000_COMBO.pkl
demos-2020-02-10-15-05-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier3_epis_2000_COMBO.pkl

are available on the project website for download: https://sites.google.com/view/fabric-smoothing/home