{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "This file is to convert ScanQA to LLaVA-3D dataset format. Ref: https://github.com/ZCMax/LLaVA-3D/issues/5" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "# load json and show\n", "import json\n", "import os\n", "\n", "data = json.load(open('ScanQA_v1.0_train.json'))\n", "# print(json.dumps(data, indent=4))\n", "\n", "# {\"answers\": [\"brown cabinet with tv sitting in it\"], \n", "# \"object_ids\": [8], \n", "# \"object_names\": [\"cabinet\"], \n", "# \"question\": \"What is in the right corner of room by curtains?\", \n", "# \"question_id\": \"train-scene0000-0\", \n", "# \"scene_id\": \"scene0000_00\"},\n" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [], "source": [ "import json\n", "\n", "# Read the input JSON file\n", "with open('ScanQA_v1.0_train.json', 'r') as f:\n", " data = json.load(f)\n", "\n", "output = []\n", "\n", "for entry in data:\n", " conversation = {\n", " \"id\": entry['object_ids'][0],\n", " \"video\": f\"scannet/{entry['scene_id']}\",\n", " \"conversations\": [\n", " {\n", " \"from\": \"human\",\n", " \"value\": f\"