Spaces:
Sleeping
Sleeping
File size: 3,626 Bytes
823b132 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 | {
"cells": [
{
"cell_type": "code",
"execution_count": 6,
"id": "25747a8f",
"metadata": {},
"outputs": [],
"source": [
"import json\n",
"import glob\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "ab382eaf",
"metadata": {},
"outputs": [],
"source": [
"# find all glb file under the directory\n",
"mesh_dir = './ours_meshes'\n",
"mesh_paths = glob.glob(os.path.join(mesh_dir, '*.glb'))\n",
"img_names = [path.split('/')[-1].replace('.glb', '') for path in mesh_paths]\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "21426d64",
"metadata": {},
"outputs": [],
"source": [
"#\n",
"ours_mesh_path_img = './ours_meshes'\n",
"trellis_mesh_path_img = './trellis_meshes'\n",
"ours_voxel_path_img = './ours_voxels'\n",
"trellis_voxel_path_img = './trellis_meshes'\n",
"ours_mesh_path_text = './ours_meshes_text'\n",
"trellis_mesh_path_text = './trellis_meshes_text'\n",
"ours_voxel_path_text = './ours_voxels_text_f'\n",
"trellis_voxel_path_text = './trellis_meshes_text'\n",
"img_prompt_dir = './user_study_pic'\n",
"text_prompt_dir = json.load(open('./captions.json', 'r'))"
]
},
{
"cell_type": "code",
"execution_count": 11,
"id": "eba1b950",
"metadata": {},
"outputs": [],
"source": [
"# create task json file\n",
"\n",
"trials = []\n",
"for name in img_names:\n",
" trial = {\n",
" \"trial_id\": f\"img_{name}\",\n",
" \"task\": \"image\",\n",
" \"prompt_image\": f\"{img_prompt_dir}/{name}.png\",\n",
"\n",
" \"ours_voxel\": f\"{ours_voxel_path_img}/{name}_cubify64.obj\",\n",
" \"cont_voxel\": f\"{trellis_voxel_path_img}/{name}_cubify64.obj\",\n",
"\n",
" \"ours_mesh\": f\"{ours_mesh_path_img}/{name}.glb\",\n",
" \"cont_mesh\": f\"{trellis_mesh_path_img}/{name}.glb\",\n",
"\n",
" \"ours_video\": f\"{ours_mesh_path_img}/{name}_gs.mp4\",\n",
" \"cont_video\": f\"{trellis_mesh_path_img}/{name}_gs.mp4\" \n",
" }\n",
" trials.append(trial)\n",
"\n",
"for name,caption in text_prompt_dir.items():\n",
" trial = {\n",
" \"trial_id\": f\"text_{name}\",\n",
" \"task\": \"text\",\n",
" \"prompt_text\": caption,\n",
"\n",
" \"ours_voxel\": f\"{ours_voxel_path_text}/{name}_cubify64.obj\",\n",
" \"cont_voxel\": f\"{trellis_voxel_path_text}/{name}_cubified64.obj\",\n",
"\n",
" \"ours_mesh\": f\"{ours_mesh_path_text}/{name}.glb\",\n",
" \"cont_mesh\": f\"{trellis_mesh_path_text}/{name}.glb\",\n",
"\n",
" \"ours_video\": f\"{ours_mesh_path_text}/{name}_gs.mp4\",\n",
" \"cont_video\": f\"{trellis_mesh_path_text}/{name}_gs.mp4\" \n",
" }\n",
" trials.append(trial)"
]
},
{
"cell_type": "code",
"execution_count": 12,
"id": "a43be243",
"metadata": {},
"outputs": [],
"source": [
"with open('trials.json', 'w') as f:\n",
" json.dump(trials, f, indent=4)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "voxel",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.14"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
|