Commit 92b02f36 authored by Nikos Athanasiou's avatar Nikos Athanasiou
Browse files

cahnges to readme,few stuff to rendering also

parent 58060523
......@@ -68,22 +68,10 @@ Explore `configs/train.yaml` to change some basic things like where you want
your output stored, which data you want to choose if you want to do a small
experiment on a subset of the data etc.
For BABEL:
`python train.py data=babel-amass`
For KIT:
`python train.py data=kit-mmm-xyz`
## GENERATE SAMPLES
For sampling do. KIT case:
[TO-FIX?]
` python sample.py folder=/is/cluster/nathanasiou/experimentals/teach/kit-mmm-xyz/baseline/2awlfcm9`
BABEL case:
For sampling do.
`python sample.py folder=/is/cluster/work/nathanasiou/experiments/teach/babel-amass/babel-full/rot-5secs-full-sched-lr number_of_samples=3 fact=1.1`
`python sample_seq.py folder=/path/to/experiment align=full slerp_ws=8`
In general it is: `folder_our/<project>/<dataname_config>/<experimet>/<run_id>`
......@@ -131,16 +119,6 @@ For fast rendering(less than 30" / per video):
`python render_video_fast.py dim=2 folder=/ps/scratch/nathanasiou/oracle_experiments/kit-temos-version/1v6vh9w2/path/to/npys/files`
check `dim` parameter for 2d/3d rendering.
``` python interact.py folder=/is/cluster/work/nathanasiou/experiments/teach/kit-mmm-xyz/debug-exps/kit-pos-mmm input=/home/nathanasiou/Desktop/conditional_action_gen/commands.txt output=/home/nathanasiou/Desktop/interactions/ dim=2```
`text-prompt.txt` is a file that looks likes:
```
walk forward
kick
```
and check the durs key in the configuration to add durations. You can do `durs='[<dur1_in_secs>, <dur2_in_secs>, ...]'`. The video outputs will be saved in the absolute output directory.
Your experiments will be always structured like this(see `train.yaml`):
......@@ -152,5 +130,3 @@ Your experiments will be always structured like this(see `train.yaml`):
`/is/cluster/work/nathanasiou/blender/blender-3.1.2-linux-x64/3.1/python/bin » ./python3.10 -m pip install moviepy`
`blender or cluster_blender --background --python render.py -- npy=path/to/file.npy`
`python cluster/single_run.py --folder /some/folder/path/or/file --mode render --bid 100`
## VISUALS QUICK
`python render_video_fast.py folder=/is/cluster/work/nathanasiou/experiments/teach/babel-amass/teach-post-submission/joint slerp=false jointstype=joints mode=free-text`
\ No newline at end of file
from dataclasses import asdict
import subprocess
from pathlib import Path
import sys
from loguru import logger
import glob
v=True
def end_script():
from inspect import currentframe, getframeinfo
frameinfo = getframeinfo(currentframe())
sys.exit(f'Exited after line {frameinfo.filename} {frameinfo.lineno}')
def run(cmd):
logger.info(f"Executing: {' '.join(cmd)}")
x = subprocess.call(cmd)
# teach/independent sampling
voutdir = "./for_site/videos"
ioutdir = "./for_site/images"
outdir = "./for_site/"
prompts = [('[stand with bent knees, kick with right leg, kick with left foot]', '[0.7, 1.2, 2.3]'),
('[jump with left foot, walk backwards, crawl]', '[1.5, 1.5, 2]'),
('[jump forwards, walk with knees bent, sit down]', '[2.1, 2.8, 2]'),
('[jump with left foot, walk forwards, sit down]', '[1.5, 2.5, 2]'),
('[walk like a drunk, stumble over something, fall down]', '[1.9, 1.2, 1.4]'),
('[hop forward, squat down, crouch, lay on a bench]', '[2, 1.5, 1.9, 2.5]'),
('[pick an object from the ground, carry object, lift object with right hand, put object on table]', '[1.5, 1.1, 1.2, 1]'),
('[pick an object from the ground, lift object with right hand, put object on the ground]', '[1.5, 1.1, 1.2]'),
('[balance on two feet, perform yoga pose, stretch arms, step forward with left foot]', '[2.8, 1.8, 1.8, 1.2]'),
('[scratch head with right hand, limp forward, turn around, knock, open the door]', '[0.8, 2.5, 1.1, 1, 1.5]'),
('[walk backwards, grab item with left hand, prepare drink, drink]', '[2.1, 1.1, 3.1, 1.5]'),
('[right side lunges, left side lunges]', '[1.5, 1.9]'),
('[hold golf club while look at the ground, swing golf club, jog forward, kneel down]', '[0.8, 1.4, 1.2, 1.3]'),
('[punches with right hand,punches with left hand, kung fu pose, sidekick motion with right foot]', '[1, 1, 1.2, 1.2]'),
('[rolls left ankle in front of body, swings full left leg forwards and backwards in front of body]', '[2.8, 3.2]'),
('[rotate neck, swing left leg in and out]', '[1.4, 4.9]'),
('[throw ball, catch ball with left hand, toss ball with left hand, drop ball in front of right foot]', '[1.2, 1.3, 1.2,0.8]'),
('[grab ball with both hands, bounce basketball, shoots basketball]', '[0.7,1.6,1.2]'),
('[step back, shoot basketball, run forwards]', '[2, 2, 2.1]'),
('[walk on toes, turn right,lie down on floor]', '[3,1,2.1]'),
('[step on the left, sit down, play the piano]', '[1.1, 1.2, 1.1]'),
('[play an instrument, nod head, wave right arm]', '[1, 0.3, 1]'),
('[stretch to side bend over, stretch head, play violin]', '[1.9, 1.6, 2.8]'),
('[wave left hand, raise right hand, step to the right, walk in a circle, sit down, stand up, hop over obstacle]', '[1.1, 1.2, 1.5, 2.5, 1.8,1, 1.9]'),
('[jump backwards, jump forwards, roll right arm, spin arms in circles]', '[1, 1.2, 1.6, 1.7]'),
('[lift object up, spin arms, jump spin]', '[1.7, 1.6, 1.2]'),
('[walk up stairs, walk down stairs backwards, climb up]', '[1.2, 1.1, 1.3]')]
exp_path='/is/cluster/work/nathanasiou/experiments/teach-post-submission-29Aug/teach-hf-5-motion_branch_true-teacher_force_false/'
nos = 3
for i, (text, dur) in enumerate(prompts):
for j in range(nos):
cmd = ['python', 'interact_teach.py', f'folder={exp_path}', f'output={outdir}/example-{i}', 'samples=3', f'texts={text}', f'durs={dur}']
run(cmd)
......@@ -6,6 +6,8 @@ from omegaconf import DictConfig, OmegaConf
from torch.utils.data import DataLoader
import teach.launch.prepare # noqa
from hydra.utils import get_original_cwd
from teach.render.video import save_video_samples
from teach.render.mesh_viz import visualize_meshes
import torch
from tqdm import tqdm
import pytorch_lightning as pl
......@@ -68,8 +70,8 @@ def interact(newcfg: DictConfig) -> None:
np.save(f'{cfg.output}_sample-{index}.npy',
{'motion': motion.numpy(), 'text': texts, 'lengths': lengths} )
logger.info(f"The motion is saved there: {cfg.output}")
vid_ = visualize_meshes(motion.numpy())
save_video_samples(vid_, {cfg.output}_sample-{index}, texts, fps=30)
if __name__ == '__main__':
......
<table border="1" class="dataframe table table-striped text-center">
<thead>
<tr>
<th></th>
<th colspan="4" halign="left">APE</th>
<th colspan="4" halign="left">AVE</th>
</tr>
<tr>
<th></th>
<th>root</th>
<th>traj</th>
<th>mean_pose</th>
<th>mean_joints</th>
<th>root</th>
<th>traj</th>
<th>mean_pose</th>
<th>mean_joints</th>
</tr>
</thead>
<tbody>
<tr>
<th>teach-hf-1-MB_true-TF_false_samples_slerp_aligned_pairs</th>
<td>0.72473</td>
<td>0.70423</td>
<td>0.16000</td>
<td>0.76577</td>
<td>0.22169</td>
<td>0.21994</td>
<td>0.01488</td>
<td>0.23417</td>
</tr>
<tr>
<th>teach-hf-2-MB_true-TF_false_samples_slerp_aligned_pairs</th>
<td>0.72679</td>
<td>0.70724</td>
<td>0.15854</td>
<td>0.76652</td>
<td>0.23637</td>
<td>0.23467</td>
<td>0.01471</td>
<td>0.24833</td>
</tr>
<tr>
<th>teach-hf-5-MB_true-TF_false_samples_slerp_aligned_pairs</th>
<td>0.67369</td>
<td>0.65404</td>
<td>0.15908</td>
<td>0.71672</td>
<td>0.22215</td>
<td>0.22048</td>
<td>0.01464</td>
<td>0.23427</td>
</tr>
<tr>
<th>teach-hf-10-MB_true-TF_false_samples_slerp_aligned_pairs</th>
<td>0.71766</td>
<td>0.69825</td>
<td>0.15725</td>
<td>0.75847</td>
<td>0.23839</td>
<td>0.23671</td>
<td>0.01448</td>
<td>0.25040</td>
</tr>
</tbody>
</table>
\ No newline at end of file
......@@ -223,6 +223,9 @@ def render(npydata, frames_folder, *, mode, faces_path,
render_current_frame(f'{path}_{action_id}{fake}.png')
delete_objs(imported_obj_names)
delete_objs(["Plane", "myCurve", "Cylinder"])
# fn = frames_folder.split('/')[-1]
# bpy.ops.wm.save_as_mainfile(filepath=f'{os.getcwd()}/{fn}-vertices.blend')
# exit()
# render in the end only
if not separate_actions and mode == 'sequence':
......@@ -232,8 +235,6 @@ def render(npydata, frames_folder, *, mode, faces_path,
delete_objs(imported_obj_names)
delete_objs(["Plane", "myCurve", "Cylinder"])
# bpy.ops.wm.save_as_mainfile(filepath="~/file.blend")
# exit()
if mode == "video":
return frames_folder
else:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment