Use the utils from MetaDrive to update object summaries; update ScenarioDescription doc (#52)
* Update * update * update * update
This commit is contained in:
committed by
GitHub
parent
1f61a4b9d1
commit
07cb55c1cc
@@ -66,6 +66,11 @@ All operations and API reference is available at
|
|||||||
our [documentation](https://scenarionet.readthedocs.io/en/latest/operations.html).
|
our [documentation](https://scenarionet.readthedocs.io/en/latest/operations.html).
|
||||||
If you already have ScenarioNet installed, you can check all operations by `python -m scenarionet.list`.
|
If you already have ScenarioNet installed, you can check all operations by `python -m scenarionet.list`.
|
||||||
|
|
||||||
|
## ScenarioNet dataset and Scenario Description
|
||||||
|
|
||||||
|
Please refer to the [Scenario Description section](https://metadrive-simulator.readthedocs.io/en/latest/scenario_description.html
|
||||||
|
) in MetaDrive documentation for a walk-through.
|
||||||
|
|
||||||
## Citation
|
## Citation
|
||||||
|
|
||||||
If you used this project in your research, please cite:
|
If you used this project in your research, please cite:
|
||||||
|
|||||||
@@ -4,4 +4,6 @@
|
|||||||
Scenario Description
|
Scenario Description
|
||||||
########################
|
########################
|
||||||
|
|
||||||
Coming soon! @Zhenghao please help this.
|
Please visit the
|
||||||
|
`Scenario Description section <https://metadrive-simulator.readthedocs.io/en/latest/scenario_description.html>`_
|
||||||
|
in MetaDrive documentation.
|
||||||
@@ -224,16 +224,12 @@ def write_to_directory_single_worker(
|
|||||||
scenario_id = sd_scenario[SD.ID]
|
scenario_id = sd_scenario[SD.ID]
|
||||||
export_file_name = SD.get_export_file_name(dataset_name, dataset_version, scenario_id)
|
export_file_name = SD.get_export_file_name(dataset_name, dataset_version, scenario_id)
|
||||||
|
|
||||||
# add agents summary
|
if hasattr(SD, "update_summaries"):
|
||||||
summary_dict = {}
|
SD.update_summaries(sd_scenario)
|
||||||
for track_id, track in sd_scenario[SD.TRACKS].items():
|
else:
|
||||||
summary_dict[track_id] = SD.get_object_summary(state_dict=track, id=track_id)
|
raise ValueError("Please update MetaDrive to latest version.")
|
||||||
sd_scenario[SD.METADATA][SD.SUMMARY.OBJECT_SUMMARY] = summary_dict
|
|
||||||
|
|
||||||
# count some objects occurrence
|
# update summary/mapping dict
|
||||||
sd_scenario[SD.METADATA][SD.SUMMARY.NUMBER_SUMMARY] = SD.get_number_summary(sd_scenario)
|
|
||||||
|
|
||||||
# update summary/mapping dicy
|
|
||||||
if export_file_name in summary:
|
if export_file_name in summary:
|
||||||
logger.warning("Scenario {} already exists and will be overwritten!".format(export_file_name))
|
logger.warning("Scenario {} already exists and will be overwritten!".format(export_file_name))
|
||||||
summary[export_file_name] = copy.deepcopy(sd_scenario[SD.METADATA])
|
summary[export_file_name] = copy.deepcopy(sd_scenario[SD.METADATA])
|
||||||
|
|||||||
@@ -232,8 +232,8 @@
|
|||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"\u001b[0;31mSignature:\u001b[0m \u001b[0mread_dataset_summary\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdataset_path\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
"\u001B[0;31mSignature:\u001B[0m \u001B[0mread_dataset_summary\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdataset_path\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n",
|
||||||
"\u001b[0;31mDocstring:\u001b[0m\n",
|
"\u001B[0;31mDocstring:\u001B[0m\n",
|
||||||
"Read the dataset and return the metadata of each scenario in this dataset.\n",
|
"Read the dataset and return the metadata of each scenario in this dataset.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Args:\n",
|
"Args:\n",
|
||||||
@@ -244,8 +244,8 @@
|
|||||||
" 1) the summary dict mapping from scenario ID to its metadata,\n",
|
" 1) the summary dict mapping from scenario ID to its metadata,\n",
|
||||||
" 2) the list of all scenarios IDs, and\n",
|
" 2) the list of all scenarios IDs, and\n",
|
||||||
" 3) a dict mapping from scenario IDs to the folder that hosts their files.\n",
|
" 3) a dict mapping from scenario IDs to the folder that hosts their files.\n",
|
||||||
"\u001b[0;31mFile:\u001b[0m ~/scenarionet/scenarionet/common_utils.py\n",
|
"\u001B[0;31mFile:\u001B[0m ~/scenarionet/scenarionet/common_utils.py\n",
|
||||||
"\u001b[0;31mType:\u001b[0m function"
|
"\u001B[0;31mType:\u001B[0m function"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
@@ -3593,8 +3593,8 @@
|
|||||||
{
|
{
|
||||||
"data": {
|
"data": {
|
||||||
"text/plain": [
|
"text/plain": [
|
||||||
"\u001b[0;31mSignature:\u001b[0m \u001b[0mread_scenario\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mdataset_path\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mmapping\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mscenario_file_name\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
|
"\u001B[0;31mSignature:\u001B[0m \u001B[0mread_scenario\u001B[0m\u001B[0;34m(\u001B[0m\u001B[0mdataset_path\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mmapping\u001B[0m\u001B[0;34m,\u001B[0m \u001B[0mscenario_file_name\u001B[0m\u001B[0;34m)\u001B[0m\u001B[0;34m\u001B[0m\u001B[0;34m\u001B[0m\u001B[0m\n",
|
||||||
"\u001b[0;31mDocstring:\u001b[0m\n",
|
"\u001B[0;31mDocstring:\u001B[0m\n",
|
||||||
"Read a scenario pkl file and return the Scenario Description instance.\n",
|
"Read a scenario pkl file and return the Scenario Description instance.\n",
|
||||||
"\n",
|
"\n",
|
||||||
"Args:\n",
|
"Args:\n",
|
||||||
@@ -3604,8 +3604,8 @@
|
|||||||
"\n",
|
"\n",
|
||||||
"Returns:\n",
|
"Returns:\n",
|
||||||
" The Scenario Description instance of that scenario.\n",
|
" The Scenario Description instance of that scenario.\n",
|
||||||
"\u001b[0;31mFile:\u001b[0m ~/scenarionet/scenarionet/common_utils.py\n",
|
"\u001B[0;31mFile:\u001B[0m ~/scenarionet/scenarionet/common_utils.py\n",
|
||||||
"\u001b[0;31mType:\u001b[0m function"
|
"\u001B[0;31mType:\u001B[0m function"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"metadata": {},
|
"metadata": {},
|
||||||
|
|||||||
Reference in New Issue
Block a user