YunzhuLi/CompositionalKoopmanOperators

blank videos when using eval.py

stephentu opened this issue · 3 comments

Hi,

Running the following command

  --env Rope \
  --pstep 2 \
  --g_dim 32 \
  --len_seq 64 \
  --I_factor 10 \
  --fit_type structured \
  --fit_num 8 \
  --eval_set demo \
  --baseline

I get the following log

Loading chipmunk for Darwin (64bit) [/Users/stephentu/anaconda3/lib/python3.7/site-packages/pymunk/libchipmunk.dylib]
===== Experiment Configuration =====
env: Rope
dt: 0.02
pstep: 2
nf_relation: 120
nf_particle: 100
nf_effect: 100
g_dim: 32
fit_type: structured
attr_dim: 2
state_dim: 4
action_dim: 1
relation_dim: 8
baseline: True
baseline_order: 3
dataf: data/data_Rope
regular_data: 0
num_workers: 10
gen_data: 0
gen_stat: 1
group_size: 25
outf: dump_Rope/train_Rope_KoopmanBaseline_demo
lr: 0.0001
batch_size: 8
grad_clip: 5.0
n_epoch: 1000
beta1: 0.9
log_per_iter: 100
ckp_per_iter: 1000
resume_epoch: -1
resume_iter: -1
lambda_loss_metric: 0.3
len_seq: 64
I_factor: 10.0
fit_num: 8
eval: 0
evalf: dump_Rope/eval_Rope_KoopmanBaseline_demo
eval_type: koopman
eval_epoch: -1
eval_iter: -1
eval_set: demo
shootf: dump_Rope/shoot_Rope_KoopmanBaseline_demo
optim_iter_init: 100
optim_iter: 10
optim_type: qp
feedback: 1
shoot_set: valid
roll_start: 0
roll_step: 40
shoot_epoch: -1
shoot_iter: -1
data_names: ['attrs', 'states', 'actions']
n_rollout: 10000
train_valid_ratio: 0.9
time_step: 101
param_dim: 5
n_splits: 5
num_obj_range: [5, 6, 7, 8, 9]
extra_num_obj_range: [10, 11, 12, 13, 14]
act_scale: 2.0
demo: True
tmpf: dump_Rope/tmp
stat_path: data/data_Rope/stat_demo.h5
====================================
Load stored dataset statistics from data/data_Rope/stat_demo.h5!

=== Forward Simulation on Example 0 ===
Save video as dump_Rope/eval_Rope_KoopmanBaseline_demo/0.pred.avi

=== Forward Simulation on Example 25 ===
Save video as dump_Rope/eval_Rope_KoopmanBaseline_demo/25.pred.avi

=== Forward Simulation on Example 50 ===
Save video as dump_Rope/eval_Rope_KoopmanBaseline_demo/50.pred.avi

=== Forward Simulation on Example 75 ===
Save video as dump_Rope/eval_Rope_KoopmanBaseline_demo/75.pred.avi

=== Forward Simulation on Example 100 ===
Save video as dump_Rope/eval_Rope_KoopmanBaseline_demo/100.pred.avi

=== Forward Simulation on Example 125 ===
Save video as dump_Rope/eval_Rope_KoopmanBaseline_demo/125.pred.avi

=== Forward Simulation on Example 150 ===
Save video as dump_Rope/eval_Rope_KoopmanBaseline_demo/150.pred.avi

=== Forward Simulation on Example 175 ===
Save video as dump_Rope/eval_Rope_KoopmanBaseline_demo/175.pred.avi

However when I open the *.avi files, the videos are just a white canvas (no rope is visible). I tried opening them both in Quicktime and VLC.

A dump of my conda list is here: https://gist.github.com/stephentu/8f06f674905c2cb885708cbd97ec503a

Any tips on how to debug this? Thanks

Hi Stephen,

I'm guessing you are running the code using an OSX machine, as I've encountered the same issue when I tested on a MAC.

One thing you can try is to change image=False into image=True at this line. Then you will be able to generate a folder at dump_{env}/eval_{env}_CKO_demo/ containing all the image frames illustrating the results. Then you can use other tools, e.g., ffmpeg, to transform the images into the resulting video.

The code for rendering the rope environment is here. For setting up the video writer (link), the combination of avi and 'M', 'J', 'P', 'G' works on my Ubuntu machine, but does not work on my MAC. I've tried some other combinations of the file extension and fourcc, but did not succeed. Let me know if you have some other solutions.

Best,
Yunzhu

I've changed the code by setting image=True as the default option. Now, the code will generate the results also in the form of images.

Thank you @YunzhuLi , I was able to render a video by using ffmpeg on the images.