Remove references to plotly-orca and scripts making use of it.

This commit is contained in:
Agnieszka Slowik 2023-12-14 14:26:54 +00:00
Родитель a2346f4a1d
Коммит 4774200e4b
3 изменённых файлов: 2 добавлений и 201 удалений

Просмотреть файл

@ -52,7 +52,7 @@ The following script summarizes the dataset statistics:
python3 scripts/summarize_dataset.py --data_path path/to/save/dataset/orbit_benchmark_<FRAME_SIZE>
# to aggregate stats across train, validation, and test collectors, add --combine_modes
```
These should match the values in Table 2 (`combine_modes=True`) and Table A.2 (`combine_modes=False`) in the dataset paper. The Jupyter notebook `scripts/plot_dataset.ipynb` can be used to plot bar charts summarizing the dataset (uses Plotly). These should match Figure 2 (`combine_modes=True`) and Figure A.3/A.4 (`combine_modes=False`) in the dataset paper.
These should match the values in Table 2 (`combine_modes=True`) and Table A.2 (`combine_modes=False`) in the dataset paper.
# Training & testing models on ORBIT
@ -245,7 +245,7 @@ bash scripts/download_unfiltered_dataset.sh folder/to/save/dataset
```
Alternatively, the train/validation/test/other ZIPs can be manually downloaded [here](https://city.figshare.com/articles/dataset/_/14294597). Use `scripts/merge_and_split_benchmark_users.py` to merge the other folder (see script for usage details).
To summarize and plot the unfiltered dataset, use `scripts/summarize_dataset.py` (with `--no_modes` rather than `--combine_modes`) and `scripts/plot_dataset.ipynb` (with `no_modes=True`) similar to above.
To summarize and plot the unfiltered dataset, use `scripts/summarize_dataset.py` (with `--no_modes` rather than `--combine_modes`) similar to above.
# Citations

Просмотреть файл

@ -7,7 +7,6 @@ dependencies:
- python=3.7
- pip=22.2.2
- plotly=4.8.1
- plotly-orca=1.3.1
- pytorch=1.13.1
- pytorch-cuda=11.6
- torchvision=0.14.1

Просмотреть файл

@ -1,198 +0,0 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Copyright (c) Microsoft Corporation.\n",
"# Licensed under the MIT license.\n",
"\n",
"import os\n",
"import plotly\n",
"import plotly.graph_objects as go\n",
"\n",
"# produce plots for ORBIT benchmark dataset, combining train/validation/test users\n",
"DATASET_DIR = \"/path/to/benchmark/root\"\n",
"PHASE = \"benchmark\"\n",
"COMBINE_MODES = True\n",
"PLOT_FOLDER = \"../plots\"\n",
"\n",
"# produce plots for just <train,validation,test> users in ORBIT benchmark dataset\n",
"# DATASET_DIR = os.path.join(\"/path/to/benchmark/root\", \"<train,validation,test>\")\n",
"# PHASE = \"benchmark_<train,validation,test>\"\n",
"# COMBINE_MODES = False\n",
"# PLOT_FOLDER = \"../plots\"\n",
"\n",
"# produce plots for ORBIT unfiltered dataset, combining all users\n",
"# DATASET_DIR = \"/path/to/unfiltered/root\"\n",
"# PHASE = \"unfiltered\"\n",
"# COMBINE_MODES = False # unfiltered dataset does not have modes\n",
"# PLOT_FOLDER = \"../plots\""
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"def get_videos_per_object_by_user(path):\n",
" user2objs, user2numvids, user2vids, vid2type = {}, {}, {}, {}\n",
" modes = ['train', 'validation', 'test'] if COMBINE_MODES else ['']\n",
" for mode in modes:\n",
" mode_dir = os.path.join(path, mode)\n",
" for user in os.listdir(mode_dir):\n",
" user_dir = os.path.join(mode_dir, user)\n",
" if os.path.isdir(user_dir):\n",
" user2objs[user] = []\n",
" user2numvids[user] = {'clean': [], 'clutter': [], 'clutter-pan': []}\n",
" user2vids[user] = []\n",
" for obj in os.listdir(user_dir):\n",
" obj_dir = os.path.join(user_dir, obj)\n",
" user2objs[user].append(obj)\n",
" for video_type in ['clean', 'clutter', 'clutter-pan']:\n",
" type_dir = os.path.join(obj_dir, video_type)\n",
" if os.path.exists(type_dir):\n",
" user2numvids[user][video_type].append( len(os.listdir(type_dir)) )\n",
" for video in os.listdir(type_dir):\n",
" user2vids[user].append(video)\n",
" vid2type[video] = video_type\n",
" else:\n",
" user2numvids[user][video_type].append(0)\n",
"\n",
" return user2objs, user2numvids, user2vids, vid2type\n",
"\n",
"os.makedirs(PLOT_FOLDER, exist_ok=True)\n",
"user2objs, user2numvids, user2vids, vid2type = get_videos_per_object_by_user(DATASET_DIR)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"def plot_objects_per_user_histogram(user2objs):\n",
" x, y, user_ids = [],[],[]\n",
" for i, k in enumerate(sorted(user2objs.items(), key=lambda x: len(x[1]), reverse=True)):\n",
" user_id, user_objs = k\n",
" x.append(i)\n",
" y.append(len(user_objs))\n",
" user_ids.append(user_id)\n",
" fig = go.Figure(data=[go.Bar(x=x, y=y)])\n",
" title=\"objects_per_user\"\n",
" layout = go.Layout(\n",
" height=1500,\n",
" width=3000,\n",
" font=dict(size=40),\n",
" \txaxis = go.layout.XAxis(\n",
" \t\ttitle = \"Collector\",\n",
" tickangle = 90,\n",
" ticks='',\n",
" ticktext = user_ids,\n",
" tickvals = x,\n",
" tickfont = dict(size=40)),\n",
" yaxis = go.layout.YAxis(\n",
" \t\ttitle = \"Number of objects\",\n",
" tickfont=dict(size=40))\n",
" )\n",
" fig.update_layout(layout)\n",
" plotly.offline.iplot(fig)\n",
" fig.write_html( os.path.join(PLOT_FOLDER, \"{:}_{:}.html\".format(title, PHASE)) )\n",
" fig.write_image( os.path.join(PLOT_FOLDER, \"{:}_{:}.pdf\".format(title, PHASE)) )\n",
"\n",
"plot_objects_per_user_histogram(user2objs)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"def plot_videos_by_object_per_user_histogram(user2objs, user2numvids):\n",
" x, user_ids = [],[]\n",
" MAX_OBJS = 15\n",
" COLORS=[(99, 110, 250, 1), (239, 85, 59, 1), (0, 204, 150, 1), (171, 99, 250, 1), (255, 161, 90, 1), (25, 211, 243, 1), (255, 102, 146, 1), (182, 232, 128, 1), (255, 151, 255, 1), (254, 203, 82, 1), (44, 160, 44, 1), (23, 190, 207, 1), (140, 86, 75, 1), (114, 183, 178, 1), (188, 189, 34, 1), (254, 203, 82, 1) ]\n",
" num_clean_vids_per_obj = [ [] for i in range(MAX_OBJS) ]\n",
" num_cluttered_vids_per_obj = [ [] for i in range(MAX_OBJS) ]\n",
" trace_names = [ \"obj {:}\".format(i+1) for i in range(MAX_OBJS)]\n",
" for i, k in enumerate(sorted(user2objs.items(), key=lambda x: len(x[1]), reverse=True)):\n",
" user_id, _ = k\n",
" x.append(i)\n",
" num_objs = len(user2objs[user_id])\n",
" for j in range(MAX_OBJS):\n",
" if j < num_objs:\n",
" num_clean_vids_per_obj[j].append( user2numvids[user_id]['clean'][j] )\n",
" num_cluttered_vids_per_obj[j].append( user2numvids[user_id]['clutter'][j] )\n",
" user_ids.append(user_id)\n",
" fig = go.Figure()\n",
" for j in range(MAX_OBJS):\n",
" lighter_color = list(COLORS[j])\n",
" lighter_color[3] = 0.65\n",
" fig.add_trace(go.Bar(x=x, y=num_clean_vids_per_obj[j], name=trace_names[j] + \" clean\", marker_color=\"rgba{:}\".format(tuple(lighter_color))))\n",
" fig.add_trace(go.Bar(x=x, y=num_cluttered_vids_per_obj[j], name=trace_names[j] + \" clutter\", marker_color=\"rgba{:}\".format(COLORS[j])))\n",
" title=\"videos_by_object_per_user\"\n",
" layout = go.Layout(\n",
" height=1500,\n",
" width=3000,\n",
" font=dict(size=40),\n",
" \txaxis = go.layout.XAxis(\n",
" \t\ttitle = \"Collector\",\n",
" tickangle = 90,\n",
" ticks='',\n",
" ticktext = user_ids,\n",
" tickvals = x,\n",
" tickfont=dict(size=40)),\n",
" yaxis = go.layout.YAxis(\n",
" \t\ttitle = \"Number of videos by object\",\n",
" tickfont=dict(size=40)),\n",
" barmode = 'stack',\n",
" showlegend=True,\n",
" legend = dict(font=dict(size=28), orientation='h', yanchor=\"bottom\", y=1, xanchor=\"left\", x=0)\n",
" )\n",
" fig.update_layout(layout)\n",
" plotly.offline.iplot(fig)\n",
" fig.write_html( os.path.join(PLOT_FOLDER, \"{:}_{:}.html\".format(title, PHASE)) )\n",
" fig.write_image( os.path.join(PLOT_FOLDER, \"{:}_{:}.pdf\".format(title, PHASE)) )\n",
"\n",
"plot_videos_by_object_per_user_histogram(user2objs, user2numvids)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3.8.13 ('orbit-dataset-v3')",
"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.8.13"
},
"orig_nbformat": 2,
"vscode": {
"interpreter": {
"hash": "5708594860c198df6886bc22825155b8182a7ae4388351ec2cbfd6b7c109203f"
}
}
},
"nbformat": 4,
"nbformat_minor": 2
}