diff --git a/demo/scenario_generate_graph_and_video_with_cameras_changes.ipynb b/demo/scenario_generate_graph_and_video_with_cameras_changes.ipynb index 112e04b..5dea39f 100644 --- a/demo/scenario_generate_graph_and_video_with_cameras_changes.ipynb +++ b/demo/scenario_generate_graph_and_video_with_cameras_changes.ipynb @@ -200,7 +200,7 @@ "outputs": [], "source": [ "def export(script_lines, file_name, activity_name, description, graph_state_list, obj_id_map):\n", - " file_path = \"../simulation/Output/scene\"+str(scene_id)+\"/graph states/\"\n", + " file_path = \"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"+file_name+\"/graph states/\"\n", " if os.path.exists(file_path) == False:\n", " os.mkdir(file_path)\n", " file_path = file_path + activity_name + \"/\"\n", @@ -235,13 +235,13 @@ " action, objs, indexs = augmentation_utils.parseStrBlock(script_line)\n", " action_list.append(action)\n", "\n", - " output_graph_path = \"../simulation/Output/scene\"+str(scene_id)+\"/\" + file_name + \"/0/Action_????_0_graph.json\"\n", + " output_graph_path = \"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"+file_name+\"/0/Action_????_0_graph.json\"\n", " for graph_path in sorted(glob.glob(output_graph_path)):\n", - " temp_path = graph_path.replace(\"../simulation/Output/scene\"+str(scene_id)+\"/\"+file_name+\"/0\\\\\", \"\")\n", + " temp_path = graph_path.replace(\"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"+file_name+\"/0/\", \"\")\n", " frame_times = int(temp_path.split(\"_\")[1])\n", " output_graph_map[frame_times] = graph_path\n", "\n", - " ftaa_path = \"../simulation/Output/scene\"+str(scene_id)+\"/\" + file_name + \"/0/ftaa_\" + file_name + \".txt\"\n", + " ftaa_path = \"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"+file_name+\"/0/ftaa_\"+file_name+\".txt\"\n", " with open(ftaa_path, \"r\") as f:\n", " ftaa_lines = f.readlines()\n", " # sometimes FIND don't print out in ftaa file if the FIND object is near avatar\n", @@ -671,7 +671,7 @@ "program_files = []\n", "data_path = \"../dataset/Test/scene\"+str(scene_id)+\"/*.txt\"\n", "for file_path in sorted(glob.glob(data_path)):\n", - " file_name = file_path.replace(file_path[0:file_path.rfind(\"\\\\\")+1], \"\")\n", + " file_name = file_path.replace(file_path[0:file_path.rfind(\"/\")+1], \"\")\n", " \n", " program_name, description, list_of_steps = get_program_file(file_path)\n", " program_files.append({\n", @@ -748,7 +748,7 @@ " s, message = comm.render_script(\n", " executed_lines,\n", " recording=True, \n", - " find_solution=False, \n", + " find_solution=False,\n", " frame_rate=30,\n", " save_pose_data=True,\n", " vis_check_object=True, \n", @@ -779,17 +779,17 @@ "try:\n", " for program in program_files:\n", " program_file_name = program[\"file_name\"][:-4]\n", - " bb_files = \"../simulation/Output/scene\"+str(scene_id) + \"/\" + program_file_name + \"/0/Action_0000_*_2D.json\"\n", + " bb_files = \"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"+program_file_name+\"/0/Action_0000_*_2D.json\"\n", " for x in range(len(sorted(glob.glob(bb_files)))):\n", - " img_path = \"../simulation/Output/scene\"+str(scene_id) + \"/\" + program_file_name + \"/0/??????_????_\" + str(x) + \"_normal.png\"\n", + " img_path = \"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"+program_file_name+\"/0/??????_????_\"+str(x)+\"_normal.png\"\n", " i = 0\n", " for file_path in sorted(glob.glob(img_path)):\n", - " file_name = file_path.replace(\"../simulation/Output/scene\"+str(scene_id) + \"/\" + program_file_name + \"/0\\\\\", \"\")\n", + " file_name = file_path.replace(\"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"+program_file_name+\"/0/\", \"\")\n", " file_num = file_name.split(\"_\")[1]\n", " if i != int(file_num):\n", " print(str(i) + \" \" + str(int(file_num)))\n", " img = PIL.Image.open(file_path)\n", - " new_file_name = \"../simulation/Output/scene\"+str(scene_id) + \"/\" + program_file_name + \"/0/\" + \"Action_%04d_\" + str(x) + \"_normal.png\"\n", + " new_file_name = \"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"+program_file_name+\"/0/\"+\"Action_%04d_\"+str(x)+\"_normal.png\"\n", " img.save(new_file_name % i)\n", " print(file_name)\n", " print(file_name + \" - 1\")\n", @@ -810,14 +810,14 @@ "source": [ "import subprocess\n", "\n", - "dir_path = \"../simulation/Output/scene\"+str(scene_id)+\"/\"\n", - "output_path = dir_path + \"movies/\"\n", - "if os.path.exists(output_path) == False:\n", - " os.mkdir(output_path)\n", + "dir_path = \"../simulation/unity_simulator/Output/scene\"+str(scene_id)+\"/\"\n", "try:\n", " for activity in program_files:\n", " program_file_name = activity[\"file_name\"][:-4]\n", - " bb_files = \"../simulation/Output/scene\"+str(scene_id) + \"/\" + program_file_name + \"/0/Action_0000_*_2D.json\"\n", + " output_path = dir_path+program_file_name+\"/movies/\"\n", + " if os.path.exists(output_path) == False:\n", + " os.mkdir(output_path)\n", + " bb_files = \"../simulation//unity_simulator/Output/scene\"+str(scene_id)+\"/\"+program_file_name+\"/0/Action_0000_*_2D.json\"\n", " for x in range(len(sorted(glob.glob(bb_files)))):\n", " file_name = activity[\"file_name\"]\n", " activity_name = activity[\"name\"]\n",