-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from invrs-io/bayer
Add the bayer sorter leaderboard
- Loading branch information
Showing
8 changed files
with
337 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
- `220607_zou_*` solutions are extracted from Supplementary figure 2 of "[Pixel-level Bayer-type colour router based on metasurfaces](https://www.nature.com/articles/s41467-022-31019-7)" by X. Zou et al. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
path=challenges/bayer_sorter/solutions/220607_zou_00.csv, eval_metric=0.42892409584479074, minimum_width=9.0, minimum_spacing=3.0, binarization_degree=1.0 |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "markdown", | ||
"id": "6dd24c9b", | ||
"metadata": {}, | ||
"source": [ | ||
"# Bayer sorter\n", | ||
"\n", | ||
"Visit the invrs-gym docs for the [bayer sorter challenge](https://invrs-io.github.io/gym/notebooks/bayer_challenge.html).\n", | ||
"\n", | ||
"The bayer sorter challenge is based on the “[Pixel-level Bayer-type colour router based on metasurfaces](https://www.nature.com/articles/s41467-022-31019-7)” by Zou et al., and entails the design of a metasurface that sorts incident light in a wavelength-dependent way and takes the place of a traditional color filter.\n", | ||
"\n", | ||
"The bayer sorter eval metric is defined as follows:" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "a805742a", | ||
"metadata": { | ||
"tags": [ | ||
"hide-input" | ||
] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"from invrs_gym import challenges\n", | ||
"\n", | ||
"docstring = challenges.bayer_sorter().eval_metric.__doc__\n", | ||
"print(\"\\n\".join([s[8:] for s in docstring.split(\"Args\")[0].split(\"\\n\")[2:-2]]))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "f8c178cb", | ||
"metadata": { | ||
"tags": [ | ||
"hide-cell" | ||
] | ||
}, | ||
"outputs": [], | ||
"source": [ | ||
"import os\n", | ||
"import plotly.express as px\n", | ||
"from IPython import display\n", | ||
"from invrs_leaderboard import data\n", | ||
"\n", | ||
"df = data.leaderboard_dataframe(base_path=\"../../\")\n", | ||
"\n", | ||
"def plot_challenge_metrics(challenge_name: str) -> display.DisplayHandle:\n", | ||
" challenge_df = df[df[\"challenge\"] == challenge_name]\n", | ||
" fig = px.scatter(\n", | ||
" challenge_df,\n", | ||
" x=\"minimum_length_scale\",\n", | ||
" y=\"eval_metric\",\n", | ||
" color=\"file_prefix\",\n", | ||
" hover_data=[\"file\", \"minimum_width\", \"minimum_spacing\", \"binarization_degree\"],\n", | ||
" )\n", | ||
" if not os.path.exists(\"_plots/\"):\n", | ||
" os.mkdir(\"_plots/\")\n", | ||
" filename = f\"_plots/eval_metric_{challenge_name}.html\"\n", | ||
" fig.write_html(filename)\n", | ||
" return display.display(display.HTML(filename))" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"id": "0712f9cd", | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"plot_challenge_metrics(\"bayer_sorter\")" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 3 (ipykernel)", | ||
"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.10.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 5 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters