AVDN / README.md
yfan1997's picture
Create README.md
aa83e6f verified
|
raw
history blame
1.66 kB

Dataset for Aerial Vision-and-Dialog Navigation (AVDN)

import pandas as pd
import json
# Process each CSV file split
for split in ['train', 'val_seen', 'val_unseen', 'test_unseen']:
    # Load the CSV data
    df = pd.read_csv(f'./{split}_full_data.csv')
    
    # Initialize a list to hold JSON data
    json_data = []
    
    # Convert each row in the DataFrame back to a dictionary (similar to JSON structure)
    for _, row in df.iterrows():
        entry = {
            'pre_dialogs': [],
            'map_name': row['map_name'],
            'route_index': row['route_index'],
            'instructions': row['instructions'],
            'gps_botm_left': json.loads(row['gps_botm_left']) if isinstance(row['gps_botm_left'], str) else row['gps_botm_left'],
            'gps_top_right': json.loads(row['gps_top_right']) if isinstance(row['gps_top_right'], str) else row['gps_top_right'],
            'lng_ratio': float(row['lng_ratio']),
            'lat_ratio': float(row['lat_ratio']),
            'angle': row['angle'],
            'destination': json.loads(row['destination']) if isinstance(row['destination'], str) else row['destination'],
            'attention_list': json.loads(row['attention_list']) if isinstance(row['attention_list'], str) else row['attention_list'],
            'gt_path_corners': json.loads(row['gt_path_corners']) if isinstance(row['gt_path_corners'], str) else row['gt_path_corners']
        }
        json_data.append(entry)

    # Save the data to a JSON file
    json_output_path = f'./{split}_full_data_from_csv_test.json'
    with open(json_output_path, 'w') as f:
        json.dump(json_data, f, indent=4)