{ "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 }