Skip to content

Commit

Permalink
more updates while collecting data
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmedjaafar committed Nov 14, 2024
1 parent ebb4eeb commit d982002
Show file tree
Hide file tree
Showing 8 changed files with 137 additions and 117 deletions.
1 change: 1 addition & 0 deletions collect_sim/.~lock.cmd_scene_dic.csv#
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
,ahmedjaafar,hotcake,12.11.2024 21:02,file:///home/ahmedjaafar/.config/libreoffice/4;
2 changes: 1 addition & 1 deletion collect_sim/.~lock.cmd_scene_dic.ods#
Original file line number Diff line number Diff line change
@@ -1 +1 @@
,ahmedjaafar,hotcake,03.11.2024 22:12,file:///home/ahmedjaafar/.config/libreoffice/4;
,ahmedjaafar,hotcake,13.11.2024 00:47,file:///home/ahmedjaafar/.config/libreoffice/4;
2 changes: 1 addition & 1 deletion collect_sim/cmd_id_dic.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion collect_sim/cmd_recep_dic.json

Large diffs are not rendered by default.

217 changes: 109 additions & 108 deletions collect_sim/cmd_scene_dic.csv

Large diffs are not rendered by default.

Binary file modified collect_sim/cmd_scene_dic.ods
Binary file not shown.
28 changes: 23 additions & 5 deletions collect_sim/findscenefour.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,50 @@
csv_file_path = 'cmd_scene_dic.csv' # Replace with your CSV file path
df = pd.read_csv(csv_file_path)

scene_num = "8_1"

# Filter the DataFrame based on the 'scene' column
filtered_df = df[df['scene'] == 'FloorPlan_Train8_1'].copy()
filtered_df = df[df['scene'] == f'FloorPlan_Train{scene_num}'].copy()

# Initialize the 'exists' column
filtered_df['exists'] = ''

# Step 2: Collect 'nl_command's from the JSON files inside the ZIP files
zip_folder_path = '/mnt/ahmed/new_sim_data/files/8_1' # Replace with the path to your ZIP files
zip_folder_path = f'/mnt/ahmed/new_sim_data/files/{scene_num}' # Replace with the path to your ZIP files
zip_files = [f for f in os.listdir(zip_folder_path) if f.endswith('.zip')]

commands_in_zip = set()

cmds = []
# repeats = []
for zip_filename in zip_files:
zip_path = os.path.join(zip_folder_path, zip_filename)
# if zip_path == f"/mnt/ahmed/new_sim_data/files/{scene_num}/data_17:46:02.zip":
# # print('###########################')
# # breakpoint()
# break
with zipfile.ZipFile(zip_path, 'r') as zip_ref:
# Assume each ZIP contains one JSON file
for file_info in zip_ref.infolist():
if file_info.filename.endswith('.json'):
with zip_ref.open(file_info) as json_file:
data = json.load(json_file)
nl_command = data.get('nl_command')
# if nl_command == "Go to the hallway and pick up the bottle and place it on the drawer next to the purple armchair.":
# breakpoint()
# if nl_command in cmds:
# repeats.append(zip_path)
# if nl_command == "Pick up the basketball next to the baseball bat and put it in the bin.":
# print(zip_path)
cmds.append(nl_command)
if nl_command == "Pick up the apple by the laptop and put it on the TV table.":
breakpoint()
print('hi')
break
if nl_command:
commands_in_zip.add(nl_command)
# No extraction to disk; processed in-memory
# print(repeats)
# diff = list(set(filtered_df['cmd'].tolist()) - set(cmds))
diff = list(set(cmds) ^ set(filtered_df['cmd'].tolist()))
breakpoint()

# Step 3: Update the 'exists' column based on matching commands
filtered_df.loc[filtered_df['cmd'].isin(commands_in_zip), 'exists'] = 'yes'
Expand Down
2 changes: 1 addition & 1 deletion collect_sim/verify_traj.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

TRAJ_PATH = args.traj_path
SCENE = args.scene
DIR_EXTRACT = "/mnt/ahmed/new_sim_data/files/12_3"
DIR_EXTRACT = "/mnt/ahmed/new_sim_data/files/1_3"


controller = None
Expand Down

0 comments on commit d982002

Please sign in to comment.