Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
- benchmark/IOAI/IOAI-2025/Individual-Contest/Antique/Antique.ipynb +236 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Antique/score.json +1 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Chicken_Counting/Chicken_Counting.ipynb +634 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Chicken_Counting/Chicken_Counting_Solution.ipynb +742 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Chicken_Counting/metrics.py +276 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/Concepts.ipynb +825 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/Concepts_Solution.ipynb +0 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/README.md +39 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/judge_api.py +91 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/llm_proxy_tutorial.ipynb +271 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/metrics.py +200 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Pixel/Pixel.ipynb +726 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Pixel/Pixel_Solution.ipynb +526 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Pixel/README.md +16 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Pixel/metrics.py +544 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Radar/Radar.ipynb +564 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Restroom/Restroom.ipynb +346 -0
- benchmark/IOAI/IOAI-2025/Individual-Contest/Restroom/Solution/Restroom_Solution.ipynb +499 -0
- benchmark/IOAI/IOAI-2025/Translations/Individual-Contest-Day1/Iran/._Iran.pdf +0 -0
- benchmark/IOAI/IOAI-2025/Translations/Individual-Contest-Day2/Iran/._Iran.pdf +0 -0
- benchmark/IOAI/IOAI-2026/Home Task/Home-Task-1.ipynb +0 -0
- benchmark/IOAI/IOAI-2026/Home Task/Home-Task-2.ipynb +0 -0
- benchmark/IOAI/IOAI-2026/Home Task/Home-Task-3.ipynb +411 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/label.csv +501 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/metrics.py +49 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/submission/submissionA.csv +500 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/submission/submissionB.csv +500 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/submissionA.csv +500 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/submissionB.csv +500 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Solution/Antique_Solution.ipynb +204 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Solution/test_set/test_set.csv +501 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Solution/validation_set/validation_set.csv +501 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Antique/training_set/training_set.csv +501 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/Chicken_Counting_Solution.ipynb +723 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/Scoring/metrics.py +271 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/test_set/dataset_info.json +11 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/test_set/labels/dataset_info.json +16 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/test_set/labels/state.json +13 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/test_set/state.json +13 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/validation_set/dataset_info.json +11 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/validation_set/labels/dataset_info.json +16 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/validation_set/labels/state.json +13 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/validation_set/state.json +13 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/training_set/train/dataset_info.json +19 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/training_set/train/state.json +13 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/Concepts_Solution.ipynb +0 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/Scoring/metrics.py +194 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/test_set/dataset_dict.json +1 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/test_set/test/dataset_info.json +45 -0
- benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/test_set/test/state.json +13 -0
benchmark/IOAI/IOAI-2025/Individual-Contest/Antique/Antique.ipynb
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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",
|
| 5 |
+
"id": "6fe78d59-1f8b-41fb-b8db-9927b8ed049e",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Antique/Antique.ipynb)"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "markdown",
|
| 17 |
+
"id": "a4c6054c-d42b-4c2b-bb79-deb64d936c24",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"source": [
|
| 20 |
+
"# Antique Painting Authentication\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"## 1. Problem Description\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"You have studied Artificial Intelligence for quite some time. Old friend of your father, famous archeologist and art critic, heard about this and asked for your help. You need to design an algorithm that can classify antique paintings as either authentic or replica pieces.\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"Because professional authentication is expensive, the research team has only obtained authenticity labels for a small portion of the paintings. For the majority of samples, the authenticity remains unknown. It is known that the paintings' digital features exhibit strong structural patterns. You are tasked with leveraging all available samples — including those with unknown labels — to train a model for classifying the authenticity of antique paintings.\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"## 2. Dataset\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"The dataset consists of a training set, a validation set and a test set, each of them has 500 independent samples. \n",
|
| 31 |
+
"\n",
|
| 32 |
+
"1. **Training Set (`training_set.csv`)**:\n",
|
| 33 |
+
"\n",
|
| 34 |
+
" - The first five columns represent the digital features of each antique painting.\n",
|
| 35 |
+
" - The sixth column contains the label: 1 for authentic, -1 for replica, and 0 for unknown.\n",
|
| 36 |
+
"\n",
|
| 37 |
+
" The training set is used for training your models and can be accessed and downloaded directly during the competition.\n",
|
| 38 |
+
"\n",
|
| 39 |
+
"2. **Validation Set (`validation_set.csv`)**: \n",
|
| 40 |
+
" - These are similar to the training set format but do not contain the label column.\n",
|
| 41 |
+
"\n",
|
| 42 |
+
" The validation set is used to calculate the Leaderboard A score and is not directly accessible during the competition.\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"3. **Test Set (`test_set.csv`)**: \n",
|
| 45 |
+
" - These are similar to the training set format but do not contain the label column.\n",
|
| 46 |
+
"\n",
|
| 47 |
+
" The test set is used to calculate the Leaderboard B score and is not directly accessible during the competition.\n",
|
| 48 |
+
"\n",
|
| 49 |
+
"## 3. Task\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"Your task is to train an appropriate model capable of predicting the authenticity of paintings in the test sets, despite the large number of unlabeled samples.\n",
|
| 52 |
+
"\n",
|
| 53 |
+
"## 4. Submission\n",
|
| 54 |
+
"\n",
|
| 55 |
+
"Contestants need to submit a notebook file named `submission.ipynb`. The file should output a zip file named `submission.zip`, which should contain the following two files:\n",
|
| 56 |
+
"\n",
|
| 57 |
+
"1. `submissionA.csv`: Contains the model's predicted label results on the validation set, with each line being a -1 or 1 and no header.\n",
|
| 58 |
+
"2. `submissionB.csv`: Contains the model's predicted label results on the test set, with each line being a -1 or 1 and no header.\n",
|
| 59 |
+
"\n",
|
| 60 |
+
"The testing machine will read `submission.zip` and calculate the scores. The submission files must strictly follow the above format and naming; otherwise, the system will not be able to read them correctly. \n",
|
| 61 |
+
"\n",
|
| 62 |
+
"Details about the submission procedure are provided in the baseline notebook. Contestants are encouraged to refer to it for guidance.\n",
|
| 63 |
+
"\n",
|
| 64 |
+
"## 5. Score\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"The evaluation metric will be **classification accuracy**, defined as the proportion of correctly predicted samples over the total number of evaluated samples.\n",
|
| 67 |
+
"\n",
|
| 68 |
+
"## 6. Baseline and Training Set\n",
|
| 69 |
+
"\n",
|
| 70 |
+
"- Below you can find the baseline solution.\n",
|
| 71 |
+
"- The dataset is in `training_set` folder.\n",
|
| 72 |
+
"- The highest score by the Scientific Committee for this task is 0.98 in Leaderboard B, this score is used for score unification.\n",
|
| 73 |
+
"- The baseline score by the Scientific Committee for this task is 0.46 in Leaderboard B, this score is used for score unification."
|
| 74 |
+
]
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"cell_type": "markdown",
|
| 78 |
+
"id": "44bf0dce",
|
| 79 |
+
"metadata": {},
|
| 80 |
+
"source": [
|
| 81 |
+
"### Train Your Model"
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"cell_type": "code",
|
| 86 |
+
"execution_count": null,
|
| 87 |
+
"id": "3acb09be",
|
| 88 |
+
"metadata": {},
|
| 89 |
+
"outputs": [],
|
| 90 |
+
"source": [
|
| 91 |
+
"import os\n",
|
| 92 |
+
"import sys\n",
|
| 93 |
+
"\n",
|
| 94 |
+
"# 1. Get the current working directory\n",
|
| 95 |
+
"current_dir = os.getcwd()\n",
|
| 96 |
+
"\n",
|
| 97 |
+
"# 2. Check if the path contains \"Individual-Contest/Antique\" and trim it to that point\n",
|
| 98 |
+
"if \"Individual-Contest/Antique\" in current_dir:\n",
|
| 99 |
+
" root_index = current_dir.index(\"Individual-Contest/Antique\") + len(\"Individual-Contest/Antique\")\n",
|
| 100 |
+
" project_root = current_dir[:root_index]\n",
|
| 101 |
+
"else:\n",
|
| 102 |
+
" raise Exception(\"Project root directory not found. Please check the folder structure.\")\n",
|
| 103 |
+
"\n",
|
| 104 |
+
"# 3. Change working directory to the project root\n",
|
| 105 |
+
"os.chdir(project_root)\n",
|
| 106 |
+
"print(\"Working directory set to:\", os.getcwd())\n",
|
| 107 |
+
"\n",
|
| 108 |
+
"# 4. Add module search path (e.g., where metrics.py is located)\n",
|
| 109 |
+
"sys.path.append(os.path.join(project_root, \"Scoring\"))"
|
| 110 |
+
]
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"cell_type": "code",
|
| 114 |
+
"execution_count": null,
|
| 115 |
+
"id": "03dae883",
|
| 116 |
+
"metadata": {},
|
| 117 |
+
"outputs": [],
|
| 118 |
+
"source": [
|
| 119 |
+
"import pandas as pd\n",
|
| 120 |
+
"import numpy as np\n",
|
| 121 |
+
"import os\n",
|
| 122 |
+
"from sklearn.svm import SVC\n",
|
| 123 |
+
"\n",
|
| 124 |
+
"TRAIN_PATH = \"./training_set/\"\n",
|
| 125 |
+
"train = pd.read_csv(TRAIN_PATH + \"training_set.csv\")\n",
|
| 126 |
+
"\n",
|
| 127 |
+
"X = np.array(train.iloc[:,:5])\n",
|
| 128 |
+
"y = np.array(train.iloc[:,5])\n",
|
| 129 |
+
"\n",
|
| 130 |
+
"np.random.seed(42)\n",
|
| 131 |
+
"y[y == 0] = np.random.choice([-1, 1], size=(y == 0).sum())\n",
|
| 132 |
+
"\n",
|
| 133 |
+
"svm_binary_model = SVC(kernel='rbf', C=1.0, gamma='scale', random_state=42)\n",
|
| 134 |
+
"svm_binary_model.fit(X, y)"
|
| 135 |
+
]
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"cell_type": "markdown",
|
| 139 |
+
"id": "a2049ba4",
|
| 140 |
+
"metadata": {},
|
| 141 |
+
"source": [
|
| 142 |
+
"### Make Predictions on the Validation and Test Set"
|
| 143 |
+
]
|
| 144 |
+
},
|
| 145 |
+
{
|
| 146 |
+
"cell_type": "code",
|
| 147 |
+
"execution_count": null,
|
| 148 |
+
"id": "c69d9d92",
|
| 149 |
+
"metadata": {},
|
| 150 |
+
"outputs": [],
|
| 151 |
+
"source": [
|
| 152 |
+
"VAL_DATA_PATH = \"./Solution/validation_set/\"\n",
|
| 153 |
+
"TEST_DATA_PATH = \"./Solution/test_set/\"\n",
|
| 154 |
+
"\n",
|
| 155 |
+
"testA = np.array(pd.read_csv(VAL_DATA_PATH + \"validation_set.csv\"))\n",
|
| 156 |
+
"testB = np.array(pd.read_csv(TEST_DATA_PATH + \"test_set.csv\"))\n",
|
| 157 |
+
"\n",
|
| 158 |
+
"predA = svm_binary_model.predict(testA)\n",
|
| 159 |
+
"predB = svm_binary_model.predict(testB)"
|
| 160 |
+
]
|
| 161 |
+
},
|
| 162 |
+
{
|
| 163 |
+
"cell_type": "markdown",
|
| 164 |
+
"id": "3e2141d8",
|
| 165 |
+
"metadata": {},
|
| 166 |
+
"source": [
|
| 167 |
+
"### Generate `submission.zip` for Submission"
|
| 168 |
+
]
|
| 169 |
+
},
|
| 170 |
+
{
|
| 171 |
+
"cell_type": "code",
|
| 172 |
+
"execution_count": null,
|
| 173 |
+
"id": "342e6ddb",
|
| 174 |
+
"metadata": {},
|
| 175 |
+
"outputs": [],
|
| 176 |
+
"source": [
|
| 177 |
+
"import zipfile\n",
|
| 178 |
+
"import os\n",
|
| 179 |
+
"\n",
|
| 180 |
+
"submissionA = pd.DataFrame(predA)\n",
|
| 181 |
+
"submissionA.to_csv(\"./Scoring/submissionA.csv\", index=False, header=False)\n",
|
| 182 |
+
"\n",
|
| 183 |
+
"submissionB = pd.DataFrame(predB)\n",
|
| 184 |
+
"submissionB.to_csv(\"./Scoring/submissionB.csv\", index=False, header=False)\n",
|
| 185 |
+
"\n",
|
| 186 |
+
"files_to_zip = ['./Scoring/submissionA.csv', './Scoring/submissionB.csv']\n",
|
| 187 |
+
"zip_filename = './Scoring/submission.zip'\n",
|
| 188 |
+
"\n",
|
| 189 |
+
"with zipfile.ZipFile(zip_filename, 'w') as zipf:\n",
|
| 190 |
+
" for file in files_to_zip:\n",
|
| 191 |
+
" zipf.write(file, os.path.basename(file))\n",
|
| 192 |
+
"\n",
|
| 193 |
+
"print(f'{zip_filename} is created succefully!')"
|
| 194 |
+
]
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
"cell_type": "markdown",
|
| 198 |
+
"id": "25da701b",
|
| 199 |
+
"metadata": {},
|
| 200 |
+
"source": [
|
| 201 |
+
"### Evaluate the Model Performance"
|
| 202 |
+
]
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"cell_type": "code",
|
| 206 |
+
"execution_count": null,
|
| 207 |
+
"id": "269246ef",
|
| 208 |
+
"metadata": {},
|
| 209 |
+
"outputs": [],
|
| 210 |
+
"source": [
|
| 211 |
+
"%run Scoring/metrics.py"
|
| 212 |
+
]
|
| 213 |
+
}
|
| 214 |
+
],
|
| 215 |
+
"metadata": {
|
| 216 |
+
"kernelspec": {
|
| 217 |
+
"display_name": "Python 3 (ipykernel)",
|
| 218 |
+
"language": "python",
|
| 219 |
+
"name": "python3"
|
| 220 |
+
},
|
| 221 |
+
"language_info": {
|
| 222 |
+
"codemirror_mode": {
|
| 223 |
+
"name": "ipython",
|
| 224 |
+
"version": 3
|
| 225 |
+
},
|
| 226 |
+
"file_extension": ".py",
|
| 227 |
+
"mimetype": "text/x-python",
|
| 228 |
+
"name": "python",
|
| 229 |
+
"nbconvert_exporter": "python",
|
| 230 |
+
"pygments_lexer": "ipython3",
|
| 231 |
+
"version": "3.12.9"
|
| 232 |
+
}
|
| 233 |
+
},
|
| 234 |
+
"nbformat": 4,
|
| 235 |
+
"nbformat_minor": 5
|
| 236 |
+
}
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Antique/score.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"status": true, "score": {"public_a": 0.984, "public_detail": {"Accuracy": 0.984}, "private_b": 0.98, "private_detail": {"Accuracy": 0.98}}, "msg": "Success!"}
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Chicken_Counting/Chicken_Counting.ipynb
ADDED
|
@@ -0,0 +1,634 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Chicken_Counting/Chicken_Counting.ipynb)"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"# Chicken Counting\n",
|
| 19 |
+
"\n",
|
| 20 |
+
"## **1. Problem Description**\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"As the leader of an AI research team collaborating with Silkie chicken farmers, you are tasked with solving a critical challenge in traditional free-range farming. Accurate counting of livestock is crucial for both farmers and insurance companies, as factors like disease outbreaks and predator invasions can significantly impact the survival rate of these chickens in a short time. While insurance coverage helps mitigate farming risks, the claims process requires precise counting of livestock losses. Your farmers have approached your team for help in developing more accurate, automated counting systems. The challenge before your research team is to develop an optimized Silkie chicken counting model using density estimation techniques that can provide reliable counts to support both farm management and insurance processes.\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"Your team has access to a pretrained feature extractor for Silkie chicken images, but you'll need to design and train the density estimation decoder to create a complete counting solution. Your task is to build upon this foundation by developing an effective decoder architecture and training strategy to achieve accurate chicken counts that farmers and insurance companies can rely on.\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"The below figure shows an image in the dataset, as well as the corresponding true density distribution and a predicted density distribution generated by the baseline model. The total density (sum of densities across all areas) is labeled.\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"<img src=\"./figs/Chicken Counting Fig 1.png\" width=\"800\">\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"## **2. Dataset**\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"The structure of the provided Silkie chicken image dataset is as follows:\n",
|
| 33 |
+
"\n",
|
| 34 |
+
"```\n",
|
| 35 |
+
"datasets/\n",
|
| 36 |
+
"├── train/\n",
|
| 37 |
+
"│ └── A dataset with features:\n",
|
| 38 |
+
"│ ├── `image`: `PIL.Image` with RGB channels (3x720x1280)\n",
|
| 39 |
+
"│ └── `density`: a 2D array of shape 180x320\n",
|
| 40 |
+
"└── base.pth (Pretrained Model)\n",
|
| 41 |
+
"\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"os.environ.get(\"DATA_PATH\")/\n",
|
| 44 |
+
"├── test_a/\n",
|
| 45 |
+
"│ └── A dataset with features:\n",
|
| 46 |
+
"│ └── `image`: `PIL.Image` with RGB channels (3x720x1280)\n",
|
| 47 |
+
"└── test_b/\n",
|
| 48 |
+
" └── A dataset with features:\n",
|
| 49 |
+
" └── `image`: `PIL.Image` with RGB channels (3x720x1280)\n",
|
| 50 |
+
"```\n",
|
| 51 |
+
"\n",
|
| 52 |
+
"(1) Training set location: `datasets`, files in this folder are used for model fine-tuning. It contains a train folder, which stores a dataset with 100 images and their corresponding density maps.\n",
|
| 53 |
+
"\n",
|
| 54 |
+
"(2) Validation set (test_a) and Test set (test_b): These will be used to evaluate scores on Leaderboard A and Leaderboard B, respectively. They will be inaccessible to contestants. Only the score achieved on test set B will be used for final scoring. \n",
|
| 55 |
+
"\n",
|
| 56 |
+
"(3) Datasets size:\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"- Training set: 100 images.\n",
|
| 59 |
+
"- Validation set: 100 images.\n",
|
| 60 |
+
"- Test set: 100 images.\n",
|
| 61 |
+
"\n",
|
| 62 |
+
"(4) Validation set (test_a) and Test set (test_b) are not visible.\n",
|
| 63 |
+
"\n",
|
| 64 |
+
"(5) Due to limits of computing resources, training density maps are reshaped to $1\\times 180 \\times 320$. **NOTE** the output density map can be viewed as a 2D real number matrix with shape $180\\times 320$, the sum of all matrix values is the count of chickens.\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"## **3. Task**\n",
|
| 67 |
+
"\n",
|
| 68 |
+
"Your task is to train your own model using the training data to predict density maps, thereby serving the purpose of chicken counting.\n",
|
| 69 |
+
"\n",
|
| 70 |
+
"You may extend and optimize the given pretrained model to improve its count prediction accuracy. The pretrained model `base.pth` only contains the weights of the first four layers of the model (the feature extraction model), and the function `load_pretrained_weights_partial` in the baseline code can be used to load these partial weights into your model. You may construct a density decoder `DensityDecoder` and combine it with the pretrained feature extraction module to form a complete data prediction model.\n",
|
| 71 |
+
"\n",
|
| 72 |
+
"```\n",
|
| 73 |
+
"class DensityDecoder(nn.Module):\n",
|
| 74 |
+
" def __init__(self):\n",
|
| 75 |
+
" #################################################\n",
|
| 76 |
+
" # Your code here\n",
|
| 77 |
+
" #################################################\n",
|
| 78 |
+
"\n",
|
| 79 |
+
" def forward(self, x):\n",
|
| 80 |
+
" #################################################\n",
|
| 81 |
+
" # Your code here\n",
|
| 82 |
+
" #################################################\n",
|
| 83 |
+
" return x\n",
|
| 84 |
+
"```\n",
|
| 85 |
+
"\n",
|
| 86 |
+
"You can also build your own model without the pretrained model we provided.\n",
|
| 87 |
+
"\n",
|
| 88 |
+
"This task is the continuation of Satellite Weather Forecasting. A kind remind is the UNET is easily to full GPU memory without any feature engineering. Then, the GPU memory error message will be reported. \n",
|
| 89 |
+
"\n",
|
| 90 |
+
"Please follow these rules to achieve a score normally:\n",
|
| 91 |
+
"\n",
|
| 92 |
+
"(1) Your model must output the predicted density map.\n",
|
| 93 |
+
"\n",
|
| 94 |
+
"(2) Due to limits of computing resources, your output density map should be reshaped to $180 \\times 320$. This is also the shape of target density maps provided in the train dataset.\n",
|
| 95 |
+
"\n",
|
| 96 |
+
"## 4. Submission\n",
|
| 97 |
+
"\n",
|
| 98 |
+
"Please submit a **submission.ipynb** that includes the following components:\n",
|
| 99 |
+
"\n",
|
| 100 |
+
"(1)**Training Code** \n",
|
| 101 |
+
"\n",
|
| 102 |
+
"- Include the full training pipeline.\n",
|
| 103 |
+
"\n",
|
| 104 |
+
"(2)**Evaluation Code**\n",
|
| 105 |
+
"- Evaluate your model on the validation set and test set. \n",
|
| 106 |
+
"\n",
|
| 107 |
+
"- The output should be saved as **`submission.npz`**. This must be a valid `npz` file containing two arrays `pred_a` and `pred_b`, each with shape `100x1x180x320` (The evaluation script will also accept predictions in the shape of `100x180x320`, if you decide to squeeze the channel dimension).\n",
|
| 108 |
+
"\n",
|
| 109 |
+
" **Any result that does not meet the specified size will be considered invalid, resulting in an assessment score of zero.**\n",
|
| 110 |
+
" \n",
|
| 111 |
+
"- Each element of the density map should be **no less than zero**, otherwise will result in an assessment score of zero.\n",
|
| 112 |
+
"\n",
|
| 113 |
+
"## **5. Scoring**\n",
|
| 114 |
+
"\n",
|
| 115 |
+
"You will be scored based on the mean relative error of your model. Relative error is defined by:\n",
|
| 116 |
+
"\n",
|
| 117 |
+
"$$\n",
|
| 118 |
+
"\\text{Relative Error} = \\frac{|y_i - \\hat{y}_i|}{|y_i|}\n",
|
| 119 |
+
"$$\n",
|
| 120 |
+
"\n",
|
| 121 |
+
"where $y_i$ is the true total density for the $i$-th sample, and $\\hat{y}_i$ is the predicted total density for the $i$-th sample.\n",
|
| 122 |
+
"\n",
|
| 123 |
+
"Your final score before normalization will be calculated based on your mean relative error, as follows:\n",
|
| 124 |
+
"\n",
|
| 125 |
+
"$$\n",
|
| 126 |
+
"\\text{Score} = \\exp(-\\frac{1}{n} \\sum_{i=1}^{n} \\frac{|y_i - \\hat{y}_i|}{y_i})\n",
|
| 127 |
+
"$$\n",
|
| 128 |
+
"\n",
|
| 129 |
+
"## **6. Baseline & Training Set**\n",
|
| 130 |
+
"\n",
|
| 131 |
+
"- Below you can find the baseline solution.\n",
|
| 132 |
+
"- The dataset is in `training_set` folder.\n",
|
| 133 |
+
"- The highest score by the Scientific Committee for this task is 0.89, this score is used for score unification.\n",
|
| 134 |
+
"- The baseline score by the Scientific Committee for this task is 0.71, this score is used for score unification."
|
| 135 |
+
]
|
| 136 |
+
},
|
| 137 |
+
{
|
| 138 |
+
"cell_type": "markdown",
|
| 139 |
+
"metadata": {},
|
| 140 |
+
"source": [
|
| 141 |
+
"### Imports"
|
| 142 |
+
]
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"cell_type": "code",
|
| 146 |
+
"execution_count": null,
|
| 147 |
+
"metadata": {},
|
| 148 |
+
"outputs": [],
|
| 149 |
+
"source": [
|
| 150 |
+
"import random\n",
|
| 151 |
+
"import numpy as np\n",
|
| 152 |
+
"import torch\n",
|
| 153 |
+
"\n",
|
| 154 |
+
"seed = 42\n",
|
| 155 |
+
"\n",
|
| 156 |
+
"random.seed(seed) # Python built-in random\n",
|
| 157 |
+
"np.random.seed(seed) # NumPy\n",
|
| 158 |
+
"torch.manual_seed(seed) # PyTorch (CPU)\n",
|
| 159 |
+
"torch.cuda.manual_seed(seed) # PyTorch (single GPU)\n",
|
| 160 |
+
"torch.cuda.manual_seed_all(seed) # PyTorch (all GPUs)\n",
|
| 161 |
+
"\n",
|
| 162 |
+
"# Ensures deterministic behavior\n",
|
| 163 |
+
"torch.backends.cudnn.deterministic = True\n",
|
| 164 |
+
"torch.backends.cudnn.benchmark = False"
|
| 165 |
+
]
|
| 166 |
+
},
|
| 167 |
+
{
|
| 168 |
+
"cell_type": "code",
|
| 169 |
+
"execution_count": null,
|
| 170 |
+
"metadata": {},
|
| 171 |
+
"outputs": [],
|
| 172 |
+
"source": [
|
| 173 |
+
"import os\n",
|
| 174 |
+
"import torch\n",
|
| 175 |
+
"import torch.nn as nn\n",
|
| 176 |
+
"import torch.nn.functional as F\n",
|
| 177 |
+
"import torch.optim as optim\n",
|
| 178 |
+
"from torch.utils.data import DataLoader\n",
|
| 179 |
+
"from datasets import load_from_disk\n",
|
| 180 |
+
"import logging\n",
|
| 181 |
+
"from torchvision import transforms\n",
|
| 182 |
+
"from tqdm import tqdm\n",
|
| 183 |
+
"import numpy as np\n",
|
| 184 |
+
"import math\n",
|
| 185 |
+
"\n",
|
| 186 |
+
"#Contestants should mount \"counting_problem_train(v1)\" datasets while creating the node.\n",
|
| 187 |
+
"TRAIN_PATH = \"./\" #Address of the training set and base.pth\n",
|
| 188 |
+
"# The training set is deployed automatically in the testing machine. \n",
|
| 189 |
+
"# You notebook can access the TRAIN_PATH even if you do not mount it along with notebook.\n",
|
| 190 |
+
"TRAINING_SET = TRAIN_PATH + \"train\" #Address of the traninig set \n",
|
| 191 |
+
"BASE_MODEL_PATH = TRAIN_PATH + \"base.pth\"#Address of the .pth file\n",
|
| 192 |
+
"DTYPE = torch.float32\n",
|
| 193 |
+
"DEVICE = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n",
|
| 194 |
+
"scale = 100.0"
|
| 195 |
+
]
|
| 196 |
+
},
|
| 197 |
+
{
|
| 198 |
+
"cell_type": "markdown",
|
| 199 |
+
"metadata": {},
|
| 200 |
+
"source": [
|
| 201 |
+
"### Logging Utilities"
|
| 202 |
+
]
|
| 203 |
+
},
|
| 204 |
+
{
|
| 205 |
+
"cell_type": "code",
|
| 206 |
+
"execution_count": null,
|
| 207 |
+
"metadata": {},
|
| 208 |
+
"outputs": [],
|
| 209 |
+
"source": [
|
| 210 |
+
"def logging_level(level='info'):\n",
|
| 211 |
+
" str_format = '%(asctime)s - %(levelname)s: %(message)s'\n",
|
| 212 |
+
" if level == 'debug':\n",
|
| 213 |
+
" logging.basicConfig(level=logging.DEBUG, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')\n",
|
| 214 |
+
" elif level == 'info':\n",
|
| 215 |
+
" logging.basicConfig(level=logging.INFO, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')\n",
|
| 216 |
+
" return logging\n",
|
| 217 |
+
"\n",
|
| 218 |
+
"\n",
|
| 219 |
+
"class BatchLossLogger:\n",
|
| 220 |
+
" def __init__(self, log_interval=100):\n",
|
| 221 |
+
" self.losses = []\n",
|
| 222 |
+
" self.batch_number = 0\n",
|
| 223 |
+
" self.log_interval = log_interval\n",
|
| 224 |
+
"\n",
|
| 225 |
+
" def log(self, loss):\n",
|
| 226 |
+
" self.losses.append(loss)\n",
|
| 227 |
+
" self.batch_number += 1\n",
|
| 228 |
+
" if self.batch_number % self.log_interval == 0:\n",
|
| 229 |
+
" logging.info(f'Batch No. {self.batch_number:7d} - loss: {loss:.6f}')"
|
| 230 |
+
]
|
| 231 |
+
},
|
| 232 |
+
{
|
| 233 |
+
"cell_type": "markdown",
|
| 234 |
+
"metadata": {},
|
| 235 |
+
"source": [
|
| 236 |
+
"### Training Your Model\n",
|
| 237 |
+
"#### Model Definition\n",
|
| 238 |
+
"Pretrained weights of the `FeatureExtraction` model is provided in `base.pth` in the training set, along with a function to load them.\n",
|
| 239 |
+
"`ChickenCounting` is the completed model."
|
| 240 |
+
]
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"cell_type": "code",
|
| 244 |
+
"execution_count": null,
|
| 245 |
+
"metadata": {},
|
| 246 |
+
"outputs": [],
|
| 247 |
+
"source": [
|
| 248 |
+
"class FeatureExtraction(nn.Module):\n",
|
| 249 |
+
" def __init__(self, in_channels=3):\n",
|
| 250 |
+
" super(FeatureExtraction, self).__init__()\n",
|
| 251 |
+
" self.conv1 = nn.Conv2d(in_channels, 64, kernel_size=3, padding=2, dilation=2)\n",
|
| 252 |
+
" self.conv2 = nn.Conv2d(64, 64, kernel_size=3, padding=2, dilation=2)\n",
|
| 253 |
+
" self.pool2 = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)\n",
|
| 254 |
+
" self.conv3 = nn.Conv2d(64, 128, kernel_size=3, padding=2, dilation=2)\n",
|
| 255 |
+
" self.conv4 = nn.Conv2d(128, 128, kernel_size=3, padding=2, dilation=2)\n",
|
| 256 |
+
" self.pool4 = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)\n",
|
| 257 |
+
"\n",
|
| 258 |
+
"\n",
|
| 259 |
+
" def forward(self, x):\n",
|
| 260 |
+
" x = F.relu(self.conv1(x))\n",
|
| 261 |
+
" x = F.relu(self.conv2(x))\n",
|
| 262 |
+
" x = self.pool2(x)\n",
|
| 263 |
+
" x = F.relu(self.conv3(x))\n",
|
| 264 |
+
" x = F.relu(self.conv4(x))\n",
|
| 265 |
+
" x = self.pool4(x)\n",
|
| 266 |
+
"\n",
|
| 267 |
+
" return x\n",
|
| 268 |
+
"\n",
|
| 269 |
+
" def load_pretrained_weights_partial(self, weights_path, num_layers=4):\n",
|
| 270 |
+
" save_model = torch.load(weights_path)\n",
|
| 271 |
+
" partial_state_dict = {}\n",
|
| 272 |
+
" expected_layers = [\n",
|
| 273 |
+
" 'feature_extraction.conv1.weight', 'feature_extraction.conv1.bias',\n",
|
| 274 |
+
" 'feature_extraction.conv2.weight', 'feature_extraction.conv2.bias',\n",
|
| 275 |
+
" 'feature_extraction.conv3.weight', 'feature_extraction.conv3.bias',\n",
|
| 276 |
+
" 'feature_extraction.conv4.weight', 'feature_extraction.conv4.bias',\n",
|
| 277 |
+
" ]\n",
|
| 278 |
+
" state_dict = {k.split('.', 1)[-1]: v for k, v in save_model.items() if k in expected_layers[:2 * num_layers]}\n",
|
| 279 |
+
" model_dict = self.state_dict()\n",
|
| 280 |
+
"\n",
|
| 281 |
+
" for k in state_dict:\n",
|
| 282 |
+
" if k in model_dict:\n",
|
| 283 |
+
" partial_state_dict[k] = state_dict[k]\n",
|
| 284 |
+
" print(k)\n",
|
| 285 |
+
"\n",
|
| 286 |
+
" self.load_state_dict(partial_state_dict)\n",
|
| 287 |
+
"\n",
|
| 288 |
+
"\n",
|
| 289 |
+
"class DensityDecoder(nn.Module): # Define your decoder model here.\n",
|
| 290 |
+
" def __init__(self):\n",
|
| 291 |
+
" super(DensityDecoder, self).__init__()\n",
|
| 292 |
+
" self.conv5 = nn.Conv2d(in_channels=128, out_channels=1, kernel_size=3, padding=2, dilation=2)\n",
|
| 293 |
+
"\n",
|
| 294 |
+
" def forward(self, x):\n",
|
| 295 |
+
" x = F.relu(self.conv5(x))\n",
|
| 296 |
+
" return x\n",
|
| 297 |
+
"\n",
|
| 298 |
+
"\n",
|
| 299 |
+
"class ChickenCounting(nn.Module):\n",
|
| 300 |
+
" def __init__(self):\n",
|
| 301 |
+
" super(ChickenCounting, self).__init__()\n",
|
| 302 |
+
" self.feature_extraction = FeatureExtraction()\n",
|
| 303 |
+
" self.feature_decoder = DensityDecoder()\n",
|
| 304 |
+
"\n",
|
| 305 |
+
" def forward(self, x):\n",
|
| 306 |
+
" x = self.feature_extraction(x)\n",
|
| 307 |
+
" x = self.feature_decoder(x)\n",
|
| 308 |
+
" return x"
|
| 309 |
+
]
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"cell_type": "markdown",
|
| 313 |
+
"metadata": {},
|
| 314 |
+
"source": [
|
| 315 |
+
"### Reading the Dataset\n",
|
| 316 |
+
"Read the train dataset"
|
| 317 |
+
]
|
| 318 |
+
},
|
| 319 |
+
{
|
| 320 |
+
"cell_type": "code",
|
| 321 |
+
"execution_count": null,
|
| 322 |
+
"metadata": {},
|
| 323 |
+
"outputs": [],
|
| 324 |
+
"source": [
|
| 325 |
+
"from datasets import load_dataset\n",
|
| 326 |
+
"\n",
|
| 327 |
+
"# 从 Hugging Face 加载数据集\n",
|
| 328 |
+
"train_dataset = load_dataset(\"ioaihsc/Task2_Chicken_Counting_Train2\", \n",
|
| 329 |
+
" data_dir=\"train\",\n",
|
| 330 |
+
" split=\"train\") \n",
|
| 331 |
+
"\n",
|
| 332 |
+
"image_transform = transforms.Compose([\n",
|
| 333 |
+
" transforms.ToTensor(),\n",
|
| 334 |
+
"])\n",
|
| 335 |
+
"\n",
|
| 336 |
+
"def collate_fn(batch, scale=scale):\n",
|
| 337 |
+
" return {\n",
|
| 338 |
+
" \"image\": torch.stack([image_transform(item[\"image\"]) for item in batch]),\n",
|
| 339 |
+
" \"density\": torch.stack([torch.tensor(item[\"density\"], dtype=DTYPE).unsqueeze(0) * scale for item in batch])\n",
|
| 340 |
+
" }\n",
|
| 341 |
+
"\n",
|
| 342 |
+
"train_loader = DataLoader(train_dataset, batch_size=8, shuffle=True, collate_fn=collate_fn)\n",
|
| 343 |
+
"val_loader = DataLoader(train_dataset, batch_size=1, shuffle=False, collate_fn=collate_fn)"
|
| 344 |
+
]
|
| 345 |
+
},
|
| 346 |
+
{
|
| 347 |
+
"cell_type": "markdown",
|
| 348 |
+
"metadata": {},
|
| 349 |
+
"source": [
|
| 350 |
+
"### Run Training"
|
| 351 |
+
]
|
| 352 |
+
},
|
| 353 |
+
{
|
| 354 |
+
"cell_type": "code",
|
| 355 |
+
"execution_count": null,
|
| 356 |
+
"metadata": {},
|
| 357 |
+
"outputs": [],
|
| 358 |
+
"source": [
|
| 359 |
+
"#Definition of the training process\n",
|
| 360 |
+
"def train_chickenfcn(model, train_loader, val_loader, optimizer, scheduler, num_epochs, device, save_path):\n",
|
| 361 |
+
" model.train()\n",
|
| 362 |
+
" criterion_mse = torch.nn.MSELoss(reduction='sum').to(device)\n",
|
| 363 |
+
" criterion_mae = torch.nn.L1Loss(reduction='sum').to(device)\n",
|
| 364 |
+
" best_loss = float('inf')\n",
|
| 365 |
+
" print(train_loader.__len__())\n",
|
| 366 |
+
"\n",
|
| 367 |
+
" for epoch in range(num_epochs):\n",
|
| 368 |
+
" train_loss_mse = 0.0\n",
|
| 369 |
+
" train_loss_mae = 0.0\n",
|
| 370 |
+
"\n",
|
| 371 |
+
" train_loader_tqdm = tqdm(train_loader, desc=f'Epoch {epoch + 1}/{num_epochs}', leave=False)\n",
|
| 372 |
+
"\n",
|
| 373 |
+
" for i, data in enumerate(train_loader_tqdm, 0):\n",
|
| 374 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 375 |
+
" inputs = inputs.to(device).float()\n",
|
| 376 |
+
" targets = targets.to(device).float()\n",
|
| 377 |
+
" # print(targets.shape)\n",
|
| 378 |
+
" # t = np.sum((targets[0] / scale).cpu().numpy().squeeze())\n",
|
| 379 |
+
" # print(t)\n",
|
| 380 |
+
"\n",
|
| 381 |
+
" optimizer.zero_grad()\n",
|
| 382 |
+
" \n",
|
| 383 |
+
" outputs = model(inputs)\n",
|
| 384 |
+
" \n",
|
| 385 |
+
" loss_mse = criterion_mse(outputs, targets)\n",
|
| 386 |
+
" loss_mae = criterion_mae(outputs, targets)\n",
|
| 387 |
+
" loss_mae.backward()\n",
|
| 388 |
+
"\n",
|
| 389 |
+
" torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=2.0)\n",
|
| 390 |
+
"\n",
|
| 391 |
+
" optimizer.step()\n",
|
| 392 |
+
" train_loss_mse += loss_mse.item()\n",
|
| 393 |
+
" train_loss_mae += loss_mae.item()\n",
|
| 394 |
+
"\n",
|
| 395 |
+
" train_loader_tqdm.set_postfix({'Train MSE Loss': loss_mse.item(), 'Train MAE Loss': loss_mae.item()})\n",
|
| 396 |
+
"\n",
|
| 397 |
+
" train_loss_mse /= (len(train_loader))\n",
|
| 398 |
+
" train_loss_mae /= (len(train_loader))\n",
|
| 399 |
+
" logging.info(\n",
|
| 400 |
+
" f'Epoch [{epoch + 1}/{num_epochs}], Train MSE loss: {train_loss_mse:.8f}, MAE loss: {train_loss_mae:.8f}')\n",
|
| 401 |
+
"\n",
|
| 402 |
+
" scheduler.step()\n",
|
| 403 |
+
"\n",
|
| 404 |
+
" # Validation\n",
|
| 405 |
+
" model.eval()\n",
|
| 406 |
+
" val_loss_mse = 0.0\n",
|
| 407 |
+
" val_loss_mae = 0.0\n",
|
| 408 |
+
"\n",
|
| 409 |
+
" val_loader_tqdm = tqdm(val_loader, desc=f'Validation Epoch {epoch + 1}/{num_epochs}', leave=False)\n",
|
| 410 |
+
"\n",
|
| 411 |
+
" with torch.no_grad():\n",
|
| 412 |
+
" for i, data in enumerate(val_loader_tqdm, 0):\n",
|
| 413 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 414 |
+
" inputs = inputs.to(device).float()\n",
|
| 415 |
+
" targets = targets.to(device).float()\n",
|
| 416 |
+
"\n",
|
| 417 |
+
" outputs = model(inputs)\n",
|
| 418 |
+
" mse_loss = criterion_mse(outputs, targets)\n",
|
| 419 |
+
" mae_loss = criterion_mae(outputs, targets)\n",
|
| 420 |
+
" val_loss_mse += mse_loss.item()\n",
|
| 421 |
+
" val_loss_mae += mae_loss.item()\n",
|
| 422 |
+
"\n",
|
| 423 |
+
" val_loader_tqdm.set_postfix(\n",
|
| 424 |
+
" {'Validation MSE Loss': mse_loss.item(), 'Validation MAE Loss': mae_loss.item()})\n",
|
| 425 |
+
"\n",
|
| 426 |
+
" val_loss_mse /= (len(val_loader))\n",
|
| 427 |
+
" val_loss_mae /= (len(val_loader))\n",
|
| 428 |
+
" logging.info(\n",
|
| 429 |
+
" f'Epoch [{epoch + 1}/{num_epochs}], Validation MSE Loss: {val_loss_mse:.8f}, MAE Loss: {val_loss_mae:.8f}')\n",
|
| 430 |
+
"\n",
|
| 431 |
+
" # Save Model\n",
|
| 432 |
+
" if val_loss_mae < best_loss:\n",
|
| 433 |
+
" best_loss = val_loss_mae\n",
|
| 434 |
+
" torch.save(model.state_dict(), save_path)\n",
|
| 435 |
+
"\n",
|
| 436 |
+
" print('Finished Training ChickenFCN')"
|
| 437 |
+
]
|
| 438 |
+
},
|
| 439 |
+
{
|
| 440 |
+
"cell_type": "code",
|
| 441 |
+
"execution_count": null,
|
| 442 |
+
"metadata": {},
|
| 443 |
+
"outputs": [],
|
| 444 |
+
"source": [
|
| 445 |
+
"logging = logging_level('info')\n",
|
| 446 |
+
"logging.debug('use debug level logging setting')\n",
|
| 447 |
+
"\n",
|
| 448 |
+
"################################################################################\n",
|
| 449 |
+
"# Experiment Settings\n",
|
| 450 |
+
"################################################################################\n",
|
| 451 |
+
"learning_rate = 1e-4\n",
|
| 452 |
+
"lr_decay = 1e-5\n",
|
| 453 |
+
"weight_decay = 0.0001\n",
|
| 454 |
+
"save_path = \"model.pth\"\n",
|
| 455 |
+
"\n",
|
| 456 |
+
"epochs = 20\n",
|
| 457 |
+
"\n",
|
| 458 |
+
"# Training\n",
|
| 459 |
+
"model = ChickenCounting().to(DEVICE)\n",
|
| 460 |
+
"model.feature_extraction.load_pretrained_weights_partial(BASE_MODEL_PATH)\n",
|
| 461 |
+
"print('load model success')\n",
|
| 462 |
+
"\n",
|
| 463 |
+
"optimizer = optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay)\n",
|
| 464 |
+
"scheduler = optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=1 - lr_decay)\n",
|
| 465 |
+
"\n",
|
| 466 |
+
"logging.info('Begin training single view model...')\n",
|
| 467 |
+
"train_chickenfcn(model, train_loader, val_loader, optimizer, scheduler, epochs, DEVICE, save_path=save_path)\n",
|
| 468 |
+
"logging.info('Finished training single view model.')"
|
| 469 |
+
]
|
| 470 |
+
},
|
| 471 |
+
{
|
| 472 |
+
"cell_type": "markdown",
|
| 473 |
+
"metadata": {},
|
| 474 |
+
"source": [
|
| 475 |
+
"### Evaluate Model\n",
|
| 476 |
+
"This section validates the model on the train set, which helps contestants understand whether the model is usable and calculate the score on the train set."
|
| 477 |
+
]
|
| 478 |
+
},
|
| 479 |
+
{
|
| 480 |
+
"cell_type": "code",
|
| 481 |
+
"execution_count": null,
|
| 482 |
+
"metadata": {},
|
| 483 |
+
"outputs": [],
|
| 484 |
+
"source": [
|
| 485 |
+
"# Definition of the evaluation function\n",
|
| 486 |
+
"def evaluate(model, val_loader, device, scale): # Function used for final scoring.\n",
|
| 487 |
+
" model.eval() # Set the model to evaluation mode\n",
|
| 488 |
+
"\n",
|
| 489 |
+
" # Initialize metrics\n",
|
| 490 |
+
" mse = 0.0\n",
|
| 491 |
+
" mae = 0.0\n",
|
| 492 |
+
" predict_num = 0.0\n",
|
| 493 |
+
" true_num = 0.0\n",
|
| 494 |
+
" rate = 0.0\n",
|
| 495 |
+
"\n",
|
| 496 |
+
" with torch.no_grad(): # Disable gradient calculation for inference\n",
|
| 497 |
+
" for i, data in enumerate(val_loader, 0):\n",
|
| 498 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 499 |
+
" inputs = inputs.to(device).float() # Move inputs to device and convert to float\n",
|
| 500 |
+
" targets = targets.to(device).float() # Move targets to device and convert to float\n",
|
| 501 |
+
"\n",
|
| 502 |
+
" # Get the model predictions\n",
|
| 503 |
+
" outputs = model(inputs) / scale # Adjusting for the scaling factor\n",
|
| 504 |
+
"\n",
|
| 505 |
+
" # Convert tensors to numpy for visualization and metrics calculation\n",
|
| 506 |
+
" inputs_np = inputs.cpu().numpy() # Convert inputs to numpy\n",
|
| 507 |
+
" targets_np = targets.cpu().numpy() # Convert targets to numpy\n",
|
| 508 |
+
" outputs_np = outputs.cpu().numpy() # Convert outputs to numpy\n",
|
| 509 |
+
" # imshow_res(inputs_np, targets_np, outputs_np, scale) # Uncomment to visualize results\n",
|
| 510 |
+
"\n",
|
| 511 |
+
" # Calculate true and predicted sums for comparison\n",
|
| 512 |
+
" t = np.sum((targets[0] / scale).cpu().numpy().squeeze()) # Ground truth sum\n",
|
| 513 |
+
" g = np.sum(outputs.cpu().numpy().squeeze()) # Predicted sum\n",
|
| 514 |
+
" print(f'NO.{i} true_sum={t}, get_sum={g}, abs={abs(t - g)}, rate={abs(1 - g / t)}')\n",
|
| 515 |
+
"\n",
|
| 516 |
+
" # Update metrics\n",
|
| 517 |
+
" predict_num += g\n",
|
| 518 |
+
" true_num += t\n",
|
| 519 |
+
" rate += abs(1 - g / t)\n",
|
| 520 |
+
" mae += abs(t - g)\n",
|
| 521 |
+
" mse += abs(t - g) * abs(t - g)\n",
|
| 522 |
+
"\n",
|
| 523 |
+
" # Calculate average metrics across all batches\n",
|
| 524 |
+
" mae /= len(val_loader)\n",
|
| 525 |
+
" mse /= len(val_loader)\n",
|
| 526 |
+
" predict_num /= len(val_loader)\n",
|
| 527 |
+
" true_num /= len(val_loader)\n",
|
| 528 |
+
" rate /= len(val_loader)\n",
|
| 529 |
+
"\n",
|
| 530 |
+
" # Log the results\n",
|
| 531 |
+
" logging.info(\n",
|
| 532 |
+
" f'test ---- Score: {math.exp(-rate):.3f}, MSE: {mse:.4f}, MAE: {mae:.4f}, Chicken_avg: {predict_num:.4f}')\n",
|
| 533 |
+
" return math.exp(-rate)"
|
| 534 |
+
]
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"cell_type": "code",
|
| 538 |
+
"execution_count": null,
|
| 539 |
+
"metadata": {},
|
| 540 |
+
"outputs": [],
|
| 541 |
+
"source": [
|
| 542 |
+
"model.load_state_dict(torch.load(save_path, map_location=DEVICE))\n",
|
| 543 |
+
"model.to(DEVICE)\n",
|
| 544 |
+
"evaluate(model, val_loader, DEVICE, scale)"
|
| 545 |
+
]
|
| 546 |
+
},
|
| 547 |
+
{
|
| 548 |
+
"cell_type": "markdown",
|
| 549 |
+
"metadata": {},
|
| 550 |
+
"source": [
|
| 551 |
+
"### Submission\n",
|
| 552 |
+
"This part is to generate the result files for testing and scoring.\n",
|
| 553 |
+
"Contestants couldn't access the validation set(test_a) and the test set(test_b) locally.\n",
|
| 554 |
+
"Please read through the following code carefully. Make sure to following the file naming conventions."
|
| 555 |
+
]
|
| 556 |
+
},
|
| 557 |
+
{
|
| 558 |
+
"cell_type": "code",
|
| 559 |
+
"execution_count": null,
|
| 560 |
+
"metadata": {},
|
| 561 |
+
"outputs": [],
|
| 562 |
+
"source": [
|
| 563 |
+
"from datasets import load_dataset\n",
|
| 564 |
+
"\n",
|
| 565 |
+
"test_dataset = load_dataset(\"ioaihsc/Task2_Chicken_Counting_Test\", \n",
|
| 566 |
+
" data_dir=\"valandtest\",\n",
|
| 567 |
+
" split=\"validation\")\n",
|
| 568 |
+
"\n",
|
| 569 |
+
"def collate_fn(batch): # The test datasets will not provide target densities\n",
|
| 570 |
+
" return torch.stack([image_transform(item[\"image\"]) for item in batch])\n",
|
| 571 |
+
"\n",
|
| 572 |
+
"test_loader = DataLoader(test_dataset, batch_size=16, shuffle=False, collate_fn=collate_fn)\n",
|
| 573 |
+
"\n",
|
| 574 |
+
"predictions = []\n",
|
| 575 |
+
"model.eval()\n",
|
| 576 |
+
"with torch.no_grad():\n",
|
| 577 |
+
" for batch in tqdm(test_loader):\n",
|
| 578 |
+
" outputs = model(batch.to(DEVICE)) / scale\n",
|
| 579 |
+
" predictions.append(outputs.cpu().numpy())\n",
|
| 580 |
+
"\n",
|
| 581 |
+
"pred_a = np.concatenate(predictions, axis=0)\n",
|
| 582 |
+
"\n",
|
| 583 |
+
"del test_dataset\n",
|
| 584 |
+
"del test_loader\n",
|
| 585 |
+
"del predictions\n",
|
| 586 |
+
"\n",
|
| 587 |
+
"test_dataset = load_dataset(\"ioaihsc/Task2_Chicken_Counting_Test\", \n",
|
| 588 |
+
" data_dir=\"valandtest\",\n",
|
| 589 |
+
" split=\"test\") \n",
|
| 590 |
+
"test_loader = DataLoader(test_dataset, batch_size=16, shuffle=False, collate_fn=collate_fn)\n",
|
| 591 |
+
"\n",
|
| 592 |
+
"predictions = []\n",
|
| 593 |
+
"with torch.no_grad():\n",
|
| 594 |
+
" for batch in tqdm(test_loader):\n",
|
| 595 |
+
" outputs = model(batch.to(DEVICE)) / scale\n",
|
| 596 |
+
" predictions.append(outputs.cpu().numpy())\n",
|
| 597 |
+
"\n",
|
| 598 |
+
"pred_b = np.concatenate(predictions, axis=0)\n",
|
| 599 |
+
"\n",
|
| 600 |
+
"np.savez('submission.npz', pred_a=pred_a, pred_b=pred_b) # save your submissions in `submission.npz` file with the keys `pred_a` and `pred_b`"
|
| 601 |
+
]
|
| 602 |
+
},
|
| 603 |
+
{
|
| 604 |
+
"cell_type": "code",
|
| 605 |
+
"execution_count": null,
|
| 606 |
+
"metadata": {},
|
| 607 |
+
"outputs": [],
|
| 608 |
+
"source": [
|
| 609 |
+
"%run ./metrics.py"
|
| 610 |
+
]
|
| 611 |
+
}
|
| 612 |
+
],
|
| 613 |
+
"metadata": {
|
| 614 |
+
"kernelspec": {
|
| 615 |
+
"display_name": "Python 3 (ipykernel)",
|
| 616 |
+
"language": "python",
|
| 617 |
+
"name": "python3"
|
| 618 |
+
},
|
| 619 |
+
"language_info": {
|
| 620 |
+
"codemirror_mode": {
|
| 621 |
+
"name": "ipython",
|
| 622 |
+
"version": 3
|
| 623 |
+
},
|
| 624 |
+
"file_extension": ".py",
|
| 625 |
+
"mimetype": "text/x-python",
|
| 626 |
+
"name": "python",
|
| 627 |
+
"nbconvert_exporter": "python",
|
| 628 |
+
"pygments_lexer": "ipython3",
|
| 629 |
+
"version": "3.12.9"
|
| 630 |
+
}
|
| 631 |
+
},
|
| 632 |
+
"nbformat": 4,
|
| 633 |
+
"nbformat_minor": 4
|
| 634 |
+
}
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Chicken_Counting/Chicken_Counting_Solution.ipynb
ADDED
|
@@ -0,0 +1,742 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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Chicken_Counting/Chicken_Counting_Solution.ipynb)"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"# Chicken Counting: Reference Solution"
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "markdown",
|
| 23 |
+
"metadata": {},
|
| 24 |
+
"source": [
|
| 25 |
+
"## Imports"
|
| 26 |
+
]
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"cell_type": "code",
|
| 30 |
+
"execution_count": null,
|
| 31 |
+
"metadata": {
|
| 32 |
+
"executionInfo": {
|
| 33 |
+
"elapsed": 5616,
|
| 34 |
+
"status": "ok",
|
| 35 |
+
"timestamp": 1753592556976,
|
| 36 |
+
"user": {
|
| 37 |
+
"displayName": "陈红涛",
|
| 38 |
+
"userId": "16480124546172497377"
|
| 39 |
+
},
|
| 40 |
+
"user_tz": -480
|
| 41 |
+
},
|
| 42 |
+
"id": "t-7tiKDEs5N7"
|
| 43 |
+
},
|
| 44 |
+
"outputs": [],
|
| 45 |
+
"source": [
|
| 46 |
+
"import os\n",
|
| 47 |
+
"import torch\n",
|
| 48 |
+
"import torch.nn as nn\n",
|
| 49 |
+
"import torch.nn.functional as F\n",
|
| 50 |
+
"import torch.optim as optim\n",
|
| 51 |
+
"from torch.utils.data import Dataset, DataLoader\n",
|
| 52 |
+
"from datasets import load_from_disk\n",
|
| 53 |
+
"import logging\n",
|
| 54 |
+
"from torchvision import transforms\n",
|
| 55 |
+
"from tqdm import tqdm\n",
|
| 56 |
+
"import numpy as np\n",
|
| 57 |
+
"import math\n",
|
| 58 |
+
"from PIL import Image\n",
|
| 59 |
+
"import zipfile\n",
|
| 60 |
+
"from typing import Optional\n",
|
| 61 |
+
"import random\n",
|
| 62 |
+
"\n",
|
| 63 |
+
"np.random.seed(42)\n",
|
| 64 |
+
"random.seed(42)\n",
|
| 65 |
+
"torch.manual_seed(42) \n",
|
| 66 |
+
"torch.cuda.manual_seed(42) \n",
|
| 67 |
+
"torch.cuda.manual_seed_all(42)\n",
|
| 68 |
+
"\n",
|
| 69 |
+
"TRAIN_PATH = \"./\"\n",
|
| 70 |
+
"TRAINING_SET = TRAIN_PATH + \"train\"\n",
|
| 71 |
+
"BASE_MODEL_PATH = TRAIN_PATH + \"base.pth\"\n",
|
| 72 |
+
"DTYPE = torch.float32\n",
|
| 73 |
+
"DEVICE = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n",
|
| 74 |
+
"scale = 300.0"
|
| 75 |
+
]
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"cell_type": "markdown",
|
| 79 |
+
"metadata": {},
|
| 80 |
+
"source": [
|
| 81 |
+
"## Logging Utilities"
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"cell_type": "code",
|
| 86 |
+
"execution_count": null,
|
| 87 |
+
"metadata": {
|
| 88 |
+
"executionInfo": {
|
| 89 |
+
"elapsed": 28,
|
| 90 |
+
"status": "ok",
|
| 91 |
+
"timestamp": 1753592562308,
|
| 92 |
+
"user": {
|
| 93 |
+
"displayName": "陈红涛",
|
| 94 |
+
"userId": "16480124546172497377"
|
| 95 |
+
},
|
| 96 |
+
"user_tz": -480
|
| 97 |
+
},
|
| 98 |
+
"id": "SMii-32Qs5N9"
|
| 99 |
+
},
|
| 100 |
+
"outputs": [],
|
| 101 |
+
"source": [
|
| 102 |
+
"def logging_level(level='info'):\n",
|
| 103 |
+
" str_format = '%(asctime)s - %(levelname)s: %(message)s'\n",
|
| 104 |
+
" if level == 'debug':\n",
|
| 105 |
+
" logging.basicConfig(level=logging.DEBUG, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')\n",
|
| 106 |
+
" elif level == 'info':\n",
|
| 107 |
+
" logging.basicConfig(level=logging.INFO, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')\n",
|
| 108 |
+
" return logging\n",
|
| 109 |
+
"\n",
|
| 110 |
+
"\n",
|
| 111 |
+
"class BatchLossLogger:\n",
|
| 112 |
+
" def __init__(self, log_interval=100):\n",
|
| 113 |
+
" self.losses = []\n",
|
| 114 |
+
" self.batch_number = 0\n",
|
| 115 |
+
" self.log_interval = log_interval\n",
|
| 116 |
+
"\n",
|
| 117 |
+
" def log(self, loss):\n",
|
| 118 |
+
" self.losses.append(loss)\n",
|
| 119 |
+
" self.batch_number += 1\n",
|
| 120 |
+
" if self.batch_number % self.log_interval == 0:\n",
|
| 121 |
+
" logging.info(f'Batch No. {self.batch_number:7d} - loss: {loss:.6f}')"
|
| 122 |
+
]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"cell_type": "markdown",
|
| 126 |
+
"metadata": {},
|
| 127 |
+
"source": [
|
| 128 |
+
"## Traininng Your Model\n",
|
| 129 |
+
"### Model Definition\n",
|
| 130 |
+
"Pretrained weights of the FeatureExtraction model is provided, along with a function to load them. And a completed UNet structure is applied."
|
| 131 |
+
]
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"cell_type": "code",
|
| 135 |
+
"execution_count": null,
|
| 136 |
+
"metadata": {
|
| 137 |
+
"executionInfo": {
|
| 138 |
+
"elapsed": 113,
|
| 139 |
+
"status": "ok",
|
| 140 |
+
"timestamp": 1753592562424,
|
| 141 |
+
"user": {
|
| 142 |
+
"displayName": "陈红涛",
|
| 143 |
+
"userId": "16480124546172497377"
|
| 144 |
+
},
|
| 145 |
+
"user_tz": -480
|
| 146 |
+
},
|
| 147 |
+
"id": "VWPcNgjUvXq5"
|
| 148 |
+
},
|
| 149 |
+
"outputs": [],
|
| 150 |
+
"source": [
|
| 151 |
+
"class DoubleConv(nn.Module):\n",
|
| 152 |
+
" \"\"\"(convolution => [BN] => ReLU) * 2\"\"\"\n",
|
| 153 |
+
"\n",
|
| 154 |
+
" def __init__(self, in_channels, out_channels, mid_channels=None):\n",
|
| 155 |
+
" super().__init__()\n",
|
| 156 |
+
" if not mid_channels:\n",
|
| 157 |
+
" mid_channels = out_channels\n",
|
| 158 |
+
" self.double_conv = nn.Sequential(\n",
|
| 159 |
+
" nn.Conv2d(in_channels, mid_channels, kernel_size=3, padding=1, bias=False),\n",
|
| 160 |
+
" nn.BatchNorm2d(mid_channels),\n",
|
| 161 |
+
" nn.ReLU(inplace=True),\n",
|
| 162 |
+
" nn.Conv2d(mid_channels, out_channels, kernel_size=3, padding=1, bias=False),\n",
|
| 163 |
+
" nn.BatchNorm2d(out_channels),\n",
|
| 164 |
+
" nn.ReLU(inplace=True)\n",
|
| 165 |
+
" )\n",
|
| 166 |
+
"\n",
|
| 167 |
+
" def forward(self, x):\n",
|
| 168 |
+
" return self.double_conv(x)\n",
|
| 169 |
+
"\n",
|
| 170 |
+
"\n",
|
| 171 |
+
"class Down(nn.Module):\n",
|
| 172 |
+
" \"\"\"Downscaling with maxpool then double conv\"\"\"\n",
|
| 173 |
+
"\n",
|
| 174 |
+
" def __init__(self, in_channels, out_channels):\n",
|
| 175 |
+
" super().__init__()\n",
|
| 176 |
+
" self.maxpool_conv = nn.Sequential(\n",
|
| 177 |
+
" nn.MaxPool2d(2),\n",
|
| 178 |
+
" DoubleConv(in_channels, out_channels)\n",
|
| 179 |
+
" )\n",
|
| 180 |
+
"\n",
|
| 181 |
+
" def forward(self, x):\n",
|
| 182 |
+
" return self.maxpool_conv(x)\n",
|
| 183 |
+
"\n",
|
| 184 |
+
"\n",
|
| 185 |
+
"class Up(nn.Module):\n",
|
| 186 |
+
" \"\"\"Upscaling then double conv\"\"\"\n",
|
| 187 |
+
"\n",
|
| 188 |
+
" def __init__(self, in_channels, out_channels, bilinear=True):\n",
|
| 189 |
+
" super().__init__()\n",
|
| 190 |
+
"\n",
|
| 191 |
+
" # if bilinear, use the normal convolutions to reduce the number of channels\n",
|
| 192 |
+
" if bilinear:\n",
|
| 193 |
+
" self.up = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=True)\n",
|
| 194 |
+
" self.conv = DoubleConv(in_channels, out_channels, in_channels // 2)\n",
|
| 195 |
+
" else:\n",
|
| 196 |
+
" self.up = nn.ConvTranspose2d(in_channels, in_channels // 2, kernel_size=2, stride=2)\n",
|
| 197 |
+
" self.conv = DoubleConv(in_channels, out_channels)\n",
|
| 198 |
+
"\n",
|
| 199 |
+
" def forward(self, x1, x2):\n",
|
| 200 |
+
" x1 = self.up(x1)\n",
|
| 201 |
+
" # input is CHW\n",
|
| 202 |
+
" diffY = x2.size()[2] - x1.size()[2]\n",
|
| 203 |
+
" diffX = x2.size()[3] - x1.size()[3]\n",
|
| 204 |
+
"\n",
|
| 205 |
+
" x1 = F.pad(x1, [diffX // 2, diffX - diffX // 2,\n",
|
| 206 |
+
" diffY // 2, diffY - diffY // 2])\n",
|
| 207 |
+
" # if you have padding issues, see\n",
|
| 208 |
+
" # https://github.com/HaiyongJiang/U-Net-Pytorch-Unstructured-Buggy/commit/0e854509c2cea854e247a9c615f175f76fbb2e3a\n",
|
| 209 |
+
" # https://github.com/xiaopeng-liao/Pytorch-UNet/commit/8ebac70e633bac59fc22bb5195e513d5832fb3bd\n",
|
| 210 |
+
" x = torch.cat([x2, x1], dim=1)\n",
|
| 211 |
+
" return self.conv(x)\n",
|
| 212 |
+
"\n",
|
| 213 |
+
"\n",
|
| 214 |
+
"class OutConv(nn.Module):\n",
|
| 215 |
+
" def __init__(self, in_channels, out_channels):\n",
|
| 216 |
+
" super(OutConv, self).__init__()\n",
|
| 217 |
+
" self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=1)\n",
|
| 218 |
+
"\n",
|
| 219 |
+
" def forward(self, x):\n",
|
| 220 |
+
" return self.conv(x)\n",
|
| 221 |
+
"\n",
|
| 222 |
+
"class UNet(nn.Module):\n",
|
| 223 |
+
" def __init__(self, n_channels, n_classes, bilinear=False):\n",
|
| 224 |
+
" super(UNet, self).__init__()\n",
|
| 225 |
+
" self.n_channels = n_channels\n",
|
| 226 |
+
" self.n_classes = n_classes\n",
|
| 227 |
+
" self.bilinear = bilinear\n",
|
| 228 |
+
"\n",
|
| 229 |
+
" self.inc = (DoubleConv(n_channels, 64))\n",
|
| 230 |
+
" self.down1 = (Down(64, 128))\n",
|
| 231 |
+
" self.down2 = (Down(128, 256))\n",
|
| 232 |
+
" self.down3 = (Down(256, 512))\n",
|
| 233 |
+
" factor = 2 if bilinear else 1\n",
|
| 234 |
+
" self.down4 = (Down(512, 1024 // factor))\n",
|
| 235 |
+
" self.up1 = (Up(1024, 512 // factor, bilinear))\n",
|
| 236 |
+
" self.up2 = (Up(512, 256 // factor, bilinear))\n",
|
| 237 |
+
" # self.up2 = (Up(512, 64, bilinear))\n",
|
| 238 |
+
" self.up3 = (Up(256, 128 // factor, bilinear))\n",
|
| 239 |
+
" self.up4 = (Up(128, 64, bilinear))\n",
|
| 240 |
+
" self.outc = (OutConv(64, n_classes))\n",
|
| 241 |
+
"\n",
|
| 242 |
+
" def forward(self, x):\n",
|
| 243 |
+
" x1 = self.inc(x)\n",
|
| 244 |
+
" x2 = self.down1(x1)\n",
|
| 245 |
+
" x3 = self.down2(x2)\n",
|
| 246 |
+
" x4 = self.down3(x3)\n",
|
| 247 |
+
" x5 = self.down4(x4)\n",
|
| 248 |
+
" x = self.up1(x5, x4)\n",
|
| 249 |
+
" x = self.up2(x, x3)\n",
|
| 250 |
+
" x = self.up3(x, x2)\n",
|
| 251 |
+
" x = self.up4(x, x1)\n",
|
| 252 |
+
" logits = self.outc(x)\n",
|
| 253 |
+
" logits = F.relu(logits)\n",
|
| 254 |
+
" return logits"
|
| 255 |
+
]
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"cell_type": "code",
|
| 259 |
+
"execution_count": null,
|
| 260 |
+
"metadata": {
|
| 261 |
+
"executionInfo": {
|
| 262 |
+
"elapsed": 13,
|
| 263 |
+
"status": "ok",
|
| 264 |
+
"timestamp": 1753592562452,
|
| 265 |
+
"user": {
|
| 266 |
+
"displayName": "陈红涛",
|
| 267 |
+
"userId": "16480124546172497377"
|
| 268 |
+
},
|
| 269 |
+
"user_tz": -480
|
| 270 |
+
},
|
| 271 |
+
"id": "5glRHs1Fs5N_"
|
| 272 |
+
},
|
| 273 |
+
"outputs": [],
|
| 274 |
+
"source": [
|
| 275 |
+
"class FeatureExtraction(nn.Module):\n",
|
| 276 |
+
" def __init__(self, in_channels=3):\n",
|
| 277 |
+
" super(FeatureExtraction, self).__init__()\n",
|
| 278 |
+
" self.conv1 = nn.Conv2d(in_channels, 64, kernel_size=3, padding=2, dilation=2)\n",
|
| 279 |
+
" self.conv2 = nn.Conv2d(64, 64, kernel_size=3, padding=2, dilation=2)\n",
|
| 280 |
+
" self.pool2 = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)\n",
|
| 281 |
+
"\n",
|
| 282 |
+
" self.conv3 = nn.Conv2d(64, 128, kernel_size=3, padding=2, dilation=2)\n",
|
| 283 |
+
" self.conv4 = nn.Conv2d(128, 128, kernel_size=3, padding=2, dilation=2)\n",
|
| 284 |
+
" self.pool4 = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)\n",
|
| 285 |
+
"\n",
|
| 286 |
+
"\n",
|
| 287 |
+
" def forward(self, x):\n",
|
| 288 |
+
" x = F.relu(self.conv1(x))\n",
|
| 289 |
+
" x = F.relu(self.conv2(x))\n",
|
| 290 |
+
" x = self.pool2(x)\n",
|
| 291 |
+
" x = F.relu(self.conv3(x))\n",
|
| 292 |
+
" x = F.relu(self.conv4(x))\n",
|
| 293 |
+
" x = self.pool4(x)\n",
|
| 294 |
+
"\n",
|
| 295 |
+
" return x\n",
|
| 296 |
+
"\n",
|
| 297 |
+
" def load_pretrained_weights_partial(self, weights_path, num_layers=4):\n",
|
| 298 |
+
" save_model = torch.load(weights_path)\n",
|
| 299 |
+
" partial_state_dict = {}\n",
|
| 300 |
+
" expected_layers = [\n",
|
| 301 |
+
" 'feature_extraction.conv1.weight', 'feature_extraction.conv1.bias',\n",
|
| 302 |
+
" 'feature_extraction.conv2.weight', 'feature_extraction.conv2.bias',\n",
|
| 303 |
+
" 'feature_extraction.conv3.weight', 'feature_extraction.conv3.bias',\n",
|
| 304 |
+
" 'feature_extraction.conv4.weight', 'feature_extraction.conv4.bias',\n",
|
| 305 |
+
" ]\n",
|
| 306 |
+
" state_dict = {k.split('.', 1)[-1]: v for k, v in save_model.items() if k in expected_layers[:2 * num_layers]}\n",
|
| 307 |
+
" model_dict = self.state_dict()\n",
|
| 308 |
+
"\n",
|
| 309 |
+
" for k in state_dict:\n",
|
| 310 |
+
" if k in model_dict:\n",
|
| 311 |
+
" partial_state_dict[k] = state_dict[k]\n",
|
| 312 |
+
" print(k)\n",
|
| 313 |
+
"\n",
|
| 314 |
+
" self.load_state_dict(partial_state_dict)\n",
|
| 315 |
+
"\n",
|
| 316 |
+
"\n",
|
| 317 |
+
"class ChickenCounting(nn.Module):\n",
|
| 318 |
+
" def __init__(self):\n",
|
| 319 |
+
" super(ChickenCounting, self).__init__()\n",
|
| 320 |
+
" self.feature_extraction = FeatureExtraction()\n",
|
| 321 |
+
" self.unet = UNet(n_channels=128, n_classes=1)\n",
|
| 322 |
+
"\n",
|
| 323 |
+
"\n",
|
| 324 |
+
" def forward(self, x):\n",
|
| 325 |
+
" x = self.feature_extraction(x)\n",
|
| 326 |
+
" x = self.unet(x)\n",
|
| 327 |
+
" return x"
|
| 328 |
+
]
|
| 329 |
+
},
|
| 330 |
+
{
|
| 331 |
+
"cell_type": "markdown",
|
| 332 |
+
"metadata": {},
|
| 333 |
+
"source": [
|
| 334 |
+
"### Reading the Dataset"
|
| 335 |
+
]
|
| 336 |
+
},
|
| 337 |
+
{
|
| 338 |
+
"cell_type": "code",
|
| 339 |
+
"execution_count": null,
|
| 340 |
+
"metadata": {
|
| 341 |
+
"executionInfo": {
|
| 342 |
+
"elapsed": 14,
|
| 343 |
+
"status": "ok",
|
| 344 |
+
"timestamp": 1753592562479,
|
| 345 |
+
"user": {
|
| 346 |
+
"displayName": "陈红涛",
|
| 347 |
+
"userId": "16480124546172497377"
|
| 348 |
+
},
|
| 349 |
+
"user_tz": -480
|
| 350 |
+
},
|
| 351 |
+
"id": "u-Pb0-1Ps5OA"
|
| 352 |
+
},
|
| 353 |
+
"outputs": [],
|
| 354 |
+
"source": [
|
| 355 |
+
"from datasets import load_dataset\n",
|
| 356 |
+
"\n",
|
| 357 |
+
"# 从 Hugging Face 加载数据集\n",
|
| 358 |
+
"train_dataset = load_dataset(\"ioaihsc/Task2_Chicken_Counting_Train2\", \n",
|
| 359 |
+
" data_dir=\"train\",\n",
|
| 360 |
+
" split=\"train\") \n",
|
| 361 |
+
"\n",
|
| 362 |
+
"image_transform = transforms.Compose([\n",
|
| 363 |
+
" transforms.ToTensor(),\n",
|
| 364 |
+
"])\n",
|
| 365 |
+
"\n",
|
| 366 |
+
"def collate_fn(batch, scale=scale):\n",
|
| 367 |
+
" return {\n",
|
| 368 |
+
" \"image\": torch.stack([image_transform(item[\"image\"]) for item in batch]),\n",
|
| 369 |
+
" \"density\": torch.stack([torch.tensor(item[\"density\"], dtype=DTYPE).unsqueeze(0) * scale for item in batch])\n",
|
| 370 |
+
" }\n",
|
| 371 |
+
"\n",
|
| 372 |
+
"train_loader = DataLoader(train_dataset, batch_size=1, shuffle=True, collate_fn=collate_fn)\n",
|
| 373 |
+
"val_loader = DataLoader(train_dataset, batch_size=1, shuffle=False, collate_fn=collate_fn)"
|
| 374 |
+
]
|
| 375 |
+
},
|
| 376 |
+
{
|
| 377 |
+
"cell_type": "markdown",
|
| 378 |
+
"metadata": {},
|
| 379 |
+
"source": [
|
| 380 |
+
"### Training"
|
| 381 |
+
]
|
| 382 |
+
},
|
| 383 |
+
{
|
| 384 |
+
"cell_type": "code",
|
| 385 |
+
"execution_count": null,
|
| 386 |
+
"metadata": {
|
| 387 |
+
"executionInfo": {
|
| 388 |
+
"elapsed": 35,
|
| 389 |
+
"status": "ok",
|
| 390 |
+
"timestamp": 1753592562517,
|
| 391 |
+
"user": {
|
| 392 |
+
"displayName": "陈红涛",
|
| 393 |
+
"userId": "16480124546172497377"
|
| 394 |
+
},
|
| 395 |
+
"user_tz": -480
|
| 396 |
+
},
|
| 397 |
+
"id": "RN2VW6yTs5OB"
|
| 398 |
+
},
|
| 399 |
+
"outputs": [],
|
| 400 |
+
"source": [
|
| 401 |
+
"def train_chickenfcn(model, train_loader, val_loader, optimizer, scheduler, num_epochs, device, save_path):\n",
|
| 402 |
+
" model.train()\n",
|
| 403 |
+
" criterion_mse = torch.nn.MSELoss(reduction='sum').to(device)\n",
|
| 404 |
+
" criterion_mae = torch.nn.L1Loss(reduction='sum').to(device)\n",
|
| 405 |
+
" best_loss = float('inf')\n",
|
| 406 |
+
" print(train_loader.__len__())\n",
|
| 407 |
+
"\n",
|
| 408 |
+
" for epoch in range(num_epochs):\n",
|
| 409 |
+
" train_loss_mse = 0.0\n",
|
| 410 |
+
" train_loss_mae = 0.0\n",
|
| 411 |
+
"\n",
|
| 412 |
+
" train_loader_tqdm = tqdm(train_loader, desc=f'Epoch {epoch + 1}/{num_epochs}', leave=False)\n",
|
| 413 |
+
"\n",
|
| 414 |
+
" for i, data in enumerate(train_loader_tqdm, 0):\n",
|
| 415 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 416 |
+
" inputs = inputs.to(device).float()\n",
|
| 417 |
+
" targets = targets.to(device).float()\n",
|
| 418 |
+
" # print(targets.shape)\n",
|
| 419 |
+
" # t = np.sum((targets[0] / scale).cpu().numpy().squeeze())\n",
|
| 420 |
+
" # print(t)\n",
|
| 421 |
+
"\n",
|
| 422 |
+
" optimizer.zero_grad()\n",
|
| 423 |
+
"\n",
|
| 424 |
+
" outputs = model(inputs)\n",
|
| 425 |
+
"\n",
|
| 426 |
+
" loss_mse = criterion_mse(outputs, targets)\n",
|
| 427 |
+
" loss_mae = criterion_mae(outputs, targets)\n",
|
| 428 |
+
" loss_mae.backward()\n",
|
| 429 |
+
"\n",
|
| 430 |
+
" torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=2.0)\n",
|
| 431 |
+
"\n",
|
| 432 |
+
" optimizer.step()\n",
|
| 433 |
+
" train_loss_mse += loss_mse.item()\n",
|
| 434 |
+
" train_loss_mae += loss_mae.item()\n",
|
| 435 |
+
"\n",
|
| 436 |
+
" train_loader_tqdm.set_postfix({'Train MSE Loss': loss_mse.item(), 'Train MAE Loss': loss_mae.item()})\n",
|
| 437 |
+
"\n",
|
| 438 |
+
" train_loss_mse /= (len(train_loader))\n",
|
| 439 |
+
" train_loss_mae /= (len(train_loader))\n",
|
| 440 |
+
" logging.info(\n",
|
| 441 |
+
" f'Epoch [{epoch + 1}/{num_epochs}], Train MSE loss: {train_loss_mse:.8f}, MAE loss: {train_loss_mae:.8f}')\n",
|
| 442 |
+
"\n",
|
| 443 |
+
" scheduler.step()\n",
|
| 444 |
+
"\n",
|
| 445 |
+
" # Validation\n",
|
| 446 |
+
" model.eval()\n",
|
| 447 |
+
" val_loss_mse = 0.0\n",
|
| 448 |
+
" val_loss_mae = 0.0\n",
|
| 449 |
+
"\n",
|
| 450 |
+
" val_loader_tqdm = tqdm(val_loader, desc=f'Validation Epoch {epoch + 1}/{num_epochs}', leave=False)\n",
|
| 451 |
+
"\n",
|
| 452 |
+
" with torch.no_grad():\n",
|
| 453 |
+
" for i, data in enumerate(val_loader_tqdm, 0):\n",
|
| 454 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 455 |
+
" inputs = inputs.to(device).float()\n",
|
| 456 |
+
" targets = targets.to(device).float()\n",
|
| 457 |
+
"\n",
|
| 458 |
+
" outputs = model(inputs)\n",
|
| 459 |
+
" mse_loss = criterion_mse(outputs, targets)\n",
|
| 460 |
+
" mae_loss = criterion_mae(outputs, targets)\n",
|
| 461 |
+
" val_loss_mse += mse_loss.item()\n",
|
| 462 |
+
" val_loss_mae += mae_loss.item()\n",
|
| 463 |
+
"\n",
|
| 464 |
+
" val_loader_tqdm.set_postfix(\n",
|
| 465 |
+
" {'Validation MSE Loss': mse_loss.item(), 'Validation MAE Loss': mae_loss.item()})\n",
|
| 466 |
+
"\n",
|
| 467 |
+
" val_loss_mse /= (len(val_loader))\n",
|
| 468 |
+
" val_loss_mae /= (len(val_loader))\n",
|
| 469 |
+
" logging.info(\n",
|
| 470 |
+
" f'Epoch [{epoch + 1}/{num_epochs}], Validation MSE Loss: {val_loss_mse:.8f}, MAE Loss: {val_loss_mae:.8f}')\n",
|
| 471 |
+
"\n",
|
| 472 |
+
" # Save Model\n",
|
| 473 |
+
" if val_loss_mae < best_loss:\n",
|
| 474 |
+
" best_loss = val_loss_mae\n",
|
| 475 |
+
" torch.save(model.state_dict(), save_path)\n",
|
| 476 |
+
"\n",
|
| 477 |
+
" print('Finished Training ChickenFCN')"
|
| 478 |
+
]
|
| 479 |
+
},
|
| 480 |
+
{
|
| 481 |
+
"cell_type": "code",
|
| 482 |
+
"execution_count": null,
|
| 483 |
+
"metadata": {
|
| 484 |
+
"colab": {
|
| 485 |
+
"base_uri": "https://localhost:8080/"
|
| 486 |
+
},
|
| 487 |
+
"executionInfo": {
|
| 488 |
+
"elapsed": 917027,
|
| 489 |
+
"status": "ok",
|
| 490 |
+
"timestamp": 1753593479556,
|
| 491 |
+
"user": {
|
| 492 |
+
"displayName": "陈红涛",
|
| 493 |
+
"userId": "16480124546172497377"
|
| 494 |
+
},
|
| 495 |
+
"user_tz": -480
|
| 496 |
+
},
|
| 497 |
+
"id": "oAoNLtC5s5OC",
|
| 498 |
+
"outputId": "f700e0dc-5a4c-4f5f-bdc9-2aa074bc3d60"
|
| 499 |
+
},
|
| 500 |
+
"outputs": [],
|
| 501 |
+
"source": [
|
| 502 |
+
"logging = logging_level('info')\n",
|
| 503 |
+
"logging.debug('use debug level logging setting')\n",
|
| 504 |
+
"\n",
|
| 505 |
+
"################################################################################\n",
|
| 506 |
+
"# Experiment Settings\n",
|
| 507 |
+
"################################################################################\n",
|
| 508 |
+
"learning_rate = 1e-4\n",
|
| 509 |
+
"lr_decay = 1e-5\n",
|
| 510 |
+
"weight_decay = 0.0001\n",
|
| 511 |
+
"save_path = \"model.pth\"\n",
|
| 512 |
+
"\n",
|
| 513 |
+
"epochs = 30\n",
|
| 514 |
+
"\n",
|
| 515 |
+
"################################################################################\n",
|
| 516 |
+
"# Dataset paths\n",
|
| 517 |
+
"################################################################################\n",
|
| 518 |
+
"\n",
|
| 519 |
+
"model = ChickenCounting().to(DEVICE)\n",
|
| 520 |
+
"model.feature_extraction.load_pretrained_weights_partial(BASE_MODEL_PATH)\n",
|
| 521 |
+
"print('load model success')\n",
|
| 522 |
+
"\n",
|
| 523 |
+
"optimizer = optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay)\n",
|
| 524 |
+
"# optimizer = optim.SGD(model.parameters(), lr=learning_rate, momentum=momentum, weight_decay=weight_decay)\n",
|
| 525 |
+
"scheduler = optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=1 - lr_decay)\n",
|
| 526 |
+
"\n",
|
| 527 |
+
"logging.info('Begin training single view model...')\n",
|
| 528 |
+
"train_chickenfcn(model, train_loader, val_loader, optimizer, scheduler, epochs, DEVICE, save_path=save_path)\n",
|
| 529 |
+
"logging.info('Finished training single view model.')"
|
| 530 |
+
]
|
| 531 |
+
},
|
| 532 |
+
{
|
| 533 |
+
"cell_type": "markdown",
|
| 534 |
+
"metadata": {},
|
| 535 |
+
"source": [
|
| 536 |
+
"### Evaluate Model"
|
| 537 |
+
]
|
| 538 |
+
},
|
| 539 |
+
{
|
| 540 |
+
"cell_type": "code",
|
| 541 |
+
"execution_count": null,
|
| 542 |
+
"metadata": {
|
| 543 |
+
"executionInfo": {
|
| 544 |
+
"elapsed": 3,
|
| 545 |
+
"status": "ok",
|
| 546 |
+
"timestamp": 1753593479563,
|
| 547 |
+
"user": {
|
| 548 |
+
"displayName": "陈红涛",
|
| 549 |
+
"userId": "16480124546172497377"
|
| 550 |
+
},
|
| 551 |
+
"user_tz": -480
|
| 552 |
+
},
|
| 553 |
+
"id": "_PuMTMDKs5OE"
|
| 554 |
+
},
|
| 555 |
+
"outputs": [],
|
| 556 |
+
"source": [
|
| 557 |
+
"def evaluate(model, val_loader, device, scale): # Function used for final scoring.\n",
|
| 558 |
+
" model.eval() # Set the model to evaluation mode\n",
|
| 559 |
+
"\n",
|
| 560 |
+
" # Initialize metrics\n",
|
| 561 |
+
" mse = 0.0\n",
|
| 562 |
+
" mae = 0.0\n",
|
| 563 |
+
" predict_num = 0.0\n",
|
| 564 |
+
" true_num = 0.0\n",
|
| 565 |
+
" rate = 0.0\n",
|
| 566 |
+
"\n",
|
| 567 |
+
" with torch.no_grad(): # Disable gradient calculation for inference\n",
|
| 568 |
+
" for i, data in enumerate(val_loader, 0):\n",
|
| 569 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 570 |
+
" inputs = inputs.to(device).float() # Move inputs to device and convert to float\n",
|
| 571 |
+
" targets = targets.to(device).float() # Move targets to device and convert to float\n",
|
| 572 |
+
"\n",
|
| 573 |
+
" # Get the model predictions\n",
|
| 574 |
+
" outputs = model(inputs) / scale # Adjusting for the scaling factor\n",
|
| 575 |
+
"\n",
|
| 576 |
+
" # Convert tensors to numpy for visualization and metrics calculation\n",
|
| 577 |
+
" inputs_np = inputs.cpu().numpy() # Convert inputs to numpy\n",
|
| 578 |
+
" targets_np = targets.cpu().numpy() # Convert targets to numpy\n",
|
| 579 |
+
" outputs_np = outputs.cpu().numpy() # Convert outputs to numpy\n",
|
| 580 |
+
" # imshow_res(inputs_np, targets_np, outputs_np, scale) # Uncomment to visualize results\n",
|
| 581 |
+
"\n",
|
| 582 |
+
" # Calculate true and predicted sums for comparison\n",
|
| 583 |
+
" t = np.sum((targets[0] / scale).cpu().numpy().squeeze()) # Ground truth sum\n",
|
| 584 |
+
" g = np.sum(outputs.cpu().numpy().squeeze()) # Predicted sum\n",
|
| 585 |
+
" print(f'NO.{i} true_sum={t}, get_sum={g}, abs={abs(t - g)}, rate={abs(1 - g / t)}')\n",
|
| 586 |
+
"\n",
|
| 587 |
+
" # Update metrics\n",
|
| 588 |
+
" predict_num += g\n",
|
| 589 |
+
" true_num += t\n",
|
| 590 |
+
" rate += abs(1 - g / t)\n",
|
| 591 |
+
" mae += abs(t - g)\n",
|
| 592 |
+
" mse += abs(t - g) * abs(t - g)\n",
|
| 593 |
+
"\n",
|
| 594 |
+
" # Calculate average metrics across all batches\n",
|
| 595 |
+
" mae /= len(val_loader)\n",
|
| 596 |
+
" mse /= len(val_loader)\n",
|
| 597 |
+
" predict_num /= len(val_loader)\n",
|
| 598 |
+
" true_num /= len(val_loader)\n",
|
| 599 |
+
" rate /= len(val_loader)\n",
|
| 600 |
+
"\n",
|
| 601 |
+
" # Log the results\n",
|
| 602 |
+
" logging.info(\n",
|
| 603 |
+
" f'test ---- Score: {math.exp(-rate):.3f}, MSE: {mse:.4f}, MAE: {mae:.4f}, Chicken_avg: {predict_num:.4f}')\n",
|
| 604 |
+
" return math.exp(-rate)"
|
| 605 |
+
]
|
| 606 |
+
},
|
| 607 |
+
{
|
| 608 |
+
"cell_type": "code",
|
| 609 |
+
"execution_count": null,
|
| 610 |
+
"metadata": {
|
| 611 |
+
"colab": {
|
| 612 |
+
"base_uri": "https://localhost:8080/"
|
| 613 |
+
},
|
| 614 |
+
"executionInfo": {
|
| 615 |
+
"elapsed": 12124,
|
| 616 |
+
"status": "ok",
|
| 617 |
+
"timestamp": 1753593491690,
|
| 618 |
+
"user": {
|
| 619 |
+
"displayName": "陈红涛",
|
| 620 |
+
"userId": "16480124546172497377"
|
| 621 |
+
},
|
| 622 |
+
"user_tz": -480
|
| 623 |
+
},
|
| 624 |
+
"id": "0yFgonMZs5OF",
|
| 625 |
+
"outputId": "f4a0fe9d-d185-4133-8f8e-4bc2e2c8fa77"
|
| 626 |
+
},
|
| 627 |
+
"outputs": [],
|
| 628 |
+
"source": [
|
| 629 |
+
"model.load_state_dict(torch.load(save_path, map_location=DEVICE))\n",
|
| 630 |
+
"model.to(DEVICE)\n",
|
| 631 |
+
"evaluate(model, val_loader, DEVICE, scale)"
|
| 632 |
+
]
|
| 633 |
+
},
|
| 634 |
+
{
|
| 635 |
+
"cell_type": "markdown",
|
| 636 |
+
"metadata": {
|
| 637 |
+
"id": "xVQtmZ55s5OG"
|
| 638 |
+
},
|
| 639 |
+
"source": [
|
| 640 |
+
"## Submission\n",
|
| 641 |
+
"Please read through the following code carefully. Make sure to following the file naming conventions."
|
| 642 |
+
]
|
| 643 |
+
},
|
| 644 |
+
{
|
| 645 |
+
"cell_type": "code",
|
| 646 |
+
"execution_count": null,
|
| 647 |
+
"metadata": {
|
| 648 |
+
"colab": {
|
| 649 |
+
"base_uri": "https://localhost:8080/"
|
| 650 |
+
},
|
| 651 |
+
"executionInfo": {
|
| 652 |
+
"elapsed": 22942,
|
| 653 |
+
"status": "ok",
|
| 654 |
+
"timestamp": 1753593514634,
|
| 655 |
+
"user": {
|
| 656 |
+
"displayName": "陈红涛",
|
| 657 |
+
"userId": "16480124546172497377"
|
| 658 |
+
},
|
| 659 |
+
"user_tz": -480
|
| 660 |
+
},
|
| 661 |
+
"id": "siCztiUEs5OI",
|
| 662 |
+
"outputId": "79ea01ce-a3c9-45fb-a511-01815386db75"
|
| 663 |
+
},
|
| 664 |
+
"outputs": [],
|
| 665 |
+
"source": [
|
| 666 |
+
"from datasets import load_dataset\n",
|
| 667 |
+
"\n",
|
| 668 |
+
"test_dataset = load_dataset(\"ioaihsc/Task2_Chicken_Counting_Test\", \n",
|
| 669 |
+
" data_dir=\"valandtest\",\n",
|
| 670 |
+
" split=\"validation\")\n",
|
| 671 |
+
"\n",
|
| 672 |
+
"def collate_fn(batch): # The test datasets will not provide target densities\n",
|
| 673 |
+
" return torch.stack([image_transform(item[\"image\"]) for item in batch])\n",
|
| 674 |
+
"\n",
|
| 675 |
+
"test_loader = DataLoader(test_dataset, batch_size=16, shuffle=False, collate_fn=collate_fn)\n",
|
| 676 |
+
"\n",
|
| 677 |
+
"predictions = []\n",
|
| 678 |
+
"model.eval()\n",
|
| 679 |
+
"with torch.no_grad():\n",
|
| 680 |
+
" for batch in tqdm(test_loader):\n",
|
| 681 |
+
" outputs = model(batch.to(DEVICE)) / scale\n",
|
| 682 |
+
" predictions.append(outputs.cpu().numpy())\n",
|
| 683 |
+
"\n",
|
| 684 |
+
"pred_a = np.concatenate(predictions, axis=0)\n",
|
| 685 |
+
"\n",
|
| 686 |
+
"del test_dataset\n",
|
| 687 |
+
"del test_loader\n",
|
| 688 |
+
"del predictions\n",
|
| 689 |
+
"\n",
|
| 690 |
+
"test_dataset = load_dataset(\"ioaihsc/Task2_Chicken_Counting_Test\", \n",
|
| 691 |
+
" data_dir=\"valandtest\",\n",
|
| 692 |
+
" split=\"test\") \n",
|
| 693 |
+
"test_loader = DataLoader(test_dataset, batch_size=16, shuffle=False, collate_fn=collate_fn)\n",
|
| 694 |
+
"\n",
|
| 695 |
+
"predictions = []\n",
|
| 696 |
+
"with torch.no_grad():\n",
|
| 697 |
+
" for batch in tqdm(test_loader):\n",
|
| 698 |
+
" outputs = model(batch.to(DEVICE)) / scale\n",
|
| 699 |
+
" predictions.append(outputs.cpu().numpy())\n",
|
| 700 |
+
"\n",
|
| 701 |
+
"pred_b = np.concatenate(predictions, axis=0)\n",
|
| 702 |
+
"\n",
|
| 703 |
+
"np.savez('submission.npz', pred_a=pred_a, pred_b=pred_b) # save your submissions in `submission.npz` file with the keys `pred_a` and `pred_b`"
|
| 704 |
+
]
|
| 705 |
+
},
|
| 706 |
+
{
|
| 707 |
+
"cell_type": "code",
|
| 708 |
+
"execution_count": null,
|
| 709 |
+
"metadata": {},
|
| 710 |
+
"outputs": [],
|
| 711 |
+
"source": [
|
| 712 |
+
"%run ./metrics.py"
|
| 713 |
+
]
|
| 714 |
+
}
|
| 715 |
+
],
|
| 716 |
+
"metadata": {
|
| 717 |
+
"accelerator": "GPU",
|
| 718 |
+
"colab": {
|
| 719 |
+
"gpuType": "T4",
|
| 720 |
+
"provenance": []
|
| 721 |
+
},
|
| 722 |
+
"kernelspec": {
|
| 723 |
+
"display_name": "Python 3 (ipykernel)",
|
| 724 |
+
"language": "python",
|
| 725 |
+
"name": "python3"
|
| 726 |
+
},
|
| 727 |
+
"language_info": {
|
| 728 |
+
"codemirror_mode": {
|
| 729 |
+
"name": "ipython",
|
| 730 |
+
"version": 3
|
| 731 |
+
},
|
| 732 |
+
"file_extension": ".py",
|
| 733 |
+
"mimetype": "text/x-python",
|
| 734 |
+
"name": "python",
|
| 735 |
+
"nbconvert_exporter": "python",
|
| 736 |
+
"pygments_lexer": "ipython3",
|
| 737 |
+
"version": "3.12.9"
|
| 738 |
+
}
|
| 739 |
+
},
|
| 740 |
+
"nbformat": 4,
|
| 741 |
+
"nbformat_min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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import logging
|
| 3 |
+
import math
|
| 4 |
+
import json
|
| 5 |
+
from datasets import load_dataset
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
# Function to configure logging levels
|
| 9 |
+
def logging_level(level='info'):
|
| 10 |
+
str_format = '%(asctime)s - %(levelname)s: %(message)s'
|
| 11 |
+
if level == 'debug':
|
| 12 |
+
logging.basicConfig(level=logging.DEBUG, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')
|
| 13 |
+
elif level == 'info':
|
| 14 |
+
logging.basicConfig(level=logging.INFO, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')
|
| 15 |
+
return logging
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def validate_predictions_shape(predictions_np, expected_shape_suffix):
|
| 19 |
+
"""
|
| 20 |
+
Validate that predictions have the correct shape.
|
| 21 |
+
Accepts either (n, 1, 180, 320) or (n, 180, 320) for this competition.
|
| 22 |
+
Number of samples (n) must be exactly 100.
|
| 23 |
+
"""
|
| 24 |
+
if not isinstance(predictions_np, np.ndarray):
|
| 25 |
+
return False, "Prediction data must be a numpy array"
|
| 26 |
+
|
| 27 |
+
# Accept (n, 1, 180, 320) or (n, 180, 320)
|
| 28 |
+
if len(predictions_np.shape) == 4:
|
| 29 |
+
# (n, 1, 180, 320)
|
| 30 |
+
if predictions_np.shape[1:] != expected_shape_suffix:
|
| 31 |
+
return False, "Prediction data has incorrect dimensions"
|
| 32 |
+
if predictions_np.shape[1] != 1:
|
| 33 |
+
return False, "Prediction data must have exactly 1 channel"
|
| 34 |
+
if predictions_np.shape[0] != 100:
|
| 35 |
+
return False, "Invalid number of samples in prediction data"
|
| 36 |
+
elif len(predictions_np.shape) == 3:
|
| 37 |
+
# (n, 180, 320)
|
| 38 |
+
if predictions_np.shape[1:] != expected_shape_suffix[1:]:
|
| 39 |
+
return False, "Prediction data has incorrect dimensions"
|
| 40 |
+
if predictions_np.shape[0] != 100:
|
| 41 |
+
return False, "Invalid number of samples in prediction data"
|
| 42 |
+
else:
|
| 43 |
+
return False, "Incorrect dimensions in prediction data"
|
| 44 |
+
|
| 45 |
+
return True, None
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def validate_predictions_values(predictions_np):
|
| 49 |
+
"""
|
| 50 |
+
Validate that prediction values are reasonable (real, non-negative, finite).
|
| 51 |
+
"""
|
| 52 |
+
if np.iscomplexobj(predictions_np):
|
| 53 |
+
return False, "Prediction data contains complex values"
|
| 54 |
+
|
| 55 |
+
if not np.isfinite(predictions_np).all():
|
| 56 |
+
return False, "Prediction data contains non-finite values"
|
| 57 |
+
|
| 58 |
+
if (predictions_np < 0).any():
|
| 59 |
+
return False, "Prediction data contains negative values"
|
| 60 |
+
|
| 61 |
+
return True, None
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def safe_evaluate_predictions(predictions_np, targets_np):
|
| 65 |
+
"""
|
| 66 |
+
Safely evaluate predictions with error handling for mathematical operations.
|
| 67 |
+
"""
|
| 68 |
+
try:
|
| 69 |
+
N = predictions_np.shape[0]
|
| 70 |
+
preds_sum = predictions_np.reshape(N, -1).sum(axis=1)
|
| 71 |
+
true_sum = targets_np.reshape(N, -1).sum(axis=1)
|
| 72 |
+
|
| 73 |
+
# Check for invalid sums
|
| 74 |
+
if not np.isfinite(preds_sum).all() or not np.isfinite(true_sum).all():
|
| 75 |
+
return None, "Invalid sum values detected"
|
| 76 |
+
|
| 77 |
+
diffs = np.abs(preds_sum - true_sum)
|
| 78 |
+
|
| 79 |
+
# Safe division - handle division by zero
|
| 80 |
+
with np.errstate(divide='ignore', invalid='ignore'):
|
| 81 |
+
rates = np.abs(1 - preds_sum / true_sum)
|
| 82 |
+
# Replace inf and nan values with a high penalty
|
| 83 |
+
rates = np.where(np.isfinite(rates), rates, 1.0)
|
| 84 |
+
|
| 85 |
+
mae = diffs.mean()
|
| 86 |
+
mse = (diffs**2).mean()
|
| 87 |
+
rate = rates.mean()
|
| 88 |
+
predict_num_avg = preds_sum.mean()
|
| 89 |
+
true_num_avg = true_sum.mean()
|
| 90 |
+
|
| 91 |
+
# Check for invalid intermediate results
|
| 92 |
+
if not all(np.isfinite([mae, mse, rate, predict_num_avg, true_num_avg])):
|
| 93 |
+
return None, "Invalid intermediate calculation results"
|
| 94 |
+
|
| 95 |
+
# Safe exponential calculation
|
| 96 |
+
if rate > 100: # Prevent exp overflow
|
| 97 |
+
score = 0.0
|
| 98 |
+
else:
|
| 99 |
+
score = math.exp(-rate)
|
| 100 |
+
|
| 101 |
+
logging.info(f'test ---- Score: {score:.3f}, MSE: {mse:.4f}, MAE: {mae:.4f}, Chicken_avg: {predict_num_avg:.4f}')
|
| 102 |
+
return score, None
|
| 103 |
+
|
| 104 |
+
except Exception as e:
|
| 105 |
+
logging.error(f"Error in evaluation: {str(e)}")
|
| 106 |
+
return None, "Evaluation calculation failed"
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
# Add function to evaluate predictions and targets arrays
|
| 110 |
+
def evaluate_predictions(predictions_np, targets_np):
|
| 111 |
+
score, error = safe_evaluate_predictions(predictions_np, targets_np)
|
| 112 |
+
if error:
|
| 113 |
+
raise ValueError(error)
|
| 114 |
+
return score
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def safe_test(preds, tag, expected_shape):
|
| 118 |
+
"""
|
| 119 |
+
Safely run the test with comprehensive error handling.
|
| 120 |
+
"""
|
| 121 |
+
try:
|
| 122 |
+
# Validate prediction shape
|
| 123 |
+
valid_shape, shape_error = validate_predictions_shape(preds, expected_shape)
|
| 124 |
+
if not valid_shape:
|
| 125 |
+
return None, shape_error
|
| 126 |
+
|
| 127 |
+
# Validate prediction values
|
| 128 |
+
valid_values, values_error = validate_predictions_values(preds)
|
| 129 |
+
if not valid_values:
|
| 130 |
+
return None, values_error
|
| 131 |
+
|
| 132 |
+
# Load target dataset
|
| 133 |
+
|
| 134 |
+
|
| 135 |
+
# 从 Hugging Face 加载数据集
|
| 136 |
+
test_dataset = load_dataset("ioaihsc/Task2_Chicken_Counting_LABEL",
|
| 137 |
+
data_dir="valandtest",
|
| 138 |
+
split=tag) # 明确指定使用训练
|
| 139 |
+
|
| 140 |
+
# Extract density data directly as numpy arrays without torch
|
| 141 |
+
targets = []
|
| 142 |
+
for item in test_dataset:
|
| 143 |
+
density = np.array(item["density"], dtype=np.float32)
|
| 144 |
+
# Add batch dimension to match expected shape
|
| 145 |
+
targets.append(density[np.newaxis, :])
|
| 146 |
+
|
| 147 |
+
# Concatenate all targets into a single numpy array
|
| 148 |
+
targets = np.concatenate(targets, axis=0)
|
| 149 |
+
|
| 150 |
+
# Remove channel dimension from predictions for shape comparison and evaluation
|
| 151 |
+
# Predictions are (n, 1, 180, 320), targets are (n, 180, 320)
|
| 152 |
+
if len(preds.shape) == 4 and preds.shape[1] == 1:
|
| 153 |
+
preds_squeezed = preds.squeeze(axis=1) # Remove channel dimension
|
| 154 |
+
else:
|
| 155 |
+
return None, "Invalid prediction format for evaluation"
|
| 156 |
+
|
| 157 |
+
# Validate that prediction and target shapes match after removing channel
|
| 158 |
+
if preds_squeezed.shape != targets.shape:
|
| 159 |
+
return None, "Prediction and target data shape mismatch"
|
| 160 |
+
|
| 161 |
+
# Safely evaluate predictions (using squeezed predictions without channel dim)
|
| 162 |
+
score, eval_error = safe_evaluate_predictions(preds_squeezed, targets)
|
| 163 |
+
if eval_error:
|
| 164 |
+
return None, eval_error
|
| 165 |
+
|
| 166 |
+
# Final safety check: clamp score to [0.0, 1.0]
|
| 167 |
+
if score < 0.0 or score > 1.0:
|
| 168 |
+
logging.warning(f"Score {score} out of valid range, setting to 0.0")
|
| 169 |
+
score = 0.0
|
| 170 |
+
|
| 171 |
+
return score, None
|
| 172 |
+
|
| 173 |
+
except Exception as e:
|
| 174 |
+
logging.error(f"Error in test function: {str(e)}")
|
| 175 |
+
return None, "Test execution failed"
|
| 176 |
+
|
| 177 |
+
|
| 178 |
+
# Main function to run the validation
|
| 179 |
+
def test(preds, test_path):
|
| 180 |
+
score, error = safe_test(preds, test_path, (1, 180, 320))
|
| 181 |
+
if error:
|
| 182 |
+
raise ValueError(error)
|
| 183 |
+
return score
|
| 184 |
+
|
| 185 |
+
|
| 186 |
+
def create_error_response(error_message):
|
| 187 |
+
"""Create standardized error response."""
|
| 188 |
+
return {
|
| 189 |
+
"status": False,
|
| 190 |
+
"score": {
|
| 191 |
+
"public_a": 0.0,
|
| 192 |
+
"private_b": 0.0,
|
| 193 |
+
},
|
| 194 |
+
"msg": f"Error: {error_message}",
|
| 195 |
+
}
|
| 196 |
+
|
| 197 |
+
|
| 198 |
+
def create_success_response(score_a, score_b):
|
| 199 |
+
"""Create standardized success response."""
|
| 200 |
+
# 处理 NaN 和 inf,替换为 0.0
|
| 201 |
+
if not np.isfinite(score_a): # np.isfinite 同时检查 NaN 和 inf
|
| 202 |
+
score_a = 0.0
|
| 203 |
+
if not np.isfinite(score_b):
|
| 204 |
+
score_b = 0.0
|
| 205 |
+
return {
|
| 206 |
+
"status": True,
|
| 207 |
+
"score": {
|
| 208 |
+
"public_a": score_a,
|
| 209 |
+
"private_b": score_b,
|
| 210 |
+
},
|
| 211 |
+
"msg": "Success!",
|
| 212 |
+
}
|
| 213 |
+
|
| 214 |
+
|
| 215 |
+
if __name__ == '__main__':
|
| 216 |
+
################################################################################
|
| 217 |
+
# Dataset paths
|
| 218 |
+
if os.environ.get('METRIC_PATH'):
|
| 219 |
+
METRIC_PATH = os.environ.get("METRIC_PATH") + "/"
|
| 220 |
+
else:
|
| 221 |
+
METRIC_PATH = "" # Fallback for local testing
|
| 222 |
+
testA_path = METRIC_PATH + "test_a_targets"
|
| 223 |
+
testB_path = METRIC_PATH + "test_b_targets"
|
| 224 |
+
|
| 225 |
+
try:
|
| 226 |
+
# Safely load the npz file
|
| 227 |
+
try:
|
| 228 |
+
preds = np.load("submission.npz", allow_pickle=False)
|
| 229 |
+
except FileNotFoundError:
|
| 230 |
+
ret_json = create_error_response("Submission file not found")
|
| 231 |
+
except Exception as e:
|
| 232 |
+
ret_json = create_error_response("Failed to load submission file")
|
| 233 |
+
else:
|
| 234 |
+
# Check for required keys
|
| 235 |
+
required_keys = ['pred_a', 'pred_b']
|
| 236 |
+
missing_keys = [key for key in required_keys if key not in preds.files]
|
| 237 |
+
|
| 238 |
+
if missing_keys:
|
| 239 |
+
ret_json = create_error_response(f"Missing required keys in submission file")
|
| 240 |
+
else:
|
| 241 |
+
try:
|
| 242 |
+
# Extract predictions safely
|
| 243 |
+
pred_a = preds['pred_a']
|
| 244 |
+
pred_b = preds['pred_b']
|
| 245 |
+
|
| 246 |
+
logging = logging_level('info')
|
| 247 |
+
|
| 248 |
+
# Test both predictions with error handling
|
| 249 |
+
score_a, error_a = safe_test(pred_a, 'validation', (1, 180, 320))
|
| 250 |
+
if error_a:
|
| 251 |
+
ret_json = create_error_response(f"Error in test A evaluation: {error_a}")
|
| 252 |
+
else:
|
| 253 |
+
score_b, error_b = safe_test(pred_b, 'test', (1, 180, 320))
|
| 254 |
+
if error_b:
|
| 255 |
+
ret_json = create_error_response(f"Error in test B evaluation: {error_b}")
|
| 256 |
+
else:
|
| 257 |
+
# Final safety check on scores
|
| 258 |
+
score_a = max(0.0, min(1.0, score_a))
|
| 259 |
+
score_b = max(0.0, min(1.0, score_b))
|
| 260 |
+
|
| 261 |
+
ret_json = create_success_response(score_a, score_b)
|
| 262 |
+
|
| 263 |
+
except Exception as e:
|
| 264 |
+
logging.error(f"Unexpected error during evaluation: {str(e)}")
|
| 265 |
+
ret_json = create_error_response("Evaluation failed due to invalid submission format")
|
| 266 |
+
|
| 267 |
+
except Exception as e:
|
| 268 |
+
logging.error(f"Critical error: {str(e)}")
|
| 269 |
+
ret_json = create_error_response("Critical evaluation error")
|
| 270 |
+
|
| 271 |
+
# Write result to file
|
| 272 |
+
try:
|
| 273 |
+
with open('score.json', 'w') as f:
|
| 274 |
+
f.write(json.dumps(ret_json))
|
| 275 |
+
except Exception as e:
|
| 276 |
+
logging.error(f"Failed to write score file: {str(e)}")
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/Concepts.ipynb
ADDED
|
@@ -0,0 +1,825 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "097ce009-a7a8-45c7-90f4-dd6f8bbb8228",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Concepts/Concepts.ipynb)"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "markdown",
|
| 17 |
+
"id": "3ddf717a-91f1-4237-8fb2-5d94371f2e4a",
|
| 18 |
+
"metadata": {
|
| 19 |
+
"jp-MarkdownHeadingCollapsed": true
|
| 20 |
+
},
|
| 21 |
+
"source": [
|
| 22 |
+
"# Concepts\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"## **1. Problem Description**\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"**Concepts** is a word-guessing game where players communicate ideas through visual icons. There are two roles: the **Clue-Giver** and the **Guesser**. A shared set of visual icons, each with a known description, is available to both players. Here are some sample icons:\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"<img src=\"./figs/Concepts Fig 1.png\" width=\"300\">\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"The Clue-Giver first selects a **secret**, which is a word or phrase, and then provides a **hint** about it by pointing to an **ordered sequence** of icons from the shared set — speaking or writing is not allowed.\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"The order of the icons in the hint is meaningful:\n",
|
| 33 |
+
"\n",
|
| 34 |
+
"- The **first icon** typically represents the core idea of the secret.\n",
|
| 35 |
+
"- The **subsequent icons** provide supporting context that helps clarify or elaborate on the main concept.\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"### Example 1\n",
|
| 38 |
+
"\n",
|
| 39 |
+
"The following hint might be interpreted as *a place where a job that fights fire takes place* — in other words, a **fire station**:\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"<img src=\"./figs/Concepts Fig 2.png\" width=\"300\">\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"If the icon order is reversed, it could instead suggest *a job that fights fire in a house* — pointing to a **firefighter**:\n",
|
| 44 |
+
"\n",
|
| 45 |
+
"<img src=\"./figs/Concepts Fig 3.png\" width=\"300\">\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"### Example 2\n",
|
| 48 |
+
"\n",
|
| 49 |
+
"Icons can take on different meanings depending on their context. For example, the heart icon can appear in the following hint, which suggests *a tool used by doctors to listen to the heart* — a **stethoscope**:\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"<img src=\"./figs/Concepts Fig 4.png\" width=\"300\">\n",
|
| 52 |
+
"\n",
|
| 53 |
+
"The same heart icon might instead appear in a hint that implies *a fictional character that is both dead and alive* — pointing to a **zombie**:\n",
|
| 54 |
+
"\n",
|
| 55 |
+
"<img src=\"./figs/Concepts Fig 5.png\" width=\"300\">\n",
|
| 56 |
+
"\n",
|
| 57 |
+
"At Home-Stage, contestants had developed an AI program that predicts outcomes based on a sequence of hints. It's fun. However, your friend has now challenged you: \n",
|
| 58 |
+
"*\"Guessing is easy, but can you make an AI system that can give a good clue as well?\"*\n",
|
| 59 |
+
"\n",
|
| 60 |
+
"In fact, they further challenged you to see if you can make an AI system that can provide a good clue so that another AI system can guess your keyword!\n",
|
| 61 |
+
"\n",
|
| 62 |
+
"To make the challenge more interesting, we now play the typical Concept game. To recall, our previous Concept game was simplified so that a clue could only consist of a single sequence of markers.\n",
|
| 63 |
+
"\n",
|
| 64 |
+
"Now, you may provide up to **4 sequences of markers**!\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"With this, we can express complex ideas better. Considering the following that utilizes 3 sequences of markers to explain a **samurai**:\n",
|
| 67 |
+
"\n",
|
| 68 |
+
"<img src=\"./figs/Concepts Fig 6.png\" width=\"300\">\n",
|
| 69 |
+
"\n",
|
| 70 |
+
"But wait, there's more. To make the challenge even more interesting, the game will now include some keywords that are not typically present in a Concept game, such as \"International Olympiad.\"\n",
|
| 71 |
+
"\n",
|
| 72 |
+
"Are you up to the challenge?\n",
|
| 73 |
+
"\n",
|
| 74 |
+
"<img src=\"./figs/Concepts Fig 7.png\" width=\"600\">\n",
|
| 75 |
+
"\n",
|
| 76 |
+
"**New AI-Powered Format:**\n",
|
| 77 |
+
"We've replaced the human guesser with an **AI Guesser**. To streamline game play:\n",
|
| 78 |
+
"\n",
|
| 79 |
+
"1. The target word (*label*) will always be selected from a predefined set (`options`).\n",
|
| 80 |
+
"2. Hints must be an **ordered sequence of markers** chosen exclusively from a fixed set of **118 candidate markers**.\n",
|
| 81 |
+
"\n",
|
| 82 |
+
"**Terminologies**\n",
|
| 83 |
+
"\n",
|
| 84 |
+
"To ensure clarity and consistency, we are standardizing key terms across all materials.\n",
|
| 85 |
+
"\n",
|
| 86 |
+
"- **label**: The target answer (or \"secret\") to be identified.\n",
|
| 87 |
+
"- **options**: The predefined candidate set from which all valid *labels* are selected.\n",
|
| 88 |
+
"- **marker**: An icon representing a concept, accompanied by its text description.\n",
|
| 89 |
+
"- **hints**: An **ordered sequence** of *markers* provided to the AI guesser to help identify the *label*.\n",
|
| 90 |
+
"\n",
|
| 91 |
+
"Your task is to provide **hints** for each *label* to help the **AI guesser** identify it. For example, when the target label is `\"microphone\"`, your program may generate four hint sequences like:\n",
|
| 92 |
+
"\n",
|
| 93 |
+
"1. **Hint 1**: \n",
|
| 94 |
+
" `[\"Object-Box\", \"Electronic-Computing\", \"Mouth-Taste\", \"Ear-Sound-Hearing\", \"Tool-Construction\"]`\n",
|
| 95 |
+
"2. **Hint 2**: \n",
|
| 96 |
+
" `[\"Music-Song\", \"Television-Program-Show\", \"Work-Occupation\", \"Use - Action-Do - Verbe-Button\"]`\n",
|
| 97 |
+
"3. **Hint 3**: \n",
|
| 98 |
+
" `[\"Black\", \"Metal\", \"Plastic-Rubber\", \"Cylinder\", \"Circle-Ring\"]`\n",
|
| 99 |
+
"4. **Hint 4**: \n",
|
| 100 |
+
" `[\"Arm-Hand-Finger\", \"Happy-Positive\", \"Expression - Quote-Talking-Words\", \"Life-Heart-Love\"]`\n",
|
| 101 |
+
"\n",
|
| 102 |
+
"**Note**: The above example is for illustrative purposes only. The program should generate lists of IDs but not strings; please refer to both `3. Task` and the [baseline.ipynb](https://ioai.bohrium.com/notebooks/26681337682).\n",
|
| 103 |
+
"\n",
|
| 104 |
+
"## **2. Dataset**\n",
|
| 105 |
+
"\n",
|
| 106 |
+
"The structure of the provided dataset is as follows:\n",
|
| 107 |
+
"\n",
|
| 108 |
+
"```\n",
|
| 109 |
+
"datasets/\n",
|
| 110 |
+
"├── train/\n",
|
| 111 |
+
"│ └── A huggingface dataset\n",
|
| 112 |
+
"└── hint_descriptions/\n",
|
| 113 |
+
" └── A huggingface dataset\n",
|
| 114 |
+
"\n",
|
| 115 |
+
"\n",
|
| 116 |
+
"os.environ.get(\"DATA_PATH\")/\n",
|
| 117 |
+
"└── test/\n",
|
| 118 |
+
" ├── test_a/\n",
|
| 119 |
+
" │ └── A huggingface dataset\n",
|
| 120 |
+
" └── test_b/\n",
|
| 121 |
+
" └── A huggingface dataset\n",
|
| 122 |
+
"```\n",
|
| 123 |
+
"\n",
|
| 124 |
+
"1. Training set: files in this folder are used for model training. It contains:\n",
|
| 125 |
+
" - `train/`: A huggingface dataset with a single split `'train'`, with 30 examples, each containing:\n",
|
| 126 |
+
" - `label`: string - the target keyword/answer\n",
|
| 127 |
+
" - `options`: sequence of strings - list of 100 possible choices\n",
|
| 128 |
+
" - `hint_descriptions/`: A huggingface dataset with a single split `'train'`, with 118 markers and their descriptions:\n",
|
| 129 |
+
" - `ID`: int64 - unique identifier for each marker\n",
|
| 130 |
+
" - `Description`: string - textual description of what the marker represents\n",
|
| 131 |
+
" - `image`: Image - visual representation of the marker\n",
|
| 132 |
+
"\n",
|
| 133 |
+
"2. Test sets: Located at `os.environ.get(\"DATA_PATH\")/test/`. These will be inaccessible during development and will only be available in the evaluation environment:\n",
|
| 134 |
+
" - `test_a/`: A huggingface dataset with a single split `'test'` containing 150 examples for leaderboard A evaluation\n",
|
| 135 |
+
" - `test_b/`: A huggingface dataset with a single split `'test'` containing 150 examples for final scoring\n",
|
| 136 |
+
" Both test datasets contain the same structure as the training set (`label` and `options` fields).\n",
|
| 137 |
+
"\n",
|
| 138 |
+
"## **3. Task**\n",
|
| 139 |
+
"\n",
|
| 140 |
+
"Your task is to provide **hint** for each *label* to help the **AI guesser** identify it. You are required to develop a program that takes two inputs:\n",
|
| 141 |
+
"\n",
|
| 142 |
+
"1. A string `label` (your secret *label*)\n",
|
| 143 |
+
"2. The `options` list (100 candidate choices for the guesser)\n",
|
| 144 |
+
"\n",
|
| 145 |
+
"The `label` is guaranteed to be one of the `options`.\n",
|
| 146 |
+
"\n",
|
| 147 |
+
"Additionally, the program will utilize the predefined `candidate markers`.\n",
|
| 148 |
+
"\n",
|
| 149 |
+
"<img src=\"./figs/Concepts Fig 8.png\" width=\"600\">\n",
|
| 150 |
+
"\n",
|
| 151 |
+
"\n",
|
| 152 |
+
"This program should return a list of lists of integers for each `label`, representing the hints(i.e. the sequences of markers). Specifically:\n",
|
| 153 |
+
"\n",
|
| 154 |
+
"- The returned list must contain **no more than 4** sequences.\n",
|
| 155 |
+
"- Each sequence can contain **up to 8 integers**.\n",
|
| 156 |
+
"- Each integer represents the ID of a marker in the clue.\n",
|
| 157 |
+
"\n",
|
| 158 |
+
"Your hints will then be given to a black-box AI guesser. You will score a point if the black-box AI guesser can correctly guess your secret keyword based on your hints.\n",
|
| 159 |
+
"\n",
|
| 160 |
+
"## **4. Submission**\n",
|
| 161 |
+
"\n",
|
| 162 |
+
"Submit a notebook that generates `submission.zip`, which includes `clues_a.jsonl` and `clues_b.jsonl`, the clues for testset a and b, respectively, in `json` format. Refer to the baseline notebook for how to generate these files and the specific structure of the `jsonl` files. Please make sure to follow the naming and structuring conventions.\n",
|
| 163 |
+
"\n",
|
| 164 |
+
"Contestants may submit model files. **If submitting model files, contestants must create a corresponding dataset on the Bohrium platform.** Only **one** dataset **can** be submitted for this task, and its size **must not** exceed 2GB. Preloaded datasets and models will be automatically mounted on the test machine, **eliminating the need for manual mounting during submission.**\n",
|
| 165 |
+
"\n",
|
| 166 |
+
"Additionally, contestants are permitted to use larger external models to assist in developing their submission.\n",
|
| 167 |
+
"\n",
|
| 168 |
+
"## **5. Scoring**\n",
|
| 169 |
+
"\n",
|
| 170 |
+
"Your clue is evaluated using two metrics:\n",
|
| 171 |
+
"\n",
|
| 172 |
+
"### Hits@10\n",
|
| 173 |
+
"\n",
|
| 174 |
+
"= 1 if the secret word is in the top 10 guesses from the AI, else 0.\n",
|
| 175 |
+
"\n",
|
| 176 |
+
"### NDCG@10 (Normalized Discounted Cumulative Gain) \n",
|
| 177 |
+
"Rewards the correct guess more if it appears higher in the list.\n",
|
| 178 |
+
"\n",
|
| 179 |
+
"If the secret word is at rank *i* (1-based):\n",
|
| 180 |
+
"\n",
|
| 181 |
+
"$$\n",
|
| 182 |
+
"\\text{NDCG@10} = \\frac{1}{\\log_2(i + 1)}\n",
|
| 183 |
+
"$$\n",
|
| 184 |
+
"\n",
|
| 185 |
+
"**Examples:**\n",
|
| 186 |
+
"- Rank 1 → 1.00 \n",
|
| 187 |
+
"- Rank 2 → ~0.63 \n",
|
| 188 |
+
"- Rank 4 → ~0.43 \n",
|
| 189 |
+
"- Rank 10 → ~0.29\n",
|
| 190 |
+
"\n",
|
| 191 |
+
"### Final Score\n",
|
| 192 |
+
"\n",
|
| 193 |
+
"Your final score will be a combination of both, specifically, it will be 0.9 Hits@10 + 0.1 NDCG@10.\n",
|
| 194 |
+
"\n",
|
| 195 |
+
"The scoring means that you'll get a significant point as long as the guesser can guess the secret keyword correctly, but more point is given if the guesser can predict the secret keyword earlier.\n",
|
| 196 |
+
"\n",
|
| 197 |
+
"\n",
|
| 198 |
+
"## **6. Baseline & Available Tools**\n",
|
| 199 |
+
"\n",
|
| 200 |
+
"- Below you can find the baseline solution.\n",
|
| 201 |
+
"- The training set and pretrained models are in `training_set` folder.\n",
|
| 202 |
+
"- The highest score by the Scientific Committee for this task is 0.54, this score is used for score unification.\n",
|
| 203 |
+
"- The baseline score by the Scientific Committee for this task is 0.20, this score is used for score unification.\n",
|
| 204 |
+
"\n",
|
| 205 |
+
"\n",
|
| 206 |
+
"### AI-Guesser API\n",
|
| 207 |
+
"\n",
|
| 208 |
+
"You can assess the AI-guesser for you to play around with. See the following code on how to access the guesser. It is recommended to implement exponential retry logic as network failures might occur. \n",
|
| 209 |
+
"\n",
|
| 210 |
+
"```python\n",
|
| 211 |
+
"guesser_response = httpx.post(f\"{API_URL}/guess\", json={\n",
|
| 212 |
+
" \"clues\": clues,\n",
|
| 213 |
+
" \"options\": options\n",
|
| 214 |
+
" }, headers={\n",
|
| 215 |
+
" \"Authorization\": f\"Bearer {SCORER_API_KEY}\"\n",
|
| 216 |
+
" }, timeout=60).json()\n",
|
| 217 |
+
"```\n",
|
| 218 |
+
"\n",
|
| 219 |
+
"**Important**: The AI-Guesser API will not be available on the inference machines. In other words, do **NOT** call the api in your submission notebooks. This is only for you to validate/train your model locally. You may attach your model weights, training data, etc. via a Bohrium dataset. Refer to the Requirements section.\n",
|
| 220 |
+
"\n",
|
| 221 |
+
"### Environment\n",
|
| 222 |
+
"\n",
|
| 223 |
+
"We installed `vllm`, `sglang` and `unsloth` in environment for LLM inference and fine tuning. \n",
|
| 224 |
+
"Additionally, we provide access to the following huggingface models via a `training_set`:\n",
|
| 225 |
+
"\n",
|
| 226 |
+
"#### Embedding Models\n",
|
| 227 |
+
"```\n",
|
| 228 |
+
"sentence-transformers/all-MiniLM-L6-v2\n",
|
| 229 |
+
"sentence-transformers/all-MiniLM-L12-v2\n",
|
| 230 |
+
"sentence-transformers/all-mpnet-base-v2\n",
|
| 231 |
+
"sentence-transformers/paraphrase-mpnet-base-v2\n",
|
| 232 |
+
"sentence-transformers/paraphrase-MiniLM-L6-v2\n",
|
| 233 |
+
"intfloat/e5-small\n",
|
| 234 |
+
"intfloat/e5-base\n",
|
| 235 |
+
"intfloat/e5-large\n",
|
| 236 |
+
"intfloat/e5-small-v2\n",
|
| 237 |
+
"intfloat/e5-base-v2\n",
|
| 238 |
+
"intfloat/e5-large-v2\n",
|
| 239 |
+
"intfloat/multilingual-e5-small\n",
|
| 240 |
+
"intfloat/multilingual-e5-base\n",
|
| 241 |
+
"Alibaba-NLP/gte-modernbert-base\n",
|
| 242 |
+
"Snowflake/snowflake-arctic-embed-xs\n",
|
| 243 |
+
"Snowflake/snowflake-arctic-embed-s\n",
|
| 244 |
+
"Snowflake/snowflake-arctic-embed-m\n",
|
| 245 |
+
"Snowflake/snowflake-arctic-embed-m-long\n",
|
| 246 |
+
"Snowflake/snowflake-arctic-embed-l\n",
|
| 247 |
+
"BAAI/bge-large-en\n",
|
| 248 |
+
"BAAI/bge-base-en\n",
|
| 249 |
+
"BAAI/bge-small-en\n",
|
| 250 |
+
"BAAI/bge-large-en-v1.5\n",
|
| 251 |
+
"BAAI/bge-base-en-v1.5\n",
|
| 252 |
+
"BAAI/bge-small-en-v1.5\n",
|
| 253 |
+
"WhereIsAI/UAE-Large-V1\n",
|
| 254 |
+
"mixedbread-ai/mxbai-embed-large-v1\n",
|
| 255 |
+
"```\n",
|
| 256 |
+
"\n",
|
| 257 |
+
"#### Small LLMs\n",
|
| 258 |
+
"\n",
|
| 259 |
+
"```\n",
|
| 260 |
+
"Qwen/Qwen3-0.6B\n",
|
| 261 |
+
"Qwen/Qwen2.5-0.5B\n",
|
| 262 |
+
"Qwen/Qwen2.5-0.5B-Instruct\n",
|
| 263 |
+
"unsloth/Qwen3-0.6B\n",
|
| 264 |
+
"facebook/opt-350m\n",
|
| 265 |
+
"facebook/opt-125m\n",
|
| 266 |
+
"```\n",
|
| 267 |
+
"\n",
|
| 268 |
+
"\n",
|
| 269 |
+
"## **7. Requirements**\n",
|
| 270 |
+
"\n",
|
| 271 |
+
"### Overall Requirements\n",
|
| 272 |
+
"\n",
|
| 273 |
+
"- Maximum submission limit: **15 times**. Only successful submissions (i.e., those receive a score on Leaderboard A) will be counted toward the submission limit.\n",
|
| 274 |
+
"- Testing environment restrictions: The test machine will run your Notebook within **10 minutes**. If the execution time exceeds **10 minutes**, the system will forcibly terminate and return a feedback of “Timeout” or “Failed”.\n",
|
| 275 |
+
"- Data and model submission: In this task, contestants should submit a Notebook and have the option to submit 1 attached dataset generated by themselves. The dataset must not exceed `2GB` in total size. You are warned that attaching a very large dataset might prolong the testing process, as the dataset needs to be mounted to the inference machine. While this process does not count towards the execution time limit, it will take longer for you to be able to see and select your submissions.\n",
|
| 276 |
+
"- Network: For the on-site stage, the test machine cannot connect to the internet. In other words, downloading commands such as 'pip' and 'conda' or trying to call APIs will not work. Specific to this problem, the testing machines cannot access the guessor API nor the LLM proxy.\n",
|
| 277 |
+
"\n",
|
| 278 |
+
"### API Access Limitations\n",
|
| 279 |
+
"\n",
|
| 280 |
+
"Your token will grant you 12,500 `POST` requests to `/guess` endpoint of the AI-guesser API. \n",
|
| 281 |
+
"\n",
|
| 282 |
+
"- If successful, this will return a dictionary in the form `{'guesses': ['firefighter', 'fire inspector', 'fire marshal', 'fire warden', 'fire safety officer', 'smokejumper', 'pyrotechnician', 'firewatcher', 'chef', 'cook'], 'message': 'Generated 10 guesses'}`. \n",
|
| 283 |
+
"\n",
|
| 284 |
+
"- If unsuccessful, this will either raise an `HTTPStatusError` and return `{'detail': 'error message'}`, or return `{'guesses': [], 'message': 'unable to generate guesses'}`. \n",
|
| 285 |
+
"- Usually, the former is because you have exceeded the 12,500 limit of your token, or you tried to make more than 1000 requests within 1 minute, and the latter is because your clues exceeded 4 sequences or exceeded 8 markers in 1 sequence. \n",
|
| 286 |
+
"- Refer to the error message for details.\n",
|
| 287 |
+
"- During extremely high load (expected in the last hour of the competition), there might be 1-2 failures in 1000 requests, 'retry' mechanism is provided in [baseline.ipynb](https://ioai.bohrium.com/notebooks/26681337682).\n",
|
| 288 |
+
"\n",
|
| 289 |
+
"\n"
|
| 290 |
+
]
|
| 291 |
+
},
|
| 292 |
+
{
|
| 293 |
+
"cell_type": "markdown",
|
| 294 |
+
"id": "fc6bbc24",
|
| 295 |
+
"metadata": {},
|
| 296 |
+
"source": [
|
| 297 |
+
"### Imports"
|
| 298 |
+
]
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"cell_type": "code",
|
| 302 |
+
"execution_count": null,
|
| 303 |
+
"id": "26a701aa",
|
| 304 |
+
"metadata": {},
|
| 305 |
+
"outputs": [],
|
| 306 |
+
"source": [
|
| 307 |
+
"import vllm\n",
|
| 308 |
+
"from vllm import LLM, SamplingParams\n",
|
| 309 |
+
"from vllm.sampling_params import GuidedDecodingParams\n",
|
| 310 |
+
"from pydantic import BaseModel"
|
| 311 |
+
]
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"cell_type": "code",
|
| 315 |
+
"execution_count": null,
|
| 316 |
+
"id": "ab3b9844-a68b-437d-9a29-4c24f2827878",
|
| 317 |
+
"metadata": {},
|
| 318 |
+
"outputs": [],
|
| 319 |
+
"source": [
|
| 320 |
+
"import random\n",
|
| 321 |
+
"import numpy as np\n",
|
| 322 |
+
"import torch\n",
|
| 323 |
+
"\n",
|
| 324 |
+
"seed = 42\n",
|
| 325 |
+
"\n",
|
| 326 |
+
"random.seed(seed) # Python built-in random\n",
|
| 327 |
+
"np.random.seed(seed) # NumPy\n",
|
| 328 |
+
"torch.manual_seed(seed) # PyTorch (CPU)\n",
|
| 329 |
+
"torch.cuda.manual_seed(seed) # PyTorch (single GPU)\n",
|
| 330 |
+
"torch.cuda.manual_seed_all(seed) # PyTorch (all GPUs)\n",
|
| 331 |
+
"\n",
|
| 332 |
+
"# Ensures deterministic behavior\n",
|
| 333 |
+
"torch.backends.cudnn.deterministic = True\n",
|
| 334 |
+
"torch.backends.cudnn.benchmark = False"
|
| 335 |
+
]
|
| 336 |
+
},
|
| 337 |
+
{
|
| 338 |
+
"cell_type": "markdown",
|
| 339 |
+
"id": "ce0b4e27-a439-4608-b71c-e393157c2e5a",
|
| 340 |
+
"metadata": {},
|
| 341 |
+
"source": [
|
| 342 |
+
"**Note on Output Determinism**\n",
|
| 343 |
+
"\n",
|
| 344 |
+
"In the above code block, we fix the random seed to ensure that results are reproducible when running the baseline model alone. This is a common practice to eliminate output variance caused by stochastic operations.\n",
|
| 345 |
+
"However, in this specific task, your model is required to interact dynamically with an AI guesser. The guesser is powered by a large language model, which may produce different responses to the same input due to inherent randomness in its decoding process. Therefore, even when given the same set of hints, the guesser’s answers may vary across runs.\n",
|
| 346 |
+
"As a result, you may observe fluctuations in the reported scores across multiple identical submissions. This is expected behavior and does not indicate a bug in the evaluation system."
|
| 347 |
+
]
|
| 348 |
+
},
|
| 349 |
+
{
|
| 350 |
+
"cell_type": "markdown",
|
| 351 |
+
"id": "f46cc2bf",
|
| 352 |
+
"metadata": {},
|
| 353 |
+
"source": [
|
| 354 |
+
"### Accessing AI-Guesser\n",
|
| 355 |
+
"\n",
|
| 356 |
+
"You can asses the AI-guesser for you to play around with, through the API_URL server. See the following code on how to access the guesser.\n",
|
| 357 |
+
"\n",
|
| 358 |
+
"Your token will grant you $12,500$ `POST` requests to `/guess`. You will also be limited to $1000$ calls per minute.\n",
|
| 359 |
+
"\n"
|
| 360 |
+
]
|
| 361 |
+
},
|
| 362 |
+
{
|
| 363 |
+
"cell_type": "code",
|
| 364 |
+
"execution_count": null,
|
| 365 |
+
"id": "a021e386",
|
| 366 |
+
"metadata": {},
|
| 367 |
+
"outputs": [],
|
| 368 |
+
"source": [
|
| 369 |
+
"'''\n",
|
| 370 |
+
"API_URL = \"https://concepts-judge-server-production-1188.up.railway.app\"\n",
|
| 371 |
+
"# During the competition, this url was notaccessible on the inference/testing machines.\n",
|
| 372 |
+
"# The testing machines used a secret url to do call API for evalutaion.\n",
|
| 373 |
+
"SCORER_API_KEY = \"sk-ioai-xxx\" # During the competition, each contestant was provided a custom `sk-IOAI-` token.\n",
|
| 374 |
+
"'''\n",
|
| 375 |
+
"\n",
|
| 376 |
+
"# The API server is now down. We have provided a `judge_api.py` script that you can use to simulate calling the api.\n",
|
| 377 |
+
"from judge_api import guess"
|
| 378 |
+
]
|
| 379 |
+
},
|
| 380 |
+
{
|
| 381 |
+
"cell_type": "code",
|
| 382 |
+
"execution_count": null,
|
| 383 |
+
"id": "20ffe741",
|
| 384 |
+
"metadata": {},
|
| 385 |
+
"outputs": [],
|
| 386 |
+
"source": [
|
| 387 |
+
"import math, random\n",
|
| 388 |
+
"# import httpx\n",
|
| 389 |
+
"\n",
|
| 390 |
+
"# from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type, retry_if_exception\n",
|
| 391 |
+
"\n",
|
| 392 |
+
"class GameClient:\n",
|
| 393 |
+
" def ndcg_at_10(self, predictions, correct_answer):\n",
|
| 394 |
+
" if correct_answer not in predictions:\n",
|
| 395 |
+
" return 0.0\n",
|
| 396 |
+
" try:\n",
|
| 397 |
+
" rank = predictions[:10].index(correct_answer) + 1\n",
|
| 398 |
+
" except ValueError:\n",
|
| 399 |
+
" return 0.0\n",
|
| 400 |
+
"\n",
|
| 401 |
+
" return 1 / math.log2(rank + 1)\n",
|
| 402 |
+
"\n",
|
| 403 |
+
" def hits_at_10(self, predictions, correct_answer):\n",
|
| 404 |
+
" return 1.0 if correct_answer in predictions[:10] else 0.0\n",
|
| 405 |
+
"\n",
|
| 406 |
+
" def __init__(self):\n",
|
| 407 |
+
" self._random_options = ['gym', 'dinosaur', 'camel', 'desk', 'chicken', 'suitcase', 'thief', 'penguin', 'bat', 'painter', 'yogurt', 'chocolate', 'football', 'wallet', 'magician', 'shoes', 'bank', 'church', 'chewing gum', 'fashion', 'chainsaw', 'escalator', 'scarf', 'lawyer', 'eagle', 'credit card', 'garden hose', 'glider', 'crosswalk', 'subway', 'fireworks', 'marshmallow', 'cookies', 'curtains', 'dining room', 'cars', 'wedding', 'guitar', 'coffee', 'mouse', 'meat', 'scale', 'train tracks', 'zebra', 'fairy', 'quit', 'museum', 'kangaroo', 'surfboard', 'cheese', 'nightmare', 'jellyfish', 'koala', 'strawberry', 'tiger', 'mailbox', 'kettle', 'potato', 'janitor', 'lighthouse', 'crocodile', 'charger', 'doctor', 'peacock', 'peanut', 'popcorn', 't-shirt', 'fertilizer', 'keyboard', 'umbrella', 'pool', 'watercolor', 'mango', 'xylophone', 'bathroom', 'ice cube', 'giraffe', 'garage', 'cabin', 'plankton', 'pig', 'vulture', 'frame', 'polar bear', 'microscope', 'snake', 'skeleton', 'rocket', 'backpack', 'jacket', 'bedroom', 'castle', 'horse', 'dragonfly', 'hotel', 'cyclist', 'mask', 'restaurant', 'toothpaste', 'angel', 'whistle', 'wrestling', 'eclipse', 'hermit crabs', 'horn', 'boxers', 'volcano', 'fire station', 'toothbrush', 'egg', 'straw', 'rice', 'diamond', 'vitamins', 'tricycle', 'bottle-opener', 'panther', 'ice skates', 'theater', 'gas mask', 'game console', 'path', 'scorpion', 'snowboard', 'crab', 'pie', 'octopus', 'mustache', 'pepper grinder', 'swings', 'palm tree', 'well', 'sewing machine', 'key', 'station', 'mosque', 'chameleon', 'cherry', 'parrot', 'leggings', 'radio', 'brick', 'sunflower', 'hammer', 'carrot', 'radar', 'kite', 'bathtub', 'rhinoceros', 'spoon', 'orchestra', 'gravity', 'flute', 'lipstick', 'school', 'meteorite', 'politician', 'ladder', 'lawnmower', 'computer', 'wheel', 'airport', 'firefighter', 'porch', 'police station', 'queen', 'mayonnaise', 'alumunium foil', 'lion', 'helmet', 'teacher', 'tea', 'fan', 'piano', 'snail', 'farmer', 'harbor', 'nurse', 'sunglasses', 'bee', 'postal worker', 'market', 'plank', 'steering wheel', 'squirrel', 'netting', 'dragon', 'cafeteria', 'millennium', 'spinach', 'fork', 'cabbage', 'ping-pong', 'lock', 'submarine', 'dictionary', 'vaccine', 'soda', 'skirt', 'toaster', 'shorts', 'circus', 'flowerpot', 'lobster', 'rainbow', 'cockroach', 'frog', 'basket ball', 'chilli pepper', 'pajamas', 'crossword', 'light bulb', 'drill', 'beaver', 'daisy', 'river', 'yo-yo', 'harmonica', 'soap', 'igloo', 'sausage', 'deer', 'sailboat', 'fish', 'mosquito', 'can', 'rat', 'frying pan', 'barcode', 'sunscreen', 'ferret', 'whale', 'duck', 'shirt', 'vacuum', 'detective', 'perfume', 'seal', 'raincoat', 'alien', 'bull', 'nest', 'butterfly', 'eraser', 'hedgehog', 'panda', 'refrigerator', 'monocle', 'window', 'kitchen', 'mole', 'speaker', 'waiter', 'salad', 'dolphin', 'storm', 'drums', 'spiderweb', 'bicycle', 'monkey', 'flamingo', 'prison', 'bowling', 'pencil sharpner', 'photo', 'printer', 'robe', 'seahorse', 'doorbell', 'gloves', 'alcohol', 'diving suit', 'shotgun', 'hairbrush', 'cactus', 'ambulance', 'hula hoop', 'snowman', 'mountain', 'unicorn', 'suit', 'cake', 'cow', 'sled', 'boar', 'barbecue', 'trash can', 'slingshot', 'banana', 'dam', 'hat', 'milk', 'shell', 'broom', 'fisherman', 'bucket', 'bell', 'tracktor', 'fly', 'spider', 'carpet', 'coconut tree', 'movie theater', 'socks', 'soldier', 'watering can', 'accountant', 'microphone', 'toothpick', 'wolf', 'trumpet', 'apple', 'library', 'cork', 'zipper', 'pan', 'doghouse', 'dynamite', 'swan', 'grasshopper', 'beach', 'starfish', 'police officer', 'board game', 'magnet', 'cucumber', 'fire extinguisher', 'sundial', 'mechanic', 'lighter', 'shovel', 'shark', 'notebook', 'ostrich', 'bodyguard', 'binoculars', 'parachute', 'drone', 'kiwi', 'ghost', 'baker', 'robot', 'postcard', 'horseshoe', 'karaoke', 'billiards', 'palace', 'hospital', 'compass', 'truck', 'holiday', 'lake', 'cave', 'space station', 'mushroom', 'magnifying glass', 'fox', 'bread', 'rose', 'windmill', 'pirate', 'earring', 'hunter', 'princess', 'calculator', 'clown', 'watch', 'pilot', 'mustard', 'swordfish', 'darts', 'microwave oven', 'plumber', 'sword']\n",
|
| 408 |
+
"\n",
|
| 409 |
+
" # @retry(\n",
|
| 410 |
+
" # stop=stop_after_attempt(3),\n",
|
| 411 |
+
" # wait=wait_exponential(multiplier=1, min=4, max=10),\n",
|
| 412 |
+
" # retry=retry_if_exception_type((httpx.TimeoutException, httpx.ConnectError, httpx.RequestError)) |\n",
|
| 413 |
+
" # retry_if_exception(lambda e: isinstance(e, httpx.HTTPStatusError) and e.response.is_server_error) # Retry on connection errors or server side errors.\n",
|
| 414 |
+
" # )\n",
|
| 415 |
+
" # def _make_api_call(self, clues, options):\n",
|
| 416 |
+
" # response = httpx.post(f\"{API_URL}/guess\", json={\n",
|
| 417 |
+
" # \"clues\": clues,\n",
|
| 418 |
+
" # \"options\": options\n",
|
| 419 |
+
" # }, headers={\n",
|
| 420 |
+
" # \"Authorization\": f\"Bearer {SCORER_API_KEY}\"\n",
|
| 421 |
+
" # }, timeout=60)\n",
|
| 422 |
+
" \n",
|
| 423 |
+
" # response.raise_for_status()\n",
|
| 424 |
+
" \n",
|
| 425 |
+
" # guesser_response = response.json()\n",
|
| 426 |
+
" \n",
|
| 427 |
+
" # if \"guesses\" not in guesser_response:\n",
|
| 428 |
+
" # raise ValueError(f\"Unable to generate guesses: {guesser_response}\")\n",
|
| 429 |
+
" # if not isinstance(guesser_response[\"guesses\"], list):\n",
|
| 430 |
+
" # raise ValueError(f\"Guesses is not a list: {guesser_response}\")\n",
|
| 431 |
+
" \n",
|
| 432 |
+
" # return guesser_response\n",
|
| 433 |
+
" def _make_api_call(self, clues, options):\n",
|
| 434 |
+
" return guess(clues, options)\n",
|
| 435 |
+
"\n",
|
| 436 |
+
" def simulate_game(self, clues, expected_answer, distractors = []):\n",
|
| 437 |
+
" expected_answer = expected_answer.lower()\n",
|
| 438 |
+
" if expected_answer in distractors:\n",
|
| 439 |
+
" options = []\n",
|
| 440 |
+
" else:\n",
|
| 441 |
+
" options = [expected_answer]\n",
|
| 442 |
+
" if len(distractors) > 0:\n",
|
| 443 |
+
" options.extend([d.lower() for d in distractors])\n",
|
| 444 |
+
" options = options[:100]\n",
|
| 445 |
+
"\n",
|
| 446 |
+
" # fill in options until the size is 100 with random options\n",
|
| 447 |
+
" # set seed based on the expected_answers\n",
|
| 448 |
+
" if len(options) < 100:\n",
|
| 449 |
+
" random.seed(expected_answer)\n",
|
| 450 |
+
" options.extend(random.choices(self._random_options, k=100-len(options)))\n",
|
| 451 |
+
" # then shuffle\n",
|
| 452 |
+
" random.shuffle(options)\n",
|
| 453 |
+
"\n",
|
| 454 |
+
" try:\n",
|
| 455 |
+
" predictions = self._make_api_call(clues, options)\n",
|
| 456 |
+
" return {\n",
|
| 457 |
+
" \"predictions\": predictions,\n",
|
| 458 |
+
" \"hit@10\": self.hits_at_10(predictions, expected_answer),\n",
|
| 459 |
+
" \"NDCG@10\": self.ndcg_at_10(predictions, expected_answer)\n",
|
| 460 |
+
" }\n",
|
| 461 |
+
" \n",
|
| 462 |
+
" except Exception as e:\n",
|
| 463 |
+
"\n",
|
| 464 |
+
" # if isinstance(e, httpx.HTTPStatusError):\n",
|
| 465 |
+
" # print(f\"HTTP Status Error {e.response.status_code}: {e.response.text}\")\n",
|
| 466 |
+
" # try:\n",
|
| 467 |
+
" # error_detail = e.response.json().get(\"detail\", \"Unknown error\")\n",
|
| 468 |
+
" # print(f\"Error details: {error_detail}\")\n",
|
| 469 |
+
" # except:\n",
|
| 470 |
+
" # print(f\"Could not parse error response {e.response.text}\")\n",
|
| 471 |
+
" \n",
|
| 472 |
+
" # elif isinstance(e, ValueError):\n",
|
| 473 |
+
" # print(f\"Value error: {e}\")\n",
|
| 474 |
+
"\n",
|
| 475 |
+
" # elif isinstance(e, httpx.TimeoutException):\n",
|
| 476 |
+
" # print(\"request timed out after retries\")\n",
|
| 477 |
+
"\n",
|
| 478 |
+
" # elif isinstance(e, httpx.ConnectError):\n",
|
| 479 |
+
" # print(f\"Could not connect to {API_URL} after retries\")\n",
|
| 480 |
+
"\n",
|
| 481 |
+
" # elif isinstance(e, httpx.RequestError):\n",
|
| 482 |
+
" # print(f\"Request error after retries: {e}\")\n",
|
| 483 |
+
"\n",
|
| 484 |
+
" # else:\n",
|
| 485 |
+
" # print(f\"Unknown error: {e}\")\n",
|
| 486 |
+
"\n",
|
| 487 |
+
" return {\n",
|
| 488 |
+
" \"predictions\": [],\n",
|
| 489 |
+
" \"hit@10\": 0.0,\n",
|
| 490 |
+
" \"NDCG@10\": 0.0\n",
|
| 491 |
+
" }"
|
| 492 |
+
]
|
| 493 |
+
},
|
| 494 |
+
{
|
| 495 |
+
"cell_type": "code",
|
| 496 |
+
"execution_count": null,
|
| 497 |
+
"id": "a7929fa5",
|
| 498 |
+
"metadata": {},
|
| 499 |
+
"outputs": [],
|
| 500 |
+
"source": [
|
| 501 |
+
"game_client = GameClient()\n",
|
| 502 |
+
"\n",
|
| 503 |
+
"# the clue for samurai\n",
|
| 504 |
+
"clue = [[4, 35],\n",
|
| 505 |
+
" [16, 116, 85, 106],\n",
|
| 506 |
+
" [43, 102]]\n",
|
| 507 |
+
"\n",
|
| 508 |
+
"# You can refer to the following code for calling the judge api. Don't forget to comment out this part before submission, otherwise your notebook will not run.\n",
|
| 509 |
+
"# you can call simulate game, given your clues and the expected answer.\n",
|
| 510 |
+
"# the game client will randomly generate 100 options.\n",
|
| 511 |
+
"# The answer will be automatically added as one of the options.\n",
|
| 512 |
+
"# note that capitalization does not matter, the client will treat all texts as lowercase.\n",
|
| 513 |
+
"prediction = game_client.simulate_game(clue, \"Samurai\")\n",
|
| 514 |
+
"\n",
|
| 515 |
+
"# it will print the prediction, as well as the score of the prediction (more later)\n",
|
| 516 |
+
"print(prediction)\n",
|
| 517 |
+
"\n",
|
| 518 |
+
"# you might also want to put your own distractors, which will be added into the set of options.\n",
|
| 519 |
+
"# It will randomly fill in the rest of options until it has 100 options\n",
|
| 520 |
+
"prediction = game_client.simulate_game(clue, \"Samurai\",\n",
|
| 521 |
+
" distractors=['cat', 'dog', 'castle', 'blacksmith', 'martial artist', 'hunter',\n",
|
| 522 |
+
" 'warrior', 'knight', 'viking', 'janissary', 'chevalier', 'imperial guard', 'swordsman', 'gladiator', 'marksman', 'police officer'])\n",
|
| 523 |
+
"print(prediction)"
|
| 524 |
+
]
|
| 525 |
+
},
|
| 526 |
+
{
|
| 527 |
+
"cell_type": "markdown",
|
| 528 |
+
"id": "17c8559a-540a-4a10-80dd-bf2a452bc098",
|
| 529 |
+
"metadata": {},
|
| 530 |
+
"source": [
|
| 531 |
+
"### Data Loading"
|
| 532 |
+
]
|
| 533 |
+
},
|
| 534 |
+
{
|
| 535 |
+
"cell_type": "code",
|
| 536 |
+
"execution_count": null,
|
| 537 |
+
"id": "8730c968",
|
| 538 |
+
"metadata": {},
|
| 539 |
+
"outputs": [],
|
| 540 |
+
"source": [
|
| 541 |
+
"from datasets import load_dataset\n",
|
| 542 |
+
"DESCRIPTIONS_PATH = \"IOAI-official/ioai2025-onsite-concepts-hint-descriptions\"\n",
|
| 543 |
+
"\n",
|
| 544 |
+
"hint_descriptions = load_dataset(DESCRIPTIONS_PATH)['train']\n",
|
| 545 |
+
"hint_descriptions = {\n",
|
| 546 |
+
" x['ID']: {'description': x['Description'], 'icons': x['image']}\n",
|
| 547 |
+
" for x in hint_descriptions\n",
|
| 548 |
+
"}"
|
| 549 |
+
]
|
| 550 |
+
},
|
| 551 |
+
{
|
| 552 |
+
"cell_type": "code",
|
| 553 |
+
"execution_count": null,
|
| 554 |
+
"id": "f1804b3b",
|
| 555 |
+
"metadata": {},
|
| 556 |
+
"outputs": [],
|
| 557 |
+
"source": [
|
| 558 |
+
"valid_hints = [x['description'] for x in hint_descriptions.values()]\n",
|
| 559 |
+
"hint_to_id = {\n",
|
| 560 |
+
" x['description']: xid\n",
|
| 561 |
+
" for xid, x in hint_descriptions.items()\n",
|
| 562 |
+
"}\n",
|
| 563 |
+
"\n",
|
| 564 |
+
"print(valid_hints)\n",
|
| 565 |
+
"print(hint_to_id)"
|
| 566 |
+
]
|
| 567 |
+
},
|
| 568 |
+
{
|
| 569 |
+
"cell_type": "code",
|
| 570 |
+
"execution_count": null,
|
| 571 |
+
"id": "118f6ada",
|
| 572 |
+
"metadata": {},
|
| 573 |
+
"outputs": [],
|
| 574 |
+
"source": [
|
| 575 |
+
"TRAINING_SET = \"IOAI-official/ioai2025-onsite-concepts-train\"\n",
|
| 576 |
+
"dev = load_dataset(TRAINING_SET)['train']\n",
|
| 577 |
+
"print(dev)\n",
|
| 578 |
+
"print(dev[0])"
|
| 579 |
+
]
|
| 580 |
+
},
|
| 581 |
+
{
|
| 582 |
+
"cell_type": "code",
|
| 583 |
+
"execution_count": null,
|
| 584 |
+
"id": "50a07d22",
|
| 585 |
+
"metadata": {},
|
| 586 |
+
"outputs": [],
|
| 587 |
+
"source": [
|
| 588 |
+
"from typing import Literal, List, Optional\n",
|
| 589 |
+
"ValidHint = Literal[*valid_hints]\n",
|
| 590 |
+
"\n",
|
| 591 |
+
"class Hints(BaseModel):\n",
|
| 592 |
+
" hints_1: List[ValidHint]\n",
|
| 593 |
+
" hints_2: List[ValidHint]\n",
|
| 594 |
+
" hints_3: List[ValidHint]\n",
|
| 595 |
+
" hints_4: List[ValidHint]\n",
|
| 596 |
+
"\n",
|
| 597 |
+
" def to_result(self):\n",
|
| 598 |
+
" hints = [self.hints_1, self.hints_2, self.hints_3, self.hints_4]\n",
|
| 599 |
+
" result = []\n",
|
| 600 |
+
" for hintlist in hints:\n",
|
| 601 |
+
" cur_hintlist = [hint_to_id[hint] for hint in hintlist[:8]]\n",
|
| 602 |
+
" result.append(cur_hintlist)\n",
|
| 603 |
+
" return result\n",
|
| 604 |
+
"\n",
|
| 605 |
+
"class ClueGiver:\n",
|
| 606 |
+
" def __init__(self):\n",
|
| 607 |
+
" self.llm = LLM(\"facebook/opt-125m\")\n",
|
| 608 |
+
" # Some models were available to the contestants, as listed above.\n",
|
| 609 |
+
" json_schema = Hints.model_json_schema()\n",
|
| 610 |
+
" self.sampling_params = SamplingParams(\n",
|
| 611 |
+
" guided_decoding=GuidedDecodingParams(\n",
|
| 612 |
+
" json=json_schema,\n",
|
| 613 |
+
" ),\n",
|
| 614 |
+
" max_tokens=5096,\n",
|
| 615 |
+
" frequency_penalty=0.5,\n",
|
| 616 |
+
" presence_penalty=0.8\n",
|
| 617 |
+
" )\n",
|
| 618 |
+
"\n",
|
| 619 |
+
" def construct_clues(self, answers: List[str], options: List[List[str]]):\n",
|
| 620 |
+
" prompts = []\n",
|
| 621 |
+
" for answer, options in zip(answers, options):\n",
|
| 622 |
+
" prompt = (\n",
|
| 623 |
+
" f\"Your valid list of clues are: {valid_hints}. \"\n",
|
| 624 |
+
" \"Your job is a clue giver. You will help the guesser pick the correct answer from a range of options.\"\n",
|
| 625 |
+
" \"You must output at least 1 hint and at most 8 hints for each sequence. \"\n",
|
| 626 |
+
" \"Please output a json object with the key 'hints_1', 'hints_2', 'hints_3', and 'hints_4', and the value being a list of hints. \"\n",
|
| 627 |
+
" \"Example: {\"\n",
|
| 628 |
+
" \"'hints_1': [\\\"Work\\\\nOccupation\\\", \\\"Idea\\\\nIntelligence\\\\nConcept\\\"], \"\n",
|
| 629 |
+
" \"'hints_2': [\\\"Fauna\\\\nAnimal\\\", \\\"Flora\\\\nPlant\\\\nNature\\\"], \"\n",
|
| 630 |
+
" \"'hints_3': [\\\"Object\\\\nBox\\\", \\\"Art\\\\nSculpture - Painting\\\\nDrawing - Cartoon\\\"], \"\n",
|
| 631 |
+
" \"'hints_4': [\\\"Work\\\\nOccupation\\\", \\\"Idea\\\\nIntelligence\\\\nConcept\\\"]\"\n",
|
| 632 |
+
" \"}\"\n",
|
| 633 |
+
" f\"The options the guesser has to choose from are: {options}.\"\n",
|
| 634 |
+
" f\"Please construct sequences of hints that are most relevant to the answer {answer}. \"\n",
|
| 635 |
+
" )\n",
|
| 636 |
+
" prompts.append(prompt)\n",
|
| 637 |
+
" # batch mode: pass a list of prompts\n",
|
| 638 |
+
" hints_batch = self.llm.generate(prompts=prompts, sampling_params=self.sampling_params)\n",
|
| 639 |
+
" results = []\n",
|
| 640 |
+
" for i, hints in enumerate(hints_batch):\n",
|
| 641 |
+
" # print(hints.outputs)\n",
|
| 642 |
+
" # print(f\"len of token ids: {len(hints.outputs[0].token_ids)}\")\n",
|
| 643 |
+
" txt = hints.outputs[0].text\n",
|
| 644 |
+
" # print(txt)\n",
|
| 645 |
+
" try:\n",
|
| 646 |
+
" hints_obj = Hints.model_validate_json(txt)\n",
|
| 647 |
+
" results.append(hints_obj.to_result())\n",
|
| 648 |
+
" except Exception as e:\n",
|
| 649 |
+
" print(f\"Error parsing hints for answer {answers[i]}: {e}\")\n",
|
| 650 |
+
" results.append([[1,2,3,4]])\n",
|
| 651 |
+
" return results"
|
| 652 |
+
]
|
| 653 |
+
},
|
| 654 |
+
{
|
| 655 |
+
"cell_type": "code",
|
| 656 |
+
"execution_count": null,
|
| 657 |
+
"id": "c21319c5",
|
| 658 |
+
"metadata": {},
|
| 659 |
+
"outputs": [],
|
| 660 |
+
"source": [
|
| 661 |
+
"clue_giver = ClueGiver()"
|
| 662 |
+
]
|
| 663 |
+
},
|
| 664 |
+
{
|
| 665 |
+
"cell_type": "code",
|
| 666 |
+
"execution_count": null,
|
| 667 |
+
"id": "01a07b30",
|
| 668 |
+
"metadata": {},
|
| 669 |
+
"outputs": [],
|
| 670 |
+
"source": [
|
| 671 |
+
"res_clues = clue_giver.construct_clues([x['label'] for x in dev], [x['options'] for x in dev])"
|
| 672 |
+
]
|
| 673 |
+
},
|
| 674 |
+
{
|
| 675 |
+
"cell_type": "code",
|
| 676 |
+
"execution_count": null,
|
| 677 |
+
"id": "bf138945",
|
| 678 |
+
"metadata": {},
|
| 679 |
+
"outputs": [],
|
| 680 |
+
"source": [
|
| 681 |
+
"# You may use the following code to evaluate your model. Don't forget to comment out this section before submission, as the inference machine will not have access to the judge api.\n",
|
| 682 |
+
"from tqdm import tqdm\n",
|
| 683 |
+
"from concurrent.futures import ThreadPoolExecutor, as_completed\n",
|
| 684 |
+
"\n",
|
| 685 |
+
"def simulate_one(i_data):\n",
|
| 686 |
+
" i, data = i_data\n",
|
| 687 |
+
" clues = res_clues[i]\n",
|
| 688 |
+
" prediction = game_client.simulate_game(clues, data['label'])\n",
|
| 689 |
+
" return prediction\n",
|
| 690 |
+
"\n",
|
| 691 |
+
"predictions = []\n",
|
| 692 |
+
"with ThreadPoolExecutor() as executor:\n",
|
| 693 |
+
" futures = [executor.submit(simulate_one, (i, data)) for i, data in enumerate(dev)]\n",
|
| 694 |
+
" for f in tqdm(as_completed(futures), total=len(futures)):\n",
|
| 695 |
+
" predictions.append(f.result())\n",
|
| 696 |
+
"\n",
|
| 697 |
+
"print(\"Final Score: \")\n",
|
| 698 |
+
"print(sum([p['hit@10'] for p in predictions]) * 0.9 + sum([p['NDCG@10'] for p in predictions]) * 0.1)"
|
| 699 |
+
]
|
| 700 |
+
},
|
| 701 |
+
{
|
| 702 |
+
"cell_type": "markdown",
|
| 703 |
+
"id": "a516aaa2-0153-4e7d-bb31-b802fe702c00",
|
| 704 |
+
"metadata": {},
|
| 705 |
+
"source": [
|
| 706 |
+
"### Clean Gpu Cache"
|
| 707 |
+
]
|
| 708 |
+
},
|
| 709 |
+
{
|
| 710 |
+
"cell_type": "code",
|
| 711 |
+
"execution_count": null,
|
| 712 |
+
"id": "a33b2a1e",
|
| 713 |
+
"metadata": {},
|
| 714 |
+
"outputs": [],
|
| 715 |
+
"source": [
|
| 716 |
+
"import torch\n",
|
| 717 |
+
"\n",
|
| 718 |
+
"del clue_giver\n",
|
| 719 |
+
"\n",
|
| 720 |
+
"torch.cuda.empty_cache()"
|
| 721 |
+
]
|
| 722 |
+
},
|
| 723 |
+
{
|
| 724 |
+
"cell_type": "markdown",
|
| 725 |
+
"id": "dda5169b",
|
| 726 |
+
"metadata": {},
|
| 727 |
+
"source": [
|
| 728 |
+
"### Submission\n",
|
| 729 |
+
"\n",
|
| 730 |
+
"You do not have to submit your training notebook (you can if you would like to). For resource-efficiency and reliability reasons, we encourage you to upload your trained model weights (if you have one) attached to your submission notebook, instead of submitting your entire training process. For help with submitting model weight files, refer to section 5 in the Bohrium Guide. Your submission notebook only has to include the test inference section below.\n",
|
| 731 |
+
"\n",
|
| 732 |
+
"You need to save your answers to testset A and testset B in separate `jsonl` files, `clues_a.jsonl` and `clues_b.jsonl`, as shown below. `clues_a` and `clues_b` should be lists of clues (each clue being a list of lists of integers). You need to zip the files together into `submission.zip`. The file names are important. You must follow the naming conventions otherwise the evaluation script will not be able to find your answers."
|
| 733 |
+
]
|
| 734 |
+
},
|
| 735 |
+
{
|
| 736 |
+
"cell_type": "code",
|
| 737 |
+
"execution_count": null,
|
| 738 |
+
"id": "3582fdfe",
|
| 739 |
+
"metadata": {},
|
| 740 |
+
"outputs": [],
|
| 741 |
+
"source": [
|
| 742 |
+
"clue_giver = ClueGiver() # Initialize your model. You can load model weights here."
|
| 743 |
+
]
|
| 744 |
+
},
|
| 745 |
+
{
|
| 746 |
+
"cell_type": "code",
|
| 747 |
+
"execution_count": null,
|
| 748 |
+
"id": "e35c1193",
|
| 749 |
+
"metadata": {},
|
| 750 |
+
"outputs": [],
|
| 751 |
+
"source": [
|
| 752 |
+
"# Note: both of these datasets were hidden from the contestants during the competition\n",
|
| 753 |
+
"VALIDATION_SET = \"IOAI-official/ioai2025-onsite-concepts-validation\"\n",
|
| 754 |
+
"TESTING_SET = \"IOAI-official/ioai2025-onsite-concepts-test\"\n",
|
| 755 |
+
"\n",
|
| 756 |
+
"testset_a = load_dataset(VALIDATION_SET)[\"test\"]\n",
|
| 757 |
+
"testset_b = load_dataset(TESTING_SET)[\"test\"]\n",
|
| 758 |
+
"clues_a = clue_giver.construct_clues([x['label'] for x in testset_a], [x['options'] for x in testset_a])\n",
|
| 759 |
+
"clues_b = clue_giver.construct_clues([x['label'] for x in testset_b], [x['options'] for x in testset_b])"
|
| 760 |
+
]
|
| 761 |
+
},
|
| 762 |
+
{
|
| 763 |
+
"cell_type": "code",
|
| 764 |
+
"execution_count": null,
|
| 765 |
+
"id": "4ef60d7a",
|
| 766 |
+
"metadata": {},
|
| 767 |
+
"outputs": [],
|
| 768 |
+
"source": [
|
| 769 |
+
"# import zipfile\n",
|
| 770 |
+
"import json\n",
|
| 771 |
+
"import os\n",
|
| 772 |
+
"\n",
|
| 773 |
+
"OUTPUT_DIR = \"out\"\n",
|
| 774 |
+
"\n",
|
| 775 |
+
"def write_clues(clues: List[List[List[int]]], path: str):\n",
|
| 776 |
+
" with open(path, 'w') as f:\n",
|
| 777 |
+
" for c in clues:\n",
|
| 778 |
+
" f.write(json.dumps(c) + '\\n')\n",
|
| 779 |
+
"\n",
|
| 780 |
+
"os.makedirs(OUTPUT_DIR, exist_ok=True)\n",
|
| 781 |
+
"write_clues(clues_a, OUTPUT_DIR + \"/clues_a.jsonl\")\n",
|
| 782 |
+
"write_clues(clues_b, OUTPUT_DIR + \"/clues_b.jsonl\")\n",
|
| 783 |
+
"\n",
|
| 784 |
+
"# Contestants were required to submit their clues in a zip file\n",
|
| 785 |
+
"# with zipfile.ZipFile('submission.zip', 'w') as zipf:\n",
|
| 786 |
+
"# zipf.write('clues_a.jsonl')\n",
|
| 787 |
+
"# zipf.write('clues_b.jsonl')"
|
| 788 |
+
]
|
| 789 |
+
},
|
| 790 |
+
{
|
| 791 |
+
"cell_type": "code",
|
| 792 |
+
"execution_count": null,
|
| 793 |
+
"id": "515d63b6-19d5-425f-85d6-d6ea9471047f",
|
| 794 |
+
"metadata": {},
|
| 795 |
+
"outputs": [],
|
| 796 |
+
"source": [
|
| 797 |
+
"import torch\n",
|
| 798 |
+
"\n",
|
| 799 |
+
"del clue_giver\n",
|
| 800 |
+
"torch.cuda.empty_cache()"
|
| 801 |
+
]
|
| 802 |
+
}
|
| 803 |
+
],
|
| 804 |
+
"metadata": {
|
| 805 |
+
"kernelspec": {
|
| 806 |
+
"display_name": "Python 3 (ipykernel)",
|
| 807 |
+
"language": "python",
|
| 808 |
+
"name": "python3"
|
| 809 |
+
},
|
| 810 |
+
"language_info": {
|
| 811 |
+
"codemirror_mode": {
|
| 812 |
+
"name": "ipython",
|
| 813 |
+
"version": 3
|
| 814 |
+
},
|
| 815 |
+
"file_extension": ".py",
|
| 816 |
+
"mimetype": "text/x-python",
|
| 817 |
+
"name": "python",
|
| 818 |
+
"nbconvert_exporter": "python",
|
| 819 |
+
"pygments_lexer": "ipython3",
|
| 820 |
+
"version": "3.12.9"
|
| 821 |
+
}
|
| 822 |
+
},
|
| 823 |
+
"nbformat": 4,
|
| 824 |
+
"nbformat_minor": 5
|
| 825 |
+
}
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/Concepts_Solution.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# IOAI 2025 Concepts Task
|
| 2 |
+
|
| 3 |
+
This folder contains resources for the Concepts task (day 1, task 3) in IOAI 2025.
|
| 4 |
+
|
| 5 |
+
## File Descriptions
|
| 6 |
+
|
| 7 |
+
- [`Concepts.ipynb`](Concepts.ipynb): The baseline notebook, including the problem statement.
|
| 8 |
+
- [`Concepts_Solution.ipynb`](Concepts_Solution.ipynb): The official intended solution notebook from the ISC and HSC.
|
| 9 |
+
- [`judge_api.py`](judge_api.py): This scripts simulates the judge api accessible to contestants during the competition. You need an openrouter token to run use this script.
|
| 10 |
+
- [`metrics.py`](metrics.py): The evaluation script.
|
| 11 |
+
- [`llm_proxy_tutorial.ipynb`](llm_proxy_tutorial.ipynb): During the competition the contestants were allowed to access LLMs for this problem only using a custom proxy and custom api keys. This was the tutorial notebook for using the custom LLM proxy. We are keeping this tutorial notebook here to inform you that you are allowed and encouraged to use LLMs to assist in solving this problem, with limitations outlined in the tutorial notebook.
|
| 12 |
+
|
| 13 |
+
## Usage
|
| 14 |
+
|
| 15 |
+
To run this task, you need an openrouter token to run the evaluation API. Go to https://openrouter.ai/ to create an API key, and insert it in [`judge_api.py`](judge_api.py). The solution notebook also uses LLM APIs, which the contestants had access to through an [official proxy](llm_proxy_tutorial.ipynb) using official IOAI tokens. You will be able to run the [solution](Concepts_Solution.ipynb) with any OpenAI API base url and corresponding token of your choice.
|
| 16 |
+
|
| 17 |
+
First, run [`Concepts.ipynb`](Concepts.ipynb) or [`Concepts_Solution.ipynb`](Concepts_Solution.ipynb). This will generate an `out` folder containing `clues_a.jsonl`, `clues_b.jsonl`, and potentially other files. The two `jsonl` files are the answers that will be evaluated.
|
| 18 |
+
|
| 19 |
+
After running a solution, run `metrics.py` to evaluate your answers. It will log your scores on both the validation and testing set as well as generate a `score.json` file under `out`.
|
| 20 |
+
|
| 21 |
+
## On-Site Limitations
|
| 22 |
+
|
| 23 |
+
During the competition, the participants were allocated $10 worth of credits for using the LLM proxy and $12,500$ total judge api calls (as well as rate limitations). The contestants submitted a notebook that was ran on inference machines, which generated `jsonl` files that were evaluated on separate evaluation machines. The inference machines did not have access to the judge api and the evaluation machines accessed it through a secret url. This means the contestants were not able access the judge api during inference or evaluation. The API was solely meant to assist in the training process and as a way to validate their solutions locally before submission. It should not be involved during inference. Furthermore, the API was a black box to the contestants and they did not know how it was implemented.
|
| 24 |
+
|
| 25 |
+
It is also worth noting that the current implementation of the [judge api script](judge_api.py) might be affected by randomness in the response of the LLM. This may result in some small oscillations in scoring. The implementation of the API server used for the competition is much more robust and ensures fairness and reproducibility.
|
| 26 |
+
|
| 27 |
+
There was also a total upload file size limit of `1GB` from the contestants' local computers to the inference machines. The inference machines also did not have access to any huggingface models other than the ones listed above.
|
| 28 |
+
|
| 29 |
+
You should keep these limitations in mind while solving this problem.
|
| 30 |
+
|
| 31 |
+
## Credits
|
| 32 |
+
|
| 33 |
+
This problem was provided by **[Alham Fikri Aji](https://afaji.github.io/)** - [Linkedin](https://www.linkedin.com/in/afaji/)
|
| 34 |
+
|
| 35 |
+
### HSC contributors
|
| 36 |
+
|
| 37 |
+
- [Jett Chen](https://jettchen.me/) - [Linkedin](https://www.linkedin.com/in/jettchen/)
|
| 38 |
+
- [Sijun Li](https://github.com/Silicon23)
|
| 39 |
+
- [Shao Duan](https://github.com/shaoxiongduan)
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/judge_api.py
ADDED
|
@@ -0,0 +1,91 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""judge_api.py
|
| 2 |
+
|
| 3 |
+
# Set your API key and base URL at the top of this file
|
| 4 |
+
### Hint descriptions are automatically loaded from Hugging Face
|
| 5 |
+
|
| 6 |
+
Usage:
|
| 7 |
+
from judge_api import guess
|
| 8 |
+
|
| 9 |
+
guesses = guess([[1, 2, 3]], options=["cat", "dog", "house"])
|
| 10 |
+
"""
|
| 11 |
+
|
| 12 |
+
from typing import List, Optional
|
| 13 |
+
from datasets import load_dataset
|
| 14 |
+
|
| 15 |
+
from openai import OpenAI
|
| 16 |
+
from pydantic import BaseModel, Field
|
| 17 |
+
|
| 18 |
+
# ---------------------------------------------------------------------------
|
| 19 |
+
# Configuration - UPDATE THESE VALUES
|
| 20 |
+
# ---------------------------------------------------------------------------
|
| 21 |
+
API_KEY = "sk-or-v1-put-your-openrouter-api-key-here" # Put your OpenRouter API key here
|
| 22 |
+
BASE_URL = "https://openrouter.ai/api/v1"
|
| 23 |
+
MODEL = "google/gemini-2.5-flash-lite-preview-06-17"
|
| 24 |
+
|
| 25 |
+
_client = OpenAI(api_key=API_KEY, base_url=BASE_URL)
|
| 26 |
+
|
| 27 |
+
# ---------------------------------------------------------------------------
|
| 28 |
+
# Load hint descriptions from Hugging Face dataset
|
| 29 |
+
# ---------------------------------------------------------------------------
|
| 30 |
+
try:
|
| 31 |
+
print("Loading hint descriptions from Hugging Face...")
|
| 32 |
+
ds = load_dataset("IOAI-official/ioai2025-onsite-concepts-hint-descriptions", split="train")
|
| 33 |
+
_HINT_DICT = {row["ID"]: row["Description"].replace("\n", ", ") for row in ds}
|
| 34 |
+
print(f"Loaded {len(_HINT_DICT)} hint descriptions")
|
| 35 |
+
except Exception as e:
|
| 36 |
+
print(f"Warning: Could not load hint descriptions from Hugging Face: {e}")
|
| 37 |
+
print("Falling back to empty dictionary")
|
| 38 |
+
_HINT_DICT = {}
|
| 39 |
+
|
| 40 |
+
_ORDINALS = ["first", "second", "third", "fourth"]
|
| 41 |
+
|
| 42 |
+
|
| 43 |
+
class GuessResponse(BaseModel):
|
| 44 |
+
answer: List[str] = Field(description="List of guessed keywords")
|
| 45 |
+
|
| 46 |
+
def guess(clues: List[List[int]], options: Optional[List[str]] = None, N: int = 10) -> List[str]:
|
| 47 |
+
"""Generate guesses for a Concepts game based on clues.
|
| 48 |
+
|
| 49 |
+
Args:
|
| 50 |
+
clues: List of clues, where each clue is a list of hint indices
|
| 51 |
+
options: List of possible answer options (optional)
|
| 52 |
+
N: Number of guesses to generate (default: 10)
|
| 53 |
+
|
| 54 |
+
Returns:
|
| 55 |
+
List of guesses
|
| 56 |
+
"""
|
| 57 |
+
# Build clue string
|
| 58 |
+
clue_str = ""
|
| 59 |
+
for i, clue in enumerate(clues):
|
| 60 |
+
clue_str += f"{_ORDINALS[i]} clue:\n"
|
| 61 |
+
for hint_idx in clue:
|
| 62 |
+
desc = _HINT_DICT.get(hint_idx, f"[hint {hint_idx}]")
|
| 63 |
+
clue_str += f" - {desc}\n"
|
| 64 |
+
clue_str += "\n"
|
| 65 |
+
|
| 66 |
+
# Create prompt
|
| 67 |
+
option_str = "\n".join(options) if options else ""
|
| 68 |
+
prompt = f"""You are playing a Concepts game. A player has a secret keyword and has provided you with the following clue:
|
| 69 |
+
{clue_str}
|
| 70 |
+
|
| 71 |
+
{'The secret keyword is guaranteed among the following options:' if options else ''}
|
| 72 |
+
{option_str}
|
| 73 |
+
|
| 74 |
+
Now, provide exactly {N} guesses of the secret keyword."""
|
| 75 |
+
|
| 76 |
+
# Make API call
|
| 77 |
+
response = _client.beta.chat.completions.parse(
|
| 78 |
+
model=MODEL,
|
| 79 |
+
messages=[
|
| 80 |
+
{"role": "system", "content": "You are a helpful assistant playing a Concepts guessing game."},
|
| 81 |
+
{"role": "user", "content": prompt}
|
| 82 |
+
],
|
| 83 |
+
response_format=GuessResponse,
|
| 84 |
+
temperature=0,
|
| 85 |
+
max_tokens=1500
|
| 86 |
+
)
|
| 87 |
+
|
| 88 |
+
return response.choices[0].message.parsed.answer
|
| 89 |
+
|
| 90 |
+
|
| 91 |
+
__all__ = ["guess"]
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/llm_proxy_tutorial.ipynb
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "1d983d23",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"# This is a tutorial on how to use IOAI's provided LLM proxy"
|
| 9 |
+
]
|
| 10 |
+
},
|
| 11 |
+
{
|
| 12 |
+
"cell_type": "markdown",
|
| 13 |
+
"id": "29eea0f6",
|
| 14 |
+
"metadata": {},
|
| 15 |
+
"source": [
|
| 16 |
+
"Note: During the competition, this LLM proxy was provided for contestants to use only for Day 1 Task 3. All requests to this proxy were logged and checked and each contestant was limited to $10 of credit. Contestants called this proxy with the same \"sk-ioai-\" token used to call the judge api."
|
| 17 |
+
]
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"cell_type": "markdown",
|
| 21 |
+
"id": "f5033564",
|
| 22 |
+
"metadata": {},
|
| 23 |
+
"source": [
|
| 24 |
+
"## Step 1: initialize your OpenAI client\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"Please use your provided api key here."
|
| 27 |
+
]
|
| 28 |
+
},
|
| 29 |
+
{
|
| 30 |
+
"cell_type": "code",
|
| 31 |
+
"execution_count": null,
|
| 32 |
+
"id": "699ae2b2",
|
| 33 |
+
"metadata": {},
|
| 34 |
+
"outputs": [],
|
| 35 |
+
"source": [
|
| 36 |
+
"from openai import AsyncClient\n",
|
| 37 |
+
"\n",
|
| 38 |
+
"BASE_URL = \"https://ioai-llm-proxy.up.railway.app/prox/v1\"\n",
|
| 39 |
+
"API_KEY = \"<YOUR_IOAI_API_KEY>\"\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"openai_client = AsyncClient(\n",
|
| 42 |
+
" base_url=BASE_URL,\n",
|
| 43 |
+
" api_key=API_KEY,\n",
|
| 44 |
+
")"
|
| 45 |
+
]
|
| 46 |
+
},
|
| 47 |
+
{
|
| 48 |
+
"cell_type": "markdown",
|
| 49 |
+
"id": "8f2b8e77",
|
| 50 |
+
"metadata": {},
|
| 51 |
+
"source": [
|
| 52 |
+
"## Step 2: Generate output\n",
|
| 53 |
+
"\n",
|
| 54 |
+
"Note that we have an allowlist on model ids:\n",
|
| 55 |
+
"\n",
|
| 56 |
+
"- `openai/gpt-4.1`\n",
|
| 57 |
+
"- `openai/gpt-4.1-mini`\n",
|
| 58 |
+
"- `openai/gpt-4.1-nano`\n",
|
| 59 |
+
"- `openai/gpt-4o`\n",
|
| 60 |
+
"- `openai/gpt-4o-mini`\n",
|
| 61 |
+
"- `gpt-4o-mini`\n",
|
| 62 |
+
"- `gpt-4o`\n",
|
| 63 |
+
"- `gpt-4.1`\n",
|
| 64 |
+
"- `gpt-4.1-mini`\n",
|
| 65 |
+
"- `gpt-4.1-nano`\n",
|
| 66 |
+
"- `google/gemini-2.5-pro`\n",
|
| 67 |
+
"- `google/gemini-2.5-flash`\n",
|
| 68 |
+
"- `moonshotai/kimi-k2`\n",
|
| 69 |
+
"- `qwen/qwen3-235b-a22b-07-25`\n",
|
| 70 |
+
"- `anthropic/claude-sonnet-4`"
|
| 71 |
+
]
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"cell_type": "code",
|
| 75 |
+
"execution_count": null,
|
| 76 |
+
"id": "96895459",
|
| 77 |
+
"metadata": {},
|
| 78 |
+
"outputs": [],
|
| 79 |
+
"source": [
|
| 80 |
+
"response = await openai_client.chat.completions.create(\n",
|
| 81 |
+
" model=\"openai/gpt-4o-mini\",\n",
|
| 82 |
+
" messages=[{\"role\": \"user\", \"content\": \"Hello, world!\"}],\n",
|
| 83 |
+
")\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"print(response)\n",
|
| 86 |
+
"print(response.choices[0].message.content)"
|
| 87 |
+
]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"cell_type": "markdown",
|
| 91 |
+
"id": "6c0b2e3e",
|
| 92 |
+
"metadata": {},
|
| 93 |
+
"source": [
|
| 94 |
+
"## Advanced: Structured Outputs\n",
|
| 95 |
+
"\n",
|
| 96 |
+
"You can use structured outputs to generate objects that fit a specific structure."
|
| 97 |
+
]
|
| 98 |
+
},
|
| 99 |
+
{
|
| 100 |
+
"cell_type": "code",
|
| 101 |
+
"execution_count": null,
|
| 102 |
+
"id": "4f67373b",
|
| 103 |
+
"metadata": {},
|
| 104 |
+
"outputs": [],
|
| 105 |
+
"source": [
|
| 106 |
+
"from pydantic import BaseModel\n",
|
| 107 |
+
"from rich import print as rprint\n",
|
| 108 |
+
"\n",
|
| 109 |
+
"class CalendarItem(BaseModel):\n",
|
| 110 |
+
" title: str\n",
|
| 111 |
+
" month: int\n",
|
| 112 |
+
" date: int\n",
|
| 113 |
+
" year: int\n",
|
| 114 |
+
" description: str\n",
|
| 115 |
+
"\n",
|
| 116 |
+
"result = await openai_client.beta.chat.completions.parse(\n",
|
| 117 |
+
" model=\"openai/gpt-4o-mini\",\n",
|
| 118 |
+
" messages=[\n",
|
| 119 |
+
" {\"role\": \"system\", \"content\": \"You are a helpful assistant that generates calendar items.\"},\n",
|
| 120 |
+
" {\"role\": \"user\", \"content\": \"IOAI opening ceremony at Aug. 1, 2025\"}\n",
|
| 121 |
+
" ],\n",
|
| 122 |
+
" response_format=CalendarItem,\n",
|
| 123 |
+
")\n",
|
| 124 |
+
"\n",
|
| 125 |
+
"print(result)\n",
|
| 126 |
+
"rprint(result.choices[0].message.parsed)"
|
| 127 |
+
]
|
| 128 |
+
},
|
| 129 |
+
{
|
| 130 |
+
"cell_type": "markdown",
|
| 131 |
+
"id": "d1d6dafa",
|
| 132 |
+
"metadata": {},
|
| 133 |
+
"source": [
|
| 134 |
+
"## Batch requests with retry\n",
|
| 135 |
+
"\n",
|
| 136 |
+
"To generate large amounts of LLM completions efficiently and rhobustly, we can leverage:\n",
|
| 137 |
+
"\n",
|
| 138 |
+
"- Concurrent requests capped by an async Semaphore -- so that we can make multiple requests at the same time without overwhelming our bandwidth\n",
|
| 139 |
+
"- Exponential backoff based retry for each request -- so that we gracefully retry when unexpected network / provider errors happen\n",
|
| 140 |
+
"\n",
|
| 141 |
+
"The below is an example:"
|
| 142 |
+
]
|
| 143 |
+
},
|
| 144 |
+
{
|
| 145 |
+
"cell_type": "code",
|
| 146 |
+
"execution_count": null,
|
| 147 |
+
"id": "f591a91f",
|
| 148 |
+
"metadata": {},
|
| 149 |
+
"outputs": [],
|
| 150 |
+
"source": [
|
| 151 |
+
"class RankingExtraction(BaseModel):\n",
|
| 152 |
+
" ranking: int\n",
|
| 153 |
+
" contest: str\n",
|
| 154 |
+
"\n",
|
| 155 |
+
"texts = [f\"We ranked {i}th in the IOAI 2025\" for i in range(1, 101)]\n",
|
| 156 |
+
"len(texts)"
|
| 157 |
+
]
|
| 158 |
+
},
|
| 159 |
+
{
|
| 160 |
+
"cell_type": "code",
|
| 161 |
+
"execution_count": null,
|
| 162 |
+
"id": "80f7dafa",
|
| 163 |
+
"metadata": {},
|
| 164 |
+
"outputs": [],
|
| 165 |
+
"source": [
|
| 166 |
+
"from typing import List\n",
|
| 167 |
+
"from tenacity import retry, stop_after_attempt, wait_exponential\n",
|
| 168 |
+
"from asyncio import Semaphore\n",
|
| 169 |
+
"from tqdm.notebook import tqdm\n",
|
| 170 |
+
"from tqdm.asyncio import tqdm as tqdm_asyncio\n",
|
| 171 |
+
"\n",
|
| 172 |
+
"@retry(\n",
|
| 173 |
+
" stop=stop_after_attempt(3),\n",
|
| 174 |
+
" wait=wait_exponential(multiplier=1, min=4, max=10),\n",
|
| 175 |
+
")\n",
|
| 176 |
+
"async def process_one(txt: str) -> RankingExtraction:\n",
|
| 177 |
+
" result = await openai_client.beta.chat.completions.parse(\n",
|
| 178 |
+
" model=\"openai/gpt-4o-mini\",\n",
|
| 179 |
+
" messages=[{\"role\": \"user\", \"content\": txt}],\n",
|
| 180 |
+
" response_format=RankingExtraction,\n",
|
| 181 |
+
" )\n",
|
| 182 |
+
" return result.choices[0].message.parsed"
|
| 183 |
+
]
|
| 184 |
+
},
|
| 185 |
+
{
|
| 186 |
+
"cell_type": "code",
|
| 187 |
+
"execution_count": null,
|
| 188 |
+
"id": "13380165",
|
| 189 |
+
"metadata": {},
|
| 190 |
+
"outputs": [],
|
| 191 |
+
"source": [
|
| 192 |
+
"print(texts[0])\n",
|
| 193 |
+
"print(await process_one(texts[0]))"
|
| 194 |
+
]
|
| 195 |
+
},
|
| 196 |
+
{
|
| 197 |
+
"cell_type": "code",
|
| 198 |
+
"execution_count": null,
|
| 199 |
+
"id": "be960117",
|
| 200 |
+
"metadata": {},
|
| 201 |
+
"outputs": [],
|
| 202 |
+
"source": [
|
| 203 |
+
"async def process_all(texts: List[str]):\n",
|
| 204 |
+
" semaphore = Semaphore(50) # we limit to making 50 requests concurrently\n",
|
| 205 |
+
" async def _process_with_sema(txt: str):\n",
|
| 206 |
+
" async with semaphore:\n",
|
| 207 |
+
" return await process_one(txt)\n",
|
| 208 |
+
" return await tqdm_asyncio.gather(\n",
|
| 209 |
+
" *[_process_with_sema(txt) for txt in texts],\n",
|
| 210 |
+
" desc=\"Processing\",\n",
|
| 211 |
+
" total=len(texts),\n",
|
| 212 |
+
" )\n",
|
| 213 |
+
"\n",
|
| 214 |
+
"results = await process_all(texts)\n",
|
| 215 |
+
"\n",
|
| 216 |
+
"results[:10]"
|
| 217 |
+
]
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"cell_type": "markdown",
|
| 221 |
+
"id": "80bee95e",
|
| 222 |
+
"metadata": {},
|
| 223 |
+
"source": [
|
| 224 |
+
"# Check your credits\n",
|
| 225 |
+
"\n",
|
| 226 |
+
"You get $10 of credits, so use it economically! You can run the following cell to check the amount of credits you have used."
|
| 227 |
+
]
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"cell_type": "code",
|
| 231 |
+
"execution_count": null,
|
| 232 |
+
"id": "81d2e662",
|
| 233 |
+
"metadata": {},
|
| 234 |
+
"outputs": [],
|
| 235 |
+
"source": [
|
| 236 |
+
"from httpx import get\n",
|
| 237 |
+
"\n",
|
| 238 |
+
"result = get(f\"https://ioai-llm-proxy.up.railway.app/credits/{API_KEY}\")\n",
|
| 239 |
+
"\n",
|
| 240 |
+
"resp = result.json()\n",
|
| 241 |
+
"\n",
|
| 242 |
+
"print(f\"\"\"\n",
|
| 243 |
+
"Credits limit: ${resp['limit']}\n",
|
| 244 |
+
"Used: ${resp['usage']}\n",
|
| 245 |
+
"Credits remaining: ${resp['limit'] - resp['usage']}\n",
|
| 246 |
+
"\"\"\")"
|
| 247 |
+
]
|
| 248 |
+
}
|
| 249 |
+
],
|
| 250 |
+
"metadata": {
|
| 251 |
+
"kernelspec": {
|
| 252 |
+
"display_name": ".venv",
|
| 253 |
+
"language": "python",
|
| 254 |
+
"name": "python3"
|
| 255 |
+
},
|
| 256 |
+
"language_info": {
|
| 257 |
+
"codemirror_mode": {
|
| 258 |
+
"name": "ipython",
|
| 259 |
+
"version": 3
|
| 260 |
+
},
|
| 261 |
+
"file_extension": ".py",
|
| 262 |
+
"mimetype": "text/x-python",
|
| 263 |
+
"name": "python",
|
| 264 |
+
"nbconvert_exporter": "python",
|
| 265 |
+
"pygments_lexer": "ipython3",
|
| 266 |
+
"version": "3.12.11"
|
| 267 |
+
}
|
| 268 |
+
},
|
| 269 |
+
"nbformat": 4,
|
| 270 |
+
"nbformat_minor": 5
|
| 271 |
+
}
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Concepts/metrics.py
ADDED
|
@@ -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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
import math
|
| 3 |
+
# import httpx
|
| 4 |
+
# from httpx import AsyncClient
|
| 5 |
+
from judge_api import guess
|
| 6 |
+
from datasets import load_dataset
|
| 7 |
+
from tqdm import tqdm
|
| 8 |
+
import json
|
| 9 |
+
import asyncio
|
| 10 |
+
# from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
|
| 11 |
+
import pathlib
|
| 12 |
+
|
| 13 |
+
VALID_PATH = "IOAI-official/ioai2025-onsite-concepts-validation"
|
| 14 |
+
TEST_PATH = "IOAI-official/ioai2025-onsite-concepts-test"
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
current_dir = pathlib.Path(__file__).parent
|
| 18 |
+
|
| 19 |
+
CLUES_A_PATH = str(current_dir / "out" / "clues_a.jsonl")
|
| 20 |
+
CLUES_B_PATH = str(current_dir / "out" / "clues_b.jsonl")
|
| 21 |
+
OUTPUT_JSON = str(current_dir / "out" / "score.json")
|
| 22 |
+
|
| 23 |
+
|
| 24 |
+
TEST_A_LEN = 50
|
| 25 |
+
TEST_B_LEN = 100
|
| 26 |
+
|
| 27 |
+
# API_URL = "https://concepts-judge-server-eval-27115.up.railway.app"
|
| 28 |
+
# API_KEY = "sk-ioai-god-key"
|
| 29 |
+
|
| 30 |
+
# a_client = AsyncClient()
|
| 31 |
+
|
| 32 |
+
class APIError(Exception):
|
| 33 |
+
pass
|
| 34 |
+
|
| 35 |
+
def read_clues(path: str):
|
| 36 |
+
with open(path, 'r') as f:
|
| 37 |
+
return [json.loads(line) for line in f]
|
| 38 |
+
|
| 39 |
+
def hits_at_10(predictions, correct_answer):
|
| 40 |
+
return 1.0 if correct_answer in predictions[:10] else 0.0
|
| 41 |
+
|
| 42 |
+
def ndcg_at_10(predictions, correct_answer):
|
| 43 |
+
if correct_answer not in predictions:
|
| 44 |
+
return 0.0
|
| 45 |
+
try:
|
| 46 |
+
rank = predictions[:10].index(correct_answer) + 1
|
| 47 |
+
except ValueError:
|
| 48 |
+
return 0.0
|
| 49 |
+
return 1 / math.log2(rank + 1)
|
| 50 |
+
|
| 51 |
+
# @retry(
|
| 52 |
+
# stop=stop_after_attempt(3),
|
| 53 |
+
# wait=wait_exponential(multiplier=1, min=4, max=10),
|
| 54 |
+
# retry=retry_if_exception_type((httpx.HTTPStatusError, httpx.TimeoutException, httpx.ConnectError, httpx.RequestError, ValueError))
|
| 55 |
+
# )
|
| 56 |
+
# async def get_predictions(clues, options):
|
| 57 |
+
# guesser_response = await a_client.post(f"{API_URL}/guess", json={
|
| 58 |
+
# "clues": clues,
|
| 59 |
+
# "options": options
|
| 60 |
+
# }, headers={
|
| 61 |
+
# "Authorization": f"Bearer {API_KEY}"
|
| 62 |
+
# }, timeout=60)
|
| 63 |
+
# guesser_response = guesser_response.json()
|
| 64 |
+
# if "guesses" not in guesser_response:
|
| 65 |
+
# raise ValueError(f"Unable to generate guesses: {guesser_response}")
|
| 66 |
+
# if not isinstance(guesser_response["guesses"], list):
|
| 67 |
+
# raise ValueError(f"Guesses is not a list: {guesser_response}")
|
| 68 |
+
# predictions = [p.lower() for p in guesser_response["guesses"]]
|
| 69 |
+
# return predictions
|
| 70 |
+
|
| 71 |
+
def get_predictions(clues, options):
|
| 72 |
+
return guess(clues, options)
|
| 73 |
+
|
| 74 |
+
async def evaluate(clues, testset, test_len, test_name):
|
| 75 |
+
# Validate all inputs first
|
| 76 |
+
for i in range(test_len):
|
| 77 |
+
if not isinstance(clues[i], list):
|
| 78 |
+
raise TypeError(f"`{test_name}[{i}]` must be a list, but got {type(clues[i])}")
|
| 79 |
+
if len(clues[i]) > 4:
|
| 80 |
+
raise ValueError(f"Too many elements in `{test_name}[{i}]`. You can only provide up to 4 sequences of markers.")
|
| 81 |
+
for sequence in clues[i]:
|
| 82 |
+
if not isinstance(sequence, list):
|
| 83 |
+
raise TypeError(f"Each sequence in `{test_name}[{i}]` must be a list, but got {type(sequence)}")
|
| 84 |
+
if len(sequence) > 8:
|
| 85 |
+
raise ValueError(f"Too many markers in `{test_name}[{i}]`. You can only provide up to 8 markers per sequence.")
|
| 86 |
+
for marker in sequence:
|
| 87 |
+
if not isinstance(marker, int):
|
| 88 |
+
raise TypeError(f"Each marker in `{test_name}[{i}]` must be an integer, but got {type(marker)}")
|
| 89 |
+
if marker < 0 or marker > 117:
|
| 90 |
+
raise ValueError(f"Invalid marker value in `{test_name}[{i}]`. Expected an integer between 0 and 117.")
|
| 91 |
+
|
| 92 |
+
# Create semaphore for concurrency control (max 50 parallel requests)
|
| 93 |
+
semaphore = asyncio.Semaphore(50)
|
| 94 |
+
|
| 95 |
+
async def process_single_item(i):
|
| 96 |
+
async with semaphore:
|
| 97 |
+
try:
|
| 98 |
+
# predictions = await get_predictions(clues[i], testset[i]['options'])
|
| 99 |
+
predictions = get_predictions(clues[i], testset[i]['options'])
|
| 100 |
+
hit10 = hits_at_10(predictions, testset[i]['label'])
|
| 101 |
+
ndcg10 = ndcg_at_10(predictions, testset[i]['label'])
|
| 102 |
+
score = 0.9 * hit10 + 0.1 * ndcg10
|
| 103 |
+
return score
|
| 104 |
+
|
| 105 |
+
except Exception as e:
|
| 106 |
+
# if isinstance(e, httpx.HTTPStatusError):
|
| 107 |
+
# print(f"HTTP Error {e.response.status_code}: {e.response.text}")
|
| 108 |
+
# try:
|
| 109 |
+
# error_detail = e.response.json().get("detail", "Unknown error")
|
| 110 |
+
# print(f"Error details: {error_detail}")
|
| 111 |
+
# except:
|
| 112 |
+
# print(f"Could not parse error response {e.response.text}")
|
| 113 |
+
|
| 114 |
+
# elif isinstance(e, ValueError):
|
| 115 |
+
# print(f"Value error: {e}")
|
| 116 |
+
|
| 117 |
+
# elif isinstance(e, httpx.TimeoutException):
|
| 118 |
+
# print("request timed out")
|
| 119 |
+
|
| 120 |
+
# elif isinstance(e, httpx.ConnectError):
|
| 121 |
+
# print(f"Could not connect to {API_URL}")
|
| 122 |
+
|
| 123 |
+
# elif isinstance(e, httpx.RequestError):
|
| 124 |
+
# print(f"Request error: {e}")
|
| 125 |
+
|
| 126 |
+
# else:
|
| 127 |
+
# print(f"Unknown error: {e}")
|
| 128 |
+
raise APIError(f"Error getting predictions for {test_name}[{i}]", e)
|
| 129 |
+
|
| 130 |
+
# Create tasks for all items
|
| 131 |
+
tasks = [process_single_item(i) for i in range(test_len)]
|
| 132 |
+
|
| 133 |
+
# Run all tasks in parallel with progress tracking
|
| 134 |
+
scores = []
|
| 135 |
+
with tqdm(total=test_len, desc=f"Evaluating {test_name}") as pbar:
|
| 136 |
+
for coro in asyncio.as_completed(tasks):
|
| 137 |
+
try:
|
| 138 |
+
score = await coro
|
| 139 |
+
scores.append(score)
|
| 140 |
+
pbar.update(1)
|
| 141 |
+
except Exception as e:
|
| 142 |
+
pbar.close()
|
| 143 |
+
raise e
|
| 144 |
+
|
| 145 |
+
return scores
|
| 146 |
+
|
| 147 |
+
async def main():
|
| 148 |
+
testset_a = load_dataset(VALID_PATH)["test"]
|
| 149 |
+
testset_b = load_dataset(TEST_PATH)["test"]
|
| 150 |
+
try:
|
| 151 |
+
clues_a = read_clues(CLUES_A_PATH)
|
| 152 |
+
clues_b = read_clues(CLUES_B_PATH)
|
| 153 |
+
if not isinstance(clues_a, list):
|
| 154 |
+
raise TypeError(f"`clues_a` must be a list, but got {type(clues_a)}")
|
| 155 |
+
if not isinstance(clues_b, list):
|
| 156 |
+
raise TypeError(f"`clues_b` must be a list, but got {type(clues_b)}")
|
| 157 |
+
if len(clues_a) != TEST_A_LEN:
|
| 158 |
+
raise ValueError(f"{'Too many' if len(clues_a) > TEST_A_LEN else 'Too few'} clues in `clues_a`. Expected {TEST_A_LEN} clues.")
|
| 159 |
+
if len(clues_b) != TEST_B_LEN:
|
| 160 |
+
raise ValueError(f"{'Too many' if len(clues_b) > TEST_B_LEN else 'Too few'} clues in `clues_b`. Expected {TEST_B_LEN} clues.")
|
| 161 |
+
scores_a = await evaluate(clues_a, testset_a, TEST_A_LEN, "clues_a")
|
| 162 |
+
scores_b = await evaluate(clues_b, testset_b, TEST_B_LEN, "clues_b")
|
| 163 |
+
score_a = sum(scores_a) / len(scores_a)
|
| 164 |
+
score_b = sum(scores_b) / len(scores_b)
|
| 165 |
+
print(f"Average score for clues_a: {score_a}")
|
| 166 |
+
print(f"Average score for clues_b: {score_b}")
|
| 167 |
+
import math
|
| 168 |
+
|
| 169 |
+
if math.isnan(score_a) or math.isinf(score_a):
|
| 170 |
+
score_a = 0
|
| 171 |
+
|
| 172 |
+
if math.isnan(score_b) or math.isinf(score_b):
|
| 173 |
+
score_b = 0
|
| 174 |
+
|
| 175 |
+
ret_json = {
|
| 176 |
+
"status": True,
|
| 177 |
+
"score": {
|
| 178 |
+
"public_a": score_a,
|
| 179 |
+
"private_b": score_b,
|
| 180 |
+
},
|
| 181 |
+
"message": "Success!"
|
| 182 |
+
}
|
| 183 |
+
with open(OUTPUT_JSON, "w") as f:
|
| 184 |
+
json.dump(ret_json, f)
|
| 185 |
+
|
| 186 |
+
except Exception as e:
|
| 187 |
+
print(f"Error: {e}")
|
| 188 |
+
ret_json = {
|
| 189 |
+
"status": False,
|
| 190 |
+
"score": {
|
| 191 |
+
"public_a": 0.0,
|
| 192 |
+
"private_b": 0.0,
|
| 193 |
+
},
|
| 194 |
+
"message": str(e)
|
| 195 |
+
}
|
| 196 |
+
with open(OUTPUT_JSON, "w") as f:
|
| 197 |
+
json.dump(ret_json, f)
|
| 198 |
+
|
| 199 |
+
if __name__ == "__main__":
|
| 200 |
+
asyncio.run(main())
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Pixel/Pixel.ipynb
ADDED
|
@@ -0,0 +1,726 @@
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "362e9f36-2300-4851-8f49-b952e62a2c78",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Pixel/Pixel.ipynb)"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "markdown",
|
| 17 |
+
"id": "4509a190",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"source": [
|
| 20 |
+
"# Pixel Efficiency\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"## 1. Problem Description\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"You are a student in wildlife biology, working on a groundbreaking research project at the Starr Park Research Center. Your team has deployed thousands of camera traps across remote wilderness areas to monitor endangered species populations. However, the satellite internet connections in these remote locations have extremely limited bandwidth. Your job is to write code that identifies the most critical pixels in each wildlife photograph so that only the essential visual information needs to be transmitted back to headquarters.\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"<img src=\"./figs/Pixel Fig 1.png\" width=\"400\">\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"## 2. Dataset\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"The dataset consists of a training set and a test set. Datasets are loaded using `load_from_disk`, and are in the format of `datasets`. Test set is not visible to the contestants.\n",
|
| 31 |
+
"\n",
|
| 32 |
+
"In the dataset there are the following fields:\n",
|
| 33 |
+
"\n",
|
| 34 |
+
"- `image`: the image are RGB full color images in PIL format, the size of each image is (224, 224)\n",
|
| 35 |
+
"- `name`: the animal species label\n",
|
| 36 |
+
"- `idx`: unique identifiers used to track the records.\n",
|
| 37 |
+
"\n",
|
| 38 |
+
"1. **Training Set (`train_dataset` folder)**:\n",
|
| 39 |
+
" - The training set is used for training your models/ doing experimentations on and can be accessed and downloaded directly during the competition.\n",
|
| 40 |
+
" - There are 700 images in the training set.\n",
|
| 41 |
+
"\n",
|
| 42 |
+
"2. **Test Set (`test_dataset` folder)**: \n",
|
| 43 |
+
" - These follow the same format as the training set but do not contain the `name` field.\n",
|
| 44 |
+
" - There are 698 images in test set, which had been separated into 2 testing sets within the ratio of 3:7, i.e. 30% of the data would be used to calculate the Leaderboard A score, another 70% data would be used to calculate the Leaderboard B score.\n",
|
| 45 |
+
" - The testing set is used to calculate the Leaderboard A score and the Leaderboard B score and is not directly accessible during the competition. Contestants can access the result on Leaderboard A , but cannot access the result on Leaderboard B. The final score would be counted using Leaderboard B only. The subsets for Leaderboard A and Leaderboard B are completely distinct.\n",
|
| 46 |
+
" \n",
|
| 47 |
+
"\n",
|
| 48 |
+
"## 3. Task\n",
|
| 49 |
+
"You are given a dataset of animal photographs and a CLIP model that can do a zero-shot classification of animal species. To conserve bandwidth, you need to retain at most **6.25%** of the pixels of each image, while keeping classification accuracy as high as possible.\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"More specifically, your task is to return **one rectangle mask** for each image, which contain a single rectangular area indicating the area to keep. Each mask is defined by two coordinate tuples: one for the top-left corner and one for the bottom-right corner of the rectangle. Below is a visualization of what the image would look like after applying a rectangular mask using the process from the baseline:\n",
|
| 52 |
+
"\n",
|
| 53 |
+
"<img src=\"./figs/Pixel Fig 2.png\" width=\"400\">\n",
|
| 54 |
+
"\n",
|
| 55 |
+
"**Coordinate Convention:**\n",
|
| 56 |
+
"- Top-left corner coordinates are **inclusive** (the pixel at this position is included in the mask) \n",
|
| 57 |
+
"- Bottom-right corner coordinates are **exclusive** (the pixel at this position is NOT included in the mask)\n",
|
| 58 |
+
"\n",
|
| 59 |
+
"For example, if you specify coordinates `((10, 20), (15, 25))`, the mask will cover pixels from row 10 to 14 (inclusive) and column 20 to 24 (inclusive), for a total area of 25 pixels.\n",
|
| 60 |
+
"\n",
|
| 61 |
+
"As an illustration, if an image size is 3x3 and we wanted to keep only the top-right pixel using coordinates `((0, 2), (1, 3))`, the resulting binary mask would be:\n",
|
| 62 |
+
"\n",
|
| 63 |
+
"```\n",
|
| 64 |
+
"[[0, 0, 1],\n",
|
| 65 |
+
" [0, 0, 0],\n",
|
| 66 |
+
" [0, 0, 0]]\n",
|
| 67 |
+
"```\n",
|
| 68 |
+
"\n",
|
| 69 |
+
"Below is a summary of the requirements for your masks:\n",
|
| 70 |
+
"\n",
|
| 71 |
+
"- Return one rectangle mask defined by coordinate tuples: `((top, left), (bottom, right))`\n",
|
| 72 |
+
"- Top-left corner coordinates are inclusive, bottom-right corner coordinates are exclusive\n",
|
| 73 |
+
"- The rectangle mask should cover at most *6.25%* of the original pixels (minimum 93.75% reduction of the original pixels)\n",
|
| 74 |
+
"- All images are of size (224, 224), so coordinate values should be within the range [0, 224]\n",
|
| 75 |
+
"\n",
|
| 76 |
+
"\n",
|
| 77 |
+
"Images would be masked using the mask you created, outside the masked rectangle, all pixels outside the masked rectangle will be replaced with RGB(0, 0, 0) (black) values. The masked image will be then passed through the CLIP model during evaluation, and your task is to keep the classification accuracy of the CLIP model on these masked images as high as possible. **An additional `other` class would be added into the classes for classification** to ensure that your masked image retains actual useful information for the researchers back at Starr Park Headquarters. So for example, if your image doesn't contain any animal information, the model will predict the `others` class instead of predicting a random animal and having a chance of getting it correct.\n",
|
| 78 |
+
"\n",
|
| 79 |
+
"You need to work only with the provided CLIP model and dataset. As a reminder, CLIP generates representations for both text and image, and it can compute a similarity score between them. So if you have ten animal classes, CLIP can look at the provided image and decide which text (class) is closest to the image. \n",
|
| 80 |
+
"\n",
|
| 81 |
+
"To ensure that your solution would handle the traffic of images for the research center, your code should run in **UNDER 8 MINUTES for the 698 images in the test dataset**. It is recommended that you test your solution on the training set first, which contain 700 images, to understand how much time your solution takes (testing set would take slightly longer due to dataset loading).\n",
|
| 82 |
+
"\n",
|
| 83 |
+
"## 4. Submission\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"Contestants need to submit a notebook file named `submission.ipynb`. The file should output a `.jsonl` file titled `submission.jsonl`, which contains all the generated masks for the dataset split. Each mask in the `submission.jsonl` file should be stored as a tuple of two coordinate tuples: `((top, left), (bottom, right))`, where the top-left corner is inclusive and the bottom-right corner is exclusive.\n",
|
| 86 |
+
"\n",
|
| 87 |
+
"Contestants don't need to separate test sets into Leaderboard A and Leaderboard B, the evaluation machine will read `submission.jsonl` and automatically calculate the scores for Leaderboard A and Leaderboard B based on the prediction results and true labels. \n",
|
| 88 |
+
"\n",
|
| 89 |
+
"The submission files must strictly follow the above format and naming; otherwise, the system will not be able to read them correctly. \n",
|
| 90 |
+
"\n",
|
| 91 |
+
"## 5. Score\n",
|
| 92 |
+
"\n",
|
| 93 |
+
"The evaluation metric will be **classification accuracy**, defined as the proportion of correctly predicted samples over the total number of evaluated samples.\n",
|
| 94 |
+
"\n",
|
| 95 |
+
"Your score is the zero-shot classification accuracy of CLIP on the masked test images. **If a submitted mask for an image is invalid (wrong shape, more than 6.25% pixels retained, etc.), that image is counted as incorrect. A sample script is provided to compute the training split score.**\n",
|
| 96 |
+
"\n",
|
| 97 |
+
"\n",
|
| 98 |
+
"## 6. Baseline and Training Set\n",
|
| 99 |
+
"\n",
|
| 100 |
+
"- Below you can find the baseline solution.\n",
|
| 101 |
+
"- The dataset is in `training_set` folder.\n",
|
| 102 |
+
"- The highest score by the Scientific Committee for this task is 0.83 in Leader Board B, this score is used for score unification.\n",
|
| 103 |
+
"- The baseline score by the Scientific Committee for this task is 0.19 in Leader Board B, this score is used for score unification."
|
| 104 |
+
]
|
| 105 |
+
},
|
| 106 |
+
{
|
| 107 |
+
"cell_type": "code",
|
| 108 |
+
"execution_count": null,
|
| 109 |
+
"id": "b7f398b1",
|
| 110 |
+
"metadata": {},
|
| 111 |
+
"outputs": [],
|
| 112 |
+
"source": [
|
| 113 |
+
"# Install required packages\n",
|
| 114 |
+
"!pip install numpy pillow tqdm torch transformers datasets accelerate matplotlib"
|
| 115 |
+
]
|
| 116 |
+
},
|
| 117 |
+
{
|
| 118 |
+
"cell_type": "code",
|
| 119 |
+
"execution_count": null,
|
| 120 |
+
"id": "ce2fd692",
|
| 121 |
+
"metadata": {},
|
| 122 |
+
"outputs": [],
|
| 123 |
+
"source": [
|
| 124 |
+
"\n",
|
| 125 |
+
"from datasets import load_dataset\n",
|
| 126 |
+
"print(\"Loading dataset...\")\n",
|
| 127 |
+
"# Load dataset directly from HuggingFace without data_dir parameter\n",
|
| 128 |
+
"# The correct way to load a specific subset/path from a HuggingFace dataset\n",
|
| 129 |
+
"\n",
|
| 130 |
+
"DATASET_NAME = \"IOAI-official/IOAI-2025-Pixel-train\"\n",
|
| 131 |
+
"SPLIT = 'train'\n",
|
| 132 |
+
"load_dataset(DATASET_NAME, data_dir=\"data\", split=SPLIT) \n",
|
| 133 |
+
"\n",
|
| 134 |
+
"print(f\"Dataset loaded successfully! Total samples: {len(dataset)}\")\n",
|
| 135 |
+
"\n",
|
| 136 |
+
"# Print first item to check available fields\n",
|
| 137 |
+
"print(\"\\nFirst item keys:\")\n",
|
| 138 |
+
"print(dataset[0].keys())\n",
|
| 139 |
+
"\n",
|
| 140 |
+
"# Show basic dataset statistics without converting fields yet\n",
|
| 141 |
+
"print(f\"\\nDataset loaded successfully!\")\n",
|
| 142 |
+
"print(f\"Total samples: {len(dataset)}\")\n",
|
| 143 |
+
"\n",
|
| 144 |
+
"print(f\"\\nSample item structure:\")\n",
|
| 145 |
+
"sample_item = dataset[0]\n",
|
| 146 |
+
"print(f\" Keys: {list(sample_item.keys())}\")\n",
|
| 147 |
+
"if 'image' in sample_item:\n",
|
| 148 |
+
" print(f\" Image type: {type(sample_item['image'])}\")\n",
|
| 149 |
+
" print(f\" Image size: {sample_item['image'].size}\")\n",
|
| 150 |
+
"else:\n",
|
| 151 |
+
" print(\" No 'image' field found in dataset\")\n",
|
| 152 |
+
" \n",
|
| 153 |
+
"if 'idx' in sample_item:\n",
|
| 154 |
+
" print(f\" Index: {sample_item['idx']}\")\n",
|
| 155 |
+
"else:\n",
|
| 156 |
+
" print(\" No 'idx' field found in dataset\")\n",
|
| 157 |
+
"\n"
|
| 158 |
+
]
|
| 159 |
+
},
|
| 160 |
+
{
|
| 161 |
+
"cell_type": "code",
|
| 162 |
+
"execution_count": null,
|
| 163 |
+
"id": "5719e7a1",
|
| 164 |
+
"metadata": {},
|
| 165 |
+
"outputs": [],
|
| 166 |
+
"source": [
|
| 167 |
+
"\n",
|
| 168 |
+
"print(\"Loading dataset...\")\n",
|
| 169 |
+
"# Load dataset directly from HuggingFace without data_dir parameter\n",
|
| 170 |
+
"# The correct way to load a specific subset/path from a HuggingFace dataset\n",
|
| 171 |
+
"dataset = load_dataset(DATASET_NAME, data_files=\"Individual-Contest/Pixel/training_set/train/data-00000-of-00001.arrow\", split=SPLIT)\n",
|
| 172 |
+
"\n",
|
| 173 |
+
"print(f\"Dataset loaded successfully! Total samples: {len(dataset)}\")\n",
|
| 174 |
+
"\n",
|
| 175 |
+
"# Print first item to check available fields\n",
|
| 176 |
+
"print(\"\\nFirst item keys:\")\n",
|
| 177 |
+
"print(dataset[0].keys())\n",
|
| 178 |
+
"\n",
|
| 179 |
+
"# Show basic dataset statistics without converting fields yet\n",
|
| 180 |
+
"print(f\"\\nDataset loaded successfully!\")\n",
|
| 181 |
+
"print(f\"Total samples: {len(dataset)}\")\n",
|
| 182 |
+
"\n",
|
| 183 |
+
"print(f\"\\nSample item structure:\")\n",
|
| 184 |
+
"sample_item = dataset[0]\n",
|
| 185 |
+
"print(f\" Keys: {list(sample_item.keys())}\")\n",
|
| 186 |
+
"if 'image' in sample_item:\n",
|
| 187 |
+
" print(f\" Image type: {type(sample_item['image'])}\")\n",
|
| 188 |
+
" print(f\" Image size: {sample_item['image'].size}\")\n",
|
| 189 |
+
"else:\n",
|
| 190 |
+
" print(\" No 'image' field found in dataset\")\n",
|
| 191 |
+
" \n",
|
| 192 |
+
"if 'idx' in sample_item:\n",
|
| 193 |
+
" print(f\" Index: {sample_item['idx']}\")\n",
|
| 194 |
+
"else:\n",
|
| 195 |
+
" print(\" No 'idx' field found in dataset\")\n",
|
| 196 |
+
"\n"
|
| 197 |
+
]
|
| 198 |
+
},
|
| 199 |
+
{
|
| 200 |
+
"cell_type": "code",
|
| 201 |
+
"execution_count": null,
|
| 202 |
+
"id": "9d1ad03b-ba1e-4c24-b866-fe6a138b58c9",
|
| 203 |
+
"metadata": {},
|
| 204 |
+
"outputs": [],
|
| 205 |
+
"source": [
|
| 206 |
+
"import random\n",
|
| 207 |
+
"import numpy as np\n",
|
| 208 |
+
"import torch\n",
|
| 209 |
+
"\n",
|
| 210 |
+
"seed = 42\n",
|
| 211 |
+
"\n",
|
| 212 |
+
"random.seed(seed) # Python built-in random\n",
|
| 213 |
+
"np.random.seed(seed) # NumPy\n",
|
| 214 |
+
"torch.manual_seed(seed) # PyTorch (CPU)\n",
|
| 215 |
+
"torch.cuda.manual_seed(seed) # PyTorch (single GPU)\n",
|
| 216 |
+
"torch.cuda.manual_seed_all(seed) # PyTorch (all GPUs)\n",
|
| 217 |
+
"\n",
|
| 218 |
+
"# Ensures deterministic behavior\n",
|
| 219 |
+
"torch.backends.cudnn.deterministic = True\n",
|
| 220 |
+
"torch.backends.cudnn.benchmark = False"
|
| 221 |
+
]
|
| 222 |
+
},
|
| 223 |
+
{
|
| 224 |
+
"cell_type": "markdown",
|
| 225 |
+
"id": "af37a8ed",
|
| 226 |
+
"metadata": {},
|
| 227 |
+
"source": [
|
| 228 |
+
"### Dependencies and Config Variables"
|
| 229 |
+
]
|
| 230 |
+
},
|
| 231 |
+
{
|
| 232 |
+
"cell_type": "code",
|
| 233 |
+
"execution_count": null,
|
| 234 |
+
"id": "23b68a41",
|
| 235 |
+
"metadata": {},
|
| 236 |
+
"outputs": [],
|
| 237 |
+
"source": [
|
| 238 |
+
"import os\n",
|
| 239 |
+
"import matplotlib.pyplot as plt\n",
|
| 240 |
+
"import numpy as np\n",
|
| 241 |
+
"from collections import Counter\n",
|
| 242 |
+
"from PIL import Image\n",
|
| 243 |
+
"from tqdm import tqdm\n",
|
| 244 |
+
"import glob\n",
|
| 245 |
+
"import json\n",
|
| 246 |
+
"import math\n",
|
| 247 |
+
"import torch\n",
|
| 248 |
+
"import matplotlib.pyplot as plt\n",
|
| 249 |
+
"from datasets import load_dataset, load_from_disk\n",
|
| 250 |
+
"from transformers import CLIPProcessor, CLIPModel\n",
|
| 251 |
+
"from PIL import Image\n",
|
| 252 |
+
"from tqdm.auto import tqdm \n",
|
| 253 |
+
"\n",
|
| 254 |
+
"\n",
|
| 255 |
+
"# Dataset configuration\n",
|
| 256 |
+
"DATASET_PATH = \"IOAI-official/IOAI-2025-Pixel-train\"\n",
|
| 257 |
+
"SPLIT = \"train\"\n",
|
| 258 |
+
"\n",
|
| 259 |
+
"# Model Configuration\n",
|
| 260 |
+
"MODEL_PATH = \"openai/clip-vit-large-patch14\"\n",
|
| 261 |
+
"DEVICE = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 262 |
+
"BACKGROUND_CLASS = \"other\"\n",
|
| 263 |
+
"\n",
|
| 264 |
+
"\n",
|
| 265 |
+
"# Image and Masking Configuration\n",
|
| 266 |
+
"HEIGHT = 224\n",
|
| 267 |
+
"WIDTH = 224\n",
|
| 268 |
+
"RETAIN_RATIO = 0.0625 # Retain 6.25% of pixels\n",
|
| 269 |
+
"MEAN_COLOR = (0, 0, 0) # RGB mean values for masked out areas\n"
|
| 270 |
+
]
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"cell_type": "markdown",
|
| 274 |
+
"id": "b888c040",
|
| 275 |
+
"metadata": {},
|
| 276 |
+
"source": [
|
| 277 |
+
"### Dataset loading\n",
|
| 278 |
+
"\n",
|
| 279 |
+
"Let's first load the dataset in and see what's in it:\n"
|
| 280 |
+
]
|
| 281 |
+
},
|
| 282 |
+
{
|
| 283 |
+
"cell_type": "code",
|
| 284 |
+
"execution_count": null,
|
| 285 |
+
"id": "bb9c8261",
|
| 286 |
+
"metadata": {},
|
| 287 |
+
"outputs": [],
|
| 288 |
+
"source": [
|
| 289 |
+
"\n",
|
| 290 |
+
"print(\"Loading dataset...\")\n",
|
| 291 |
+
"# Load dataset directly from HuggingFace without data_dir parameter\n",
|
| 292 |
+
"dataset = load_dataset(DATASET_PATH, split=SPLIT)\n",
|
| 293 |
+
"\n",
|
| 294 |
+
"print(f\"Dataset loaded successfully! Total samples: {len(dataset)}\")\n",
|
| 295 |
+
"\n",
|
| 296 |
+
"# Print first item to check available fields\n",
|
| 297 |
+
"print(\"\\nFirst item keys:\")\n",
|
| 298 |
+
"print(dataset[0].keys())\n",
|
| 299 |
+
"\n",
|
| 300 |
+
"# Show basic dataset statistics without converting fields yet\n",
|
| 301 |
+
"print(f\"\\nDataset loaded successfully!\")\n",
|
| 302 |
+
"print(f\"Total samples: {len(dataset)}\")\n",
|
| 303 |
+
"\n",
|
| 304 |
+
"print(f\"\\nSample item structure:\")\n",
|
| 305 |
+
"sample_item = dataset[0]\n",
|
| 306 |
+
"print(f\" Keys: {list(sample_item.keys())}\")\n",
|
| 307 |
+
"print(f\" Image type: {type(sample_item['image'])}\")\n",
|
| 308 |
+
"print(f\" Image size: {sample_item['image'].size}\")\n",
|
| 309 |
+
"print(f\" Index: {sample_item['idx']}\")\n",
|
| 310 |
+
"\n"
|
| 311 |
+
]
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"cell_type": "code",
|
| 315 |
+
"execution_count": null,
|
| 316 |
+
"id": "37c2dbfa",
|
| 317 |
+
"metadata": {},
|
| 318 |
+
"outputs": [],
|
| 319 |
+
"source": [
|
| 320 |
+
"# Visualize first 10 samples\n",
|
| 321 |
+
"fig, axes = plt.subplots(2, 5, figsize=(15, 8))\n",
|
| 322 |
+
"axes = axes.flatten()\n",
|
| 323 |
+
"\n",
|
| 324 |
+
"print(\"Visualizing first 10 samples...\")\n",
|
| 325 |
+
"\n",
|
| 326 |
+
"for i in range(10):\n",
|
| 327 |
+
" sample = dataset[i]\n",
|
| 328 |
+
" image = sample['image']\n",
|
| 329 |
+
" label = sample['name']\n",
|
| 330 |
+
" \n",
|
| 331 |
+
" axes[i].imshow(image)\n",
|
| 332 |
+
" axes[i].set_title(f\"{label}\\n\", fontsize=12)\n",
|
| 333 |
+
" axes[i].axis('off')\n",
|
| 334 |
+
"\n",
|
| 335 |
+
"plt.tight_layout()\n",
|
| 336 |
+
"plt.suptitle('First 10 Samples from Dataset', fontsize=16, y=1.02)\n",
|
| 337 |
+
"plt.show()\n"
|
| 338 |
+
]
|
| 339 |
+
},
|
| 340 |
+
{
|
| 341 |
+
"cell_type": "markdown",
|
| 342 |
+
"id": "24cee96a",
|
| 343 |
+
"metadata": {},
|
| 344 |
+
"source": [
|
| 345 |
+
"### Model\n",
|
| 346 |
+
"\n",
|
| 347 |
+
"Now let's load the model and see some predictions:"
|
| 348 |
+
]
|
| 349 |
+
},
|
| 350 |
+
{
|
| 351 |
+
"cell_type": "code",
|
| 352 |
+
"execution_count": null,
|
| 353 |
+
"id": "fd92b376",
|
| 354 |
+
"metadata": {},
|
| 355 |
+
"outputs": [],
|
| 356 |
+
"source": [
|
| 357 |
+
"print(f\"Loading CLIP model and processor: {MODEL_PATH}...\")\n",
|
| 358 |
+
"model = CLIPModel.from_pretrained(MODEL_PATH).to(DEVICE)\n",
|
| 359 |
+
"processor = CLIPProcessor.from_pretrained(MODEL_PATH)\n",
|
| 360 |
+
"print(\"Model and processor loaded successfully.\")"
|
| 361 |
+
]
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"cell_type": "code",
|
| 365 |
+
"execution_count": null,
|
| 366 |
+
"id": "a2e25924",
|
| 367 |
+
"metadata": {},
|
| 368 |
+
"outputs": [],
|
| 369 |
+
"source": [
|
| 370 |
+
"image = dataset[0]['image']\n",
|
| 371 |
+
"# Visualize the image with its true label\n",
|
| 372 |
+
"plt.figure(figsize=(8, 6))\n",
|
| 373 |
+
"plt.imshow(image)\n",
|
| 374 |
+
"plt.title(f\"Sample Image\\nTrue Label: {dataset[0]['name']}\", fontsize=14)\n",
|
| 375 |
+
"plt.axis('off')\n",
|
| 376 |
+
"plt.show()\n",
|
| 377 |
+
"\n",
|
| 378 |
+
"\n",
|
| 379 |
+
"labels = sorted(list(set(dataset['name']))) + [BACKGROUND_CLASS]\n",
|
| 380 |
+
"text_inputs = processor(text=labels, return_tensors=\"pt\", padding=True).to(DEVICE)\n",
|
| 381 |
+
"image_processed = processor(images=image, return_tensors=\"pt\").to(DEVICE)\n",
|
| 382 |
+
"pixel_values = image_processed['pixel_values']\n",
|
| 383 |
+
"outputs_full = model(pixel_values=pixel_values, **text_inputs)\n",
|
| 384 |
+
"logits_full = outputs_full.logits_per_image # Shape: (1, num_styles)\n",
|
| 385 |
+
"predicted_index_full = logits_full.argmax(dim=-1).item()\n",
|
| 386 |
+
"\n",
|
| 387 |
+
"print(f\"Predicted label: {labels[predicted_index_full]}\")\n"
|
| 388 |
+
]
|
| 389 |
+
},
|
| 390 |
+
{
|
| 391 |
+
"cell_type": "markdown",
|
| 392 |
+
"id": "54467f0c",
|
| 393 |
+
"metadata": {},
|
| 394 |
+
"source": [
|
| 395 |
+
"### Baseline: A trivial masking method\n",
|
| 396 |
+
"\n",
|
| 397 |
+
"We will now be implementing a trivial masking solution, one that randomly masks out 90% of the pixels."
|
| 398 |
+
]
|
| 399 |
+
},
|
| 400 |
+
{
|
| 401 |
+
"cell_type": "code",
|
| 402 |
+
"execution_count": null,
|
| 403 |
+
"id": "0ee24b90",
|
| 404 |
+
"metadata": {},
|
| 405 |
+
"outputs": [],
|
| 406 |
+
"source": [
|
| 407 |
+
"def generate_center_crop_coordinates(image):\n",
|
| 408 |
+
" \"\"\"\n",
|
| 409 |
+
" Generate coordinates for a center crop mask.\n",
|
| 410 |
+
" \n",
|
| 411 |
+
" Returns:\n",
|
| 412 |
+
" tuple: ((top, left), (bottom, right)) coordinates for the crop\n",
|
| 413 |
+
" \"\"\"\n",
|
| 414 |
+
" H, W = image.size\n",
|
| 415 |
+
" total_px = H * W\n",
|
| 416 |
+
" k = int(total_px * RETAIN_RATIO)\n",
|
| 417 |
+
" \n",
|
| 418 |
+
" # Calculate side length of the square crop\n",
|
| 419 |
+
" side_length = int(np.sqrt(k))\n",
|
| 420 |
+
" \n",
|
| 421 |
+
" # Calculate center coordinates\n",
|
| 422 |
+
" center_h, center_w = H // 2, W // 2\n",
|
| 423 |
+
" \n",
|
| 424 |
+
" # Calculate crop boundaries\n",
|
| 425 |
+
" half_side = side_length // 2\n",
|
| 426 |
+
" top = max(0, center_h - half_side)\n",
|
| 427 |
+
" left = max(0, center_w - half_side)\n",
|
| 428 |
+
" bottom = min(H, top + side_length)\n",
|
| 429 |
+
" right = min(W, left + side_length)\n",
|
| 430 |
+
" \n",
|
| 431 |
+
" return ((top, left), (bottom, right))\n",
|
| 432 |
+
"\n",
|
| 433 |
+
"def generate_mask_from_coordinates(image, coordinates):\n",
|
| 434 |
+
" \"\"\"\n",
|
| 435 |
+
" Generate a binary mask from crop coordinates.\n",
|
| 436 |
+
" \n",
|
| 437 |
+
" Parameters:\n",
|
| 438 |
+
" image: PIL Image\n",
|
| 439 |
+
" coordinates: tuple of ((top, left), (bottom, right))\n",
|
| 440 |
+
" \n",
|
| 441 |
+
" Returns:\n",
|
| 442 |
+
" numpy array: Binary mask with 1s in the crop area\n",
|
| 443 |
+
" \"\"\"\n",
|
| 444 |
+
" H, W = image.size\n",
|
| 445 |
+
" mask = np.zeros((H, W), dtype=np.int8)\n",
|
| 446 |
+
" \n",
|
| 447 |
+
" (top, left), (bottom, right) = coordinates\n",
|
| 448 |
+
" mask[top:bottom, left:right] = 1\n",
|
| 449 |
+
" \n",
|
| 450 |
+
" return mask"
|
| 451 |
+
]
|
| 452 |
+
},
|
| 453 |
+
{
|
| 454 |
+
"cell_type": "code",
|
| 455 |
+
"execution_count": null,
|
| 456 |
+
"id": "e87f8f85",
|
| 457 |
+
"metadata": {},
|
| 458 |
+
"outputs": [],
|
| 459 |
+
"source": [
|
| 460 |
+
"def apply_mask_with_mean(image, mask, mean_rgb=MEAN_COLOR):\n",
|
| 461 |
+
" \"\"\"\n",
|
| 462 |
+
" Apply arbitrary binary mask to image, replacing masked areas with mean values\n",
|
| 463 |
+
"\n",
|
| 464 |
+
" Parameters:\n",
|
| 465 |
+
" - image: PIL Image (224x224)\n",
|
| 466 |
+
" - mask: Binary numpy array or PIL Image (224x224) where 0 is the area to drop and 1 is the area to keep\n",
|
| 467 |
+
" - mean_rgb: RGB mean values to use (default: from config)\n",
|
| 468 |
+
"\n",
|
| 469 |
+
" Returns: Modified PIL Image\n",
|
| 470 |
+
" \"\"\"\n",
|
| 471 |
+
" # Convert images to numpy arrays\n",
|
| 472 |
+
" img_array = np.array(image).copy()\n",
|
| 473 |
+
"\n",
|
| 474 |
+
" # Ensure mask is numpy array\n",
|
| 475 |
+
" if isinstance(mask, Image.Image):\n",
|
| 476 |
+
" mask_array = np.array(mask.convert('L')) > 127 # Convert to binary\n",
|
| 477 |
+
" else:\n",
|
| 478 |
+
" mask_array = mask > 0\n",
|
| 479 |
+
"\n",
|
| 480 |
+
" # Reshape mask for broadcasting with RGB\n",
|
| 481 |
+
" mask_3d = np.stack([mask_array] * 3, axis=2)\n",
|
| 482 |
+
"\n",
|
| 483 |
+
" # Convert mean values to 0-255 range\n",
|
| 484 |
+
" mean_values = np.array([int(m * 255) for m in mean_rgb])\n",
|
| 485 |
+
" # Apply mask - replace areas where mask is 0 (drop) with mean values, keep areas where mask is 1\n",
|
| 486 |
+
" img_array = np.where(mask_3d, img_array, mean_values.reshape(1, 1, 3))\n",
|
| 487 |
+
"\n",
|
| 488 |
+
" return Image.fromarray(img_array.astype(np.uint8))"
|
| 489 |
+
]
|
| 490 |
+
},
|
| 491 |
+
{
|
| 492 |
+
"cell_type": "code",
|
| 493 |
+
"execution_count": null,
|
| 494 |
+
"id": "a84ed28b",
|
| 495 |
+
"metadata": {},
|
| 496 |
+
"outputs": [],
|
| 497 |
+
"source": [
|
| 498 |
+
"image = dataset[0]['image']\n",
|
| 499 |
+
"# Visualize the image with its true label\n",
|
| 500 |
+
"plt.figure(figsize=(8, 6))\n",
|
| 501 |
+
"plt.imshow(image)\n",
|
| 502 |
+
"plt.title(f\"Sample Image\\nTrue Label: {dataset[0]['name']}\", fontsize=14)\n",
|
| 503 |
+
"plt.axis('off')\n",
|
| 504 |
+
"plt.show()\n",
|
| 505 |
+
"\n",
|
| 506 |
+
"\n",
|
| 507 |
+
"labels = sorted(list(set(dataset['name']))) + [BACKGROUND_CLASS]\n",
|
| 508 |
+
"text_inputs = processor(text=labels, return_tensors=\"pt\", padding=True).to(DEVICE)\n",
|
| 509 |
+
"\n",
|
| 510 |
+
"mask = generate_mask_from_coordinates(image, generate_center_crop_coordinates(image))\n",
|
| 511 |
+
"image_masked = apply_mask_with_mean(image, mask)\n",
|
| 512 |
+
"\n",
|
| 513 |
+
"plt.figure(figsize=(8, 6))\n",
|
| 514 |
+
"plt.imshow(image_masked)\n",
|
| 515 |
+
"plt.title(f\"Masked Image\\nTrue Label: {dataset[0]['name']}\", fontsize=14)\n",
|
| 516 |
+
"plt.axis('off')\n",
|
| 517 |
+
"plt.show()\n",
|
| 518 |
+
"\n",
|
| 519 |
+
"image_processed = processor(images=image_masked, return_tensors=\"pt\").to(DEVICE)\n",
|
| 520 |
+
"pixel_values = image_processed['pixel_values']\n",
|
| 521 |
+
"outputs_full = model(pixel_values=pixel_values, **text_inputs)\n",
|
| 522 |
+
"logits_full = outputs_full.logits_per_image # Shape: (1, num_styles)\n",
|
| 523 |
+
"predicted_index_full = logits_full.argmax(dim=-1).item()\n",
|
| 524 |
+
"\n",
|
| 525 |
+
"print(f\"Predicted label: {labels[predicted_index_full]}\")"
|
| 526 |
+
]
|
| 527 |
+
},
|
| 528 |
+
{
|
| 529 |
+
"cell_type": "markdown",
|
| 530 |
+
"id": "d6987536",
|
| 531 |
+
"metadata": {},
|
| 532 |
+
"source": [
|
| 533 |
+
"### Exporting the masks\n"
|
| 534 |
+
]
|
| 535 |
+
},
|
| 536 |
+
{
|
| 537 |
+
"cell_type": "code",
|
| 538 |
+
"execution_count": null,
|
| 539 |
+
"id": "8aa65a80",
|
| 540 |
+
"metadata": {},
|
| 541 |
+
"outputs": [],
|
| 542 |
+
"source": [
|
| 543 |
+
"dataset = load_dataset(\"IOAI-official/IOAI-2025-Pixel-test\", split=\"test\")"
|
| 544 |
+
]
|
| 545 |
+
},
|
| 546 |
+
{
|
| 547 |
+
"cell_type": "code",
|
| 548 |
+
"execution_count": null,
|
| 549 |
+
"id": "5cae01f0",
|
| 550 |
+
"metadata": {},
|
| 551 |
+
"outputs": [],
|
| 552 |
+
"source": [
|
| 553 |
+
"## Exporting results and validating on full dataset\n",
|
| 554 |
+
"RETAIN_RATIO = 0.0625\n",
|
| 555 |
+
"\n",
|
| 556 |
+
"masks = {}\n",
|
| 557 |
+
"for item in tqdm(dataset):\n",
|
| 558 |
+
" image = item['image']\n",
|
| 559 |
+
"\n",
|
| 560 |
+
" ## you should replace mask generation with your function\n",
|
| 561 |
+
" coordinates = generate_center_crop_coordinates(image)\n",
|
| 562 |
+
" \n",
|
| 563 |
+
" # don't need to change below, it's just saving to file\n",
|
| 564 |
+
" idx = item['idx']\n",
|
| 565 |
+
" # For validation, we still need to generate the full mask\n",
|
| 566 |
+
" mask = generate_mask_from_coordinates(image, coordinates)\n",
|
| 567 |
+
" assert mask.shape == (224, 224), \"Mask should be 224x224\"\n",
|
| 568 |
+
" assert mask.sum() <= RETAIN_RATIO * 224 * 224, \"You should leave only 6.25% of pixels\"\n",
|
| 569 |
+
" \n",
|
| 570 |
+
" # Save only the coordinates (topleft, bottomright) instead of the full mask\n",
|
| 571 |
+
" masks[idx] = coordinates\n",
|
| 572 |
+
"\n",
|
| 573 |
+
"# Save as JSONL (one JSON object per line) - much safer than pickle\n",
|
| 574 |
+
"with open('submission.jsonl', 'w') as f:\n",
|
| 575 |
+
" for idx, coordinates in masks.items():\n",
|
| 576 |
+
" json.dump({\"idx\": idx, \"coordinates\": coordinates}, f)\n",
|
| 577 |
+
" f.write('\\n')\n",
|
| 578 |
+
"\n",
|
| 579 |
+
"print(\"Masks saved to submission.jsonl\")"
|
| 580 |
+
]
|
| 581 |
+
},
|
| 582 |
+
{
|
| 583 |
+
"cell_type": "markdown",
|
| 584 |
+
"id": "ed60e044",
|
| 585 |
+
"metadata": {},
|
| 586 |
+
"source": [
|
| 587 |
+
"### Validation"
|
| 588 |
+
]
|
| 589 |
+
},
|
| 590 |
+
{
|
| 591 |
+
"cell_type": "code",
|
| 592 |
+
"execution_count": null,
|
| 593 |
+
"id": "3d1ef680",
|
| 594 |
+
"metadata": {},
|
| 595 |
+
"outputs": [],
|
| 596 |
+
"source": [
|
| 597 |
+
"# # Validation code for generated masks\n",
|
| 598 |
+
"\n",
|
| 599 |
+
"# def check_validity(coordinates):\n",
|
| 600 |
+
"# \"\"\"\n",
|
| 601 |
+
"# Check if coordinates are valid according to the requirements.\n",
|
| 602 |
+
"# Returns True if valid, False otherwise.\n",
|
| 603 |
+
"# \"\"\"\n",
|
| 604 |
+
"# try:\n",
|
| 605 |
+
"# # Check if coordinates is a tuple of two tuples\n",
|
| 606 |
+
"# if not isinstance(coordinates, tuple) or len(coordinates) != 2:\n",
|
| 607 |
+
"# print(f\"Coordinates is not a tuple of two tuples\")\n",
|
| 608 |
+
"# return False\n",
|
| 609 |
+
" \n",
|
| 610 |
+
"# (top, left), (bottom, right) = coordinates\n",
|
| 611 |
+
" \n",
|
| 612 |
+
"# # Check if all coordinates are integers\n",
|
| 613 |
+
"# if not all(isinstance(coord, (int, np.integer)) for coord in [top, left, bottom, right]):\n",
|
| 614 |
+
"# print(f\"Coordinates are not integers\")\n",
|
| 615 |
+
"# return False\n",
|
| 616 |
+
" \n",
|
| 617 |
+
"# # Check if coordinates are within image bounds\n",
|
| 618 |
+
"# # For slicing mask[top:bottom, left:right], valid ranges are:\n",
|
| 619 |
+
"# # top, left: [0, 223] (inclusive)\n",
|
| 620 |
+
"# # bottom, right: [1, 224] (inclusive) since we need top < bottom and left < right\n",
|
| 621 |
+
"# if not (0 <= top < 224 and 0 <= left < 224 and 1 <= bottom <= 224 and 1 <= right <= 224):\n",
|
| 622 |
+
"# print(f\"Coordinates are not within image bounds\")\n",
|
| 623 |
+
"# return False\n",
|
| 624 |
+
" \n",
|
| 625 |
+
"# # Check if top-left is actually top-left of bottom-right (proper ordering)\n",
|
| 626 |
+
"# if not (top < bottom and left < right):\n",
|
| 627 |
+
"# print(f\"Top-left is not actually top-left of bottom-right\")\n",
|
| 628 |
+
"# return False\n",
|
| 629 |
+
" \n",
|
| 630 |
+
"# # Check that the crop area doesn't exceed RETAIN_RATIO\n",
|
| 631 |
+
"# crop_area = (bottom - top) * (right - left)\n",
|
| 632 |
+
"# max_area = RETAIN_RATIO * 224 * 224\n",
|
| 633 |
+
"# if crop_area > max_area:\n",
|
| 634 |
+
"# print(f\"Crop area {crop_area} exceeds max area {max_area}\")\n",
|
| 635 |
+
"# return False\n",
|
| 636 |
+
" \n",
|
| 637 |
+
"# return True\n",
|
| 638 |
+
"# except Exception:\n",
|
| 639 |
+
"# return False\n",
|
| 640 |
+
"\n",
|
| 641 |
+
"\n",
|
| 642 |
+
"\n",
|
| 643 |
+
"\n",
|
| 644 |
+
"# def validate_masks(masks):\n",
|
| 645 |
+
"# \"\"\"Simple validation of generated masks on the dataset\"\"\"\n",
|
| 646 |
+
"# correct = 0\n",
|
| 647 |
+
"# total = 0\n",
|
| 648 |
+
"\n",
|
| 649 |
+
"# labels = sorted(list(set(dataset['name']))) + ['other']\n",
|
| 650 |
+
"# text_inputs = processor(text=labels, return_tensors=\"pt\", padding=True).to(DEVICE)\n",
|
| 651 |
+
"\n",
|
| 652 |
+
"# with torch.no_grad():\n",
|
| 653 |
+
"# for item in tqdm(dataset, desc=\"Validating masks\"):\n",
|
| 654 |
+
"# idx = item['idx']\n",
|
| 655 |
+
"# if idx not in masks:\n",
|
| 656 |
+
"# continue\n",
|
| 657 |
+
"\n",
|
| 658 |
+
"# if not check_validity(masks[idx]):\n",
|
| 659 |
+
"# continue\n",
|
| 660 |
+
" \n",
|
| 661 |
+
"# mask_coordinates = masks[idx]\n",
|
| 662 |
+
"# image = item['image']\n",
|
| 663 |
+
"# true_label = item['name']\n",
|
| 664 |
+
" \n",
|
| 665 |
+
"# # Apply mask to image\n",
|
| 666 |
+
"# if image.mode != \"RGB\":\n",
|
| 667 |
+
"# image = image.convert(\"RGB\")\n",
|
| 668 |
+
" \n",
|
| 669 |
+
"# mask = generate_mask_from_coordinates(image, mask_coordinates)\n",
|
| 670 |
+
"\n",
|
| 671 |
+
"# # Apply mask with mean color replacement\n",
|
| 672 |
+
"# img_array = np.array(image).copy()\n",
|
| 673 |
+
"# mask_array = mask > 0\n",
|
| 674 |
+
"# mask_3d = np.stack([mask_array] * 3, axis=2)\n",
|
| 675 |
+
"# mean_values = np.array([0, 0, 0]) # Black mean color\n",
|
| 676 |
+
"# img_array = np.where(mask_3d, img_array, mean_values.reshape(1, 1, 3))\n",
|
| 677 |
+
"# masked_image = Image.fromarray(img_array.astype(np.uint8))\n",
|
| 678 |
+
" \n",
|
| 679 |
+
"# # Get prediction on masked image\n",
|
| 680 |
+
"# image_processed = processor(images=masked_image, return_tensors=\"pt\").to(DEVICE)\n",
|
| 681 |
+
"# pixel_values = image_processed['pixel_values']\n",
|
| 682 |
+
"# outputs = model(pixel_values=pixel_values, **text_inputs)\n",
|
| 683 |
+
"# logits = outputs.logits_per_image\n",
|
| 684 |
+
"# predicted_idx = logits.argmax(dim=-1).item()\n",
|
| 685 |
+
"# predicted_label = labels[predicted_idx]\n",
|
| 686 |
+
" \n",
|
| 687 |
+
"# # Check if prediction is correct\n",
|
| 688 |
+
"# if predicted_label == true_label:\n",
|
| 689 |
+
"# correct += 1\n",
|
| 690 |
+
"# total += 1\n",
|
| 691 |
+
" \n",
|
| 692 |
+
"# accuracy = correct / total if total > 0 else 0\n",
|
| 693 |
+
"# print(f\"Validation Results:\")\n",
|
| 694 |
+
"# print(f\"Total samples: {total}\")\n",
|
| 695 |
+
"# print(f\"Correct predictions: {correct}\")\n",
|
| 696 |
+
"# print(f\"Accuracy: {accuracy:.4f} ({accuracy*100:.2f}%)\")\n",
|
| 697 |
+
" \n",
|
| 698 |
+
"# return accuracy\n",
|
| 699 |
+
"\n",
|
| 700 |
+
"# # Run validation\n",
|
| 701 |
+
"# accuracy = validate_masks(masks)\n"
|
| 702 |
+
]
|
| 703 |
+
}
|
| 704 |
+
],
|
| 705 |
+
"metadata": {
|
| 706 |
+
"kernelspec": {
|
| 707 |
+
"display_name": "venv",
|
| 708 |
+
"language": "python",
|
| 709 |
+
"name": "python3"
|
| 710 |
+
},
|
| 711 |
+
"language_info": {
|
| 712 |
+
"codemirror_mode": {
|
| 713 |
+
"name": "ipython",
|
| 714 |
+
"version": 3
|
| 715 |
+
},
|
| 716 |
+
"file_extension": ".py",
|
| 717 |
+
"mimetype": "text/x-python",
|
| 718 |
+
"name": "python",
|
| 719 |
+
"nbconvert_exporter": "python",
|
| 720 |
+
"pygments_lexer": "ipython3",
|
| 721 |
+
"version": "3.9.6"
|
| 722 |
+
}
|
| 723 |
+
},
|
| 724 |
+
"nbformat": 4,
|
| 725 |
+
"nbformat_minor": 5
|
| 726 |
+
}
|
ben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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "2051e891-2bcf-42a6-9a1e-f773baff8808",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Pixel/Pixel_Solution.ipynb)"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "markdown",
|
| 17 |
+
"id": "441c46a0-b20a-4dc1-9227-f659833a7d2f",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"source": [
|
| 20 |
+
"# Pixel Efficiency: Reference Solution"
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"cell_type": "code",
|
| 25 |
+
"execution_count": null,
|
| 26 |
+
"id": "5d573331",
|
| 27 |
+
"metadata": {},
|
| 28 |
+
"outputs": [],
|
| 29 |
+
"source": [
|
| 30 |
+
"# Install required packages\n",
|
| 31 |
+
"!pip install numpy pillow tqdm torch transformers datasets accelerate\n"
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"cell_type": "code",
|
| 36 |
+
"execution_count": null,
|
| 37 |
+
"id": "2df5ae63",
|
| 38 |
+
"metadata": {},
|
| 39 |
+
"outputs": [],
|
| 40 |
+
"source": [
|
| 41 |
+
"import os\n",
|
| 42 |
+
"import numpy as np\n",
|
| 43 |
+
"from PIL import Image\n",
|
| 44 |
+
"from tqdm import tqdm\n",
|
| 45 |
+
"import json\n",
|
| 46 |
+
"import torch\n",
|
| 47 |
+
"import torch.nn as nn\n",
|
| 48 |
+
"from datasets import load_dataset\n",
|
| 49 |
+
"from transformers import CLIPProcessor, CLIPModel\n",
|
| 50 |
+
"from typing import Optional\n",
|
| 51 |
+
"from transformers.models.clip.modeling_clip import CLIPVisionTransformer, CLIPVisionConfig, BaseModelOutputWithPooling\n",
|
| 52 |
+
"\n",
|
| 53 |
+
"\n",
|
| 54 |
+
"# Dataset configuration\n",
|
| 55 |
+
"DATASET_PATH = \"IOAI-official/IOAI-2025-Pixel-test\"\n",
|
| 56 |
+
"SPLIT = \"test\"\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"# Model Configuration\n",
|
| 59 |
+
"MODEL_PATH = \"openai/clip-vit-large-patch14\"\n",
|
| 60 |
+
"DEVICE = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 61 |
+
"BACKGROUND_CLASS = \"other\"\n",
|
| 62 |
+
"\n",
|
| 63 |
+
"# Image and Masking Configuration\n",
|
| 64 |
+
"HEIGHT = 224\n",
|
| 65 |
+
"WIDTH = 224\n",
|
| 66 |
+
"RETAIN_RATIO = 0.0625\n",
|
| 67 |
+
"MEAN_COLOR = (0, 0, 0)\n",
|
| 68 |
+
"STRIDE = 2\n",
|
| 69 |
+
"TOP_K = 3\n",
|
| 70 |
+
"\n",
|
| 71 |
+
"# Load the dataset\n",
|
| 72 |
+
"print(\"Loading dataset...\")\n",
|
| 73 |
+
"dataset = load_dataset(DATASET_PATH, split=SPLIT)\n",
|
| 74 |
+
"\n",
|
| 75 |
+
"print(f\"Dataset loaded successfully! Total samples: {len(dataset)}\")\n",
|
| 76 |
+
"\n",
|
| 77 |
+
"print(f\"Loading CLIP model and processor: {MODEL_PATH}...\")\n",
|
| 78 |
+
"model = CLIPModel.from_pretrained(MODEL_PATH).to(DEVICE)\n",
|
| 79 |
+
"processor = CLIPProcessor.from_pretrained(MODEL_PATH)\n",
|
| 80 |
+
"print(\"Model and processor loaded successfully.\")\n",
|
| 81 |
+
"\n",
|
| 82 |
+
"\n",
|
| 83 |
+
"def generate_all_rectangular_regions(image_size=224, patch_size=14, retain_ratio=RETAIN_RATIO, max_aspect_ratio=1.2, stride=1):\n",
|
| 84 |
+
" \"\"\"Generate rectangular regions with optimizations for speed\"\"\"\n",
|
| 85 |
+
" max_pixels = int(retain_ratio * image_size * image_size)\n",
|
| 86 |
+
" patches_per_side = image_size // patch_size\n",
|
| 87 |
+
" patch_area = patch_size * patch_size\n",
|
| 88 |
+
" target_patches = max_pixels // patch_area\n",
|
| 89 |
+
" \n",
|
| 90 |
+
" min_patches = max(1, target_patches - 1)\n",
|
| 91 |
+
" max_patches = target_patches + 1\n",
|
| 92 |
+
" \n",
|
| 93 |
+
" regions = []\n",
|
| 94 |
+
" region_to_patches = []\n",
|
| 95 |
+
" \n",
|
| 96 |
+
" # Pre-compute valid rectangle dimensions\n",
|
| 97 |
+
" valid_dims = []\n",
|
| 98 |
+
" for width_patches in range(1, patches_per_side + 1):\n",
|
| 99 |
+
" for height_patches in range(1, patches_per_side + 1):\n",
|
| 100 |
+
" total_patches = width_patches * height_patches\n",
|
| 101 |
+
" if min_patches <= total_patches <= max_patches:\n",
|
| 102 |
+
" aspect_ratio = max(width_patches, height_patches) / min(width_patches, height_patches)\n",
|
| 103 |
+
" if aspect_ratio <= max_aspect_ratio:\n",
|
| 104 |
+
" valid_dims.append((width_patches, height_patches, total_patches))\n",
|
| 105 |
+
" \n",
|
| 106 |
+
" # Generate rectangles using stride for positions\n",
|
| 107 |
+
" for width_patches, height_patches, total_patches in valid_dims:\n",
|
| 108 |
+
" for top_patch in range(0, patches_per_side - height_patches + 1, stride):\n",
|
| 109 |
+
" for left_patch in range(0, patches_per_side - width_patches + 1, stride):\n",
|
| 110 |
+
" bottom_patch = top_patch + height_patches\n",
|
| 111 |
+
" right_patch = left_patch + width_patches\n",
|
| 112 |
+
" \n",
|
| 113 |
+
" pixel_coords = (\n",
|
| 114 |
+
" top_patch * patch_size,\n",
|
| 115 |
+
" left_patch * patch_size,\n",
|
| 116 |
+
" bottom_patch * patch_size,\n",
|
| 117 |
+
" right_patch * patch_size\n",
|
| 118 |
+
" )\n",
|
| 119 |
+
" regions.append(pixel_coords)\n",
|
| 120 |
+
" \n",
|
| 121 |
+
" covered_patches = []\n",
|
| 122 |
+
" for p_row in range(top_patch, bottom_patch):\n",
|
| 123 |
+
" for p_col in range(left_patch, right_patch):\n",
|
| 124 |
+
" patch_idx = p_row * patches_per_side + p_col\n",
|
| 125 |
+
" covered_patches.append(patch_idx)\n",
|
| 126 |
+
" region_to_patches.append(covered_patches)\n",
|
| 127 |
+
" \n",
|
| 128 |
+
" return regions, region_to_patches\n",
|
| 129 |
+
"\n",
|
| 130 |
+
"\n",
|
| 131 |
+
"class MaskCLIPVisionTransformer(CLIPVisionTransformer):\n",
|
| 132 |
+
" \"\"\"Modified CLIP Vision Transformer that supports mask tokens for all possible rectangular regions\"\"\"\n",
|
| 133 |
+
" \n",
|
| 134 |
+
" def __init__(self, config: CLIPVisionConfig, retain_ratio=RETAIN_RATIO):\n",
|
| 135 |
+
" super().__init__(config)\n",
|
| 136 |
+
" self.retain_ratio = retain_ratio\n",
|
| 137 |
+
" self.num_patches = (config.image_size // config.patch_size) ** 2\n",
|
| 138 |
+
" \n",
|
| 139 |
+
" self.regions, self.region_to_patches = generate_all_rectangular_regions(\n",
|
| 140 |
+
" image_size=config.image_size, \n",
|
| 141 |
+
" patch_size=config.patch_size, \n",
|
| 142 |
+
" retain_ratio=retain_ratio,\n",
|
| 143 |
+
" max_aspect_ratio=1.2,\n",
|
| 144 |
+
" stride=STRIDE\n",
|
| 145 |
+
" )\n",
|
| 146 |
+
" self.num_mask_tokens = len(self.regions)\n",
|
| 147 |
+
" \n",
|
| 148 |
+
" self.mask_tokens = nn.Parameter(torch.randn(1, self.num_mask_tokens, config.hidden_size))\n",
|
| 149 |
+
" \n",
|
| 150 |
+
" def create_mask_attention_matrix(self, batch_size):\n",
|
| 151 |
+
" \"\"\"Create attention mask matrix for all rectangular regions\"\"\"\n",
|
| 152 |
+
" N = self.num_patches\n",
|
| 153 |
+
" M = self.num_mask_tokens\n",
|
| 154 |
+
" total_tokens = N + 1 + M\n",
|
| 155 |
+
" \n",
|
| 156 |
+
" attention_mask = torch.zeros(total_tokens, total_tokens, dtype=torch.bool, device=self.mask_tokens.device)\n",
|
| 157 |
+
" \n",
|
| 158 |
+
" # Class token and image patches do NOT attend to mask tokens\n",
|
| 159 |
+
" attention_mask[:N+1, N+1:] = True\n",
|
| 160 |
+
" \n",
|
| 161 |
+
" # Each mask token attends to its specific image patches (not CLS)\n",
|
| 162 |
+
" attention_mask[N+1:, 1:N+1] = True\n",
|
| 163 |
+
" \n",
|
| 164 |
+
" # Then allow each mask token to attend to its assigned patches\n",
|
| 165 |
+
" for mask_idx in range(M):\n",
|
| 166 |
+
" covered_patches = self.region_to_patches[mask_idx]\n",
|
| 167 |
+
" for patch_idx in covered_patches:\n",
|
| 168 |
+
" token_pos = 1 + patch_idx\n",
|
| 169 |
+
" attention_mask[N + 1 + mask_idx, token_pos] = False\n",
|
| 170 |
+
" \n",
|
| 171 |
+
" # Mask tokens do NOT attend to each other\n",
|
| 172 |
+
" attention_mask[N+1:, N+1:] = True\n",
|
| 173 |
+
" # Allow self-attention for each mask token\n",
|
| 174 |
+
" for i in range(M):\n",
|
| 175 |
+
" attention_mask[N + 1 + i, N + 1 + i] = False\n",
|
| 176 |
+
" \n",
|
| 177 |
+
" return attention_mask\n",
|
| 178 |
+
" \n",
|
| 179 |
+
" def forward(\n",
|
| 180 |
+
" self,\n",
|
| 181 |
+
" pixel_values: Optional[torch.FloatTensor] = None,\n",
|
| 182 |
+
" output_attentions: Optional[bool] = None,\n",
|
| 183 |
+
" output_hidden_states: Optional[bool] = None,\n",
|
| 184 |
+
" interpolate_pos_encoding: Optional[bool] = False,\n",
|
| 185 |
+
" use_mask_tokens: bool = False,\n",
|
| 186 |
+
" ) -> BaseModelOutputWithPooling:\n",
|
| 187 |
+
" \"\"\"Forward pass with optional mask tokens\"\"\"\n",
|
| 188 |
+
" output_attentions = output_attentions if output_attentions is not None else self.config.output_attentions\n",
|
| 189 |
+
" output_hidden_states = (\n",
|
| 190 |
+
" output_hidden_states if output_hidden_states is not None else self.config.output_hidden_states\n",
|
| 191 |
+
" )\n",
|
| 192 |
+
"\n",
|
| 193 |
+
" if pixel_values is None:\n",
|
| 194 |
+
" raise ValueError(\"You have to specify pixel_values\")\n",
|
| 195 |
+
"\n",
|
| 196 |
+
" # Get embeddings (patches + class token)\n",
|
| 197 |
+
" hidden_states = self.embeddings(pixel_values, interpolate_pos_encoding=interpolate_pos_encoding)\n",
|
| 198 |
+
" hidden_states = self.pre_layrnorm(hidden_states)\n",
|
| 199 |
+
" \n",
|
| 200 |
+
" if use_mask_tokens:\n",
|
| 201 |
+
" # Add mask tokens to the sequence\n",
|
| 202 |
+
" batch_size = hidden_states.shape[0]\n",
|
| 203 |
+
" \n",
|
| 204 |
+
" cls_token_embedding = hidden_states[:, 0:1, :]\n",
|
| 205 |
+
" mask_tokens_expanded = cls_token_embedding.expand(batch_size, self.num_mask_tokens, -1)\n",
|
| 206 |
+
" \n",
|
| 207 |
+
" if mask_tokens_expanded.device != hidden_states.device:\n",
|
| 208 |
+
" mask_tokens_expanded = mask_tokens_expanded.to(hidden_states.device)\n",
|
| 209 |
+
" \n",
|
| 210 |
+
" hidden_states = torch.cat([hidden_states, mask_tokens_expanded], dim=1)\n",
|
| 211 |
+
" \n",
|
| 212 |
+
" # Create custom attention mask\n",
|
| 213 |
+
" attention_mask = self.create_mask_attention_matrix(batch_size)\n",
|
| 214 |
+
" \n",
|
| 215 |
+
" seq_len = hidden_states.shape[1]\n",
|
| 216 |
+
" attention_mask_4d = attention_mask.unsqueeze(0).unsqueeze(0).expand(batch_size, 1, -1, -1)\n",
|
| 217 |
+
" attention_mask_4d = attention_mask_4d.float()\n",
|
| 218 |
+
" attention_mask_4d = attention_mask_4d.masked_fill(attention_mask_4d == 1, float('-inf'))\n",
|
| 219 |
+
" attention_mask_4d = attention_mask_4d.masked_fill(attention_mask_4d == 0, 0.0)\n",
|
| 220 |
+
" else:\n",
|
| 221 |
+
" attention_mask_4d = None\n",
|
| 222 |
+
"\n",
|
| 223 |
+
" # Process through encoder layers\n",
|
| 224 |
+
" encoder_outputs = self.encoder(\n",
|
| 225 |
+
" inputs_embeds=hidden_states,\n",
|
| 226 |
+
" attention_mask=attention_mask_4d,\n",
|
| 227 |
+
" causal_attention_mask=None,\n",
|
| 228 |
+
" output_attentions=output_attentions,\n",
|
| 229 |
+
" output_hidden_states=output_hidden_states,\n",
|
| 230 |
+
" )\n",
|
| 231 |
+
"\n",
|
| 232 |
+
" last_hidden_state = encoder_outputs.last_hidden_state\n",
|
| 233 |
+
" \n",
|
| 234 |
+
" if use_mask_tokens:\n",
|
| 235 |
+
" # Extract different token types\n",
|
| 236 |
+
" class_token_output = last_hidden_state[:, 0]\n",
|
| 237 |
+
" mask_tokens_output = last_hidden_state[:, self.num_patches + 1:]\n",
|
| 238 |
+
" \n",
|
| 239 |
+
" # Apply post layer norm\n",
|
| 240 |
+
" pooled_output = self.post_layernorm(class_token_output)\n",
|
| 241 |
+
" mask_tokens_output = self.post_layernorm(mask_tokens_output)\n",
|
| 242 |
+
" \n",
|
| 243 |
+
" return {\n",
|
| 244 |
+
" 'last_hidden_state': last_hidden_state,\n",
|
| 245 |
+
" 'pooler_output': pooled_output,\n",
|
| 246 |
+
" 'mask_tokens_output': mask_tokens_output,\n",
|
| 247 |
+
" 'hidden_states': encoder_outputs.hidden_states,\n",
|
| 248 |
+
" 'attentions': encoder_outputs.attentions,\n",
|
| 249 |
+
" }\n",
|
| 250 |
+
" else:\n",
|
| 251 |
+
" # Standard CLIP behavior\n",
|
| 252 |
+
" pooled_output = last_hidden_state[:, 0, :]\n",
|
| 253 |
+
" pooled_output = self.post_layernorm(pooled_output)\n",
|
| 254 |
+
"\n",
|
| 255 |
+
" return BaseModelOutputWithPooling(\n",
|
| 256 |
+
" last_hidden_state=last_hidden_state,\n",
|
| 257 |
+
" pooler_output=pooled_output,\n",
|
| 258 |
+
" hidden_states=encoder_outputs.hidden_states,\n",
|
| 259 |
+
" attentions=encoder_outputs.attentions,\n",
|
| 260 |
+
" )\n",
|
| 261 |
+
"\n",
|
| 262 |
+
"\n",
|
| 263 |
+
"def apply_mask_with_mean(image, mask, mean_rgb=MEAN_COLOR):\n",
|
| 264 |
+
" \"\"\"Apply arbitrary binary mask to image, replacing masked areas with mean values\"\"\"\n",
|
| 265 |
+
" img_array = np.array(image).copy()\n",
|
| 266 |
+
"\n",
|
| 267 |
+
" if isinstance(mask, Image.Image):\n",
|
| 268 |
+
" mask_array = np.array(mask.convert('L')) > 127\n",
|
| 269 |
+
" else:\n",
|
| 270 |
+
" mask_array = mask > 0\n",
|
| 271 |
+
"\n",
|
| 272 |
+
" mask_3d = np.stack([mask_array] * 3, axis=2)\n",
|
| 273 |
+
" mean_values = np.array([int(m * 255) for m in mean_rgb])\n",
|
| 274 |
+
" img_array = np.where(mask_3d, img_array, mean_values.reshape(1, 1, 3))\n",
|
| 275 |
+
"\n",
|
| 276 |
+
" return Image.fromarray(img_array.astype(np.uint8))\n",
|
| 277 |
+
"\n",
|
| 278 |
+
"\n",
|
| 279 |
+
"def compute_vision_features_once(model, image, mask_vision_model):\n",
|
| 280 |
+
" \"\"\"\n",
|
| 281 |
+
" Compute vision features once for efficient reuse across multiple mask selection functions.\n",
|
| 282 |
+
" This eliminates redundant forward passes.\n",
|
| 283 |
+
" \"\"\"\n",
|
| 284 |
+
" image_inputs = processor(images=image, return_tensors=\"pt\").to(DEVICE)\n",
|
| 285 |
+
" \n",
|
| 286 |
+
" with torch.no_grad():\n",
|
| 287 |
+
" vision_outputs = mask_vision_model(\n",
|
| 288 |
+
" pixel_values=image_inputs['pixel_values'],\n",
|
| 289 |
+
" use_mask_tokens=True\n",
|
| 290 |
+
" )\n",
|
| 291 |
+
" \n",
|
| 292 |
+
" full_image_features = vision_outputs['pooler_output']\n",
|
| 293 |
+
" if hasattr(model, 'visual_projection') and model.visual_projection is not None:\n",
|
| 294 |
+
" full_image_features = model.visual_projection(full_image_features)\n",
|
| 295 |
+
" \n",
|
| 296 |
+
" mask_tokens_features = vision_outputs['mask_tokens_output']\n",
|
| 297 |
+
" if hasattr(model, 'visual_projection') and model.visual_projection is not None:\n",
|
| 298 |
+
" batch_size, num_tokens, embed_dim = mask_tokens_features.shape\n",
|
| 299 |
+
" mask_tokens_features = mask_tokens_features.view(-1, embed_dim)\n",
|
| 300 |
+
" mask_tokens_features = model.visual_projection(mask_tokens_features)\n",
|
| 301 |
+
" mask_tokens_features = mask_tokens_features.view(batch_size, num_tokens, -1)\n",
|
| 302 |
+
" \n",
|
| 303 |
+
" full_image_features = full_image_features / full_image_features.norm(dim=-1, keepdim=True)\n",
|
| 304 |
+
" mask_tokens_features = mask_tokens_features / mask_tokens_features.norm(dim=-1, keepdim=True)\n",
|
| 305 |
+
" \n",
|
| 306 |
+
" return vision_outputs, full_image_features, mask_tokens_features\n",
|
| 307 |
+
"\n",
|
| 308 |
+
"\n",
|
| 309 |
+
"def find_best_mask_region_calibrated(model, image, class_names, mask_vision_model, text_features, \n",
|
| 310 |
+
" vision_outputs=None, full_image_features=None, mask_tokens_features=None, \n",
|
| 311 |
+
" return_detailed=False):\n",
|
| 312 |
+
" \"\"\"Find the best mask region using MaskCLIP approach with calibration for black-pixel masking\"\"\"\n",
|
| 313 |
+
" num_mask_tokens = mask_vision_model.num_mask_tokens\n",
|
| 314 |
+
" \n",
|
| 315 |
+
" # Use pre-computed features if provided, otherwise compute them\n",
|
| 316 |
+
" if vision_outputs is None or full_image_features is None or mask_tokens_features is None:\n",
|
| 317 |
+
" image_inputs = processor(images=image, return_tensors=\"pt\").to(DEVICE)\n",
|
| 318 |
+
" \n",
|
| 319 |
+
" with torch.no_grad():\n",
|
| 320 |
+
" vision_outputs = mask_vision_model(\n",
|
| 321 |
+
" pixel_values=image_inputs['pixel_values'],\n",
|
| 322 |
+
" use_mask_tokens=True\n",
|
| 323 |
+
" )\n",
|
| 324 |
+
" \n",
|
| 325 |
+
" full_image_features = vision_outputs['pooler_output']\n",
|
| 326 |
+
" if hasattr(model, 'visual_projection') and model.visual_projection is not None:\n",
|
| 327 |
+
" full_image_features = model.visual_projection(full_image_features)\n",
|
| 328 |
+
" \n",
|
| 329 |
+
" mask_tokens_features = vision_outputs['mask_tokens_output']\n",
|
| 330 |
+
" if hasattr(model, 'visual_projection') and model.visual_projection is not None:\n",
|
| 331 |
+
" batch_size, num_tokens, embed_dim = mask_tokens_features.shape\n",
|
| 332 |
+
" mask_tokens_features = mask_tokens_features.view(-1, embed_dim)\n",
|
| 333 |
+
" mask_tokens_features = model.visual_projection(mask_tokens_features)\n",
|
| 334 |
+
" mask_tokens_features = mask_tokens_features.view(batch_size, num_tokens, -1)\n",
|
| 335 |
+
" \n",
|
| 336 |
+
" full_image_features = full_image_features / full_image_features.norm(dim=-1, keepdim=True)\n",
|
| 337 |
+
" mask_tokens_features = mask_tokens_features / mask_tokens_features.norm(dim=-1, keepdim=True)\n",
|
| 338 |
+
" \n",
|
| 339 |
+
" # Compute similarity between full image and text\n",
|
| 340 |
+
" full_image_similarities = torch.matmul(full_image_features, text_features.T)\n",
|
| 341 |
+
" full_image_prediction = torch.argmax(full_image_similarities, dim=-1)\n",
|
| 342 |
+
" predicted_class_idx = full_image_prediction.item()\n",
|
| 343 |
+
" \n",
|
| 344 |
+
" # Compute similarities for each mask token\n",
|
| 345 |
+
" mask_similarities = torch.matmul(mask_tokens_features.squeeze(0), text_features.T)\n",
|
| 346 |
+
" mask_predictions = torch.argmax(mask_similarities, dim=-1)\n",
|
| 347 |
+
" \n",
|
| 348 |
+
" # Get candidates that predict the same class as full image, sorted by confidence\n",
|
| 349 |
+
" matching_masks = (mask_predictions == predicted_class_idx)\n",
|
| 350 |
+
" \n",
|
| 351 |
+
" if matching_masks.any():\n",
|
| 352 |
+
" candidate_indices = torch.where(matching_masks)[0]\n",
|
| 353 |
+
" candidate_confidences = mask_similarities[candidate_indices, predicted_class_idx]\n",
|
| 354 |
+
" sorted_indices = torch.argsort(candidate_confidences, descending=True)\n",
|
| 355 |
+
" sorted_candidates = candidate_indices[sorted_indices]\n",
|
| 356 |
+
" else:\n",
|
| 357 |
+
" # If no exact matches, use all candidates sorted by confidence for predicted class\n",
|
| 358 |
+
" candidate_confidences = mask_similarities[:, predicted_class_idx]\n",
|
| 359 |
+
" sorted_candidates = torch.topk(candidate_confidences, len(candidate_confidences)).indices\n",
|
| 360 |
+
" \n",
|
| 361 |
+
" # OPTIMIZATION: If TOP_K=1, skip calibration and return best candidate directly\n",
|
| 362 |
+
" if TOP_K == 1:\n",
|
| 363 |
+
" return sorted_candidates[0].item()\n",
|
| 364 |
+
" \n",
|
| 365 |
+
" # CALIBRATION STEP: Test top K candidates, return immediately when one is correct\n",
|
| 366 |
+
" calibration_results = []\n",
|
| 367 |
+
" candidates_to_test = sorted_candidates[:TOP_K]\n",
|
| 368 |
+
" \n",
|
| 369 |
+
" for i, candidate_idx in enumerate(candidates_to_test):\n",
|
| 370 |
+
" candidate_idx_item = candidate_idx.item()\n",
|
| 371 |
+
" \n",
|
| 372 |
+
" # Create masked image for this candidate\n",
|
| 373 |
+
" coordinates = mask_idx_to_coordinates(candidate_idx_item, mask_vision_model)\n",
|
| 374 |
+
" mask = generate_mask_from_coordinates(image, coordinates)\n",
|
| 375 |
+
" masked_image = apply_mask_with_mean(image, mask)\n",
|
| 376 |
+
" \n",
|
| 377 |
+
" # Test with actual forward pass\n",
|
| 378 |
+
" with torch.no_grad():\n",
|
| 379 |
+
" masked_image_inputs = processor(images=masked_image, return_tensors=\"pt\").to(DEVICE)\n",
|
| 380 |
+
" masked_image_features = model.get_image_features(**masked_image_inputs)\n",
|
| 381 |
+
" masked_image_features = masked_image_features / masked_image_features.norm(dim=-1, keepdim=True)\n",
|
| 382 |
+
" \n",
|
| 383 |
+
" masked_similarities = torch.matmul(masked_image_features, text_features.T)\n",
|
| 384 |
+
" masked_prediction = torch.argmax(masked_similarities, dim=-1).item()\n",
|
| 385 |
+
" masked_confidence = masked_similarities[0, predicted_class_idx].item()\n",
|
| 386 |
+
" \n",
|
| 387 |
+
" # If this candidate predicts correctly, return it immediately (early exit optimization)\n",
|
| 388 |
+
" if masked_prediction == predicted_class_idx:\n",
|
| 389 |
+
" return candidate_idx_item\n",
|
| 390 |
+
" \n",
|
| 391 |
+
" # Store failed calibration result\n",
|
| 392 |
+
" calibration_results.append((candidate_idx_item, masked_confidence))\n",
|
| 393 |
+
" \n",
|
| 394 |
+
" # If we reach here, all TOP_K candidates failed calibration\n",
|
| 395 |
+
" # Fall back to the next best candidate from sorted list WITHOUT additional calibration\n",
|
| 396 |
+
" if len(sorted_candidates) > TOP_K:\n",
|
| 397 |
+
" return sorted_candidates[TOP_K].item()\n",
|
| 398 |
+
" else:\n",
|
| 399 |
+
" # If no more candidates available, return the best failed calibration result\n",
|
| 400 |
+
" if calibration_results:\n",
|
| 401 |
+
" return max(calibration_results, key=lambda x: x[1])[0]\n",
|
| 402 |
+
" else:\n",
|
| 403 |
+
" # Ultimate fallback: return the best mask token prediction\n",
|
| 404 |
+
" return sorted_candidates[0].item()\n",
|
| 405 |
+
"\n",
|
| 406 |
+
"\n",
|
| 407 |
+
"def mask_idx_to_coordinates(mask_idx, mask_vision_model):\n",
|
| 408 |
+
" \"\"\"Convert mask token index to image coordinates using the pre-computed regions\"\"\"\n",
|
| 409 |
+
" if mask_idx >= len(mask_vision_model.regions):\n",
|
| 410 |
+
" raise ValueError(f\"mask_idx {mask_idx} is out of range. Only {len(mask_vision_model.regions)} regions available.\")\n",
|
| 411 |
+
" \n",
|
| 412 |
+
" top, left, bottom, right = mask_vision_model.regions[mask_idx]\n",
|
| 413 |
+
" return ((top, left), (bottom, right))\n",
|
| 414 |
+
"\n",
|
| 415 |
+
"\n",
|
| 416 |
+
"def generate_mask_from_coordinates(image, coordinates):\n",
|
| 417 |
+
" \"\"\"Generate a binary mask from crop coordinates\"\"\"\n",
|
| 418 |
+
" H, W = 224, 224\n",
|
| 419 |
+
" mask = np.zeros((H, W), dtype=np.int8)\n",
|
| 420 |
+
" \n",
|
| 421 |
+
" (top, left), (bottom, right) = coordinates\n",
|
| 422 |
+
" mask[top:bottom, left:right] = 1\n",
|
| 423 |
+
" \n",
|
| 424 |
+
" return mask\n",
|
| 425 |
+
"\n",
|
| 426 |
+
"\n",
|
| 427 |
+
"# Create the MaskCLIP model\n",
|
| 428 |
+
"print(\"Creating MaskCLIP model...\")\n",
|
| 429 |
+
"mask_vision_model = MaskCLIPVisionTransformer(model.vision_model.config, retain_ratio=RETAIN_RATIO)\n",
|
| 430 |
+
"mask_vision_model.load_state_dict(model.vision_model.state_dict(), strict=False)\n",
|
| 431 |
+
"mask_vision_model = mask_vision_model.to(DEVICE)\n",
|
| 432 |
+
"mask_vision_model.eval()\n",
|
| 433 |
+
"print(\"MaskCLIP model created successfully.\")\n",
|
| 434 |
+
"\n",
|
| 435 |
+
"# Get class names from training dataset for consistent evaluation \n",
|
| 436 |
+
"train_dataset = load_dataset(\"IOAI-official/IOAI-2025-Pixel-train\", split=\"train\")\n",
|
| 437 |
+
"class_names_eval = list(set([item['name'] for item in train_dataset])) + [BACKGROUND_CLASS]\n",
|
| 438 |
+
"\n",
|
| 439 |
+
"# Prepare text features once for efficiency\n",
|
| 440 |
+
"print(\"Preparing text features...\")\n",
|
| 441 |
+
"text_inputs_eval = processor(text=class_names_eval, return_tensors=\"pt\", padding=True).to(DEVICE)\n",
|
| 442 |
+
"with torch.no_grad():\n",
|
| 443 |
+
" text_features_eval = model.get_text_features(**text_inputs_eval)\n",
|
| 444 |
+
" text_features_eval = text_features_eval / text_features_eval.norm(dim=-1, keepdim=True)\n",
|
| 445 |
+
"print(\"Text features prepared.\")\n",
|
| 446 |
+
"\n",
|
| 447 |
+
"# Main evaluation loop\n",
|
| 448 |
+
"masks = {}\n",
|
| 449 |
+
"total_correct = 0\n",
|
| 450 |
+
"total_processed = 0\n",
|
| 451 |
+
"\n",
|
| 452 |
+
"for item in tqdm(dataset):\n",
|
| 453 |
+
" image = item['image']\n",
|
| 454 |
+
" total_processed += 1\n",
|
| 455 |
+
"\n",
|
| 456 |
+
" try:\n",
|
| 457 |
+
" # Compute vision features once for efficiency (eliminates redundant forward passes)\n",
|
| 458 |
+
" vision_outputs, full_image_features, mask_tokens_features = compute_vision_features_once(\n",
|
| 459 |
+
" model, image, mask_vision_model\n",
|
| 460 |
+
" )\n",
|
| 461 |
+
" \n",
|
| 462 |
+
" # Get prediction from pre-computed features\n",
|
| 463 |
+
" full_image_similarities = torch.matmul(full_image_features, text_features_eval.T)\n",
|
| 464 |
+
" predicted_class_idx = torch.argmax(full_image_similarities, dim=-1).item()\n",
|
| 465 |
+
" \n",
|
| 466 |
+
" best_mask_idx = find_best_mask_region_calibrated(\n",
|
| 467 |
+
" model, image, class_names_eval, mask_vision_model, text_features_eval,\n",
|
| 468 |
+
" vision_outputs=vision_outputs, full_image_features=full_image_features, \n",
|
| 469 |
+
" mask_tokens_features=mask_tokens_features\n",
|
| 470 |
+
" )\n",
|
| 471 |
+
" \n",
|
| 472 |
+
" coordinates = mask_idx_to_coordinates(best_mask_idx, mask_vision_model)\n",
|
| 473 |
+
" \n",
|
| 474 |
+
" # Validate the mask\n",
|
| 475 |
+
" mask = generate_mask_from_coordinates(image, coordinates)\n",
|
| 476 |
+
" assert mask.shape == (224, 224), \"Mask should be 224x224\"\n",
|
| 477 |
+
" assert mask.sum() <= RETAIN_RATIO * 224 * 224, \"You should leave only 6.25% of pixels\"\n",
|
| 478 |
+
"\n",
|
| 479 |
+
" \n",
|
| 480 |
+
" # Save the coordinates\n",
|
| 481 |
+
" idx = item['idx']\n",
|
| 482 |
+
" masks[idx] = coordinates\n",
|
| 483 |
+
" \n",
|
| 484 |
+
" except Exception as e:\n",
|
| 485 |
+
" print(f\"Error processing image {item['idx']}: {e}\")\n",
|
| 486 |
+
" # Fallback to a small center region if there's an error\n",
|
| 487 |
+
" if len(mask_vision_model.regions) > 0:\n",
|
| 488 |
+
" region_sizes = [(r[2]-r[0])*(r[3]-r[1]) for r in mask_vision_model.regions]\n",
|
| 489 |
+
" min_region_idx = region_sizes.index(min(region_sizes))\n",
|
| 490 |
+
" fallback_coords = mask_idx_to_coordinates(min_region_idx, mask_vision_model)\n",
|
| 491 |
+
" else:\n",
|
| 492 |
+
" fallback_coords = ((84, 84), (140, 140))\n",
|
| 493 |
+
" masks[item['idx']] = fallback_coords\n",
|
| 494 |
+
"\n",
|
| 495 |
+
"# Save as JSONL (one JSON object per line) - much safer than pickle\n",
|
| 496 |
+
"with open('submission.jsonl', 'w') as f:\n",
|
| 497 |
+
" for idx, coordinates in masks.items():\n",
|
| 498 |
+
" json.dump({\"idx\": idx, \"coordinates\": coordinates}, f)\n",
|
| 499 |
+
" f.write('\\n')\n",
|
| 500 |
+
"\n",
|
| 501 |
+
"print(\"Masks saved to masks.jsonl\")\n"
|
| 502 |
+
]
|
| 503 |
+
}
|
| 504 |
+
],
|
| 505 |
+
"metadata": {
|
| 506 |
+
"kernelspec": {
|
| 507 |
+
"display_name": "Python 3 (ipykernel)",
|
| 508 |
+
"language": "python",
|
| 509 |
+
"name": "python3"
|
| 510 |
+
},
|
| 511 |
+
"language_info": {
|
| 512 |
+
"codemirror_mode": {
|
| 513 |
+
"name": "ipython",
|
| 514 |
+
"version": 3
|
| 515 |
+
},
|
| 516 |
+
"file_extension": ".py",
|
| 517 |
+
"mimetype": "text/x-python",
|
| 518 |
+
"name": "python",
|
| 519 |
+
"nbconvert_exporter": "python",
|
| 520 |
+
"pygments_lexer": "ipython3",
|
| 521 |
+
"version": "3.12.9"
|
| 522 |
+
}
|
| 523 |
+
},
|
| 524 |
+
"nbformat": 4,
|
| 525 |
+
"nbformat_minor": 5
|
| 526 |
+
}
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Pixel/README.md
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# IOAI 2025 Pixel Efficiency Task
|
| 2 |
+
|
| 3 |
+
This folder contains resources for the Pixel Efficiency task (day 2, task 6) in IOAI 2025.
|
| 4 |
+
|
| 5 |
+
# File Descriptions
|
| 6 |
+
|
| 7 |
+
- `Pixel.ipynb`: The baseline notebook.
|
| 8 |
+
- `Pixel_Solution.ipynb`: The official implementation of the reference result from the HSC and ISC.
|
| 9 |
+
- `metrics.py`: The evaluation script.
|
| 10 |
+
|
| 11 |
+
# Usage
|
| 12 |
+
|
| 13 |
+
First run `Pixel.ipynb`, `Pixel_Solution`, or any other solution you want to test. It should generate a `submission.jsonl` containing the generated masks.
|
| 14 |
+
|
| 15 |
+
After that, run `metrics.py` to evaluate and get the final accuracies.
|
| 16 |
+
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Pixel/metrics.py
ADDED
|
@@ -0,0 +1,544 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import json
|
| 2 |
+
from pathlib import Path
|
| 3 |
+
from argparse import ArgumentParser
|
| 4 |
+
import os
|
| 5 |
+
|
| 6 |
+
import torch
|
| 7 |
+
from transformers import CLIPProcessor, CLIPModel
|
| 8 |
+
from datasets import load_from_disk, load_dataset
|
| 9 |
+
from PIL import Image
|
| 10 |
+
import numpy as np
|
| 11 |
+
import math
|
| 12 |
+
from tqdm.auto import tqdm # Progress bar
|
| 13 |
+
import random
|
| 14 |
+
import matplotlib.pyplot as plt
|
| 15 |
+
|
| 16 |
+
|
| 17 |
+
H, W = 224, 224
|
| 18 |
+
MODEL_PATH = "openai/clip-vit-large-patch14"
|
| 19 |
+
DATASET_PATH = "IOAI-official/IOAI-2025-Pixel-ref"
|
| 20 |
+
MASK_PATH = "submission.jsonl"
|
| 21 |
+
SPLIT = "ref"
|
| 22 |
+
DEVICE = "cuda" if torch.cuda.is_available() else "cpu"
|
| 23 |
+
RETAIN_RATIO = 0.0625
|
| 24 |
+
SCORE_OUTPUT_FILE = "score.json"
|
| 25 |
+
MEAN_COLOR = (0, 0, 0)
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
parser = ArgumentParser()
|
| 29 |
+
parser.add_argument("--mask-file", default='masks.npy', type=str)
|
| 30 |
+
parser.add_argument("--debug", default=False, action='store_true')
|
| 31 |
+
args = parser.parse_args()
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
def write_error_score(error_message):
|
| 35 |
+
"""Write error score to JSON file"""
|
| 36 |
+
error_json = {
|
| 37 |
+
"status": False,
|
| 38 |
+
"score": {
|
| 39 |
+
"public_a": 0.0,
|
| 40 |
+
"public_detail": {
|
| 41 |
+
"Score": 0.0,
|
| 42 |
+
"Accuracy": 0.0,
|
| 43 |
+
},
|
| 44 |
+
"private_b": 0.0,
|
| 45 |
+
"private_detail": {
|
| 46 |
+
"Score": 0.0,
|
| 47 |
+
"Accuracy": 0.0,
|
| 48 |
+
},
|
| 49 |
+
},
|
| 50 |
+
"msg": f"Error: {error_message}",
|
| 51 |
+
}
|
| 52 |
+
|
| 53 |
+
with open(SCORE_OUTPUT_FILE, 'w') as f:
|
| 54 |
+
json.dump(error_json, f, indent=2)
|
| 55 |
+
print(f"Error written to {SCORE_OUTPUT_FILE}: {error_message}")
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
def safe_load_masks(mask_file_path, expected_dataset_size):
|
| 59 |
+
"""
|
| 60 |
+
Safely load and validate the masks file from contestants.
|
| 61 |
+
|
| 62 |
+
Parameters:
|
| 63 |
+
mask_file_path: Path to the masks file
|
| 64 |
+
expected_dataset_size: Expected number of test cases
|
| 65 |
+
|
| 66 |
+
Returns:
|
| 67 |
+
dict: Validated masks dictionary or None if invalid
|
| 68 |
+
"""
|
| 69 |
+
try:
|
| 70 |
+
# Check if file exists
|
| 71 |
+
if not os.path.exists(mask_file_path):
|
| 72 |
+
write_error_score("Mask file not found.")
|
| 73 |
+
return None
|
| 74 |
+
|
| 75 |
+
# Check file size (prevent extremely large files)
|
| 76 |
+
file_size = os.path.getsize(mask_file_path)
|
| 77 |
+
max_file_size = 50 * 1024 * 1024 # 50MB limit
|
| 78 |
+
if file_size > max_file_size:
|
| 79 |
+
write_error_score("Mask file too large.")
|
| 80 |
+
return None
|
| 81 |
+
|
| 82 |
+
masks = {}
|
| 83 |
+
|
| 84 |
+
# Load based on file extension
|
| 85 |
+
if mask_file_path.endswith('.jsonl'):
|
| 86 |
+
# Load JSONL format (one JSON object per line)
|
| 87 |
+
try:
|
| 88 |
+
with open(mask_file_path, 'r') as f:
|
| 89 |
+
for line_num, line in enumerate(f, 1):
|
| 90 |
+
if line.strip(): # Skip empty lines
|
| 91 |
+
try:
|
| 92 |
+
data = json.loads(line.strip())
|
| 93 |
+
idx = data.get('idx')
|
| 94 |
+
coordinates = data.get('coordinates')
|
| 95 |
+
|
| 96 |
+
if idx is None or coordinates is None:
|
| 97 |
+
write_error_score("Invalid JSONL format.")
|
| 98 |
+
return None
|
| 99 |
+
|
| 100 |
+
masks[idx] = coordinates
|
| 101 |
+
except json.JSONDecodeError:
|
| 102 |
+
write_error_score("Invalid JSON in mask file.")
|
| 103 |
+
return None
|
| 104 |
+
except Exception:
|
| 105 |
+
write_error_score("Unable to load JSONL mask file.")
|
| 106 |
+
return None
|
| 107 |
+
|
| 108 |
+
# Validate it's a dictionary
|
| 109 |
+
if not isinstance(masks, dict):
|
| 110 |
+
write_error_score("Mask data must be a dictionary.")
|
| 111 |
+
return None
|
| 112 |
+
|
| 113 |
+
# Check number of entries
|
| 114 |
+
if len(masks) != expected_dataset_size:
|
| 115 |
+
# print(len(masks), expected_dataset_size)
|
| 116 |
+
write_error_score("Incorrect number of mask entries.")
|
| 117 |
+
return None
|
| 118 |
+
|
| 119 |
+
# Validate each mask entry
|
| 120 |
+
for idx, coordinates in masks.items():
|
| 121 |
+
# Validate index
|
| 122 |
+
if not isinstance(idx, (int, np.integer, str)):
|
| 123 |
+
write_error_score("Invalid mask index format.")
|
| 124 |
+
return None
|
| 125 |
+
|
| 126 |
+
# Validate coordinates structure
|
| 127 |
+
if not isinstance(coordinates, (tuple, list)) or len(coordinates) != 2:
|
| 128 |
+
write_error_score("Invalid mask coordinate structure.")
|
| 129 |
+
return None
|
| 130 |
+
|
| 131 |
+
try:
|
| 132 |
+
(top, left), (bottom, right) = coordinates
|
| 133 |
+
except (ValueError, TypeError):
|
| 134 |
+
write_error_score("Invalid mask coordinate format.")
|
| 135 |
+
return None
|
| 136 |
+
|
| 137 |
+
# Validate coordinate types and values
|
| 138 |
+
coords = [top, left, bottom, right]
|
| 139 |
+
for coord in coords:
|
| 140 |
+
if not isinstance(coord, (int, np.integer)):
|
| 141 |
+
write_error_score("Mask coordinates must be integers.")
|
| 142 |
+
return None
|
| 143 |
+
|
| 144 |
+
if not (0 <= coord <= 224):
|
| 145 |
+
write_error_score("Mask coordinates out of valid range.")
|
| 146 |
+
return None
|
| 147 |
+
|
| 148 |
+
# Validate coordinate ordering
|
| 149 |
+
if not (top < bottom and left < right):
|
| 150 |
+
write_error_score("Invalid mask coordinate ordering.")
|
| 151 |
+
return None
|
| 152 |
+
|
| 153 |
+
# Validate area constraint
|
| 154 |
+
crop_area = (bottom - top) * (right - left)
|
| 155 |
+
max_area = RETAIN_RATIO * 224 * 224
|
| 156 |
+
if crop_area > max_area:
|
| 157 |
+
write_error_score("Mask area exceeds allowed limit.")
|
| 158 |
+
return None
|
| 159 |
+
|
| 160 |
+
# Additional security: prevent degenerate cases
|
| 161 |
+
if crop_area <= 0:
|
| 162 |
+
write_error_score("Invalid mask area.")
|
| 163 |
+
return None
|
| 164 |
+
|
| 165 |
+
return masks
|
| 166 |
+
|
| 167 |
+
except Exception as e:
|
| 168 |
+
write_error_score("Unexpected error loading mask file.")
|
| 169 |
+
return None
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def check_validity(coordinates):
|
| 173 |
+
"""
|
| 174 |
+
Check if coordinates are valid according to the requirements.
|
| 175 |
+
Returns True if valid, False otherwise.
|
| 176 |
+
"""
|
| 177 |
+
try:
|
| 178 |
+
# Check if coordinates is a tuple of two tuples
|
| 179 |
+
if not hasattr(coordinates, '__iter__') or len(coordinates) != 2:
|
| 180 |
+
return False
|
| 181 |
+
|
| 182 |
+
(top, left), (bottom, right) = coordinates
|
| 183 |
+
|
| 184 |
+
# Check if all coordinates are integers
|
| 185 |
+
if not all(isinstance(coord, (int, np.integer)) for coord in [top, left, bottom, right]):
|
| 186 |
+
return False
|
| 187 |
+
|
| 188 |
+
# Check if coordinates are within image bounds
|
| 189 |
+
# For slicing mask[top:bottom, left:right], valid ranges are:
|
| 190 |
+
# top, left: [0, 223] (inclusive)
|
| 191 |
+
# bottom, right: [1, 224] (inclusive) since we need top < bottom and left < right
|
| 192 |
+
if not (0 <= top < 224 and 0 <= left < 224 and 1 <= bottom <= 224 and 1 <= right <= 224):
|
| 193 |
+
return False
|
| 194 |
+
|
| 195 |
+
# Check if top-left is actually top-left of bottom-right (proper ordering)
|
| 196 |
+
if not (top < bottom and left < right):
|
| 197 |
+
return False
|
| 198 |
+
|
| 199 |
+
# Check that the crop area doesn't exceed RETAIN_RATIO
|
| 200 |
+
crop_area = (bottom - top) * (right - left)
|
| 201 |
+
max_area = RETAIN_RATIO * 224 * 224
|
| 202 |
+
if crop_area > max_area:
|
| 203 |
+
return False
|
| 204 |
+
|
| 205 |
+
return True
|
| 206 |
+
except Exception:
|
| 207 |
+
return False
|
| 208 |
+
|
| 209 |
+
def generate_mask_from_coordinates(image, coordinates):
|
| 210 |
+
"""
|
| 211 |
+
Generate a binary mask from crop coordinates.
|
| 212 |
+
|
| 213 |
+
Parameters:
|
| 214 |
+
image: PIL Image
|
| 215 |
+
coordinates: tuple of ((top, left), (bottom, right))
|
| 216 |
+
|
| 217 |
+
Returns:
|
| 218 |
+
numpy array: Binary mask with 1s in the crop area
|
| 219 |
+
"""
|
| 220 |
+
H, W = 224, 224 # Standard image size
|
| 221 |
+
mask = np.zeros((H, W), dtype=np.int8)
|
| 222 |
+
|
| 223 |
+
(top, left), (bottom, right) = coordinates
|
| 224 |
+
mask[top:bottom, left:right] = 1
|
| 225 |
+
|
| 226 |
+
return mask
|
| 227 |
+
|
| 228 |
+
def apply_mask_with_mean(image, mask, mean_rgb=MEAN_COLOR):
|
| 229 |
+
"""
|
| 230 |
+
Apply arbitrary binary mask to image, replacing masked areas with mean values
|
| 231 |
+
|
| 232 |
+
Parameters:
|
| 233 |
+
- image: PIL Image (224x224)
|
| 234 |
+
- mask: Binary numpy array or PIL Image (224x224) where 0 is the area to drop and 1 is the area to keep
|
| 235 |
+
- mean_rgb: RGB mean values to use (default: from config)
|
| 236 |
+
|
| 237 |
+
Returns: Modified PIL Image
|
| 238 |
+
"""
|
| 239 |
+
# Convert images to numpy arrays
|
| 240 |
+
img_array = np.array(image).copy()
|
| 241 |
+
|
| 242 |
+
# Ensure mask is numpy array
|
| 243 |
+
if isinstance(mask, Image.Image):
|
| 244 |
+
mask_array = np.array(mask.convert('L')) > 127 # Convert to binary
|
| 245 |
+
else:
|
| 246 |
+
mask_array = mask > 0
|
| 247 |
+
|
| 248 |
+
# Reshape mask for broadcasting with RGB
|
| 249 |
+
mask_3d = np.stack([mask_array] * 3, axis=2)
|
| 250 |
+
|
| 251 |
+
# Convert mean values to 0-255 range
|
| 252 |
+
mean_values = np.array([int(m * 255) for m in mean_rgb])
|
| 253 |
+
# Apply mask - replace areas where mask is 0 (drop) with mean values, keep areas where mask is 1
|
| 254 |
+
img_array = np.where(mask_3d, img_array, mean_values.reshape(1, 1, 3))
|
| 255 |
+
|
| 256 |
+
return Image.fromarray(img_array.astype(np.uint8))
|
| 257 |
+
|
| 258 |
+
|
| 259 |
+
if __name__ == '__main__':
|
| 260 |
+
try:
|
| 261 |
+
try:
|
| 262 |
+
dataset = load_dataset(DATASET_PATH, split=SPLIT)
|
| 263 |
+
except Exception:
|
| 264 |
+
write_error_score("Unable to load reference dataset.")
|
| 265 |
+
exit(1)
|
| 266 |
+
|
| 267 |
+
# Safely load and validate masks
|
| 268 |
+
masks = safe_load_masks(MASK_PATH, len(dataset))
|
| 269 |
+
if masks is None:
|
| 270 |
+
exit(1) # Error already written by safe_load_masks
|
| 271 |
+
|
| 272 |
+
# Check validity of coordinates and report invalid ones
|
| 273 |
+
invalid_coordinates = []
|
| 274 |
+
valid_coordinates = 0
|
| 275 |
+
for idx, coordinates in masks.items():
|
| 276 |
+
if not check_validity(coordinates):
|
| 277 |
+
invalid_coordinates.append(idx)
|
| 278 |
+
else:
|
| 279 |
+
valid_coordinates += 1
|
| 280 |
+
|
| 281 |
+
if invalid_coordinates:
|
| 282 |
+
print(f"Warning: Found {len(invalid_coordinates)} invalid coordinates (indices: {invalid_coordinates[:10]}{'...' if len(invalid_coordinates) > 10 else ''})")
|
| 283 |
+
print(f"Invalid coordinates will be treated as incorrect predictions")
|
| 284 |
+
print(f"Valid coordinates: {valid_coordinates}/{len(masks)}")
|
| 285 |
+
|
| 286 |
+
#dataset = dataset.select(range(10)) # debug remove later
|
| 287 |
+
|
| 288 |
+
# --- Step 1: Load Model and Processor ---
|
| 289 |
+
print(f"Loading CLIP model and processor: {MODEL_PATH}...")
|
| 290 |
+
try:
|
| 291 |
+
model = CLIPModel.from_pretrained(MODEL_PATH).to(DEVICE)
|
| 292 |
+
processor = CLIPProcessor.from_pretrained(MODEL_PATH)
|
| 293 |
+
model.eval() # Set to evaluation mode
|
| 294 |
+
print("Model and processor loaded successfully.")
|
| 295 |
+
except Exception as e:
|
| 296 |
+
write_error_score("Unable to load model.")
|
| 297 |
+
exit(1)
|
| 298 |
+
|
| 299 |
+
try:
|
| 300 |
+
labels = sorted(list(set(dataset['name']))) + ['other']
|
| 301 |
+
text_inputs = processor(text=labels, return_tensors="pt", padding=True).to(DEVICE)
|
| 302 |
+
except Exception:
|
| 303 |
+
write_error_score("Unable to process labels.")
|
| 304 |
+
exit(1)
|
| 305 |
+
|
| 306 |
+
# Map label names to indices for later comparison
|
| 307 |
+
label_to_index = {label: i for i, label in enumerate(labels)}
|
| 308 |
+
index_to_label = {i: label for label, i in label_to_index.items()} # For mapping prediction back
|
| 309 |
+
|
| 310 |
+
def predict_with_coordinates(image, coordinates):
|
| 311 |
+
try:
|
| 312 |
+
# Generate mask from coordinates
|
| 313 |
+
mask = generate_mask_from_coordinates(image, coordinates)
|
| 314 |
+
assert len(mask.shape) == 2
|
| 315 |
+
|
| 316 |
+
if image.mode != "RGB":
|
| 317 |
+
image = image.convert("RGB")
|
| 318 |
+
image = apply_mask_with_mean(image, mask)
|
| 319 |
+
image_processed = processor(images=image, return_tensors="pt").to(DEVICE)
|
| 320 |
+
pixel_values = image_processed['pixel_values']
|
| 321 |
+
outputs_full = model(pixel_values=pixel_values, **text_inputs)
|
| 322 |
+
logits_full = outputs_full.logits_per_image # Shape: (1, num_labels)
|
| 323 |
+
predicted_index_full = logits_full.argmax(dim=-1).item()
|
| 324 |
+
return predicted_index_full
|
| 325 |
+
except Exception:
|
| 326 |
+
# Return a random prediction if processing fails
|
| 327 |
+
return len(labels) - 1 # Return 'other' class
|
| 328 |
+
|
| 329 |
+
def get_accuracy(masks):
|
| 330 |
+
try:
|
| 331 |
+
with torch.no_grad(): # Disable gradient calculations for inference
|
| 332 |
+
correct = 0
|
| 333 |
+
for item in tqdm(dataset):
|
| 334 |
+
idx = item['idx']
|
| 335 |
+
if idx not in masks:
|
| 336 |
+
continue
|
| 337 |
+
coordinates = masks[idx]
|
| 338 |
+
|
| 339 |
+
# Check coordinates validity - if invalid, mark as incorrect
|
| 340 |
+
if not check_validity(coordinates):
|
| 341 |
+
print(f"Invalid coordinates for item {idx}")
|
| 342 |
+
continue # Skip this item, treating it as incorrect
|
| 343 |
+
|
| 344 |
+
image = item['image']
|
| 345 |
+
true_label_label = item['name'] # This is now the animal class name
|
| 346 |
+
|
| 347 |
+
# Store true label for confusion matrix
|
| 348 |
+
true_label_idx = label_to_index[true_label_label]
|
| 349 |
+
if predict_with_coordinates(image, coordinates) == true_label_idx:
|
| 350 |
+
correct += 1
|
| 351 |
+
return correct / len(masks)
|
| 352 |
+
except Exception:
|
| 353 |
+
return 0.0
|
| 354 |
+
|
| 355 |
+
def get_accuracy_by_sets(masks):
|
| 356 |
+
"""Calculate accuracy for A set (smaller) and B set (larger) with 30:70 split"""
|
| 357 |
+
try:
|
| 358 |
+
# Set random seed for reproducible shuffling
|
| 359 |
+
random.seed(42)
|
| 360 |
+
|
| 361 |
+
with torch.no_grad():
|
| 362 |
+
correct_a = 0
|
| 363 |
+
correct_b = 0
|
| 364 |
+
total_a = 0
|
| 365 |
+
total_b = 0
|
| 366 |
+
|
| 367 |
+
# First, collect all valid items that have masks
|
| 368 |
+
valid_items = []
|
| 369 |
+
for item in dataset:
|
| 370 |
+
idx = item['idx']
|
| 371 |
+
if idx in masks:
|
| 372 |
+
valid_items.append(item)
|
| 373 |
+
|
| 374 |
+
# Group items by class name for stratified sampling
|
| 375 |
+
items_by_class = {}
|
| 376 |
+
for item in valid_items:
|
| 377 |
+
class_name = item['name']
|
| 378 |
+
if class_name not in items_by_class:
|
| 379 |
+
items_by_class[class_name] = []
|
| 380 |
+
items_by_class[class_name].append(item)
|
| 381 |
+
|
| 382 |
+
# Stratified split: for each class, allocate 30% to A and 70% to B
|
| 383 |
+
set_a_items = []
|
| 384 |
+
set_b_items = []
|
| 385 |
+
|
| 386 |
+
for class_name, class_items in items_by_class.items():
|
| 387 |
+
# Shuffle items within each class for random stratified sampling
|
| 388 |
+
random.shuffle(class_items)
|
| 389 |
+
|
| 390 |
+
# Calculate split point for this class (30% to A, 70% to B)
|
| 391 |
+
split_point = int(len(class_items) * 0.3)
|
| 392 |
+
|
| 393 |
+
# Ensure at least one item goes to each set if possible
|
| 394 |
+
if len(class_items) >= 2:
|
| 395 |
+
if split_point == 0:
|
| 396 |
+
split_point = 1
|
| 397 |
+
elif split_point == len(class_items):
|
| 398 |
+
split_point = len(class_items) - 1
|
| 399 |
+
|
| 400 |
+
class_a_items = class_items[:split_point]
|
| 401 |
+
class_b_items = class_items[split_point:]
|
| 402 |
+
|
| 403 |
+
set_a_items.extend(class_a_items)
|
| 404 |
+
set_b_items.extend(class_b_items)
|
| 405 |
+
|
| 406 |
+
print(f"Class '{class_name}': {len(class_items)} total, {len(class_a_items)} to A, {len(class_b_items)} to B")
|
| 407 |
+
|
| 408 |
+
print(f"Stratified split: Set A has {len(set_a_items)} items, Set B has {len(set_b_items)} items")
|
| 409 |
+
|
| 410 |
+
# Verify class distribution
|
| 411 |
+
a_class_counts = {}
|
| 412 |
+
b_class_counts = {}
|
| 413 |
+
for item in set_a_items:
|
| 414 |
+
class_name = item['name']
|
| 415 |
+
a_class_counts[class_name] = a_class_counts.get(class_name, 0) + 1
|
| 416 |
+
for item in set_b_items:
|
| 417 |
+
class_name = item['name']
|
| 418 |
+
b_class_counts[class_name] = b_class_counts.get(class_name, 0) + 1
|
| 419 |
+
|
| 420 |
+
print("Class distribution verification:")
|
| 421 |
+
for class_name in sorted(labels):
|
| 422 |
+
a_count = a_class_counts.get(class_name, 0)
|
| 423 |
+
b_count = b_class_counts.get(class_name, 0)
|
| 424 |
+
total_count = a_count + b_count
|
| 425 |
+
if total_count > 0:
|
| 426 |
+
a_ratio = a_count / total_count
|
| 427 |
+
b_ratio = b_count / total_count
|
| 428 |
+
print(f" {class_name}: A={a_count} ({a_ratio:.1%}), B={b_count} ({b_ratio:.1%})")
|
| 429 |
+
|
| 430 |
+
# Process Set A
|
| 431 |
+
for item in tqdm(set_a_items, desc="Processing Set A"):
|
| 432 |
+
idx = item['idx']
|
| 433 |
+
coordinates = masks[idx]
|
| 434 |
+
|
| 435 |
+
# Check coordinates validity - if invalid, mark as incorrect
|
| 436 |
+
if not check_validity(coordinates):
|
| 437 |
+
total_a += 1
|
| 438 |
+
continue # Skip prediction, treating as incorrect
|
| 439 |
+
|
| 440 |
+
image = item['image']
|
| 441 |
+
true_label_label = item['name'] # This is now the animal class name
|
| 442 |
+
true_label_idx = label_to_index[true_label_label]
|
| 443 |
+
|
| 444 |
+
# Get prediction on masked image
|
| 445 |
+
masked_pred_idx = predict_with_coordinates(image, coordinates)
|
| 446 |
+
|
| 447 |
+
is_correct = masked_pred_idx == true_label_idx
|
| 448 |
+
|
| 449 |
+
total_a += 1
|
| 450 |
+
if is_correct:
|
| 451 |
+
correct_a += 1
|
| 452 |
+
|
| 453 |
+
# Process Set B
|
| 454 |
+
for item in tqdm(set_b_items, desc="Processing Set B"):
|
| 455 |
+
idx = item['idx']
|
| 456 |
+
coordinates = masks[idx]
|
| 457 |
+
|
| 458 |
+
# Check coordinates validity - if invalid, mark as incorrect
|
| 459 |
+
if not check_validity(coordinates):
|
| 460 |
+
total_b += 1
|
| 461 |
+
continue # Skip prediction, treating as incorrect
|
| 462 |
+
|
| 463 |
+
image = item['image']
|
| 464 |
+
true_label_label = item['name'] # This is now the animal class name
|
| 465 |
+
true_label_idx = label_to_index[true_label_label]
|
| 466 |
+
|
| 467 |
+
# Get prediction on masked image
|
| 468 |
+
masked_pred_idx = predict_with_coordinates(image, coordinates)
|
| 469 |
+
|
| 470 |
+
is_correct = masked_pred_idx == true_label_idx
|
| 471 |
+
|
| 472 |
+
total_b += 1
|
| 473 |
+
if is_correct:
|
| 474 |
+
correct_b += 1
|
| 475 |
+
|
| 476 |
+
accuracy_a = correct_a / total_a if total_a > 0 else 0
|
| 477 |
+
accuracy_b = correct_b / total_b if total_b > 0 else 0
|
| 478 |
+
|
| 479 |
+
print(f"Set A (30%): {total_a} samples, accuracy: {accuracy_a:.4f}")
|
| 480 |
+
print(f"Set B (70%): {total_b} samples, accuracy: {accuracy_b:.4f}")
|
| 481 |
+
|
| 482 |
+
return accuracy_a, accuracy_b
|
| 483 |
+
except Exception:
|
| 484 |
+
return 0.0, 0.0
|
| 485 |
+
|
| 486 |
+
def predict_without_mask(image):
|
| 487 |
+
"""Predict on original image without mask"""
|
| 488 |
+
try:
|
| 489 |
+
if image.mode != "RGB":
|
| 490 |
+
image = image.convert("RGB")
|
| 491 |
+
image_processed = processor(images=image, return_tensors="pt").to(DEVICE)
|
| 492 |
+
pixel_values = image_processed['pixel_values']
|
| 493 |
+
outputs_full = model(pixel_values=pixel_values, **text_inputs)
|
| 494 |
+
logits_full = outputs_full.logits_per_image
|
| 495 |
+
predicted_index_full = logits_full.argmax(dim=-1).item()
|
| 496 |
+
return predicted_index_full
|
| 497 |
+
except Exception:
|
| 498 |
+
return len(labels) - 1 # Return 'other' class
|
| 499 |
+
|
| 500 |
+
# Calculate accuracies for A and B sets
|
| 501 |
+
accuracy_a, accuracy_b = get_accuracy_by_sets(masks)
|
| 502 |
+
|
| 503 |
+
|
| 504 |
+
score_a = accuracy_a
|
| 505 |
+
score_b = accuracy_b
|
| 506 |
+
|
| 507 |
+
# Ensure scores are within valid bounds [0.0, 1.0]
|
| 508 |
+
if not (0.0 <= score_a <= 1.0) or not isinstance(score_a, (int, float)) or math.isnan(score_a) or math.isinf(score_a):
|
| 509 |
+
score_a = 0.0
|
| 510 |
+
if not (0.0 <= score_b <= 1.0) or not isinstance(score_b, (int, float)) or math.isnan(score_b) or math.isinf(score_b):
|
| 511 |
+
score_b = 0.0
|
| 512 |
+
|
| 513 |
+
print(f"Score A: {score_a}, Score B: {score_b}")
|
| 514 |
+
|
| 515 |
+
#----------calculate the score on the leaderboard------------#
|
| 516 |
+
score = {
|
| 517 |
+
"public_a": score_a,
|
| 518 |
+
"public_detail": {
|
| 519 |
+
"Score": score_a,
|
| 520 |
+
"Accuracy": accuracy_a,
|
| 521 |
+
},
|
| 522 |
+
"private_b": score_b,
|
| 523 |
+
"private_detail": {
|
| 524 |
+
"Score": score_b,
|
| 525 |
+
"Accuracy": accuracy_b,
|
| 526 |
+
},
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
ret_json = {
|
| 530 |
+
"status": True,
|
| 531 |
+
"score": score,
|
| 532 |
+
"msg": "Success!",
|
| 533 |
+
}
|
| 534 |
+
|
| 535 |
+
# Save the score to JSON file
|
| 536 |
+
with open(SCORE_OUTPUT_FILE, 'w') as f:
|
| 537 |
+
json.dump(ret_json, f, indent=2)
|
| 538 |
+
|
| 539 |
+
print(f"Score saved to {SCORE_OUTPUT_FILE}")
|
| 540 |
+
|
| 541 |
+
except Exception as e:
|
| 542 |
+
# Catch any unexpected errors during execution
|
| 543 |
+
write_error_score("Unexpected error during evaluation.")
|
| 544 |
+
exit(1)
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Radar/Radar.ipynb
ADDED
|
@@ -0,0 +1,564 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Radar/Radar.ipynb)"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"# Radar\n",
|
| 19 |
+
"\n",
|
| 20 |
+
"## 1. Problem Description \n",
|
| 21 |
+
"\n",
|
| 22 |
+
"Radar is a key technology in wireless communication, with widespread applications such as self-driving cars. It typically involves an antenna that transmits specific signals and receives their reflections from objects in the environment. By processing these signals, the system determines the angular direction, distance, and velocity of target objects.\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"In real-world applications, radar signal processing is challenging due to noise and reflections from non-target objects in the surroundings. For example, when attempting to detect pedestrians, the radar may also receive reflections from trees or other background objects, which can degrade accuracy. Your task is to use AI to analyze the signals received by the radar and identify the presence of a human at each position.\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"In this task, we provide an **indoor radar experiment dataset**, and your objective is to develop a model that performs **radar semantic segmentation**. \n",
|
| 27 |
+
"\n",
|
| 28 |
+
"\n",
|
| 29 |
+
"## 2. Dataset\n",
|
| 30 |
+
"\n",
|
| 31 |
+
"To measure objects surrounding a radar, the following key parameters are used:\n",
|
| 32 |
+
"\n",
|
| 33 |
+
"- **Range**: The straight-line distance between the radar and an object.\n",
|
| 34 |
+
"- **Azimuth**: The horizontal angle (left to right) between the radar and the object.\n",
|
| 35 |
+
"- **Elevation**: The vertical angle (up or down) of the object relative to the radar.\n",
|
| 36 |
+
"- **Velocity**: The speed at which the object is moving toward or away from the radar.\n",
|
| 37 |
+
"\n",
|
| 38 |
+
"<img src=\"./figs/Radar Fig 1.png\" width=\"300\">\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"The radar data is processed into multiple **heatmaps**, each encoding the **received signal strength** at various positions and directions.\n",
|
| 42 |
+
"\n",
|
| 43 |
+
"- **Static heatmaps** emphasize reflections from **stationary** objects.\n",
|
| 44 |
+
"- **Dynamic heatmaps** highlight changes caused by **moving** objects.\n",
|
| 45 |
+
"\n",
|
| 46 |
+
"When no object is present at a specific location, the signal consists mostly of background noise and appears weak. In contrast, reflections from an object increase signal intensity, enabling detection of the object.\n",
|
| 47 |
+
"\n",
|
| 48 |
+
"For example, the **static range-azimuth heatmap** represents signal strength across different distances (**range**) and horizontal angles (**azimuth**), mainly reflected by stationary objects.\n",
|
| 49 |
+
"\n",
|
| 50 |
+
"Each sample in the dataset is stored in a `.mat.pt` file as a tensor of shape $7 \\times 50 \\times 181$, where:\n",
|
| 51 |
+
"\n",
|
| 52 |
+
"- 7 is the number of maps (6 heatmaps + 1 semantic label map),\n",
|
| 53 |
+
"- 50 represents range bins (distance),\n",
|
| 54 |
+
"- 181 represents angular or velocity bins, covering angles from \\-90° to \\+90° in either the horizontal or vertical plane. You can assume that the velocity bins are also remapped from \\-90° to \\+90° for visualization consistency.\n",
|
| 55 |
+
"- each heatmap intensity value is normalized to [0, 1], representing received signal strength.\n",
|
| 56 |
+
"\n",
|
| 57 |
+
"The 6 heatmaps are structured as follows:\n",
|
| 58 |
+
"\n",
|
| 59 |
+
"- **Index 0**: Static range-azimuth heatmap\n",
|
| 60 |
+
"- **Index 1**: Dynamic range-azimuth heatmap\n",
|
| 61 |
+
"- **Index 2**: Static range-elevation heatmap\n",
|
| 62 |
+
"- **Index 3**: Dynamic range-elevation heatmap\n",
|
| 63 |
+
"- **Index 4**: Static range-velocity heatmap\n",
|
| 64 |
+
"- **Index 5**: Dynamic range-velocity heatmap\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"All values in heatmaps are **normalized**, so no unit conversion is required.\n",
|
| 67 |
+
"\n",
|
| 68 |
+
"The **map at Index 6** is the semantic label map, stored in range-azimuth format. \n",
|
| 69 |
+
"\n",
|
| 70 |
+
"- **-1**: Background (no target)\n",
|
| 71 |
+
"- **0**: Suitcase\n",
|
| 72 |
+
"- **1**: Chair\n",
|
| 73 |
+
"- **2**: Human\n",
|
| 74 |
+
"- **3**: Wall\n",
|
| 75 |
+
"\n",
|
| 76 |
+
"This is the visualization of 1.mat.pt in training_set:\n",
|
| 77 |
+
"\n",
|
| 78 |
+
"<img src=\"./figs/Radar Fig 2.png\" width=\"675\">\n",
|
| 79 |
+
"\n",
|
| 80 |
+
"Here is part of a sample from the dataset:\n",
|
| 81 |
+
"\n",
|
| 82 |
+
"<img src=\"./figs/Radar Fig 3.png\" width=\"675\">\n",
|
| 83 |
+
"\n",
|
| 84 |
+
"\n",
|
| 85 |
+
"Data scale: 1800 samples in the training set, 500 samples in the validation set, and 500 samples in the test set.\n",
|
| 86 |
+
"\n",
|
| 87 |
+
"## 3\\. Task\n",
|
| 88 |
+
"\n",
|
| 89 |
+
"Your task is to develop a model that takes the **first six heatmaps** (indices 0 to 5) as input, and predicts the **semantic label map** (index 6) as the output. The goal is to accurately identify what the target is(-1 to 3) at each location in the radar’s field of view.\n",
|
| 90 |
+
"\n",
|
| 91 |
+
"1. **Input**: A tensor of shape $6 \\times 50 \\times 181$, representing six radar heatmaps.\n",
|
| 92 |
+
"2. **Output**: A tensor of shape $50 \\times 181$, representing the target semantic label map.\n",
|
| 93 |
+
"\n",
|
| 94 |
+
"\n",
|
| 95 |
+
"## 4\\. Submission \n",
|
| 96 |
+
"\n",
|
| 97 |
+
"Please submit a file named `submission.ipynb`. The output is a zip file named \"submission.zip\", which contains two tables `submission_val.csv` and `submission_test.csv` corresponding to the prediction results of the validation set and the test set respectively.\n",
|
| 98 |
+
"\n",
|
| 99 |
+
"**Note:** The output table should have a header, the data in the table is not the actual solved data, it is only used as an example of the submission format.\n",
|
| 100 |
+
"\n",
|
| 101 |
+
"| filename | pixel_0 | pixel_1 | ... | pixel_9049 |\n",
|
| 102 |
+
"| :------: | :-----: | ------- | --- | ---------- |\n",
|
| 103 |
+
"| 1.mat.pt | -1 | -1 | ... | -1 |\n",
|
| 104 |
+
"| ... | ... | ... | ... | ... |\n",
|
| 105 |
+
"\n",
|
| 106 |
+
"## 5\\. Score\n",
|
| 107 |
+
"\n",
|
| 108 |
+
"The score is based on the **accuracy of label recognition**. Correctly identifying target points is weighted more heavily than correctly identifying background points. \n",
|
| 109 |
+
"\n",
|
| 110 |
+
"### Scoring Criteria: \n",
|
| 111 |
+
"\n",
|
| 112 |
+
"* Each correctly identified **background pixel** earns **1 point**. \n",
|
| 113 |
+
"\n",
|
| 114 |
+
"* Each correctly identified **non-background pixel** earns **50 points**. \n",
|
| 115 |
+
"\n",
|
| 116 |
+
"* The final score is normalized to a **0-1 point** by comparing it to the maximum possible score. \n",
|
| 117 |
+
"\n",
|
| 118 |
+
"### Formula:\n",
|
| 119 |
+
"$$\n",
|
| 120 |
+
"Score = \\frac{|C_{0,correct}| \\times 1 + |C_{1,correct}| \\times bonus}{|C_0| \\times 1 + |C_1| \\times bonus}\n",
|
| 121 |
+
"$$\n",
|
| 122 |
+
"where:\n",
|
| 123 |
+
"\n",
|
| 124 |
+
"$$\n",
|
| 125 |
+
"\\begin{aligned}\n",
|
| 126 |
+
"I &= \\{1, 2, \\dots, 50\\times 181\\}\\\\\n",
|
| 127 |
+
"C_0 &= \\{i \\in I \\mid y_i = -1\\}\\\\\n",
|
| 128 |
+
"C_1 &= \\{i \\in I \\mid y_i \\neq -1\\}\\\\\n",
|
| 129 |
+
"C_{0,correct} &= \\{i \\in C_0 \\mid p_i = y_i\\}\\\\\n",
|
| 130 |
+
"C_{1,correct} &= \\{i \\in C_1 \\mid p_i = y_i\\}\\\\\n",
|
| 131 |
+
"\\end{aligned}\n",
|
| 132 |
+
"$$\n",
|
| 133 |
+
"\n",
|
| 134 |
+
"\n",
|
| 135 |
+
"### Example\n",
|
| 136 |
+
"\n",
|
| 137 |
+
"For a $3\\times3$ heatmap, assume the Ground Truth is:\n",
|
| 138 |
+
"\n",
|
| 139 |
+
"$$\n",
|
| 140 |
+
"\\begin{bmatrix}\n",
|
| 141 |
+
"-1 & -1 & -1 \\\\\n",
|
| 142 |
+
"1 & 2 & 3 \\\\\n",
|
| 143 |
+
"-1 & -1 & -1\n",
|
| 144 |
+
"\\end{bmatrix}\n",
|
| 145 |
+
"$$\n",
|
| 146 |
+
"\n",
|
| 147 |
+
"The intenteded result is:\n",
|
| 148 |
+
"\n",
|
| 149 |
+
"$$\n",
|
| 150 |
+
"\\begin{bmatrix}\n",
|
| 151 |
+
"-1 & 1 & -1 \\\\\n",
|
| 152 |
+
"-1 & 2 & -1 \\\\\n",
|
| 153 |
+
"-1 & 3 & -1\n",
|
| 154 |
+
"\\end{bmatrix}\n",
|
| 155 |
+
"$$\n",
|
| 156 |
+
"\n",
|
| 157 |
+
"Then there are four correctly identified `-1` and one correctly identified `2`. Your score is 4 + 50 = 54 points. The maximum possible score is 6 + 50 * 3 = 156, that is, the score for six background pixels and three non-background pixels. Your normalized score is 54 / 156 = 0.346.\n",
|
| 158 |
+
"\n",
|
| 159 |
+
"$$\n",
|
| 160 |
+
"Score = \\frac{4 \\times 1 + 1 \\times 50}{6 \\times 1 + 3 \\times 50}=0.346\n",
|
| 161 |
+
"$$\n",
|
| 162 |
+
"\n",
|
| 163 |
+
"## 6. Baseline and Training Set\n",
|
| 164 |
+
"\n",
|
| 165 |
+
"- Below you can find the baseline solution.\n",
|
| 166 |
+
"- The dataset is in `training_set` folder.\n",
|
| 167 |
+
"- The highest score by the Scientific Committee for this task is 0.90 in Leaderboard B, this score is used for score unification.\n",
|
| 168 |
+
"- The baseline score by the Scientific Committee for this task is 0.67 in Leaderboard B, this score is used for score unification."
|
| 169 |
+
]
|
| 170 |
+
},
|
| 171 |
+
{
|
| 172 |
+
"cell_type": "markdown",
|
| 173 |
+
"metadata": {},
|
| 174 |
+
"source": [
|
| 175 |
+
"### Data Loading"
|
| 176 |
+
]
|
| 177 |
+
},
|
| 178 |
+
{
|
| 179 |
+
"cell_type": "code",
|
| 180 |
+
"execution_count": null,
|
| 181 |
+
"metadata": {},
|
| 182 |
+
"outputs": [],
|
| 183 |
+
"source": [
|
| 184 |
+
"import random\n",
|
| 185 |
+
"import numpy as np\n",
|
| 186 |
+
"import torch\n",
|
| 187 |
+
"\n",
|
| 188 |
+
"seed = 42\n",
|
| 189 |
+
"\n",
|
| 190 |
+
"random.seed(seed) # Python built-in random\n",
|
| 191 |
+
"np.random.seed(seed) # NumPy\n",
|
| 192 |
+
"torch.manual_seed(seed) # PyTorch (CPU)\n",
|
| 193 |
+
"torch.cuda.manual_seed(seed) # PyTorch (single GPU)\n",
|
| 194 |
+
"torch.cuda.manual_seed_all(seed) # PyTorch (all GPUs)\n",
|
| 195 |
+
"\n",
|
| 196 |
+
"# Ensures deterministic behavior\n",
|
| 197 |
+
"torch.backends.cudnn.deterministic = True\n",
|
| 198 |
+
"torch.backends.cudnn.benchmark = False"
|
| 199 |
+
]
|
| 200 |
+
},
|
| 201 |
+
{
|
| 202 |
+
"cell_type": "code",
|
| 203 |
+
"execution_count": null,
|
| 204 |
+
"metadata": {},
|
| 205 |
+
"outputs": [],
|
| 206 |
+
"source": [
|
| 207 |
+
"import os\n",
|
| 208 |
+
"import torch\n",
|
| 209 |
+
"from torch.utils.data import Dataset, DataLoader\n",
|
| 210 |
+
"from sklearn.model_selection import train_test_split\n",
|
| 211 |
+
"\n",
|
| 212 |
+
"class CustomDataset(Dataset):\n",
|
| 213 |
+
" def __init__(self, file_paths, transform=None):\n",
|
| 214 |
+
" self.file_paths = file_paths\n",
|
| 215 |
+
" self.transform = transform\n",
|
| 216 |
+
" self.file_names = [os.path.basename(path) for path in file_paths]\n",
|
| 217 |
+
"\n",
|
| 218 |
+
" def __len__(self):\n",
|
| 219 |
+
" return len(self.file_paths)\n",
|
| 220 |
+
"\n",
|
| 221 |
+
" def __getitem__(self, idx):\n",
|
| 222 |
+
" data = torch.load(self.file_paths[idx], weights_only=True)\n",
|
| 223 |
+
" \n",
|
| 224 |
+
" images = data[:6] \n",
|
| 225 |
+
" labels = data[6] \n",
|
| 226 |
+
" \n",
|
| 227 |
+
" images = images.float() \n",
|
| 228 |
+
" labels = labels.long() \n",
|
| 229 |
+
" labels = labels + 1\n",
|
| 230 |
+
"\n",
|
| 231 |
+
" if self.transform:\n",
|
| 232 |
+
" images = self.transform(images)\n",
|
| 233 |
+
" labels = self.transform(labels)\n",
|
| 234 |
+
" \n",
|
| 235 |
+
" return images, labels, self.file_names[idx]\n",
|
| 236 |
+
"\n",
|
| 237 |
+
"class CustomDataset_test(Dataset):\n",
|
| 238 |
+
" def __init__(self, file_paths, transform=None):\n",
|
| 239 |
+
" self.file_paths = file_paths\n",
|
| 240 |
+
" self.transform = transform\n",
|
| 241 |
+
" self.file_names = [os.path.basename(path) for path in file_paths]\n",
|
| 242 |
+
"\n",
|
| 243 |
+
" def __len__(self):\n",
|
| 244 |
+
" return len(self.file_paths)\n",
|
| 245 |
+
"\n",
|
| 246 |
+
" def __getitem__(self, idx):\n",
|
| 247 |
+
" data = torch.load(self.file_paths[idx], weights_only=True)\n",
|
| 248 |
+
" \n",
|
| 249 |
+
" images = data[:6] \n",
|
| 250 |
+
" \n",
|
| 251 |
+
" images = images.float() \n",
|
| 252 |
+
"\n",
|
| 253 |
+
" if self.transform:\n",
|
| 254 |
+
" images = self.transform(images)\n",
|
| 255 |
+
" \n",
|
| 256 |
+
" return images, self.file_names[idx]\n",
|
| 257 |
+
"\n",
|
| 258 |
+
"def generate_file_paths(base_path):\n",
|
| 259 |
+
" file_paths = []\n",
|
| 260 |
+
" for frame in os.listdir(base_path):\n",
|
| 261 |
+
" frame_path = os.path.join(base_path, frame)\n",
|
| 262 |
+
" if frame_path.endswith('.mat.pt'):\n",
|
| 263 |
+
" file_paths.append(frame_path)\n",
|
| 264 |
+
" return [path for path in file_paths if os.path.exists(path)]\n",
|
| 265 |
+
"\n",
|
| 266 |
+
"def load_data(base_path, batch_size=4, num_workers=2, test_size=0.2):\n",
|
| 267 |
+
" file_paths = generate_file_paths(base_path)\n",
|
| 268 |
+
" \n",
|
| 269 |
+
" train_paths, test_paths = train_test_split(file_paths, test_size=test_size, random_state=42)\n",
|
| 270 |
+
" \n",
|
| 271 |
+
" train_dataset = CustomDataset(file_paths=train_paths)\n",
|
| 272 |
+
" test_dataset = CustomDataset(file_paths=test_paths)\n",
|
| 273 |
+
" \n",
|
| 274 |
+
" train_loader = DataLoader(\n",
|
| 275 |
+
" train_dataset, \n",
|
| 276 |
+
" batch_size=batch_size, \n",
|
| 277 |
+
" shuffle=True, \n",
|
| 278 |
+
" num_workers=num_workers, \n",
|
| 279 |
+
" drop_last=True\n",
|
| 280 |
+
" )\n",
|
| 281 |
+
" \n",
|
| 282 |
+
" test_loader = DataLoader(\n",
|
| 283 |
+
" test_dataset, \n",
|
| 284 |
+
" batch_size=batch_size, \n",
|
| 285 |
+
" shuffle=False, \n",
|
| 286 |
+
" num_workers=num_workers, \n",
|
| 287 |
+
" drop_last=True\n",
|
| 288 |
+
" )\n",
|
| 289 |
+
" \n",
|
| 290 |
+
" return train_loader, test_loader"
|
| 291 |
+
]
|
| 292 |
+
},
|
| 293 |
+
{
|
| 294 |
+
"cell_type": "markdown",
|
| 295 |
+
"metadata": {},
|
| 296 |
+
"source": [
|
| 297 |
+
"### Model Definition and Training"
|
| 298 |
+
]
|
| 299 |
+
},
|
| 300 |
+
{
|
| 301 |
+
"cell_type": "code",
|
| 302 |
+
"execution_count": null,
|
| 303 |
+
"metadata": {},
|
| 304 |
+
"outputs": [],
|
| 305 |
+
"source": [
|
| 306 |
+
"import torch\n",
|
| 307 |
+
"import torch.nn as nn\n",
|
| 308 |
+
"import torch.optim as optim\n",
|
| 309 |
+
"\n",
|
| 310 |
+
"class MyModel(nn.Module):\n",
|
| 311 |
+
" def __init__(self):\n",
|
| 312 |
+
" super(MyModel, self).__init__()\n",
|
| 313 |
+
" self.conv1 = nn.Conv2d(in_channels=6, out_channels=16, kernel_size=3, padding=1) \n",
|
| 314 |
+
" self.conv2 = nn.Conv2d(in_channels=16, out_channels=32, kernel_size=3, padding=1) \n",
|
| 315 |
+
" self.conv3 = nn.Conv2d(in_channels=32, out_channels=5, kernel_size=3, padding=1)\n",
|
| 316 |
+
"\n",
|
| 317 |
+
" self.relu = nn.ReLU()\n",
|
| 318 |
+
"\n",
|
| 319 |
+
" def forward(self, x):\n",
|
| 320 |
+
" x = self.relu(self.conv1(x))\n",
|
| 321 |
+
" x = self.relu(self.conv2(x))\n",
|
| 322 |
+
" x = self.conv3(x) \n",
|
| 323 |
+
" return x\n",
|
| 324 |
+
"\n",
|
| 325 |
+
"def train(model, train_loader, test_loader, optimizer, criterion, num_epochs=100):\n",
|
| 326 |
+
" train_losses = []\n",
|
| 327 |
+
" val_losses = []\n",
|
| 328 |
+
" \n",
|
| 329 |
+
" for epoch in range(num_epochs):\n",
|
| 330 |
+
" model.train()\n",
|
| 331 |
+
" epoch_loss = 0.0\n",
|
| 332 |
+
" batch_count = 0\n",
|
| 333 |
+
" \n",
|
| 334 |
+
" for images, labels, _ in train_loader:\n",
|
| 335 |
+
" images = images.cuda() if torch.cuda.is_available() else images\n",
|
| 336 |
+
" labels = labels.cuda() if torch.cuda.is_available() else labels\n",
|
| 337 |
+
" \n",
|
| 338 |
+
" outputs = model(images)\n",
|
| 339 |
+
" outputs = outputs.view(outputs.size(0), outputs.size(1), -1) # [B, C, H*W]\n",
|
| 340 |
+
" labels = labels.view(labels.size(0), -1) # [B, H*W]\n",
|
| 341 |
+
" loss = criterion(outputs, labels)\n",
|
| 342 |
+
" \n",
|
| 343 |
+
" optimizer.zero_grad()\n",
|
| 344 |
+
" loss.backward()\n",
|
| 345 |
+
" optimizer.step()\n",
|
| 346 |
+
" \n",
|
| 347 |
+
" epoch_loss += loss.item()\n",
|
| 348 |
+
" batch_count += 1\n",
|
| 349 |
+
" \n",
|
| 350 |
+
" avg_train_loss = epoch_loss / batch_count\n",
|
| 351 |
+
" train_losses.append(avg_train_loss)\n",
|
| 352 |
+
" \n",
|
| 353 |
+
" model.eval()\n",
|
| 354 |
+
" val_loss = 0.0\n",
|
| 355 |
+
" val_batch_count = 0\n",
|
| 356 |
+
" \n",
|
| 357 |
+
" with torch.no_grad():\n",
|
| 358 |
+
" for images, labels, _ in test_loader:\n",
|
| 359 |
+
" images = images.cuda() if torch.cuda.is_available() else images\n",
|
| 360 |
+
" labels = labels.cuda() if torch.cuda.is_available() else labels\n",
|
| 361 |
+
" \n",
|
| 362 |
+
" outputs = model(images)\n",
|
| 363 |
+
" outputs = outputs.view(outputs.size(0), outputs.size(1), -1)\n",
|
| 364 |
+
" labels = labels.view(labels.size(0), -1)\n",
|
| 365 |
+
" loss = criterion(outputs, labels)\n",
|
| 366 |
+
" \n",
|
| 367 |
+
" val_loss += loss.item()\n",
|
| 368 |
+
" val_batch_count += 1\n",
|
| 369 |
+
" \n",
|
| 370 |
+
" avg_val_loss = val_loss / val_batch_count\n",
|
| 371 |
+
" val_losses.append(avg_val_loss)\n",
|
| 372 |
+
" \n",
|
| 373 |
+
" if (epoch+1) % 2 == 0:\n",
|
| 374 |
+
" print(f'Epoch [{epoch+1}/{num_epochs}], '\n",
|
| 375 |
+
" f'Train Loss: {avg_train_loss:.4f}, '\n",
|
| 376 |
+
" f'Val Loss: {avg_val_loss:.4f}')\n",
|
| 377 |
+
" \n",
|
| 378 |
+
" return train_losses, val_losses\n",
|
| 379 |
+
"TRAIN_PATH = \"./\"\n",
|
| 380 |
+
"# The training set is deployed automatically in the testing machine. \n",
|
| 381 |
+
"# You notebook can access the TRAIN_PATH even if you do not mount it along with notebook.\n",
|
| 382 |
+
"data_path = TRAIN_PATH + 'training_set'\n",
|
| 383 |
+
"\n",
|
| 384 |
+
"train_loader, test_loader = load_data(\n",
|
| 385 |
+
" base_path=data_path,\n",
|
| 386 |
+
" batch_size=4, \n",
|
| 387 |
+
" num_workers=2,\n",
|
| 388 |
+
" test_size=0.2\n",
|
| 389 |
+
")\n",
|
| 390 |
+
"\n",
|
| 391 |
+
"model = MyModel()\n",
|
| 392 |
+
"if torch.cuda.is_available():\n",
|
| 393 |
+
" model = model.cuda()\n",
|
| 394 |
+
"\n",
|
| 395 |
+
"criterion = nn.CrossEntropyLoss()\n",
|
| 396 |
+
"optimizer = optim.Adam(model.parameters(), lr=0.001) \n",
|
| 397 |
+
"\n",
|
| 398 |
+
"train_losses, val_losses = train(\n",
|
| 399 |
+
" model=model,\n",
|
| 400 |
+
" train_loader=train_loader,\n",
|
| 401 |
+
" test_loader=test_loader,\n",
|
| 402 |
+
" optimizer=optimizer,\n",
|
| 403 |
+
" criterion=criterion,\n",
|
| 404 |
+
" num_epochs=40\n",
|
| 405 |
+
")"
|
| 406 |
+
]
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
"cell_type": "markdown",
|
| 410 |
+
"metadata": {},
|
| 411 |
+
"source": [
|
| 412 |
+
"### Generate CSV for Submission"
|
| 413 |
+
]
|
| 414 |
+
},
|
| 415 |
+
{
|
| 416 |
+
"cell_type": "code",
|
| 417 |
+
"execution_count": null,
|
| 418 |
+
"metadata": {},
|
| 419 |
+
"outputs": [],
|
| 420 |
+
"source": [
|
| 421 |
+
"# Run inference on validation set and testing set\n",
|
| 422 |
+
"from torch.utils.data import DataLoader\n",
|
| 423 |
+
"import pandas as pd\n",
|
| 424 |
+
"\n",
|
| 425 |
+
"def run_inference(model, data_loader):\n",
|
| 426 |
+
" \"\"\"Run inference and return predictions with filenames\"\"\"\n",
|
| 427 |
+
" model.eval()\n",
|
| 428 |
+
" predictions = []\n",
|
| 429 |
+
" filenames = []\n",
|
| 430 |
+
" \n",
|
| 431 |
+
" with torch.no_grad():\n",
|
| 432 |
+
" for images, file_names in data_loader:\n",
|
| 433 |
+
" images = images.cuda() if torch.cuda.is_available() else images\n",
|
| 434 |
+
" \n",
|
| 435 |
+
" outputs = model(images)\n",
|
| 436 |
+
" preds = torch.argmax(outputs, dim=1)\n",
|
| 437 |
+
" \n",
|
| 438 |
+
" # Convert predictions back to original label range [-1, 3]\n",
|
| 439 |
+
" preds = preds - 1\n",
|
| 440 |
+
" \n",
|
| 441 |
+
" # Flatten predictions for each sample\n",
|
| 442 |
+
" for i, pred in enumerate(preds):\n",
|
| 443 |
+
" predictions.append(pred.cpu().numpy().flatten())\n",
|
| 444 |
+
" filenames.append(file_names[i])\n",
|
| 445 |
+
" \n",
|
| 446 |
+
" return predictions, filenames\n",
|
| 447 |
+
"\n",
|
| 448 |
+
"#DATA_PATH is the secret environment variable to point the address of the validation set and test set on the testing machine. \n",
|
| 449 |
+
"#You cannot access this address locally.\n",
|
| 450 |
+
"if os.environ.get('DATA_PATH'):\n",
|
| 451 |
+
" DATA_PATH = os.environ.get(\"DATA_PATH\") + \"/\" \n",
|
| 452 |
+
"else:\n",
|
| 453 |
+
" DATA_PATH = \"Solution/\" # Fallback for local testing\n",
|
| 454 |
+
"# Load validation set\n",
|
| 455 |
+
"val_paths = generate_file_paths(DATA_PATH + 'validation_set')\n",
|
| 456 |
+
"val_dataset = CustomDataset_test(file_paths=val_paths)\n",
|
| 457 |
+
"val_loader = DataLoader(\n",
|
| 458 |
+
" val_dataset,\n",
|
| 459 |
+
" batch_size=1,\n",
|
| 460 |
+
" shuffle=False,\n",
|
| 461 |
+
" num_workers=2\n",
|
| 462 |
+
")\n",
|
| 463 |
+
"\n",
|
| 464 |
+
"# Load testing set\n",
|
| 465 |
+
"test_paths = generate_file_paths(DATA_PATH + 'test_set')\n",
|
| 466 |
+
"test_dataset = CustomDataset_test(file_paths=test_paths)\n",
|
| 467 |
+
"test_loader = DataLoader(\n",
|
| 468 |
+
" test_dataset,\n",
|
| 469 |
+
" batch_size=1,\n",
|
| 470 |
+
" shuffle=False,\n",
|
| 471 |
+
" num_workers=2\n",
|
| 472 |
+
")\n",
|
| 473 |
+
"\n",
|
| 474 |
+
"# Run inference on validation set\n",
|
| 475 |
+
"print(\"Running inference on validation set...\")\n",
|
| 476 |
+
"val_predictions, val_filenames = run_inference(model, val_loader)\n",
|
| 477 |
+
"\n",
|
| 478 |
+
"# Save validation results to CSV\n",
|
| 479 |
+
"val_results = []\n",
|
| 480 |
+
"for filename, pred in zip(val_filenames, val_predictions):\n",
|
| 481 |
+
" # Create a row with filename and flattened predictions\n",
|
| 482 |
+
" row = {'filename': filename}\n",
|
| 483 |
+
" for i, p in enumerate(pred):\n",
|
| 484 |
+
" row[f'pixel_{i}'] = p\n",
|
| 485 |
+
" val_results.append(row)\n",
|
| 486 |
+
"\n",
|
| 487 |
+
"val_df = pd.DataFrame(val_results)\n",
|
| 488 |
+
"val_df.to_csv('submission_val.csv', index=False)\n",
|
| 489 |
+
"print(f\"Validation results saved to output_validation.csv with shape: {val_df.shape}\")\n",
|
| 490 |
+
"\n",
|
| 491 |
+
"# Run inference on testing set\n",
|
| 492 |
+
"print(\"Running inference on testing set...\")\n",
|
| 493 |
+
"test_predictions, test_filenames = run_inference(model, test_loader)\n",
|
| 494 |
+
"\n",
|
| 495 |
+
"# Save testing results to CSV\n",
|
| 496 |
+
"test_results = []\n",
|
| 497 |
+
"for filename, pred in zip(test_filenames, test_predictions):\n",
|
| 498 |
+
" # Create a row with filename and flattened predictions\n",
|
| 499 |
+
" row = {'filename': filename}\n",
|
| 500 |
+
" for i, p in enumerate(pred):\n",
|
| 501 |
+
" row[f'pixel_{i}'] = p\n",
|
| 502 |
+
" test_results.append(row)\n",
|
| 503 |
+
"\n",
|
| 504 |
+
"test_df = pd.DataFrame(test_results)\n",
|
| 505 |
+
"test_df.to_csv('submission_test.csv', index=False)\n",
|
| 506 |
+
"print(f\"Testing results saved to output_testing.csv with shape: {test_df.shape}\")\n",
|
| 507 |
+
"\n",
|
| 508 |
+
"print(\"\\nInference completed! Results saved to:\")\n",
|
| 509 |
+
"print(\"- submission_val.csv (for validation set leaderboard)\")\n",
|
| 510 |
+
"print(\"- submission_test.csv (for testing set leaderboard)\")"
|
| 511 |
+
]
|
| 512 |
+
},
|
| 513 |
+
{
|
| 514 |
+
"cell_type": "markdown",
|
| 515 |
+
"metadata": {},
|
| 516 |
+
"source": [
|
| 517 |
+
"### Create .zip File"
|
| 518 |
+
]
|
| 519 |
+
},
|
| 520 |
+
{
|
| 521 |
+
"cell_type": "code",
|
| 522 |
+
"execution_count": null,
|
| 523 |
+
"metadata": {},
|
| 524 |
+
"outputs": [],
|
| 525 |
+
"source": [
|
| 526 |
+
"import zipfile\n",
|
| 527 |
+
"import os\n",
|
| 528 |
+
"\n",
|
| 529 |
+
"# Define the files to zip and the zip file name.\n",
|
| 530 |
+
"files_to_zip = ['submission_val.csv', 'submission_test.csv']\n",
|
| 531 |
+
"zip_filename = 'submission.zip'\n",
|
| 532 |
+
"\n",
|
| 533 |
+
"# Create a zip file\n",
|
| 534 |
+
"with zipfile.ZipFile(zip_filename, 'w') as zipf:\n",
|
| 535 |
+
" for file in files_to_zip:\n",
|
| 536 |
+
" # Add the file to the zip fil\n",
|
| 537 |
+
" zipf.write(file, os.path.basename(file))\n",
|
| 538 |
+
"\n",
|
| 539 |
+
"print(f'{zip_filename} Created successfully!')"
|
| 540 |
+
]
|
| 541 |
+
}
|
| 542 |
+
],
|
| 543 |
+
"metadata": {
|
| 544 |
+
"kernelspec": {
|
| 545 |
+
"display_name": "Python 3 (ipykernel)",
|
| 546 |
+
"language": "python",
|
| 547 |
+
"name": "python3"
|
| 548 |
+
},
|
| 549 |
+
"language_info": {
|
| 550 |
+
"codemirror_mode": {
|
| 551 |
+
"name": "ipython",
|
| 552 |
+
"version": 3
|
| 553 |
+
},
|
| 554 |
+
"file_extension": ".py",
|
| 555 |
+
"mimetype": "text/x-python",
|
| 556 |
+
"name": "python",
|
| 557 |
+
"nbconvert_exporter": "python",
|
| 558 |
+
"pygments_lexer": "ipython3",
|
| 559 |
+
"version": "3.12.9"
|
| 560 |
+
}
|
| 561 |
+
},
|
| 562 |
+
"nbformat": 4,
|
| 563 |
+
"nbformat_minor": 4
|
| 564 |
+
}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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Restroom/Restroom.ipynb)"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"# Restroom Icon Matching\n",
|
| 19 |
+
"\n",
|
| 20 |
+
"## 1. Problem Description\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"This task focuses on training a model to learn the relationship between **male and female restroom icons from the same restroom**. Based on labeled training data, you are required to train a matching model that, given a query image, finds its **cross-gender counterpart** (e.g., match a male icon in its cropped image to its female counterpart in its original image), under the constraint that both icons come from the **same restroom**.\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"For example, for a query image (i.e., a male icon in cropped image) shown below in Fig1, its corresponding counterpart is shown in Fig2 (i.e., a female icon in original image which is from the same restroom).\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"| <img src=\"./figs/Restroom Fig 1.png\" height=\"200\"> | <img src=\"./figs/Restroom Fig 2.png\" height=\"200\"> |\n",
|
| 27 |
+
"| ------------------------------------------------------------ | ------------------------------------------------------------ |\n",
|
| 28 |
+
"\n",
|
| 29 |
+
"\n",
|
| 30 |
+
"\n",
|
| 31 |
+
"## 2. Dataset\n",
|
| 32 |
+
"\n",
|
| 33 |
+
"**(1) Training Set:** \n",
|
| 34 |
+
"\n",
|
| 35 |
+
"Used for model training. Directory structure:\n",
|
| 36 |
+
"\n",
|
| 37 |
+
"```bash\n",
|
| 38 |
+
"train/\n",
|
| 39 |
+
"├── crop/ # Cropped icons\n",
|
| 40 |
+
"│ ├── female/ 1.png, 2.png, ...\n",
|
| 41 |
+
"│ └── male/\n",
|
| 42 |
+
"└── orig/ # Original icons\n",
|
| 43 |
+
" ├── female/\n",
|
| 44 |
+
" └── male/\n",
|
| 45 |
+
"```\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"Each subfolder contains icons named from `1.png` to `82.png`, where the number indicates the restroom ID. For each restroom, there are four images (note that four images from the same restroom will share one same unique id across all four subfolders):\n",
|
| 48 |
+
"\n",
|
| 49 |
+
"- `crop/female/i.png` → Cropped female icon \n",
|
| 50 |
+
"- `crop/male/i.png` → Cropped male icon \n",
|
| 51 |
+
"- `orig/female/i.png` → Original female icon \n",
|
| 52 |
+
"- `orig/male/i.png` → Original male icon \n",
|
| 53 |
+
"\n",
|
| 54 |
+
"**(2) Validation Set and Test Set:** \n",
|
| 55 |
+
"\n",
|
| 56 |
+
"Either the validation set (test_a) or the test set (test_b) contains two subfolders:\n",
|
| 57 |
+
"\n",
|
| 58 |
+
"```bash\n",
|
| 59 |
+
"test_a/ (or test_b/)\n",
|
| 60 |
+
"├── query/ # Cropped icons to be matched\n",
|
| 61 |
+
"└── gallery/ # Candidate original icons\n",
|
| 62 |
+
"```\n",
|
| 63 |
+
"\n",
|
| 64 |
+
"- `query/`: **cropped** icons that need to be matched. \n",
|
| 65 |
+
"- `gallery/`: pool of **original** icons to match from. \n",
|
| 66 |
+
"- Note that:\n",
|
| 67 |
+
" - Unlike the training split, the filenames in `query/` and `gallery/` are independently numbered and shuffled, which means that matching cannot rely on the ids\n",
|
| 68 |
+
" - For each cropped icon in `query/` there are exactly two originals in `gallery/` (one male, one female from the same restroom), which means $\\text{len}(\\text{gallery})=2 * \\text{len}(\\text{query})$\n",
|
| 69 |
+
"- All images are in `.png` format. \n",
|
| 70 |
+
"- The validation set has $10$ images in its `query/` folder, and the test set has $30$ images in its `query/` folder.\n",
|
| 71 |
+
"\n",
|
| 72 |
+
"## 3. Task\n",
|
| 73 |
+
"\n",
|
| 74 |
+
"For each image in the `query/` folder, predict the image in `gallery/` that:\n",
|
| 75 |
+
"- Is of the **opposite gender**, and\n",
|
| 76 |
+
"- Comes from the **same restroom**\n",
|
| 77 |
+
"\n",
|
| 78 |
+
"This matching should be accomplished **using your trained model**. \n",
|
| 79 |
+
"\n",
|
| 80 |
+
"## 4. Submission Requirements\n",
|
| 81 |
+
"\n",
|
| 82 |
+
"You must submit a notebook named `submission.ipynb`, which should include:\n",
|
| 83 |
+
"\n",
|
| 84 |
+
"- Model training process (using `train/` data) \n",
|
| 85 |
+
"- Matching process for both test sets (`test_a/` and `test_b/`) \n",
|
| 86 |
+
"- The notebook must output two `.npy` files:\n",
|
| 87 |
+
"```bash\n",
|
| 88 |
+
"submission_a.npy # Matching results for validation set (test_a).\n",
|
| 89 |
+
"submission_b.npy # Matching results for test set (test_b).\n",
|
| 90 |
+
"```\n",
|
| 91 |
+
"\n",
|
| 92 |
+
"Each npz file is a one-dimensional array with a size equal to the number of queries, and each value in the array corresponds to the image ID in the gallery.\n",
|
| 93 |
+
"\n",
|
| 94 |
+
"For example, one valid `submission_a.npy` may looks like this:\n",
|
| 95 |
+
"<img src=\"./figs/Restroom Fig 3.png\" width=\"300\">\n",
|
| 96 |
+
"\n",
|
| 97 |
+
"You can also find an example output format in [baseline.ipynb](https://ioai.bohrium.com/notebooks/81153159178).\n",
|
| 98 |
+
"\n",
|
| 99 |
+
"## 5. Score\n",
|
| 100 |
+
"\n",
|
| 101 |
+
"- If the submission finishes within the time limit, the score is calculated as: \n",
|
| 102 |
+
" $$\n",
|
| 103 |
+
" \\text{Score} = \\frac{\\text{Number of correct matches}}{\\text{Total queries}}\n",
|
| 104 |
+
" $$\n",
|
| 105 |
+
" \n",
|
| 106 |
+
" which will be a float number between $0.0$ and $1.0$ (inclusive).\n",
|
| 107 |
+
" \n",
|
| 108 |
+
"- Submissions that exceed the time limit will receive a score of **0**.\n",
|
| 109 |
+
"\n",
|
| 110 |
+
"## 6. Baseline and Training Set\n",
|
| 111 |
+
"\n",
|
| 112 |
+
"- Below you can find the baseline solution.\n",
|
| 113 |
+
"- The dataset is in `training_set` folder. \n",
|
| 114 |
+
"- The highest score by the Scientific Committee for this task is $0.90$ in Leaderboard B, this score is used for score unification.\n",
|
| 115 |
+
"- The baseline score by the Scientific Committee for this task is $0.77$ in Leaderboard B, this score is used for score unification.\n"
|
| 116 |
+
]
|
| 117 |
+
},
|
| 118 |
+
{
|
| 119 |
+
"cell_type": "code",
|
| 120 |
+
"execution_count": null,
|
| 121 |
+
"metadata": {},
|
| 122 |
+
"outputs": [],
|
| 123 |
+
"source": [
|
| 124 |
+
"import random\n",
|
| 125 |
+
"import numpy as np\n",
|
| 126 |
+
"import torch\n",
|
| 127 |
+
"from pathlib import Path\n",
|
| 128 |
+
"from tqdm import tqdm\n",
|
| 129 |
+
"import os\n",
|
| 130 |
+
"from PIL import Image\n",
|
| 131 |
+
"import torch.nn.functional as F\n",
|
| 132 |
+
"\n",
|
| 133 |
+
"seed = 42\n",
|
| 134 |
+
"\n",
|
| 135 |
+
"random.seed(seed) # Python built-in random\n",
|
| 136 |
+
"np.random.seed(seed) # NumPy\n",
|
| 137 |
+
"torch.manual_seed(seed) # PyTorch (CPU)\n",
|
| 138 |
+
"torch.cuda.manual_seed(seed) # PyTorch (single GPU)\n",
|
| 139 |
+
"torch.cuda.manual_seed_all(seed) # PyTorch (all GPUs)\n",
|
| 140 |
+
"\n",
|
| 141 |
+
"# Ensures deterministic behavior\n",
|
| 142 |
+
"torch.backends.cudnn.deterministic = True\n",
|
| 143 |
+
"torch.backends.cudnn.benchmark = False"
|
| 144 |
+
]
|
| 145 |
+
},
|
| 146 |
+
{
|
| 147 |
+
"cell_type": "code",
|
| 148 |
+
"execution_count": null,
|
| 149 |
+
"metadata": {
|
| 150 |
+
"id": "I5GTjH_JDD6-"
|
| 151 |
+
},
|
| 152 |
+
"outputs": [],
|
| 153 |
+
"source": [
|
| 154 |
+
"def sort_paths_by_number(path_list):\n",
|
| 155 |
+
" \"\"\"\n",
|
| 156 |
+
" Sort based on the numerical values of the filenames in the path,\n",
|
| 157 |
+
" assuming all filenames can be converted to integers.\n",
|
| 158 |
+
" \"\"\"\n",
|
| 159 |
+
" def get_file_number(path):\n",
|
| 160 |
+
" file_name = os.path.splitext(os.path.basename(path))[0]\n",
|
| 161 |
+
" return int(file_name)\n",
|
| 162 |
+
"\n",
|
| 163 |
+
" path_list.sort(key=get_file_number)\n"
|
| 164 |
+
]
|
| 165 |
+
},
|
| 166 |
+
{
|
| 167 |
+
"cell_type": "code",
|
| 168 |
+
"execution_count": null,
|
| 169 |
+
"metadata": {
|
| 170 |
+
"colab": {
|
| 171 |
+
"base_uri": "https://localhost:8080/"
|
| 172 |
+
},
|
| 173 |
+
"id": "GaCBe4plvK-e",
|
| 174 |
+
"outputId": "b3e76723-7f79-45d7-878b-5619d684e25d",
|
| 175 |
+
"papermill": {
|
| 176 |
+
"duration": 6.61984,
|
| 177 |
+
"end_time": "2022-02-04T11:33:28.148721",
|
| 178 |
+
"exception": false,
|
| 179 |
+
"start_time": "2022-02-04T11:33:21.528881",
|
| 180 |
+
"status": "completed"
|
| 181 |
+
},
|
| 182 |
+
"tags": []
|
| 183 |
+
},
|
| 184 |
+
"outputs": [],
|
| 185 |
+
"source": [
|
| 186 |
+
"# import clip-vit model\n",
|
| 187 |
+
"DEVICE = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 188 |
+
"%pip install --quiet git+https://github.com/openai/CLIP.git\n",
|
| 189 |
+
"import clip\n",
|
| 190 |
+
"\n",
|
| 191 |
+
"model, preprocess = clip.load(\"ViT-B/16\", device=DEVICE)\n",
|
| 192 |
+
"model.eval() # zero shot evaluation"
|
| 193 |
+
]
|
| 194 |
+
},
|
| 195 |
+
{
|
| 196 |
+
"cell_type": "code",
|
| 197 |
+
"execution_count": null,
|
| 198 |
+
"metadata": {
|
| 199 |
+
"id": "Eq7CnxKBvK-e",
|
| 200 |
+
"papermill": {
|
| 201 |
+
"duration": 0.034656,
|
| 202 |
+
"end_time": "2022-02-04T11:33:28.209027",
|
| 203 |
+
"exception": false,
|
| 204 |
+
"start_time": "2022-02-04T11:33:28.174371",
|
| 205 |
+
"status": "completed"
|
| 206 |
+
},
|
| 207 |
+
"tags": []
|
| 208 |
+
},
|
| 209 |
+
"outputs": [],
|
| 210 |
+
"source": [
|
| 211 |
+
"def infer(img_paths):\n",
|
| 212 |
+
" \"\"\"\n",
|
| 213 |
+
" Compute L2‑normalized feature embeddings for a list of image file paths using the CLIP visual encoder.\n",
|
| 214 |
+
" \"\"\"\n",
|
| 215 |
+
" # print(len(img_paths)) # for debug\n",
|
| 216 |
+
" embeddings = []\n",
|
| 217 |
+
" for path in tqdm(img_paths):\n",
|
| 218 |
+
" img = Image.open(path)\n",
|
| 219 |
+
" x = preprocess(img)\n",
|
| 220 |
+
" x = x.type(torch.float16).unsqueeze(0).to(DEVICE)\n",
|
| 221 |
+
"\n",
|
| 222 |
+
" with torch.no_grad():\n",
|
| 223 |
+
" emb = model.visual.forward(x)\n",
|
| 224 |
+
"\n",
|
| 225 |
+
" embeddings.append(emb)\n",
|
| 226 |
+
"\n",
|
| 227 |
+
" embeddings = torch.cat(embeddings)\n",
|
| 228 |
+
" embeddings = F.normalize(embeddings, p=2, dim=1)\n",
|
| 229 |
+
"\n",
|
| 230 |
+
" return embeddings"
|
| 231 |
+
]
|
| 232 |
+
},
|
| 233 |
+
{
|
| 234 |
+
"cell_type": "code",
|
| 235 |
+
"execution_count": null,
|
| 236 |
+
"metadata": {
|
| 237 |
+
"id": "gPOB1nCkEUoJ"
|
| 238 |
+
},
|
| 239 |
+
"outputs": [],
|
| 240 |
+
"source": [
|
| 241 |
+
"def match_images(BASE_DATA_DIR, result_path):\n",
|
| 242 |
+
" \"\"\"\n",
|
| 243 |
+
" For each query image in BASE_DATA_DIR/query, find its best matching image\n",
|
| 244 |
+
" in BASE_DATA_DIR/gallery by computing cosine similarity of CLIP embeddings,\n",
|
| 245 |
+
" then save 1‑based match indices to result_path as a .npy file.\n",
|
| 246 |
+
" \"\"\"\n",
|
| 247 |
+
" QUERY_DIR = BASE_DATA_DIR / \"query\"\n",
|
| 248 |
+
" NON_QUERY_DIR = BASE_DATA_DIR / \"gallery\"\n",
|
| 249 |
+
"\n",
|
| 250 |
+
" query_image_paths = list(QUERY_DIR.glob(\"*.png\"))\n",
|
| 251 |
+
" non_query_image_paths = list(NON_QUERY_DIR.glob(\"*.png\"))\n",
|
| 252 |
+
"\n",
|
| 253 |
+
" query_image_paths_str = [str(p) for p in query_image_paths]\n",
|
| 254 |
+
" non_query_image_paths_str = [str(p) for p in non_query_image_paths]\n",
|
| 255 |
+
"\n",
|
| 256 |
+
" sort_paths_by_number(query_image_paths_str)\n",
|
| 257 |
+
" sort_paths_by_number(non_query_image_paths_str)\n",
|
| 258 |
+
"\n",
|
| 259 |
+
" # print(query_image_paths_str) # for debug\n",
|
| 260 |
+
"\n",
|
| 261 |
+
" query_embeddings = infer(query_image_paths_str)\n",
|
| 262 |
+
" non_query_embeddings = infer(non_query_image_paths_str)\n",
|
| 263 |
+
" distances = torch.mm(query_embeddings, non_query_embeddings.t())\n",
|
| 264 |
+
" distances = (distances + 1.) / 2.\n",
|
| 265 |
+
"\n",
|
| 266 |
+
" topk_dists, topk_idxs = torch.topk(distances, 11, dim=1) # distances has shape (num_queries, num_non_queries)\n",
|
| 267 |
+
"\n",
|
| 268 |
+
" topk_dists, topk_idxs = topk_dists.cpu(), topk_idxs.cpu()\n",
|
| 269 |
+
"\n",
|
| 270 |
+
" matches_dists, matches_idxs = topk_dists[:, 1], topk_idxs[:, 1]\n",
|
| 271 |
+
" matches_dists = matches_dists.cpu().numpy()\n",
|
| 272 |
+
" matches_idxs = matches_idxs.cpu().numpy()\n",
|
| 273 |
+
"\n",
|
| 274 |
+
" for i in range(len(matches_idxs)):\n",
|
| 275 |
+
" matches_idxs[i]+=1\n",
|
| 276 |
+
"\n",
|
| 277 |
+
" # print(matches_idxs) # for debug\n",
|
| 278 |
+
" np.save(result_path, matches_idxs) # save as .npy file"
|
| 279 |
+
]
|
| 280 |
+
},
|
| 281 |
+
{
|
| 282 |
+
"cell_type": "code",
|
| 283 |
+
"execution_count": null,
|
| 284 |
+
"metadata": {
|
| 285 |
+
"colab": {
|
| 286 |
+
"base_uri": "https://localhost:8080/"
|
| 287 |
+
},
|
| 288 |
+
"id": "RUtraYPDEz30",
|
| 289 |
+
"outputId": "e0b44045-e6bf-47c3-e89c-e050760c8e50"
|
| 290 |
+
},
|
| 291 |
+
"outputs": [],
|
| 292 |
+
"source": [
|
| 293 |
+
"\"\"\"the generated submission should be two .npy files\"\"\"\n",
|
| 294 |
+
"DATA_PATH = Path(\"Solution/\")\n",
|
| 295 |
+
"OUTPUT_PATH = DATA_PATH / \"Scoring\"\n",
|
| 296 |
+
"\n",
|
| 297 |
+
"match_images(DATA_PATH / \"validation_set\", OUTPUT_PATH / \"submission_a.npy\")\n",
|
| 298 |
+
"match_images(DATA_PATH / \"test_set\", OUTPUT_PATH / \"submission_b.npy\")"
|
| 299 |
+
]
|
| 300 |
+
},
|
| 301 |
+
{
|
| 302 |
+
"cell_type": "code",
|
| 303 |
+
"execution_count": null,
|
| 304 |
+
"metadata": {},
|
| 305 |
+
"outputs": [],
|
| 306 |
+
"source": [
|
| 307 |
+
"import zipfile\n",
|
| 308 |
+
"\n",
|
| 309 |
+
"files_to_zip = ['./Solution/Scoring/submission_a.npy', './Solution/Scoring/submission_b.npy']\n",
|
| 310 |
+
"zip_filename = 'submission.zip'\n",
|
| 311 |
+
"\n",
|
| 312 |
+
"with zipfile.ZipFile(zip_filename, 'w') as zipf:\n",
|
| 313 |
+
" for file in files_to_zip:\n",
|
| 314 |
+
" zipf.write(file, os.path.basename(file))\n",
|
| 315 |
+
"\n",
|
| 316 |
+
"print(f'{zip_filename} is created succefully!')"
|
| 317 |
+
]
|
| 318 |
+
}
|
| 319 |
+
],
|
| 320 |
+
"metadata": {
|
| 321 |
+
"accelerator": "GPU",
|
| 322 |
+
"colab": {
|
| 323 |
+
"gpuType": "L4",
|
| 324 |
+
"provenance": []
|
| 325 |
+
},
|
| 326 |
+
"kernelspec": {
|
| 327 |
+
"display_name": "noai_env",
|
| 328 |
+
"language": "python",
|
| 329 |
+
"name": "python3"
|
| 330 |
+
},
|
| 331 |
+
"language_info": {
|
| 332 |
+
"codemirror_mode": {
|
| 333 |
+
"name": "ipython",
|
| 334 |
+
"version": 3
|
| 335 |
+
},
|
| 336 |
+
"file_extension": ".py",
|
| 337 |
+
"mimetype": "text/x-python",
|
| 338 |
+
"name": "python",
|
| 339 |
+
"nbconvert_exporter": "python",
|
| 340 |
+
"pygments_lexer": "ipython3",
|
| 341 |
+
"version": "3.9.21"
|
| 342 |
+
}
|
| 343 |
+
},
|
| 344 |
+
"nbformat": 4,
|
| 345 |
+
"nbformat_minor": 4
|
| 346 |
+
}
|
benchmark/IOAI/IOAI-2025/Individual-Contest/Restroom/Solution/Restroom_Solution.ipynb
ADDED
|
@@ -0,0 +1,499 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Restroom/Solution/Restroom_Solution.ipynb)"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"# Restroom Icon Matching: Reference Solution"
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "code",
|
| 23 |
+
"execution_count": null,
|
| 24 |
+
"metadata": {
|
| 25 |
+
"colab": {
|
| 26 |
+
"base_uri": "https://localhost:8080/"
|
| 27 |
+
},
|
| 28 |
+
"execution": {
|
| 29 |
+
"iopub.execute_input": "2022-02-04T11:33:19.450019Z",
|
| 30 |
+
"iopub.status.busy": "2022-02-04T11:33:19.448976Z",
|
| 31 |
+
"iopub.status.idle": "2022-02-04T11:33:21.323179Z",
|
| 32 |
+
"shell.execute_reply": "2022-02-04T11:33:21.323659Z",
|
| 33 |
+
"shell.execute_reply.started": "2022-02-04T11:30:05.671311Z"
|
| 34 |
+
},
|
| 35 |
+
"id": "WAP2UubJvK-e",
|
| 36 |
+
"outputId": "7dda341d-6351-4f6f-bab3-305e4818481c",
|
| 37 |
+
"papermill": {
|
| 38 |
+
"duration": 1.897624,
|
| 39 |
+
"end_time": "2022-02-04T11:33:21.323833",
|
| 40 |
+
"exception": false,
|
| 41 |
+
"start_time": "2022-02-04T11:33:19.426209",
|
| 42 |
+
"status": "completed"
|
| 43 |
+
},
|
| 44 |
+
"tags": []
|
| 45 |
+
},
|
| 46 |
+
"outputs": [],
|
| 47 |
+
"source": [
|
| 48 |
+
"# type: ignore\n",
|
| 49 |
+
"import os\n",
|
| 50 |
+
"import clip\n",
|
| 51 |
+
"import numpy as np\n",
|
| 52 |
+
"from PIL import Image\n",
|
| 53 |
+
"from tqdm import tqdm\n",
|
| 54 |
+
"from pathlib import Path\n",
|
| 55 |
+
"\n",
|
| 56 |
+
"import torch\n",
|
| 57 |
+
"import torch.nn as nn\n",
|
| 58 |
+
"import torch.nn.functional as F\n",
|
| 59 |
+
"from torch.utils.data import Dataset, DataLoader\n",
|
| 60 |
+
"from torch.optim.lr_scheduler import CosineAnnealingLR"
|
| 61 |
+
]
|
| 62 |
+
},
|
| 63 |
+
{
|
| 64 |
+
"cell_type": "code",
|
| 65 |
+
"execution_count": null,
|
| 66 |
+
"metadata": {},
|
| 67 |
+
"outputs": [],
|
| 68 |
+
"source": [
|
| 69 |
+
"DEVICE = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 70 |
+
"%pip install --quiet git+https://github.com/openai/CLIP.git\n",
|
| 71 |
+
"import clip\n",
|
| 72 |
+
"train_dir = Path(\"../training_set\")"
|
| 73 |
+
]
|
| 74 |
+
},
|
| 75 |
+
{
|
| 76 |
+
"cell_type": "code",
|
| 77 |
+
"execution_count": null,
|
| 78 |
+
"metadata": {},
|
| 79 |
+
"outputs": [],
|
| 80 |
+
"source": [
|
| 81 |
+
"class CLIPReID(nn.Module):\n",
|
| 82 |
+
" def __init__(self, unfreeze_last_n_layers=1):\n",
|
| 83 |
+
" super(CLIPReID, self).__init__()\n",
|
| 84 |
+
" self.device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 85 |
+
" self.clip_model, self.preprocess = clip.load(\"ViT-B/32\", device=self.device)\n",
|
| 86 |
+
" \n",
|
| 87 |
+
" # freeze all parameters firstly\n",
|
| 88 |
+
" for param in self.clip_model.parameters():\n",
|
| 89 |
+
" param.requires_grad = False\n",
|
| 90 |
+
" \n",
|
| 91 |
+
" # unfreeze the last n transformer blocks\n",
|
| 92 |
+
" total_blocks = len(self.clip_model.visual.transformer.resblocks)\n",
|
| 93 |
+
" start_block = total_blocks - unfreeze_last_n_layers\n",
|
| 94 |
+
" \n",
|
| 95 |
+
" # unfreeze assigned layers\n",
|
| 96 |
+
" for i in range(start_block, total_blocks):\n",
|
| 97 |
+
" for param in self.clip_model.visual.transformer.resblocks[i].parameters():\n",
|
| 98 |
+
" param.requires_grad = True\n",
|
| 99 |
+
" \n",
|
| 100 |
+
" # unfreeze the last layer\n",
|
| 101 |
+
" for param in self.clip_model.visual.ln_post.parameters():\n",
|
| 102 |
+
" param.requires_grad = True\n",
|
| 103 |
+
" \n",
|
| 104 |
+
" def get_trainable_params(self):\n",
|
| 105 |
+
" \"\"\"Return numbers and names of trainable parameters\"\"\"\n",
|
| 106 |
+
" trainable_params = []\n",
|
| 107 |
+
" total_params = 0\n",
|
| 108 |
+
" for name, param in self.named_parameters():\n",
|
| 109 |
+
" if param.requires_grad:\n",
|
| 110 |
+
" trainable_params.append(name)\n",
|
| 111 |
+
" total_params += param.numel()\n",
|
| 112 |
+
" return trainable_params, total_params\n",
|
| 113 |
+
" \n",
|
| 114 |
+
" def forward_one(self, x):\n",
|
| 115 |
+
" x = x.to(dtype=torch.float32, device=self.device)\n",
|
| 116 |
+
" # for training mode, do not use torch.no_grad()\n",
|
| 117 |
+
" if self.training:\n",
|
| 118 |
+
" features = self.clip_model.encode_image(x)\n",
|
| 119 |
+
" else:\n",
|
| 120 |
+
" with torch.no_grad():\n",
|
| 121 |
+
" features = self.clip_model.encode_image(x)\n",
|
| 122 |
+
" features = features.to(dtype=torch.float32)\n",
|
| 123 |
+
" return nn.functional.normalize(features, p=2, dim=1)\n",
|
| 124 |
+
" \n",
|
| 125 |
+
" def forward(self, x1, x2):\n",
|
| 126 |
+
" feat1 = self.forward_one(x1)\n",
|
| 127 |
+
" feat2 = self.forward_one(x2)\n",
|
| 128 |
+
" return feat1, feat2\n",
|
| 129 |
+
"\n",
|
| 130 |
+
" def preprocess(self, image):\n",
|
| 131 |
+
" return self.processor(images=image, return_tensors=\"pt\")[\"pixel_values\"][0]\n"
|
| 132 |
+
]
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"cell_type": "code",
|
| 136 |
+
"execution_count": null,
|
| 137 |
+
"metadata": {},
|
| 138 |
+
"outputs": [],
|
| 139 |
+
"source": [
|
| 140 |
+
"class CropMatchDataset(Dataset):\n",
|
| 141 |
+
" \"\"\"Step one: match crop and orig\"\"\"\n",
|
| 142 |
+
" def __init__(self, data_dir):\n",
|
| 143 |
+
" self.data_dir = data_dir\n",
|
| 144 |
+
" self.device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 145 |
+
" _, self.preprocess = clip.load(\"ViT-B/32\", device=self.device)\n",
|
| 146 |
+
" \n",
|
| 147 |
+
" # construct positive sample pairs with crop relationship\n",
|
| 148 |
+
" self.pairs = [] # [(orig_img, crop_img), ...]\n",
|
| 149 |
+
" \n",
|
| 150 |
+
" print(\"train_dir:\", os.listdir(os.path.join(data_dir, 'crop', 'male')))\n",
|
| 151 |
+
" n = len(os.listdir(os.path.join(data_dir, 'crop', 'male')))\n",
|
| 152 |
+
" print([(os.path.join(data_dir, 'orig', 'male', f'{i}.png'), os.path.join(data_dir, 'crop', 'male', f'{i}.png')) for i in range(1, n+1)])\n",
|
| 153 |
+
" self.pairs = [(os.path.join(data_dir, 'orig', 'male', f'{i}.png'), os.path.join(data_dir, 'crop', 'male', f'{i}.png')) for i in range(1, n+1)] + \\\n",
|
| 154 |
+
" [(os.path.join(data_dir, 'orig', 'female', f'{i}.png'), os.path.join(data_dir, 'crop', 'female', f'{i}.png')) for i in range(1, n+1)]\n",
|
| 155 |
+
" print(self.pairs, type(self.pairs))\n",
|
| 156 |
+
" print(f\"Found {len(self.pairs)} matching pairs\")\n",
|
| 157 |
+
" \n",
|
| 158 |
+
" def __len__(self):\n",
|
| 159 |
+
" return len(self.pairs)\n",
|
| 160 |
+
" \n",
|
| 161 |
+
" def __getitem__(self, idx):\n",
|
| 162 |
+
" orig_path, crop_path = self.pairs[idx]\n",
|
| 163 |
+
" \n",
|
| 164 |
+
" orig = Image.open(orig_path).convert('RGB')\n",
|
| 165 |
+
" crop = Image.open(crop_path).convert('RGB')\n",
|
| 166 |
+
" \n",
|
| 167 |
+
" orig = self.preprocess(orig)\n",
|
| 168 |
+
" crop = self.preprocess(crop)\n",
|
| 169 |
+
" \n",
|
| 170 |
+
" return orig, crop\n",
|
| 171 |
+
" \n",
|
| 172 |
+
"def train_crop_matcher(train_dir, epochs=50, batch_size=32, unfreeze_last_n_layers=6):\n",
|
| 173 |
+
" dataset = CropMatchDataset(train_dir)\n",
|
| 174 |
+
" train_loader = DataLoader(dataset, batch_size=batch_size, shuffle=True, num_workers=0)\n",
|
| 175 |
+
" \n",
|
| 176 |
+
" print(f\"Training set size: {len(dataset)}\")\n",
|
| 177 |
+
" \n",
|
| 178 |
+
" device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 179 |
+
" print(f\"Using device: {device}\")\n",
|
| 180 |
+
" \n",
|
| 181 |
+
" # assign number of layers to unfreeze when create model\n",
|
| 182 |
+
" model = CLIPReID(unfreeze_last_n_layers=unfreeze_last_n_layers).to(device).float()\n",
|
| 183 |
+
" \n",
|
| 184 |
+
" # print trainable params info\n",
|
| 185 |
+
" trainable_params, total_params = model.get_trainable_params()\n",
|
| 186 |
+
" print(f\"Number of trainable parameters: {total_params}\")\n",
|
| 187 |
+
" print(\"Trainable Layers:\")\n",
|
| 188 |
+
" for param_name in trainable_params:\n",
|
| 189 |
+
" print(f\"- {param_name}\")\n",
|
| 190 |
+
" \n",
|
| 191 |
+
" optimizer = torch.optim.Adam(model.parameters(), lr=1e-4, weight_decay=1e-5, betas=(0.5, 0.999))\n",
|
| 192 |
+
" scheduler = CosineAnnealingLR(optimizer, T_max=epochs, eta_min=1e-5)\n",
|
| 193 |
+
" temp = 0.07\n",
|
| 194 |
+
" best_loss = float('inf')\n",
|
| 195 |
+
" \n",
|
| 196 |
+
" for epoch in range(epochs):\n",
|
| 197 |
+
" model.train()\n",
|
| 198 |
+
" total_loss = 0\n",
|
| 199 |
+
" \n",
|
| 200 |
+
" pbar = tqdm(train_loader, desc=f'Epoch {epoch+1}/{epochs}')\n",
|
| 201 |
+
" for orig, crop in pbar:\n",
|
| 202 |
+
" orig = orig.float().to(device)\n",
|
| 203 |
+
" crop = crop.float().to(device)\n",
|
| 204 |
+
" \n",
|
| 205 |
+
" optimizer.zero_grad()\n",
|
| 206 |
+
" \n",
|
| 207 |
+
" orig_feat = F.normalize(model.forward_one(orig), dim=1) # |v| = 1\n",
|
| 208 |
+
" crop_feat = F.normalize(model.forward_one(crop), dim=1)\n",
|
| 209 |
+
" \n",
|
| 210 |
+
" # Info-NCE loss\n",
|
| 211 |
+
" logits = (orig_feat @ crop_feat.t()) / temp # (B, B)\n",
|
| 212 |
+
" labels = torch.arange(orig_feat.size(0), device=device)\n",
|
| 213 |
+
" loss_i2c = F.cross_entropy(logits, labels) # orig→crop\n",
|
| 214 |
+
" loss_c2i = F.cross_entropy(logits.t(), labels) # crop→orig\n",
|
| 215 |
+
" loss = 0.5 * (loss_i2c + loss_c2i)\n",
|
| 216 |
+
" \n",
|
| 217 |
+
" loss.backward()\n",
|
| 218 |
+
" optimizer.step()\n",
|
| 219 |
+
" \n",
|
| 220 |
+
" total_loss += loss.item()\n",
|
| 221 |
+
" pbar.set_postfix({'loss': f'{loss.item():.8f}'})\n",
|
| 222 |
+
" \n",
|
| 223 |
+
" scheduler.step()\n",
|
| 224 |
+
" avg_loss = total_loss / len(train_loader)\n",
|
| 225 |
+
" print(f'Epoch {epoch+1}, Loss: {avg_loss:.8f}')\n",
|
| 226 |
+
" if avg_loss < best_loss:\n",
|
| 227 |
+
" torch.save(model.state_dict(), 'crop_model.pth')\n",
|
| 228 |
+
" best_loss = avg_loss\n",
|
| 229 |
+
" print(\"Saved best model\")\n",
|
| 230 |
+
" \n",
|
| 231 |
+
" return model"
|
| 232 |
+
]
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"cell_type": "code",
|
| 236 |
+
"execution_count": null,
|
| 237 |
+
"metadata": {},
|
| 238 |
+
"outputs": [],
|
| 239 |
+
"source": [
|
| 240 |
+
"crop_model = train_crop_matcher(train_dir=train_dir)"
|
| 241 |
+
]
|
| 242 |
+
},
|
| 243 |
+
{
|
| 244 |
+
"cell_type": "code",
|
| 245 |
+
"execution_count": null,
|
| 246 |
+
"metadata": {},
|
| 247 |
+
"outputs": [],
|
| 248 |
+
"source": [
|
| 249 |
+
"class GenderMatchDataset(Dataset):\n",
|
| 250 |
+
" \"\"\"Step 2: match gender relations\"\"\"\n",
|
| 251 |
+
" def __init__(self, data_dir):\n",
|
| 252 |
+
" self.data_dir = data_dir\n",
|
| 253 |
+
" self.device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 254 |
+
" _, self.preprocess = clip.load(\"ViT-B/32\", device=self.device)\n",
|
| 255 |
+
" \n",
|
| 256 |
+
" # construct positive sample pairs (same ID opposite gender)\n",
|
| 257 |
+
" self.pairs = [] # [(male_img, female_img), ...]\n",
|
| 258 |
+
" \n",
|
| 259 |
+
" n = len(os.listdir(os.path.join(data_dir, 'crop', 'male')))\n",
|
| 260 |
+
" self.pairs = [(os.path.join(data_dir, 'orig', 'male', f'{i}.png'), os.path.join(data_dir, 'orig', 'female', f'{i}.png')) for i in range(1, n+1)]\n",
|
| 261 |
+
" \n",
|
| 262 |
+
" print(f\"Founded {len(self.pairs)} pairs of gender matching images\")\n",
|
| 263 |
+
" \n",
|
| 264 |
+
" def __len__(self):\n",
|
| 265 |
+
" return len(self.pairs)\n",
|
| 266 |
+
" \n",
|
| 267 |
+
" def __getitem__(self, idx):\n",
|
| 268 |
+
" male_path, female_path = self.pairs[idx]\n",
|
| 269 |
+
" \n",
|
| 270 |
+
" male = Image.open(male_path).convert('RGB')\n",
|
| 271 |
+
" female = Image.open(female_path).convert('RGB')\n",
|
| 272 |
+
" \n",
|
| 273 |
+
" male = self.preprocess(male)\n",
|
| 274 |
+
" female = self.preprocess(female)\n",
|
| 275 |
+
" \n",
|
| 276 |
+
" return male, female\n",
|
| 277 |
+
"\n",
|
| 278 |
+
"def train_gender_matcher(train_dir, epochs=50, batch_size=32, unfreeze_last_n_layers=6):\n",
|
| 279 |
+
" dataset = GenderMatchDataset(train_dir)\n",
|
| 280 |
+
" train_loader = DataLoader(dataset, batch_size=batch_size, shuffle=True, num_workers=0)\n",
|
| 281 |
+
" \n",
|
| 282 |
+
" print(f\"Training set size: {len(dataset)}\")\n",
|
| 283 |
+
" \n",
|
| 284 |
+
" device = \"cuda\" if torch.cuda.is_available() else \"cpu\"\n",
|
| 285 |
+
" print(f\"Using device: {device}\")\n",
|
| 286 |
+
" \n",
|
| 287 |
+
" # assign number of layers to unfreeze when create model\n",
|
| 288 |
+
" model = CLIPReID(unfreeze_last_n_layers=unfreeze_last_n_layers).to(device).float()\n",
|
| 289 |
+
" \n",
|
| 290 |
+
" # print info of trainable parameters\n",
|
| 291 |
+
" trainable_params, total_params = model.get_trainable_params()\n",
|
| 292 |
+
" print(f\"Number of trainable parameters: {total_params}\")\n",
|
| 293 |
+
" print(\"Trainable layers:\")\n",
|
| 294 |
+
" for param_name in trainable_params:\n",
|
| 295 |
+
" print(f\"- {param_name}\")\n",
|
| 296 |
+
" \n",
|
| 297 |
+
" optimizer = torch.optim.Adam(model.parameters(), lr=1e-4, weight_decay=1e-5, betas=(0.5, 0.999))\n",
|
| 298 |
+
" scheduler = CosineAnnealingLR(optimizer, T_max=epochs, eta_min=1e-6)\n",
|
| 299 |
+
" temp = 0.07\n",
|
| 300 |
+
" best_loss = float('inf')\n",
|
| 301 |
+
" \n",
|
| 302 |
+
" for epoch in range(epochs):\n",
|
| 303 |
+
" model.train()\n",
|
| 304 |
+
" total_loss = 0\n",
|
| 305 |
+
" \n",
|
| 306 |
+
" pbar = tqdm(train_loader, desc=f'Epoch {epoch+1}/{epochs}')\n",
|
| 307 |
+
" for male, female in pbar:\n",
|
| 308 |
+
" male = male.float().to(device)\n",
|
| 309 |
+
" female = female.float().to(device)\n",
|
| 310 |
+
" \n",
|
| 311 |
+
" optimizer.zero_grad()\n",
|
| 312 |
+
" \n",
|
| 313 |
+
" male_feat = F.normalize(model.forward_one(male), dim=1)\n",
|
| 314 |
+
" female_feat = F.normalize(model.forward_one(female), dim=1)\n",
|
| 315 |
+
" \n",
|
| 316 |
+
" # Info-NCE loss\n",
|
| 317 |
+
" logits = (male_feat @ female_feat.t()) / temp\n",
|
| 318 |
+
" labels = torch.arange(male_feat.size(0), device=device)\n",
|
| 319 |
+
" loss_i2f = F.cross_entropy(logits, labels)\n",
|
| 320 |
+
" loss_f2i = F.cross_entropy(logits.t(), labels)\n",
|
| 321 |
+
" loss = 0.5 * (loss_i2f + loss_f2i)\n",
|
| 322 |
+
" \n",
|
| 323 |
+
" loss.backward()\n",
|
| 324 |
+
" optimizer.step()\n",
|
| 325 |
+
" \n",
|
| 326 |
+
" total_loss += loss.item()\n",
|
| 327 |
+
" pbar.set_postfix({'loss': f'{loss.item():.8f}'})\n",
|
| 328 |
+
" \n",
|
| 329 |
+
" scheduler.step()\n",
|
| 330 |
+
" avg_loss = total_loss / len(train_loader)\n",
|
| 331 |
+
" print(f'Epoch {epoch+1}, Loss: {avg_loss:.8f}')\n",
|
| 332 |
+
" if avg_loss < best_loss:\n",
|
| 333 |
+
" torch.save(model.state_dict(), 'gender_model.pth')\n",
|
| 334 |
+
" best_loss = avg_loss\n",
|
| 335 |
+
" print(\"Saved best model\")\n",
|
| 336 |
+
" \n",
|
| 337 |
+
" return model "
|
| 338 |
+
]
|
| 339 |
+
},
|
| 340 |
+
{
|
| 341 |
+
"cell_type": "code",
|
| 342 |
+
"execution_count": null,
|
| 343 |
+
"metadata": {},
|
| 344 |
+
"outputs": [],
|
| 345 |
+
"source": [
|
| 346 |
+
"gender_model = train_gender_matcher(train_dir=train_dir)"
|
| 347 |
+
]
|
| 348 |
+
},
|
| 349 |
+
{
|
| 350 |
+
"cell_type": "code",
|
| 351 |
+
"execution_count": null,
|
| 352 |
+
"metadata": {},
|
| 353 |
+
"outputs": [],
|
| 354 |
+
"source": [
|
| 355 |
+
"def extract_features(model, image_dir):\n",
|
| 356 |
+
" features = {}\n",
|
| 357 |
+
" for img_name in tqdm(os.listdir(image_dir)):\n",
|
| 358 |
+
" if img_name.endswith('.png'):\n",
|
| 359 |
+
" img_path = os.path.join(image_dir, img_name)\n",
|
| 360 |
+
" img = Image.open(img_path).convert('RGB')\n",
|
| 361 |
+
" img = model.preprocess(img)\n",
|
| 362 |
+
" img = img.unsqueeze(0).float().to(model.device)\n",
|
| 363 |
+
" \n",
|
| 364 |
+
" with torch.no_grad():\n",
|
| 365 |
+
" feat = model.forward_one(img)\n",
|
| 366 |
+
" features[img_name[:-4]] = feat.cpu().numpy()\n",
|
| 367 |
+
" return features\n",
|
| 368 |
+
"\n",
|
| 369 |
+
"def match_images(query_dir, gallery_dir, prevent_gallery_reuse, save_path):\n",
|
| 370 |
+
" # Load two models\n",
|
| 371 |
+
" crop_model = CLIPReID()\n",
|
| 372 |
+
" gender_model = CLIPReID()\n",
|
| 373 |
+
" crop_model.load_state_dict(torch.load('crop_model.pth'))\n",
|
| 374 |
+
" gender_model.load_state_dict(torch.load('gender_model.pth'))\n",
|
| 375 |
+
" \n",
|
| 376 |
+
" device = \"cuda\" if torch.cuda.is_available() else \"cpu\" \n",
|
| 377 |
+
" crop_model.to(device).eval()\n",
|
| 378 |
+
" gender_model.to(device).eval()\n",
|
| 379 |
+
" \n",
|
| 380 |
+
" # Step1: find crop relations between query and gallery\n",
|
| 381 |
+
" print(\"Extract features for finding crop relations...\")\n",
|
| 382 |
+
" query_features = extract_features(crop_model, query_dir)\n",
|
| 383 |
+
" gallery_features = extract_features(crop_model, gallery_dir)\n",
|
| 384 |
+
" \n",
|
| 385 |
+
" # Store corresponding original images of each cropped query\n",
|
| 386 |
+
" crop_matches = {}\n",
|
| 387 |
+
" \n",
|
| 388 |
+
" for q_name, q_feat in query_features.items():\n",
|
| 389 |
+
" similarities = []\n",
|
| 390 |
+
" for g_name, g_feat in gallery_features.items():\n",
|
| 391 |
+
" sim = torch.nn.functional.cosine_similarity(\n",
|
| 392 |
+
" torch.from_numpy(q_feat),\n",
|
| 393 |
+
" torch.from_numpy(g_feat),\n",
|
| 394 |
+
" dim=1\n",
|
| 395 |
+
" ).item()\n",
|
| 396 |
+
" similarities.append((g_name, sim))\n",
|
| 397 |
+
" \n",
|
| 398 |
+
" # Find the most similar gallery images (crop relation)\n",
|
| 399 |
+
" similarities.sort(key=lambda x: x[1], reverse=True)\n",
|
| 400 |
+
" crop_matches[q_name] = similarities[0][0]\n",
|
| 401 |
+
" \n",
|
| 402 |
+
" # Step2: Find gender matching in gallery\n",
|
| 403 |
+
" print(\"Extract features for gender matching...\")\n",
|
| 404 |
+
" gallery_gender_features = extract_features(gender_model, gallery_dir)\n",
|
| 405 |
+
" \n",
|
| 406 |
+
" n = len(os.listdir(query_dir))\n",
|
| 407 |
+
" results = np.zeros(n)\n",
|
| 408 |
+
" matched_galleries = set() # for tracking matched images\n",
|
| 409 |
+
" print(\"Matching images...\")\n",
|
| 410 |
+
" \n",
|
| 411 |
+
" for q_name, matched_crop in tqdm(crop_matches.items()):\n",
|
| 412 |
+
" # get features of matched_crop\n",
|
| 413 |
+
" crop_feat = gallery_gender_features[matched_crop]\n",
|
| 414 |
+
" \n",
|
| 415 |
+
" # Find the most similar one in gallary, but exclude crop relation and matched images\n",
|
| 416 |
+
" similarities = []\n",
|
| 417 |
+
" for g_name, g_feat in gallery_gender_features.items():\n",
|
| 418 |
+
" if g_name != matched_crop:\n",
|
| 419 |
+
" if not prevent_gallery_reuse or g_name not in matched_galleries:\n",
|
| 420 |
+
" sim = torch.nn.functional.cosine_similarity(\n",
|
| 421 |
+
" torch.from_numpy(crop_feat),\n",
|
| 422 |
+
" torch.from_numpy(g_feat),\n",
|
| 423 |
+
" dim=1\n",
|
| 424 |
+
" ).item()\n",
|
| 425 |
+
" similarities.append((g_name, sim))\n",
|
| 426 |
+
" \n",
|
| 427 |
+
" # Find the most similar one in the remaining images\n",
|
| 428 |
+
" if similarities: # make sure candidates are not empty\n",
|
| 429 |
+
" similarities.sort(key=lambda x: x[1], reverse=True)\n",
|
| 430 |
+
" gender_match = similarities[0][0]\n",
|
| 431 |
+
" if prevent_gallery_reuse:\n",
|
| 432 |
+
" matched_galleries.add(gender_match) # add the matched image into set\n",
|
| 433 |
+
" # print(q_name, gender_match)\n",
|
| 434 |
+
" results[int(q_name)-1] = int(gender_match)\n",
|
| 435 |
+
" \n",
|
| 436 |
+
" # save the results\n",
|
| 437 |
+
" np.save(save_path, results)\n",
|
| 438 |
+
" print(f\"Matched {query_dir} with {gallery_dir}, results saved to {save_path}\")"
|
| 439 |
+
]
|
| 440 |
+
},
|
| 441 |
+
{
|
| 442 |
+
"cell_type": "code",
|
| 443 |
+
"execution_count": null,
|
| 444 |
+
"metadata": {},
|
| 445 |
+
"outputs": [],
|
| 446 |
+
"source": [
|
| 447 |
+
"DATA_PATH = Path(\".\")\n",
|
| 448 |
+
"OUTPUT_PATH = DATA_PATH / \"Scoring\"\n",
|
| 449 |
+
"\n",
|
| 450 |
+
"match_images(query_dir = DATA_PATH / \"validation_set/query\", gallery_dir = DATA_PATH / \"validation_set/gallery\", prevent_gallery_reuse=True, save_path = OUTPUT_PATH / \"submission_a.npy\")\n",
|
| 451 |
+
"match_images(query_dir = DATA_PATH / \"test_set/query\", gallery_dir = DATA_PATH / \"test_set/gallery\", prevent_gallery_reuse=True, save_path = OUTPUT_PATH / \"submission_b.npy\")"
|
| 452 |
+
]
|
| 453 |
+
},
|
| 454 |
+
{
|
| 455 |
+
"cell_type": "code",
|
| 456 |
+
"execution_count": null,
|
| 457 |
+
"metadata": {},
|
| 458 |
+
"outputs": [],
|
| 459 |
+
"source": [
|
| 460 |
+
"import zipfile\n",
|
| 461 |
+
"\n",
|
| 462 |
+
"files_to_zip = ['./Scoring/submission_a.npy', './Scoring/submission_b.npy']\n",
|
| 463 |
+
"zip_filename = 'submission.zip'\n",
|
| 464 |
+
"\n",
|
| 465 |
+
"with zipfile.ZipFile(zip_filename, 'w') as zipf:\n",
|
| 466 |
+
" for file in files_to_zip:\n",
|
| 467 |
+
" zipf.write(file, os.path.basename(file))\n",
|
| 468 |
+
"\n",
|
| 469 |
+
"print(f'{zip_filename} is created succefully!')"
|
| 470 |
+
]
|
| 471 |
+
}
|
| 472 |
+
],
|
| 473 |
+
"metadata": {
|
| 474 |
+
"accelerator": "GPU",
|
| 475 |
+
"colab": {
|
| 476 |
+
"gpuType": "L4",
|
| 477 |
+
"provenance": []
|
| 478 |
+
},
|
| 479 |
+
"kernelspec": {
|
| 480 |
+
"display_name": "noai_env",
|
| 481 |
+
"language": "python",
|
| 482 |
+
"name": "python3"
|
| 483 |
+
},
|
| 484 |
+
"language_info": {
|
| 485 |
+
"codemirror_mode": {
|
| 486 |
+
"name": "ipython",
|
| 487 |
+
"version": 3
|
| 488 |
+
},
|
| 489 |
+
"file_extension": ".py",
|
| 490 |
+
"mimetype": "text/x-python",
|
| 491 |
+
"name": "python",
|
| 492 |
+
"nbconvert_exporter": "python",
|
| 493 |
+
"pygments_lexer": "ipython3",
|
| 494 |
+
"version": "3.9.21"
|
| 495 |
+
}
|
| 496 |
+
},
|
| 497 |
+
"nbformat": 4,
|
| 498 |
+
"nbformat_minor": 4
|
| 499 |
+
}
|
benchmark/IOAI/IOAI-2025/Translations/Individual-Contest-Day1/Iran/._Iran.pdf
ADDED
|
Binary file (4.1 kB). View file
|
|
|
benchmark/IOAI/IOAI-2025/Translations/Individual-Contest-Day2/Iran/._Iran.pdf
ADDED
|
Binary file (4.1 kB). View file
|
|
|
benchmark/IOAI/IOAI-2026/Home Task/Home-Task-1.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOAI/IOAI-2026/Home Task/Home-Task-2.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOAI/IOAI-2026/Home Task/Home-Task-3.ipynb
ADDED
|
@@ -0,0 +1,411 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"<a href=\"https://colab.research.google.com/github/IOAI-official/IOAI-2026/blob/main/Home%20Task/Home-Task-3.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
| 8 |
+
]
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"cell_type": "markdown",
|
| 12 |
+
"metadata": {},
|
| 13 |
+
"source": [
|
| 14 |
+
"# 🗄️ The Analytical Language of John Wilkins\n",
|
| 15 |
+
"\n",
|
| 16 |
+
"> *\"These ambiguities, redundancies, and deficiencies recall those attributed by Dr. Franz Kuhn to a certain Chinese encyclopedia called the *Celestial Emporium of Benevolent Knowledge*. On those remote pages it is written that animals are divided into (a) those that belong to the Emperor, (b) embalmed ones, (c) those that are trained, (d) suckling pigs, (e) mermaids, (f) fabulous ones, (g) stray dogs, (h) those that are included in this classification...\"*\n",
|
| 17 |
+
">\n",
|
| 18 |
+
"> — Jorge Luis Borges, *The Analytical Language of John Wilkins*\n",
|
| 19 |
+
"\n",
|
| 20 |
+
"## The story\n",
|
| 21 |
+
"\n",
|
| 22 |
+
"In the seventeenth century a churchman named John Wilkins set out to build a perfect language — one in which the very *spelling* of a word would declare the nature of the thing it named. Each animal would be filed under a rigorous tree of yes-and-no distinctions: beast or fish, winged or finned, tame or wild, until the creature stood alone at the end of a single branch, named by the path that led to it.\n",
|
| 23 |
+
"\n",
|
| 24 |
+
"The scheme failed, as all such schemes fail. But somewhere a clerk kept building it anyway. He bound every animal of the world into a great **Cabinet of Distinctions** — and then, before the index could be written, he died. The drawers remain. Each holds one creature behind a small brass grille, and the creature will not say its name. It will only answer **yes** or **no** to questions about its own nature.\n",
|
| 25 |
+
"\n",
|
| 26 |
+
"The Cabinet has come to you with its labels lost. Two lists survived in the clerk's hand:\n",
|
| 27 |
+
"\n",
|
| 28 |
+
"- `animals_pool.txt` — every creature filed in the Cabinet (~1,400 entries).\n",
|
| 29 |
+
"- `questions_pool.txt` — every distinction the clerk thought to draw (~500 yes/no questions).\n",
|
| 30 |
+
"\n",
|
| 31 |
+
"Open a drawer. Ask your distinctions. Find the path that names the beast."
|
| 32 |
+
]
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"cell_type": "markdown",
|
| 36 |
+
"metadata": {},
|
| 37 |
+
"source": [
|
| 38 |
+
"## Your task\n",
|
| 39 |
+
"\n",
|
| 40 |
+
"Each hidden creature sits inside a sealed oracle called an **Interactor** — a brass grille over a drawer, holding one animal. You cannot see it. You may put to it one of two kinds of question:\n",
|
| 41 |
+
"\n",
|
| 42 |
+
"| Call | Returns | What you are asking |\n",
|
| 43 |
+
"|---|---|---|\n",
|
| 44 |
+
"| `interactor.ask(question)` | `\"yes\"` or `\"no\"` | A yes/no question about the hidden animal. The question must be a line from `questions_pool.txt`. |\n",
|
| 45 |
+
"| `interactor.guess(animal)` | `\"correct\"` or `\"wrong\"` | \"Is this the hidden animal?\" `\"correct\"` ends the row. The animal must be a word from `animals_pool.txt`. |\n",
|
| 46 |
+
"\n",
|
| 47 |
+
"Each question in the pool refers to the creature generically — *\"is it a mammal?\"*, *\"does it live in water?\"*, *\"can it fly?\"* — and the oracle answers about whichever animal is hidden in that drawer.\n",
|
| 48 |
+
"\n",
|
| 49 |
+
"If you submit a question or animal not in the relevant pool, the oracle refuses without spending its strength: a `ValueError` is raised and your budget is unchanged. Typos cost nothing.\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"Each drawer will entertain at most **fifteen questions** before the grille falls shut.\n",
|
| 52 |
+
"\n",
|
| 53 |
+
"### Scoring\n",
|
| 54 |
+
"\n",
|
| 55 |
+
"For each creature:\n",
|
| 56 |
+
"\n",
|
| 57 |
+
"```\n",
|
| 58 |
+
"score = max(0, (1 if you ever guessed correctly else 0) - 0.02 × queries_used)\n",
|
| 59 |
+
"```\n",
|
| 60 |
+
"\n",
|
| 61 |
+
"- Correct guess on question 1 → 0.98\n",
|
| 62 |
+
"- Correct guess on question 5 → 0.90\n",
|
| 63 |
+
"- Correct guess on question 15 → 0.70\n",
|
| 64 |
+
"- Never correct → 0\n",
|
| 65 |
+
"\n",
|
| 66 |
+
"Your score is the mean across all creatures in a test set. Tune on `dev`, then run the final cell to get your **`test1`** score — that summary table is what you submit a screenshot of. The organizers keep a second, **hidden** test set for official grading, so a solution that genuinely deduces (rather than overfits `dev`/`test1`) is what scores well."
|
| 67 |
+
]
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"cell_type": "markdown",
|
| 71 |
+
"metadata": {},
|
| 72 |
+
"source": [
|
| 73 |
+
"## The oracle\n",
|
| 74 |
+
"\n",
|
| 75 |
+
"In plain language, the oracle inside each Interactor is a local language model — by default, `Qwen/Qwen2.5-3B-Instruct`. When you call `ask(question)` it prompts the model with:\n",
|
| 76 |
+
"\n",
|
| 77 |
+
"```\n",
|
| 78 |
+
"You are answering a question about one specific animal.\n",
|
| 79 |
+
"The animal is: <hidden animal>.\n",
|
| 80 |
+
"Answer with a single word, yes or no.\n",
|
| 81 |
+
"Question: <question>\n",
|
| 82 |
+
"```\n",
|
| 83 |
+
"\n",
|
| 84 |
+
"at temperature 0, parses the first word of the reply, and returns `\"yes\"` or `\"no\"` to your code.\n",
|
| 85 |
+
"\n",
|
| 86 |
+
"The model is deterministic (the same `(animal, question)` pair always gives the same answer) and runs entirely inside the Interactor. You are free to run the same model in your own code to **predict** what it will say without spending the oracle's strength — that is a large part of what makes a clever solution. Note the oracle answers from the model's *beliefs* about the animal, which are usually right but not infallible; a good solution is robust to the occasional surprising answer."
|
| 87 |
+
]
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"cell_type": "markdown",
|
| 91 |
+
"metadata": {},
|
| 92 |
+
"source": [
|
| 93 |
+
"## Step 1: Setup\n",
|
| 94 |
+
"\n",
|
| 95 |
+
"The dataset and helper code (`interactor.py`, `evaluate.py`, the two pools, the dev/test CSVs) live in the shared **`IOAI-2026/AnimalDeduction/dataset`** Drive folder. The cell below just downloads them into Colab — no sign-in, no shortcuts, just run it. Use a **GPU** runtime: *Runtime → Change runtime type → T4* (free tier is enough)."
|
| 96 |
+
],
|
| 97 |
+
"outputs": [],
|
| 98 |
+
"execution_count": null
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"cell_type": "code",
|
| 102 |
+
"metadata": {},
|
| 103 |
+
"execution_count": null,
|
| 104 |
+
"outputs": [],
|
| 105 |
+
"source": [
|
| 106 |
+
"!pip install -q gdown transformers accelerate\n",
|
| 107 |
+
"\n",
|
| 108 |
+
"import os, sys\n",
|
| 109 |
+
"from pathlib import Path\n",
|
| 110 |
+
"import gdown\n",
|
| 111 |
+
"\n",
|
| 112 |
+
"# Dataset + helper code live in the shared IOAI-2026/AnimalDeduction/dataset folder\n",
|
| 113 |
+
"# (public link). Download locally and import from there — no sign-in needed.\n",
|
| 114 |
+
"LOCAL_DIR = Path('/content/animaldeduction')\n",
|
| 115 |
+
"if not LOCAL_DIR.exists() or not any(LOCAL_DIR.iterdir()):\n",
|
| 116 |
+
" gdown.download_folder(id='1YheHvGfQw5YUa7MjdUF0hQC4sdtLZ5UC',\n",
|
| 117 |
+
" output=str(LOCAL_DIR), quiet=True, use_cookies=False)\n",
|
| 118 |
+
"\n",
|
| 119 |
+
"sys.path.insert(0, str(LOCAL_DIR))\n",
|
| 120 |
+
"os.chdir(LOCAL_DIR)\n",
|
| 121 |
+
"print('Working directory:', os.getcwd())\n",
|
| 122 |
+
"print('Files:', sorted(p.name for p in LOCAL_DIR.iterdir()))"
|
| 123 |
+
]
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"cell_type": "markdown",
|
| 127 |
+
"metadata": {},
|
| 128 |
+
"source": [
|
| 129 |
+
"## Step 2: Load data and try the oracle\n",
|
| 130 |
+
"\n",
|
| 131 |
+
"The `Interactor` owns the hidden gold animal and runs a local LLM (Qwen 2.5 3B Instruct by default) to answer yes/no questions about it. The first `Interactor(...)` instantiation triggers the LLM download (~6 GB on first run, takes 30-60 s on T4). Every subsequent Interactor reuses the same LLM that's already loaded in memory."
|
| 132 |
+
]
|
| 133 |
+
},
|
| 134 |
+
{
|
| 135 |
+
"cell_type": "code",
|
| 136 |
+
"metadata": {},
|
| 137 |
+
"execution_count": null,
|
| 138 |
+
"outputs": [],
|
| 139 |
+
"source": [
|
| 140 |
+
"import random\n",
|
| 141 |
+
"import numpy as np\n",
|
| 142 |
+
"import pandas as pd\n",
|
| 143 |
+
"import torch\n",
|
| 144 |
+
"\n",
|
| 145 |
+
"from interactor import Interactor\n",
|
| 146 |
+
"from evaluate import evaluate, load_pools\n",
|
| 147 |
+
"\n",
|
| 148 |
+
"DEVICE = 'cuda' if torch.cuda.is_available() else 'cpu'\n",
|
| 149 |
+
"print('Device:', DEVICE)\n",
|
| 150 |
+
"\n",
|
| 151 |
+
"animals_pool, questions_pool = load_pools()\n",
|
| 152 |
+
"print(f'animals_pool size: {len(animals_pool):>6} (e.g. {animals_pool[:5]})')\n",
|
| 153 |
+
"print(f'questions_pool size: {len(questions_pool):>6} (e.g. {questions_pool[:3]})')\n",
|
| 154 |
+
"\n",
|
| 155 |
+
"# Sanity probe: create one Interactor and ask two questions about an octopus.\n",
|
| 156 |
+
"probe = Interactor(gold_animal='octopus', animals_pool=animals_pool, questions_pool=questions_pool)\n",
|
| 157 |
+
"print(\"\\nask('is it a mammal?') ->\", probe.ask('is it a mammal?'))\n",
|
| 158 |
+
"print(\"ask('does it live in water?') ->\", probe.ask('does it live in water?'))\n",
|
| 159 |
+
"print('Queries used:', probe.queries_used, '/', probe.budget)\n",
|
| 160 |
+
"\n",
|
| 161 |
+
"# The model loads in bfloat16, which a T4 (Turing) cannot accelerate. Convert to\n",
|
| 162 |
+
"# float16 (T4 has fp16 tensor cores) -> identical answers, several times faster.\n",
|
| 163 |
+
"import torch\n",
|
| 164 |
+
"if torch.cuda.is_available() and next(Interactor._model.parameters()).dtype != torch.float16:\n",
|
| 165 |
+
" Interactor._model = Interactor._model.half()\n",
|
| 166 |
+
" print('oracle model -> float16 (faster on T4)')"
|
| 167 |
+
]
|
| 168 |
+
},
|
| 169 |
+
{
|
| 170 |
+
"cell_type": "markdown",
|
| 171 |
+
"metadata": {},
|
| 172 |
+
"source": [
|
| 173 |
+
"## Step 3: Solution interface\n",
|
| 174 |
+
"\n",
|
| 175 |
+
"Your solution is a class with two methods:\n",
|
| 176 |
+
"\n",
|
| 177 |
+
"- `__init__(self, animals_pool, questions_pool)` — runs once. Load models, precompute tables, etc.\n",
|
| 178 |
+
"- `solve(self, interactor)` — runs once per test row. Use the oracle to identify the hidden animal.\n",
|
| 179 |
+
"\n",
|
| 180 |
+
"Inside `solve`, you have:\n",
|
| 181 |
+
"\n",
|
| 182 |
+
"```\n",
|
| 183 |
+
"interactor.ask(question) -> 'yes' or 'no' (question must be in questions_pool)\n",
|
| 184 |
+
"interactor.guess(animal) -> 'correct' or 'wrong' (animal must be in animals_pool)\n",
|
| 185 |
+
"interactor.is_done() -> True after a correct guess or budget exhausted\n",
|
| 186 |
+
"interactor.remaining_budget() -> int\n",
|
| 187 |
+
"```\n",
|
| 188 |
+
"\n",
|
| 189 |
+
"**Scoring per row**: `score = max(0, (1 if you ever guess correctly else 0) - 0.02 * total_queries)`.\n",
|
| 190 |
+
"\n",
|
| 191 |
+
"Budget is **15 questions** per row. Information theory: `log₂(1400) ≈ 10.5 bits`, each yes/no answer is at most 1 bit — so ~11 well-chosen questions plus 1 final guess fit the budget, *if* each question splits the remaining candidates in half. Most don't: *\"does it have a backbone?\"* sounds decisive but the model calls a great many creatures vertebrates. A good question splits the *remaining* candidates roughly in half, given everything you have already learned — so the right next question depends on the answers so far."
|
| 192 |
+
]
|
| 193 |
+
},
|
| 194 |
+
{
|
| 195 |
+
"cell_type": "markdown",
|
| 196 |
+
"metadata": {},
|
| 197 |
+
"source": [
|
| 198 |
+
"### Baseline: random guessing (the floor)\n",
|
| 199 |
+
"\n",
|
| 200 |
+
"Ignores `ask()` entirely. Just guesses random animals until the budget runs out. Expected score: ~0 (15 random guesses out of ~1,400 candidates ≈ 1% solve rate). Any reasonable solution needs to beat this by a lot."
|
| 201 |
+
]
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"cell_type": "code",
|
| 205 |
+
"metadata": {},
|
| 206 |
+
"execution_count": null,
|
| 207 |
+
"outputs": [],
|
| 208 |
+
"source": [
|
| 209 |
+
"class RandomBaseline:\n",
|
| 210 |
+
" def __init__(self, animals_pool, questions_pool, seed=0):\n",
|
| 211 |
+
" self.animals_pool = animals_pool\n",
|
| 212 |
+
" self.questions_pool = questions_pool\n",
|
| 213 |
+
" self.rng = random.Random(seed)\n",
|
| 214 |
+
"\n",
|
| 215 |
+
" def solve(self, interactor):\n",
|
| 216 |
+
" guessed = set()\n",
|
| 217 |
+
" while not interactor.is_done():\n",
|
| 218 |
+
" cand = self.rng.choice(self.animals_pool)\n",
|
| 219 |
+
" while cand in guessed:\n",
|
| 220 |
+
" cand = self.rng.choice(self.animals_pool)\n",
|
| 221 |
+
" guessed.add(cand)\n",
|
| 222 |
+
" interactor.guess(cand)\n",
|
| 223 |
+
"\n",
|
| 224 |
+
"baseline_results = evaluate(RandomBaseline(animals_pool, questions_pool), 'dev.csv')"
|
| 225 |
+
]
|
| 226 |
+
},
|
| 227 |
+
{
|
| 228 |
+
"cell_type": "markdown",
|
| 229 |
+
"metadata": {},
|
| 230 |
+
"source": [
|
| 231 |
+
"### Reference: a non-adaptive 20-questions sketch\n",
|
| 232 |
+
"\n",
|
| 233 |
+
"This reference shows the *shape* of a real solution without giving away the points. In `__init__` it precomputes, with its own copy of the model, the oracle's yes/no answer to a small **fixed** list of broad questions for every animal — a bit-vector per animal. In `solve` it asks those same fixed questions, reads off the oracle's bit-vector, and guesses the animals whose precomputed vector is closest.\n",
|
| 234 |
+
"\n",
|
| 235 |
+
"It works, but it's deliberately weak: the questions are the **same for every row** (not chosen adaptively to split the *remaining* candidates), and it uses only a handful. Beating it is mostly about (1) precomputing the full `animal × question` table and (2) choosing each next question *greedily* to most evenly split the animals still consistent with the answers so far. That's your job in Step 4.\n",
|
| 236 |
+
"\n",
|
| 237 |
+
"> Precomputing even this small table calls the model a few thousand times (~5-15 min on T4). Skip this cell if you just want to get to your own solution — it is only a reference."
|
| 238 |
+
]
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"cell_type": "markdown",
|
| 242 |
+
"metadata": {},
|
| 243 |
+
"source": [
|
| 244 |
+
"### 💡 Speed tip\n",
|
| 245 |
+
"\n",
|
| 246 |
+
"Building the animal×question table by calling `interactor.ask()` **one at a time** is slow.\n",
|
| 247 |
+
"You can make your precompute **much** faster — without changing any answers — by **batching**\n",
|
| 248 |
+
"your model calls (many prompts through the model per forward pass). That optimization is up to you."
|
| 249 |
+
]
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"cell_type": "code",
|
| 253 |
+
"metadata": {},
|
| 254 |
+
"execution_count": null,
|
| 255 |
+
"outputs": [],
|
| 256 |
+
"source": [
|
| 257 |
+
"# Reference solution (optional, slow to init). Demonstrates precompute + match,\n",
|
| 258 |
+
"# but uses FIXED, non-adaptive questions -> leaves most of the score on the table.\n",
|
| 259 |
+
"FIXED_QUESTIONS = [\n",
|
| 260 |
+
" 'is it a mammal?',\n",
|
| 261 |
+
" 'is it a bird?',\n",
|
| 262 |
+
" 'is it a fish?',\n",
|
| 263 |
+
" 'is it an insect?',\n",
|
| 264 |
+
" 'does it live in water?',\n",
|
| 265 |
+
" 'can it fly?',\n",
|
| 266 |
+
" 'is it a carnivore?',\n",
|
| 267 |
+
" 'is it bigger than a human?',\n",
|
| 268 |
+
" 'does it have a backbone?',\n",
|
| 269 |
+
" 'is it commonly kept as a pet?',\n",
|
| 270 |
+
" 'does it have legs?',\n",
|
| 271 |
+
" 'does it lay eggs?',\n",
|
| 272 |
+
"]\n",
|
| 273 |
+
"\n",
|
| 274 |
+
"class FixedQuestionsReference:\n",
|
| 275 |
+
" def __init__(self, animals_pool, questions_pool, max_animals=None):\n",
|
| 276 |
+
" self.animals_pool = animals_pool\n",
|
| 277 |
+
" self.questions_pool = set(questions_pool)\n",
|
| 278 |
+
" self.fixed = [q for q in FIXED_QUESTIONS if q in self.questions_pool]\n",
|
| 279 |
+
" from interactor import Interactor\n",
|
| 280 |
+
" cand = animals_pool if max_animals is None else animals_pool[:max_animals]\n",
|
| 281 |
+
" self.candidates = cand\n",
|
| 282 |
+
" print(f' [reference] precomputing {len(cand)} x {len(self.fixed)} answer table...')\n",
|
| 283 |
+
" self.table = {}\n",
|
| 284 |
+
" for i, a in enumerate(cand):\n",
|
| 285 |
+
" sim = Interactor(gold_animal=a, animals_pool=self.animals_pool,\n",
|
| 286 |
+
" questions_pool=self.questions_pool, budget=10**9)\n",
|
| 287 |
+
" self.table[a] = tuple(1 if sim.ask(q) == 'yes' else 0 for q in self.fixed)\n",
|
| 288 |
+
" if (i + 1) % 200 == 0:\n",
|
| 289 |
+
" print(f' {i+1}/{len(cand)}')\n",
|
| 290 |
+
" print(' [reference] table ready.')\n",
|
| 291 |
+
"\n",
|
| 292 |
+
" def solve(self, interactor):\n",
|
| 293 |
+
" obs = []\n",
|
| 294 |
+
" for q in self.fixed:\n",
|
| 295 |
+
" if interactor.remaining_budget() <= 1:\n",
|
| 296 |
+
" break\n",
|
| 297 |
+
" obs.append(1 if interactor.ask(q) == 'yes' else 0)\n",
|
| 298 |
+
" obs = tuple(obs)\n",
|
| 299 |
+
" def agree(a):\n",
|
| 300 |
+
" vec = self.table[a]\n",
|
| 301 |
+
" return sum(1 for x, y in zip(vec, obs) if x == y)\n",
|
| 302 |
+
" ranked = sorted(self.candidates, key=agree, reverse=True)\n",
|
| 303 |
+
" for a in ranked:\n",
|
| 304 |
+
" if interactor.is_done():\n",
|
| 305 |
+
" break\n",
|
| 306 |
+
" interactor.guess(a)\n",
|
| 307 |
+
"\n",
|
| 308 |
+
"# Example (commented out by default — uncomment to run; slow to init):\n",
|
| 309 |
+
"# ref = FixedQuestionsReference(animals_pool, questions_pool)\n",
|
| 310 |
+
"# ref_results = evaluate(ref, 'dev.csv')"
|
| 311 |
+
]
|
| 312 |
+
},
|
| 313 |
+
{
|
| 314 |
+
"cell_type": "markdown",
|
| 315 |
+
"metadata": {},
|
| 316 |
+
"source": [
|
| 317 |
+
"## Step 4: Your solution\n",
|
| 318 |
+
"\n",
|
| 319 |
+
"Replace the body of `MySolution.solve` (and `__init__` if you precompute anything) with your strategy. Iterate on `dev.csv` until you're happy with the score, then jump to Step 5 to evaluate on test1 + test2.\n",
|
| 320 |
+
"\n",
|
| 321 |
+
"**The intended approach:**\n",
|
| 322 |
+
"1. In `__init__`, precompute once — with your own copy of the model — the oracle's yes/no answer for every `(animal, question)` pair you care about. This costs no oracle budget.\n",
|
| 323 |
+
"2. In `solve`, keep a set of candidate animals still consistent with the answers so far. At each step pick the **question whose answer most evenly splits that set** (maximize information gain), ask it, and shrink the set. Guess when one candidate dominates or the budget is nearly gone.\n",
|
| 324 |
+
"3. Be robust: the oracle occasionally answers in a way your table didn't predict. Don't let one surprising bit eliminate the true animal forever."
|
| 325 |
+
]
|
| 326 |
+
},
|
| 327 |
+
{
|
| 328 |
+
"cell_type": "code",
|
| 329 |
+
"metadata": {},
|
| 330 |
+
"execution_count": null,
|
| 331 |
+
"outputs": [],
|
| 332 |
+
"source": [
|
| 333 |
+
"class MySolution:\n",
|
| 334 |
+
" def __init__(self, animals_pool, questions_pool):\n",
|
| 335 |
+
" self.animals_pool = animals_pool\n",
|
| 336 |
+
" self.questions_pool = questions_pool\n",
|
| 337 |
+
" # TODO: precompute the (animal x question) answer table and anything else.\n",
|
| 338 |
+
"\n",
|
| 339 |
+
" def solve(self, interactor):\n",
|
| 340 |
+
" # TODO: your strategy. Each ask is ~1 bit; log2(1400) ~ 10.5 bits needed.\n",
|
| 341 |
+
" # Budget is 15. Choose each question to split the remaining candidates.\n",
|
| 342 |
+
" while not interactor.is_done():\n",
|
| 343 |
+
" interactor.guess(self.animals_pool[0])\n",
|
| 344 |
+
"\n",
|
| 345 |
+
"my_dev = evaluate(MySolution(animals_pool, questions_pool), 'dev.csv')"
|
| 346 |
+
]
|
| 347 |
+
},
|
| 348 |
+
{
|
| 349 |
+
"cell_type": "markdown",
|
| 350 |
+
"metadata": {},
|
| 351 |
+
"source": [
|
| 352 |
+
"## Step 5: Final scoring\n",
|
| 353 |
+
"\n",
|
| 354 |
+
"Once you're happy with your dev score, run this cell. It scores `dev` and `test1` (and `test2` automatically, if that file is present). The **FINAL** line — the *n*-weighted mean over the available test split(s) — is what you submit a screenshot of.\n",
|
| 355 |
+
"\n",
|
| 356 |
+
"> The organizers also score your submitted `MySolution` on a separate **hidden** test set that is not included here. Aim for a strategy that deduces the animal from scratch each row, so it transfers to unseen creatures."
|
| 357 |
+
]
|
| 358 |
+
},
|
| 359 |
+
{
|
| 360 |
+
"cell_type": "code",
|
| 361 |
+
"metadata": {},
|
| 362 |
+
"execution_count": null,
|
| 363 |
+
"outputs": [],
|
| 364 |
+
"source": [
|
| 365 |
+
"import os\n",
|
| 366 |
+
"\n",
|
| 367 |
+
"solution = MySolution(animals_pool, questions_pool)\n",
|
| 368 |
+
"dev_results = evaluate(solution, 'dev.csv')\n",
|
| 369 |
+
"test1_results = evaluate(solution, 'test1.csv')\n",
|
| 370 |
+
"\n",
|
| 371 |
+
"splits = [('dev', dev_results), ('test1', test1_results)]\n",
|
| 372 |
+
"# test2 is a held-out set; included automatically only if present in the folder.\n",
|
| 373 |
+
"if os.path.exists('test2.csv'):\n",
|
| 374 |
+
" splits.append(('test2', evaluate(solution, 'test2.csv')))\n",
|
| 375 |
+
"\n",
|
| 376 |
+
"rows = [{\n",
|
| 377 |
+
" 'split': name, 'n': r['n'], 'mean_score': r['mean_score'],\n",
|
| 378 |
+
" 'solved_rate': r['solved_rate'], 'mean_queries': r['mean_queries'],\n",
|
| 379 |
+
"} for name, r in splits]\n",
|
| 380 |
+
"\n",
|
| 381 |
+
"# FINAL = n-weighted mean over every test split available (test1 [+ test2]).\n",
|
| 382 |
+
"tests = [r for name, r in splits if name.startswith('test')]\n",
|
| 383 |
+
"n_test = sum(r['n'] for r in tests)\n",
|
| 384 |
+
"rows.append({\n",
|
| 385 |
+
" 'split': 'FINAL',\n",
|
| 386 |
+
" 'n': n_test,\n",
|
| 387 |
+
" 'mean_score': sum(r['mean_score'] * r['n'] for r in tests) / n_test,\n",
|
| 388 |
+
" 'solved_rate': sum(r['solved_rate'] * r['n'] for r in tests) / n_test,\n",
|
| 389 |
+
" 'mean_queries': sum(r['mean_queries'] * r['n'] for r in tests) / n_test,\n",
|
| 390 |
+
"})\n",
|
| 391 |
+
"pd.DataFrame(rows)"
|
| 392 |
+
]
|
| 393 |
+
}
|
| 394 |
+
],
|
| 395 |
+
"metadata": {
|
| 396 |
+
"kernelspec": {
|
| 397 |
+
"display_name": "Python 3",
|
| 398 |
+
"language": "python",
|
| 399 |
+
"name": "python3"
|
| 400 |
+
},
|
| 401 |
+
"language_info": {
|
| 402 |
+
"name": "python"
|
| 403 |
+
},
|
| 404 |
+
"accelerator": "GPU",
|
| 405 |
+
"colab": {
|
| 406 |
+
"provenance": []
|
| 407 |
+
}
|
| 408 |
+
},
|
| 409 |
+
"nbformat": 4,
|
| 410 |
+
"nbformat_minor": 5
|
| 411 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/label.csv
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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+
1,1
|
| 77 |
+
-1,-1
|
| 78 |
+
-1,-1
|
| 79 |
+
-1,-1
|
| 80 |
+
-1,-1
|
| 81 |
+
-1,-1
|
| 82 |
+
1,1
|
| 83 |
+
1,1
|
| 84 |
+
-1,-1
|
| 85 |
+
-1,1
|
| 86 |
+
-1,1
|
| 87 |
+
1,1
|
| 88 |
+
-1,1
|
| 89 |
+
-1,-1
|
| 90 |
+
-1,1
|
| 91 |
+
1,-1
|
| 92 |
+
1,1
|
| 93 |
+
1,-1
|
| 94 |
+
1,1
|
| 95 |
+
-1,1
|
| 96 |
+
1,-1
|
| 97 |
+
-1,1
|
| 98 |
+
1,-1
|
| 99 |
+
1,1
|
| 100 |
+
-1,1
|
| 101 |
+
1,1
|
| 102 |
+
-1,-1
|
| 103 |
+
-1,1
|
| 104 |
+
1,1
|
| 105 |
+
-1,1
|
| 106 |
+
1,-1
|
| 107 |
+
-1,-1
|
| 108 |
+
1,-1
|
| 109 |
+
-1,1
|
| 110 |
+
1,-1
|
| 111 |
+
1,1
|
| 112 |
+
-1,-1
|
| 113 |
+
-1,1
|
| 114 |
+
-1,-1
|
| 115 |
+
1,-1
|
| 116 |
+
1,1
|
| 117 |
+
-1,1
|
| 118 |
+
-1,-1
|
| 119 |
+
1,1
|
| 120 |
+
1,-1
|
| 121 |
+
-1,1
|
| 122 |
+
-1,1
|
| 123 |
+
1,1
|
| 124 |
+
1,1
|
| 125 |
+
-1,1
|
| 126 |
+
1,-1
|
| 127 |
+
1,1
|
| 128 |
+
-1,1
|
| 129 |
+
1,1
|
| 130 |
+
-1,1
|
| 131 |
+
1,1
|
| 132 |
+
1,-1
|
| 133 |
+
1,-1
|
| 134 |
+
1,-1
|
| 135 |
+
-1,-1
|
| 136 |
+
-1,-1
|
| 137 |
+
1,-1
|
| 138 |
+
-1,1
|
| 139 |
+
-1,1
|
| 140 |
+
-1,-1
|
| 141 |
+
-1,-1
|
| 142 |
+
1,1
|
| 143 |
+
1,1
|
| 144 |
+
-1,1
|
| 145 |
+
-1,1
|
| 146 |
+
-1,1
|
| 147 |
+
-1,-1
|
| 148 |
+
1,-1
|
| 149 |
+
-1,1
|
| 150 |
+
-1,1
|
| 151 |
+
1,-1
|
| 152 |
+
-1,-1
|
| 153 |
+
-1,1
|
| 154 |
+
-1,1
|
| 155 |
+
-1,1
|
| 156 |
+
1,-1
|
| 157 |
+
1,-1
|
| 158 |
+
-1,-1
|
| 159 |
+
1,1
|
| 160 |
+
1,1
|
| 161 |
+
-1,-1
|
| 162 |
+
-1,1
|
| 163 |
+
1,1
|
| 164 |
+
1,1
|
| 165 |
+
1,-1
|
| 166 |
+
-1,-1
|
| 167 |
+
1,1
|
| 168 |
+
-1,-1
|
| 169 |
+
1,-1
|
| 170 |
+
1,1
|
| 171 |
+
1,-1
|
| 172 |
+
1,1
|
| 173 |
+
-1,1
|
| 174 |
+
-1,1
|
| 175 |
+
1,-1
|
| 176 |
+
-1,1
|
| 177 |
+
1,1
|
| 178 |
+
-1,1
|
| 179 |
+
1,-1
|
| 180 |
+
1,1
|
| 181 |
+
1,-1
|
| 182 |
+
1,-1
|
| 183 |
+
1,1
|
| 184 |
+
-1,-1
|
| 185 |
+
-1,1
|
| 186 |
+
1,-1
|
| 187 |
+
-1,1
|
| 188 |
+
1,-1
|
| 189 |
+
1,-1
|
| 190 |
+
1,1
|
| 191 |
+
-1,1
|
| 192 |
+
1,-1
|
| 193 |
+
1,1
|
| 194 |
+
1,1
|
| 195 |
+
-1,1
|
| 196 |
+
-1,-1
|
| 197 |
+
-1,1
|
| 198 |
+
1,1
|
| 199 |
+
-1,1
|
| 200 |
+
1,-1
|
| 201 |
+
-1,-1
|
| 202 |
+
1,1
|
| 203 |
+
1,1
|
| 204 |
+
1,1
|
| 205 |
+
1,-1
|
| 206 |
+
1,1
|
| 207 |
+
1,1
|
| 208 |
+
-1,1
|
| 209 |
+
-1,1
|
| 210 |
+
-1,-1
|
| 211 |
+
1,1
|
| 212 |
+
-1,-1
|
| 213 |
+
-1,1
|
| 214 |
+
-1,1
|
| 215 |
+
1,-1
|
| 216 |
+
-1,-1
|
| 217 |
+
-1,1
|
| 218 |
+
-1,1
|
| 219 |
+
-1,-1
|
| 220 |
+
1,-1
|
| 221 |
+
1,-1
|
| 222 |
+
1,-1
|
| 223 |
+
-1,1
|
| 224 |
+
-1,1
|
| 225 |
+
1,-1
|
| 226 |
+
-1,1
|
| 227 |
+
1,-1
|
| 228 |
+
-1,-1
|
| 229 |
+
-1,1
|
| 230 |
+
1,1
|
| 231 |
+
1,-1
|
| 232 |
+
1,1
|
| 233 |
+
1,1
|
| 234 |
+
1,-1
|
| 235 |
+
1,1
|
| 236 |
+
1,-1
|
| 237 |
+
-1,1
|
| 238 |
+
1,-1
|
| 239 |
+
1,1
|
| 240 |
+
1,1
|
| 241 |
+
1,-1
|
| 242 |
+
-1,-1
|
| 243 |
+
-1,-1
|
| 244 |
+
-1,-1
|
| 245 |
+
1,1
|
| 246 |
+
-1,1
|
| 247 |
+
1,1
|
| 248 |
+
-1,-1
|
| 249 |
+
1,1
|
| 250 |
+
-1,-1
|
| 251 |
+
-1,-1
|
| 252 |
+
1,1
|
| 253 |
+
1,1
|
| 254 |
+
1,1
|
| 255 |
+
1,-1
|
| 256 |
+
1,-1
|
| 257 |
+
1,-1
|
| 258 |
+
-1,-1
|
| 259 |
+
1,1
|
| 260 |
+
1,-1
|
| 261 |
+
-1,1
|
| 262 |
+
1,-1
|
| 263 |
+
1,-1
|
| 264 |
+
1,1
|
| 265 |
+
1,-1
|
| 266 |
+
1,1
|
| 267 |
+
-1,1
|
| 268 |
+
-1,1
|
| 269 |
+
-1,1
|
| 270 |
+
-1,1
|
| 271 |
+
1,-1
|
| 272 |
+
1,-1
|
| 273 |
+
-1,1
|
| 274 |
+
1,-1
|
| 275 |
+
-1,-1
|
| 276 |
+
-1,-1
|
| 277 |
+
1,-1
|
| 278 |
+
1,1
|
| 279 |
+
-1,-1
|
| 280 |
+
1,-1
|
| 281 |
+
1,1
|
| 282 |
+
-1,-1
|
| 283 |
+
1,-1
|
| 284 |
+
1,1
|
| 285 |
+
-1,-1
|
| 286 |
+
1,1
|
| 287 |
+
1,1
|
| 288 |
+
-1,-1
|
| 289 |
+
1,-1
|
| 290 |
+
-1,-1
|
| 291 |
+
1,1
|
| 292 |
+
1,-1
|
| 293 |
+
1,1
|
| 294 |
+
1,-1
|
| 295 |
+
1,1
|
| 296 |
+
-1,-1
|
| 297 |
+
-1,1
|
| 298 |
+
1,1
|
| 299 |
+
1,1
|
| 300 |
+
-1,-1
|
| 301 |
+
1,-1
|
| 302 |
+
1,1
|
| 303 |
+
1,-1
|
| 304 |
+
-1,-1
|
| 305 |
+
1,-1
|
| 306 |
+
1,-1
|
| 307 |
+
1,1
|
| 308 |
+
1,-1
|
| 309 |
+
-1,-1
|
| 310 |
+
1,1
|
| 311 |
+
1,1
|
| 312 |
+
1,1
|
| 313 |
+
-1,-1
|
| 314 |
+
1,-1
|
| 315 |
+
-1,1
|
| 316 |
+
1,-1
|
| 317 |
+
-1,-1
|
| 318 |
+
-1,1
|
| 319 |
+
-1,-1
|
| 320 |
+
1,1
|
| 321 |
+
-1,1
|
| 322 |
+
1,1
|
| 323 |
+
-1,-1
|
| 324 |
+
1,1
|
| 325 |
+
-1,-1
|
| 326 |
+
-1,-1
|
| 327 |
+
-1,-1
|
| 328 |
+
1,1
|
| 329 |
+
-1,1
|
| 330 |
+
-1,1
|
| 331 |
+
-1,-1
|
| 332 |
+
1,1
|
| 333 |
+
1,-1
|
| 334 |
+
-1,-1
|
| 335 |
+
1,1
|
| 336 |
+
1,-1
|
| 337 |
+
-1,-1
|
| 338 |
+
1,1
|
| 339 |
+
-1,1
|
| 340 |
+
1,-1
|
| 341 |
+
1,-1
|
| 342 |
+
-1,1
|
| 343 |
+
-1,1
|
| 344 |
+
-1,-1
|
| 345 |
+
-1,-1
|
| 346 |
+
-1,-1
|
| 347 |
+
1,1
|
| 348 |
+
-1,-1
|
| 349 |
+
1,-1
|
| 350 |
+
-1,-1
|
| 351 |
+
1,-1
|
| 352 |
+
-1,1
|
| 353 |
+
-1,1
|
| 354 |
+
-1,-1
|
| 355 |
+
1,-1
|
| 356 |
+
-1,1
|
| 357 |
+
-1,-1
|
| 358 |
+
-1,-1
|
| 359 |
+
1,1
|
| 360 |
+
-1,-1
|
| 361 |
+
-1,1
|
| 362 |
+
1,-1
|
| 363 |
+
1,1
|
| 364 |
+
1,-1
|
| 365 |
+
-1,-1
|
| 366 |
+
-1,1
|
| 367 |
+
1,-1
|
| 368 |
+
1,-1
|
| 369 |
+
1,-1
|
| 370 |
+
-1,1
|
| 371 |
+
-1,-1
|
| 372 |
+
-1,1
|
| 373 |
+
1,-1
|
| 374 |
+
1,-1
|
| 375 |
+
-1,-1
|
| 376 |
+
1,1
|
| 377 |
+
-1,-1
|
| 378 |
+
-1,-1
|
| 379 |
+
-1,-1
|
| 380 |
+
1,-1
|
| 381 |
+
-1,1
|
| 382 |
+
-1,-1
|
| 383 |
+
-1,-1
|
| 384 |
+
-1,-1
|
| 385 |
+
-1,1
|
| 386 |
+
-1,-1
|
| 387 |
+
1,1
|
| 388 |
+
1,-1
|
| 389 |
+
-1,-1
|
| 390 |
+
-1,1
|
| 391 |
+
1,-1
|
| 392 |
+
-1,-1
|
| 393 |
+
1,-1
|
| 394 |
+
-1,-1
|
| 395 |
+
1,-1
|
| 396 |
+
-1,1
|
| 397 |
+
1,1
|
| 398 |
+
1,1
|
| 399 |
+
1,-1
|
| 400 |
+
1,1
|
| 401 |
+
1,1
|
| 402 |
+
-1,1
|
| 403 |
+
-1,-1
|
| 404 |
+
-1,1
|
| 405 |
+
-1,1
|
| 406 |
+
1,-1
|
| 407 |
+
-1,1
|
| 408 |
+
-1,-1
|
| 409 |
+
1,-1
|
| 410 |
+
-1,1
|
| 411 |
+
-1,-1
|
| 412 |
+
-1,1
|
| 413 |
+
-1,1
|
| 414 |
+
1,-1
|
| 415 |
+
1,-1
|
| 416 |
+
-1,1
|
| 417 |
+
1,-1
|
| 418 |
+
-1,1
|
| 419 |
+
-1,1
|
| 420 |
+
1,1
|
| 421 |
+
1,1
|
| 422 |
+
-1,1
|
| 423 |
+
1,1
|
| 424 |
+
1,1
|
| 425 |
+
1,1
|
| 426 |
+
-1,-1
|
| 427 |
+
1,-1
|
| 428 |
+
1,1
|
| 429 |
+
1,1
|
| 430 |
+
1,1
|
| 431 |
+
-1,1
|
| 432 |
+
1,-1
|
| 433 |
+
-1,1
|
| 434 |
+
1,-1
|
| 435 |
+
-1,-1
|
| 436 |
+
-1,-1
|
| 437 |
+
-1,1
|
| 438 |
+
-1,1
|
| 439 |
+
1,-1
|
| 440 |
+
1,-1
|
| 441 |
+
-1,1
|
| 442 |
+
-1,-1
|
| 443 |
+
-1,-1
|
| 444 |
+
-1,1
|
| 445 |
+
1,1
|
| 446 |
+
-1,-1
|
| 447 |
+
1,1
|
| 448 |
+
1,1
|
| 449 |
+
1,-1
|
| 450 |
+
-1,1
|
| 451 |
+
1,1
|
| 452 |
+
-1,1
|
| 453 |
+
-1,1
|
| 454 |
+
-1,-1
|
| 455 |
+
-1,-1
|
| 456 |
+
-1,1
|
| 457 |
+
1,-1
|
| 458 |
+
1,-1
|
| 459 |
+
-1,1
|
| 460 |
+
-1,-1
|
| 461 |
+
1,1
|
| 462 |
+
1,1
|
| 463 |
+
1,-1
|
| 464 |
+
1,-1
|
| 465 |
+
-1,1
|
| 466 |
+
1,1
|
| 467 |
+
1,-1
|
| 468 |
+
1,1
|
| 469 |
+
-1,1
|
| 470 |
+
1,-1
|
| 471 |
+
-1,1
|
| 472 |
+
-1,1
|
| 473 |
+
1,1
|
| 474 |
+
1,-1
|
| 475 |
+
-1,1
|
| 476 |
+
-1,-1
|
| 477 |
+
-1,1
|
| 478 |
+
1,-1
|
| 479 |
+
1,-1
|
| 480 |
+
1,-1
|
| 481 |
+
-1,1
|
| 482 |
+
-1,-1
|
| 483 |
+
1,-1
|
| 484 |
+
-1,1
|
| 485 |
+
1,-1
|
| 486 |
+
-1,1
|
| 487 |
+
-1,1
|
| 488 |
+
-1,-1
|
| 489 |
+
-1,-1
|
| 490 |
+
1,-1
|
| 491 |
+
1,-1
|
| 492 |
+
1,-1
|
| 493 |
+
-1,1
|
| 494 |
+
-1,1
|
| 495 |
+
-1,-1
|
| 496 |
+
-1,1
|
| 497 |
+
1,-1
|
| 498 |
+
1,-1
|
| 499 |
+
-1,-1
|
| 500 |
+
-1,-1
|
| 501 |
+
-1,-1
|
benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/metrics.py
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# -*- coding: utf-8 -*-
|
| 2 |
+
import numpy as np
|
| 3 |
+
import pandas as pd
|
| 4 |
+
import json
|
| 5 |
+
from sklearn.metrics import accuracy_score
|
| 6 |
+
import zipfile
|
| 7 |
+
import os
|
| 8 |
+
|
| 9 |
+
if __name__ == '__main__':
|
| 10 |
+
with zipfile.ZipFile('./Scoring/submission.zip', 'r') as zip_ref:
|
| 11 |
+
zip_ref.extractall('./Scoring/submission/')
|
| 12 |
+
|
| 13 |
+
ANSWER_PATH = "./Scoring/" # local testing
|
| 14 |
+
# A榜
|
| 15 |
+
predA_dir = ANSWER_PATH + "submission/submissionA.csv"
|
| 16 |
+
test_dir = ANSWER_PATH + "label.csv"
|
| 17 |
+
y_predA = pd.read_csv(predA_dir, header=None)
|
| 18 |
+
y_test = pd.read_csv(test_dir)
|
| 19 |
+
accuracy_A = accuracy_score(y_predA, y_test['validation_label'])
|
| 20 |
+
if accuracy_A > 1:
|
| 21 |
+
accuracy_A = 0
|
| 22 |
+
print(f"Accuracy for test A: {accuracy_A:.2f}")
|
| 23 |
+
# B榜
|
| 24 |
+
predB_dir = ANSWER_PATH + "submission/submissionB.csv"
|
| 25 |
+
y_predB = pd.read_csv(predB_dir, header=None)
|
| 26 |
+
accuracy_B = accuracy_score(y_predB, y_test['testing_label'])
|
| 27 |
+
if accuracy_B > 1:
|
| 28 |
+
accuracy_B = 0
|
| 29 |
+
print(f"Accuracy for test B: {accuracy_B:.2f}")
|
| 30 |
+
#----------calculate the score on the leaderboard------------#
|
| 31 |
+
score = {
|
| 32 |
+
"public_a": accuracy_A,
|
| 33 |
+
"public_detail": {
|
| 34 |
+
"Accuracy": accuracy_A,
|
| 35 |
+
},
|
| 36 |
+
"private_b": accuracy_B,
|
| 37 |
+
"private_detail":{
|
| 38 |
+
"Accuracy": accuracy_B,
|
| 39 |
+
},
|
| 40 |
+
}
|
| 41 |
+
#print(score)
|
| 42 |
+
ret_json = {
|
| 43 |
+
"status": True,
|
| 44 |
+
"score": score,
|
| 45 |
+
"msg": "Success!",
|
| 46 |
+
}
|
| 47 |
+
with open('score.json', 'w') as f:
|
| 48 |
+
f.write(json.dumps(ret_json))
|
| 49 |
+
|
benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/submission/submissionA.csv
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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+
1
|
| 109 |
+
-1
|
| 110 |
+
1
|
| 111 |
+
-1
|
| 112 |
+
1
|
| 113 |
+
-1
|
| 114 |
+
-1
|
| 115 |
+
1
|
| 116 |
+
1
|
| 117 |
+
-1
|
| 118 |
+
-1
|
| 119 |
+
-1
|
| 120 |
+
1
|
| 121 |
+
1
|
| 122 |
+
1
|
| 123 |
+
1
|
| 124 |
+
1
|
| 125 |
+
-1
|
| 126 |
+
1
|
| 127 |
+
1
|
| 128 |
+
1
|
| 129 |
+
1
|
| 130 |
+
1
|
| 131 |
+
-1
|
| 132 |
+
-1
|
| 133 |
+
-1
|
| 134 |
+
1
|
| 135 |
+
-1
|
| 136 |
+
-1
|
| 137 |
+
1
|
| 138 |
+
1
|
| 139 |
+
-1
|
| 140 |
+
-1
|
| 141 |
+
1
|
| 142 |
+
1
|
| 143 |
+
1
|
| 144 |
+
1
|
| 145 |
+
1
|
| 146 |
+
-1
|
| 147 |
+
-1
|
| 148 |
+
1
|
| 149 |
+
1
|
| 150 |
+
-1
|
| 151 |
+
-1
|
| 152 |
+
1
|
| 153 |
+
1
|
| 154 |
+
1
|
| 155 |
+
-1
|
| 156 |
+
-1
|
| 157 |
+
-1
|
| 158 |
+
1
|
| 159 |
+
1
|
| 160 |
+
-1
|
| 161 |
+
1
|
| 162 |
+
1
|
| 163 |
+
1
|
| 164 |
+
-1
|
| 165 |
+
-1
|
| 166 |
+
1
|
| 167 |
+
-1
|
| 168 |
+
1
|
| 169 |
+
1
|
| 170 |
+
-1
|
| 171 |
+
1
|
| 172 |
+
1
|
| 173 |
+
1
|
| 174 |
+
-1
|
| 175 |
+
1
|
| 176 |
+
1
|
| 177 |
+
1
|
| 178 |
+
-1
|
| 179 |
+
1
|
| 180 |
+
-1
|
| 181 |
+
-1
|
| 182 |
+
1
|
| 183 |
+
-1
|
| 184 |
+
1
|
| 185 |
+
-1
|
| 186 |
+
1
|
| 187 |
+
-1
|
| 188 |
+
-1
|
| 189 |
+
1
|
| 190 |
+
1
|
| 191 |
+
-1
|
| 192 |
+
1
|
| 193 |
+
1
|
| 194 |
+
1
|
| 195 |
+
-1
|
| 196 |
+
1
|
| 197 |
+
1
|
| 198 |
+
1
|
| 199 |
+
-1
|
| 200 |
+
-1
|
| 201 |
+
1
|
| 202 |
+
1
|
| 203 |
+
1
|
| 204 |
+
-1
|
| 205 |
+
1
|
| 206 |
+
1
|
| 207 |
+
1
|
| 208 |
+
1
|
| 209 |
+
-1
|
| 210 |
+
1
|
| 211 |
+
-1
|
| 212 |
+
1
|
| 213 |
+
1
|
| 214 |
+
-1
|
| 215 |
+
-1
|
| 216 |
+
1
|
| 217 |
+
1
|
| 218 |
+
-1
|
| 219 |
+
-1
|
| 220 |
+
-1
|
| 221 |
+
-1
|
| 222 |
+
1
|
| 223 |
+
1
|
| 224 |
+
-1
|
| 225 |
+
1
|
| 226 |
+
-1
|
| 227 |
+
-1
|
| 228 |
+
1
|
| 229 |
+
1
|
| 230 |
+
-1
|
| 231 |
+
1
|
| 232 |
+
1
|
| 233 |
+
-1
|
| 234 |
+
1
|
| 235 |
+
-1
|
| 236 |
+
1
|
| 237 |
+
-1
|
| 238 |
+
1
|
| 239 |
+
1
|
| 240 |
+
-1
|
| 241 |
+
-1
|
| 242 |
+
-1
|
| 243 |
+
-1
|
| 244 |
+
1
|
| 245 |
+
1
|
| 246 |
+
1
|
| 247 |
+
-1
|
| 248 |
+
1
|
| 249 |
+
-1
|
| 250 |
+
-1
|
| 251 |
+
1
|
| 252 |
+
1
|
| 253 |
+
1
|
| 254 |
+
-1
|
| 255 |
+
-1
|
| 256 |
+
-1
|
| 257 |
+
-1
|
| 258 |
+
1
|
| 259 |
+
-1
|
| 260 |
+
1
|
| 261 |
+
-1
|
| 262 |
+
-1
|
| 263 |
+
1
|
| 264 |
+
-1
|
| 265 |
+
1
|
| 266 |
+
1
|
| 267 |
+
1
|
| 268 |
+
1
|
| 269 |
+
1
|
| 270 |
+
-1
|
| 271 |
+
-1
|
| 272 |
+
1
|
| 273 |
+
-1
|
| 274 |
+
-1
|
| 275 |
+
-1
|
| 276 |
+
-1
|
| 277 |
+
1
|
| 278 |
+
-1
|
| 279 |
+
-1
|
| 280 |
+
1
|
| 281 |
+
-1
|
| 282 |
+
-1
|
| 283 |
+
1
|
| 284 |
+
-1
|
| 285 |
+
1
|
| 286 |
+
1
|
| 287 |
+
-1
|
| 288 |
+
-1
|
| 289 |
+
-1
|
| 290 |
+
1
|
| 291 |
+
-1
|
| 292 |
+
1
|
| 293 |
+
-1
|
| 294 |
+
1
|
| 295 |
+
-1
|
| 296 |
+
1
|
| 297 |
+
1
|
| 298 |
+
1
|
| 299 |
+
-1
|
| 300 |
+
-1
|
| 301 |
+
1
|
| 302 |
+
-1
|
| 303 |
+
-1
|
| 304 |
+
-1
|
| 305 |
+
-1
|
| 306 |
+
1
|
| 307 |
+
-1
|
| 308 |
+
-1
|
| 309 |
+
1
|
| 310 |
+
1
|
| 311 |
+
1
|
| 312 |
+
1
|
| 313 |
+
-1
|
| 314 |
+
1
|
| 315 |
+
-1
|
| 316 |
+
-1
|
| 317 |
+
1
|
| 318 |
+
-1
|
| 319 |
+
1
|
| 320 |
+
1
|
| 321 |
+
1
|
| 322 |
+
-1
|
| 323 |
+
1
|
| 324 |
+
-1
|
| 325 |
+
-1
|
| 326 |
+
-1
|
| 327 |
+
1
|
| 328 |
+
1
|
| 329 |
+
1
|
| 330 |
+
-1
|
| 331 |
+
1
|
| 332 |
+
-1
|
| 333 |
+
-1
|
| 334 |
+
1
|
| 335 |
+
-1
|
| 336 |
+
-1
|
| 337 |
+
1
|
| 338 |
+
1
|
| 339 |
+
-1
|
| 340 |
+
-1
|
| 341 |
+
1
|
| 342 |
+
1
|
| 343 |
+
-1
|
| 344 |
+
-1
|
| 345 |
+
-1
|
| 346 |
+
1
|
| 347 |
+
-1
|
| 348 |
+
-1
|
| 349 |
+
-1
|
| 350 |
+
-1
|
| 351 |
+
1
|
| 352 |
+
1
|
| 353 |
+
-1
|
| 354 |
+
-1
|
| 355 |
+
1
|
| 356 |
+
-1
|
| 357 |
+
-1
|
| 358 |
+
1
|
| 359 |
+
-1
|
| 360 |
+
1
|
| 361 |
+
-1
|
| 362 |
+
1
|
| 363 |
+
-1
|
| 364 |
+
1
|
| 365 |
+
1
|
| 366 |
+
-1
|
| 367 |
+
-1
|
| 368 |
+
-1
|
| 369 |
+
1
|
| 370 |
+
-1
|
| 371 |
+
1
|
| 372 |
+
-1
|
| 373 |
+
-1
|
| 374 |
+
-1
|
| 375 |
+
1
|
| 376 |
+
-1
|
| 377 |
+
-1
|
| 378 |
+
-1
|
| 379 |
+
-1
|
| 380 |
+
1
|
| 381 |
+
-1
|
| 382 |
+
-1
|
| 383 |
+
-1
|
| 384 |
+
1
|
| 385 |
+
-1
|
| 386 |
+
1
|
| 387 |
+
-1
|
| 388 |
+
-1
|
| 389 |
+
1
|
| 390 |
+
-1
|
| 391 |
+
-1
|
| 392 |
+
-1
|
| 393 |
+
-1
|
| 394 |
+
-1
|
| 395 |
+
1
|
| 396 |
+
1
|
| 397 |
+
1
|
| 398 |
+
-1
|
| 399 |
+
1
|
| 400 |
+
1
|
| 401 |
+
1
|
| 402 |
+
-1
|
| 403 |
+
1
|
| 404 |
+
1
|
| 405 |
+
-1
|
| 406 |
+
1
|
| 407 |
+
-1
|
| 408 |
+
-1
|
| 409 |
+
1
|
| 410 |
+
-1
|
| 411 |
+
1
|
| 412 |
+
1
|
| 413 |
+
-1
|
| 414 |
+
-1
|
| 415 |
+
1
|
| 416 |
+
-1
|
| 417 |
+
1
|
| 418 |
+
1
|
| 419 |
+
1
|
| 420 |
+
1
|
| 421 |
+
1
|
| 422 |
+
1
|
| 423 |
+
1
|
| 424 |
+
1
|
| 425 |
+
-1
|
| 426 |
+
-1
|
| 427 |
+
1
|
| 428 |
+
1
|
| 429 |
+
1
|
| 430 |
+
1
|
| 431 |
+
-1
|
| 432 |
+
1
|
| 433 |
+
-1
|
| 434 |
+
-1
|
| 435 |
+
-1
|
| 436 |
+
1
|
| 437 |
+
1
|
| 438 |
+
-1
|
| 439 |
+
-1
|
| 440 |
+
1
|
| 441 |
+
-1
|
| 442 |
+
-1
|
| 443 |
+
1
|
| 444 |
+
1
|
| 445 |
+
-1
|
| 446 |
+
1
|
| 447 |
+
1
|
| 448 |
+
-1
|
| 449 |
+
1
|
| 450 |
+
1
|
| 451 |
+
1
|
| 452 |
+
1
|
| 453 |
+
-1
|
| 454 |
+
-1
|
| 455 |
+
1
|
| 456 |
+
-1
|
| 457 |
+
-1
|
| 458 |
+
1
|
| 459 |
+
-1
|
| 460 |
+
1
|
| 461 |
+
1
|
| 462 |
+
-1
|
| 463 |
+
-1
|
| 464 |
+
1
|
| 465 |
+
1
|
| 466 |
+
-1
|
| 467 |
+
1
|
| 468 |
+
1
|
| 469 |
+
-1
|
| 470 |
+
1
|
| 471 |
+
1
|
| 472 |
+
1
|
| 473 |
+
-1
|
| 474 |
+
1
|
| 475 |
+
-1
|
| 476 |
+
1
|
| 477 |
+
-1
|
| 478 |
+
-1
|
| 479 |
+
-1
|
| 480 |
+
1
|
| 481 |
+
-1
|
| 482 |
+
-1
|
| 483 |
+
1
|
| 484 |
+
-1
|
| 485 |
+
1
|
| 486 |
+
1
|
| 487 |
+
-1
|
| 488 |
+
-1
|
| 489 |
+
-1
|
| 490 |
+
-1
|
| 491 |
+
-1
|
| 492 |
+
1
|
| 493 |
+
-1
|
| 494 |
+
-1
|
| 495 |
+
1
|
| 496 |
+
-1
|
| 497 |
+
-1
|
| 498 |
+
-1
|
| 499 |
+
-1
|
| 500 |
+
-1
|
benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/submission/submissionB.csv
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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-1
|
| 100 |
+
1
|
| 101 |
+
-1
|
| 102 |
+
-1
|
| 103 |
+
1
|
| 104 |
+
-1
|
| 105 |
+
1
|
| 106 |
+
-1
|
| 107 |
+
1
|
| 108 |
+
-1
|
| 109 |
+
1
|
| 110 |
+
1
|
| 111 |
+
-1
|
| 112 |
+
-1
|
| 113 |
+
-1
|
| 114 |
+
1
|
| 115 |
+
1
|
| 116 |
+
-1
|
| 117 |
+
-1
|
| 118 |
+
1
|
| 119 |
+
1
|
| 120 |
+
-1
|
| 121 |
+
-1
|
| 122 |
+
1
|
| 123 |
+
1
|
| 124 |
+
-1
|
| 125 |
+
1
|
| 126 |
+
1
|
| 127 |
+
-1
|
| 128 |
+
1
|
| 129 |
+
-1
|
| 130 |
+
1
|
| 131 |
+
1
|
| 132 |
+
1
|
| 133 |
+
1
|
| 134 |
+
-1
|
| 135 |
+
-1
|
| 136 |
+
1
|
| 137 |
+
-1
|
| 138 |
+
-1
|
| 139 |
+
-1
|
| 140 |
+
-1
|
| 141 |
+
1
|
| 142 |
+
1
|
| 143 |
+
-1
|
| 144 |
+
-1
|
| 145 |
+
-1
|
| 146 |
+
-1
|
| 147 |
+
1
|
| 148 |
+
-1
|
| 149 |
+
-1
|
| 150 |
+
1
|
| 151 |
+
-1
|
| 152 |
+
-1
|
| 153 |
+
-1
|
| 154 |
+
-1
|
| 155 |
+
1
|
| 156 |
+
1
|
| 157 |
+
-1
|
| 158 |
+
1
|
| 159 |
+
1
|
| 160 |
+
-1
|
| 161 |
+
-1
|
| 162 |
+
1
|
| 163 |
+
1
|
| 164 |
+
1
|
| 165 |
+
-1
|
| 166 |
+
1
|
| 167 |
+
-1
|
| 168 |
+
1
|
| 169 |
+
1
|
| 170 |
+
1
|
| 171 |
+
1
|
| 172 |
+
-1
|
| 173 |
+
-1
|
| 174 |
+
1
|
| 175 |
+
-1
|
| 176 |
+
1
|
| 177 |
+
-1
|
| 178 |
+
1
|
| 179 |
+
1
|
| 180 |
+
1
|
| 181 |
+
1
|
| 182 |
+
1
|
| 183 |
+
-1
|
| 184 |
+
-1
|
| 185 |
+
1
|
| 186 |
+
-1
|
| 187 |
+
1
|
| 188 |
+
1
|
| 189 |
+
1
|
| 190 |
+
-1
|
| 191 |
+
1
|
| 192 |
+
1
|
| 193 |
+
1
|
| 194 |
+
-1
|
| 195 |
+
-1
|
| 196 |
+
-1
|
| 197 |
+
1
|
| 198 |
+
-1
|
| 199 |
+
1
|
| 200 |
+
-1
|
| 201 |
+
1
|
| 202 |
+
1
|
| 203 |
+
1
|
| 204 |
+
1
|
| 205 |
+
1
|
| 206 |
+
1
|
| 207 |
+
-1
|
| 208 |
+
-1
|
| 209 |
+
-1
|
| 210 |
+
1
|
| 211 |
+
-1
|
| 212 |
+
-1
|
| 213 |
+
-1
|
| 214 |
+
1
|
| 215 |
+
-1
|
| 216 |
+
-1
|
| 217 |
+
-1
|
| 218 |
+
-1
|
| 219 |
+
1
|
| 220 |
+
1
|
| 221 |
+
1
|
| 222 |
+
-1
|
| 223 |
+
-1
|
| 224 |
+
1
|
| 225 |
+
-1
|
| 226 |
+
1
|
| 227 |
+
-1
|
| 228 |
+
-1
|
| 229 |
+
1
|
| 230 |
+
1
|
| 231 |
+
1
|
| 232 |
+
1
|
| 233 |
+
1
|
| 234 |
+
1
|
| 235 |
+
1
|
| 236 |
+
-1
|
| 237 |
+
1
|
| 238 |
+
1
|
| 239 |
+
1
|
| 240 |
+
1
|
| 241 |
+
-1
|
| 242 |
+
-1
|
| 243 |
+
-1
|
| 244 |
+
1
|
| 245 |
+
-1
|
| 246 |
+
1
|
| 247 |
+
-1
|
| 248 |
+
1
|
| 249 |
+
-1
|
| 250 |
+
-1
|
| 251 |
+
1
|
| 252 |
+
-1
|
| 253 |
+
1
|
| 254 |
+
1
|
| 255 |
+
1
|
| 256 |
+
1
|
| 257 |
+
-1
|
| 258 |
+
1
|
| 259 |
+
1
|
| 260 |
+
-1
|
| 261 |
+
1
|
| 262 |
+
1
|
| 263 |
+
1
|
| 264 |
+
1
|
| 265 |
+
1
|
| 266 |
+
-1
|
| 267 |
+
-1
|
| 268 |
+
-1
|
| 269 |
+
-1
|
| 270 |
+
1
|
| 271 |
+
1
|
| 272 |
+
-1
|
| 273 |
+
1
|
| 274 |
+
-1
|
| 275 |
+
-1
|
| 276 |
+
1
|
| 277 |
+
1
|
| 278 |
+
1
|
| 279 |
+
1
|
| 280 |
+
1
|
| 281 |
+
-1
|
| 282 |
+
1
|
| 283 |
+
1
|
| 284 |
+
-1
|
| 285 |
+
1
|
| 286 |
+
1
|
| 287 |
+
-1
|
| 288 |
+
-1
|
| 289 |
+
1
|
| 290 |
+
1
|
| 291 |
+
1
|
| 292 |
+
1
|
| 293 |
+
1
|
| 294 |
+
1
|
| 295 |
+
-1
|
| 296 |
+
-1
|
| 297 |
+
1
|
| 298 |
+
1
|
| 299 |
+
-1
|
| 300 |
+
1
|
| 301 |
+
1
|
| 302 |
+
1
|
| 303 |
+
-1
|
| 304 |
+
1
|
| 305 |
+
1
|
| 306 |
+
1
|
| 307 |
+
1
|
| 308 |
+
-1
|
| 309 |
+
1
|
| 310 |
+
1
|
| 311 |
+
1
|
| 312 |
+
-1
|
| 313 |
+
1
|
| 314 |
+
-1
|
| 315 |
+
1
|
| 316 |
+
-1
|
| 317 |
+
1
|
| 318 |
+
-1
|
| 319 |
+
1
|
| 320 |
+
1
|
| 321 |
+
1
|
| 322 |
+
-1
|
| 323 |
+
1
|
| 324 |
+
-1
|
| 325 |
+
-1
|
| 326 |
+
-1
|
| 327 |
+
1
|
| 328 |
+
-1
|
| 329 |
+
-1
|
| 330 |
+
-1
|
| 331 |
+
1
|
| 332 |
+
1
|
| 333 |
+
-1
|
| 334 |
+
1
|
| 335 |
+
1
|
| 336 |
+
-1
|
| 337 |
+
1
|
| 338 |
+
-1
|
| 339 |
+
1
|
| 340 |
+
1
|
| 341 |
+
-1
|
| 342 |
+
-1
|
| 343 |
+
-1
|
| 344 |
+
-1
|
| 345 |
+
-1
|
| 346 |
+
1
|
| 347 |
+
-1
|
| 348 |
+
1
|
| 349 |
+
-1
|
| 350 |
+
1
|
| 351 |
+
-1
|
| 352 |
+
-1
|
| 353 |
+
-1
|
| 354 |
+
1
|
| 355 |
+
-1
|
| 356 |
+
-1
|
| 357 |
+
-1
|
| 358 |
+
1
|
| 359 |
+
-1
|
| 360 |
+
-1
|
| 361 |
+
1
|
| 362 |
+
1
|
| 363 |
+
1
|
| 364 |
+
-1
|
| 365 |
+
-1
|
| 366 |
+
1
|
| 367 |
+
1
|
| 368 |
+
1
|
| 369 |
+
-1
|
| 370 |
+
-1
|
| 371 |
+
-1
|
| 372 |
+
1
|
| 373 |
+
1
|
| 374 |
+
-1
|
| 375 |
+
1
|
| 376 |
+
-1
|
| 377 |
+
-1
|
| 378 |
+
-1
|
| 379 |
+
1
|
| 380 |
+
-1
|
| 381 |
+
-1
|
| 382 |
+
-1
|
| 383 |
+
-1
|
| 384 |
+
-1
|
| 385 |
+
-1
|
| 386 |
+
1
|
| 387 |
+
1
|
| 388 |
+
-1
|
| 389 |
+
-1
|
| 390 |
+
1
|
| 391 |
+
-1
|
| 392 |
+
1
|
| 393 |
+
-1
|
| 394 |
+
1
|
| 395 |
+
-1
|
| 396 |
+
1
|
| 397 |
+
1
|
| 398 |
+
1
|
| 399 |
+
1
|
| 400 |
+
1
|
| 401 |
+
-1
|
| 402 |
+
-1
|
| 403 |
+
-1
|
| 404 |
+
-1
|
| 405 |
+
1
|
| 406 |
+
-1
|
| 407 |
+
-1
|
| 408 |
+
1
|
| 409 |
+
-1
|
| 410 |
+
-1
|
| 411 |
+
-1
|
| 412 |
+
-1
|
| 413 |
+
1
|
| 414 |
+
1
|
| 415 |
+
-1
|
| 416 |
+
1
|
| 417 |
+
-1
|
| 418 |
+
-1
|
| 419 |
+
1
|
| 420 |
+
1
|
| 421 |
+
-1
|
| 422 |
+
1
|
| 423 |
+
1
|
| 424 |
+
1
|
| 425 |
+
-1
|
| 426 |
+
1
|
| 427 |
+
1
|
| 428 |
+
1
|
| 429 |
+
1
|
| 430 |
+
-1
|
| 431 |
+
1
|
| 432 |
+
-1
|
| 433 |
+
1
|
| 434 |
+
-1
|
| 435 |
+
-1
|
| 436 |
+
-1
|
| 437 |
+
-1
|
| 438 |
+
1
|
| 439 |
+
1
|
| 440 |
+
-1
|
| 441 |
+
-1
|
| 442 |
+
-1
|
| 443 |
+
-1
|
| 444 |
+
1
|
| 445 |
+
-1
|
| 446 |
+
1
|
| 447 |
+
1
|
| 448 |
+
1
|
| 449 |
+
-1
|
| 450 |
+
1
|
| 451 |
+
-1
|
| 452 |
+
-1
|
| 453 |
+
-1
|
| 454 |
+
-1
|
| 455 |
+
-1
|
| 456 |
+
1
|
| 457 |
+
1
|
| 458 |
+
-1
|
| 459 |
+
-1
|
| 460 |
+
1
|
| 461 |
+
1
|
| 462 |
+
1
|
| 463 |
+
1
|
| 464 |
+
-1
|
| 465 |
+
1
|
| 466 |
+
1
|
| 467 |
+
1
|
| 468 |
+
1
|
| 469 |
+
1
|
| 470 |
+
-1
|
| 471 |
+
-1
|
| 472 |
+
1
|
| 473 |
+
1
|
| 474 |
+
-1
|
| 475 |
+
-1
|
| 476 |
+
1
|
| 477 |
+
1
|
| 478 |
+
1
|
| 479 |
+
1
|
| 480 |
+
-1
|
| 481 |
+
-1
|
| 482 |
+
1
|
| 483 |
+
-1
|
| 484 |
+
1
|
| 485 |
+
-1
|
| 486 |
+
-1
|
| 487 |
+
-1
|
| 488 |
+
-1
|
| 489 |
+
1
|
| 490 |
+
1
|
| 491 |
+
1
|
| 492 |
+
-1
|
| 493 |
+
-1
|
| 494 |
+
-1
|
| 495 |
+
-1
|
| 496 |
+
1
|
| 497 |
+
1
|
| 498 |
+
-1
|
| 499 |
+
-1
|
| 500 |
+
-1
|
benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Scoring/submissionA.csv
ADDED
|
@@ -0,0 +1,500 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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|
| 92 |
+
-1
|
| 93 |
+
1
|
| 94 |
+
1
|
| 95 |
+
-1
|
| 96 |
+
1
|
| 97 |
+
-1
|
| 98 |
+
1
|
| 99 |
+
1
|
| 100 |
+
1
|
| 101 |
+
-1
|
| 102 |
+
1
|
| 103 |
+
1
|
| 104 |
+
1
|
| 105 |
+
-1
|
| 106 |
+
-1
|
| 107 |
+
-1
|
| 108 |
+
1
|
| 109 |
+
-1
|
| 110 |
+
1
|
| 111 |
+
-1
|
| 112 |
+
1
|
| 113 |
+
-1
|
| 114 |
+
-1
|
| 115 |
+
1
|
| 116 |
+
1
|
| 117 |
+
-1
|
| 118 |
+
-1
|
| 119 |
+
-1
|
| 120 |
+
1
|
| 121 |
+
1
|
| 122 |
+
1
|
| 123 |
+
1
|
| 124 |
+
1
|
| 125 |
+
-1
|
| 126 |
+
1
|
| 127 |
+
1
|
| 128 |
+
1
|
| 129 |
+
1
|
| 130 |
+
1
|
| 131 |
+
-1
|
| 132 |
+
-1
|
| 133 |
+
-1
|
| 134 |
+
1
|
| 135 |
+
-1
|
| 136 |
+
-1
|
| 137 |
+
1
|
| 138 |
+
1
|
| 139 |
+
-1
|
| 140 |
+
-1
|
| 141 |
+
1
|
| 142 |
+
1
|
| 143 |
+
1
|
| 144 |
+
1
|
| 145 |
+
1
|
| 146 |
+
-1
|
| 147 |
+
-1
|
| 148 |
+
1
|
| 149 |
+
1
|
| 150 |
+
-1
|
| 151 |
+
-1
|
| 152 |
+
1
|
| 153 |
+
1
|
| 154 |
+
1
|
| 155 |
+
-1
|
| 156 |
+
-1
|
| 157 |
+
-1
|
| 158 |
+
1
|
| 159 |
+
1
|
| 160 |
+
-1
|
| 161 |
+
1
|
| 162 |
+
1
|
| 163 |
+
1
|
| 164 |
+
-1
|
| 165 |
+
-1
|
| 166 |
+
1
|
| 167 |
+
-1
|
| 168 |
+
1
|
| 169 |
+
1
|
| 170 |
+
-1
|
| 171 |
+
1
|
| 172 |
+
1
|
| 173 |
+
1
|
| 174 |
+
-1
|
| 175 |
+
1
|
| 176 |
+
1
|
| 177 |
+
1
|
| 178 |
+
-1
|
| 179 |
+
1
|
| 180 |
+
-1
|
| 181 |
+
-1
|
| 182 |
+
1
|
| 183 |
+
-1
|
| 184 |
+
1
|
| 185 |
+
-1
|
| 186 |
+
1
|
| 187 |
+
-1
|
| 188 |
+
-1
|
| 189 |
+
1
|
| 190 |
+
1
|
| 191 |
+
-1
|
| 192 |
+
1
|
| 193 |
+
1
|
| 194 |
+
1
|
| 195 |
+
-1
|
| 196 |
+
1
|
| 197 |
+
1
|
| 198 |
+
1
|
| 199 |
+
-1
|
| 200 |
+
-1
|
| 201 |
+
1
|
| 202 |
+
1
|
| 203 |
+
1
|
| 204 |
+
-1
|
| 205 |
+
1
|
| 206 |
+
1
|
| 207 |
+
1
|
| 208 |
+
1
|
| 209 |
+
-1
|
| 210 |
+
1
|
| 211 |
+
-1
|
| 212 |
+
1
|
| 213 |
+
1
|
| 214 |
+
-1
|
| 215 |
+
-1
|
| 216 |
+
1
|
| 217 |
+
1
|
| 218 |
+
-1
|
| 219 |
+
-1
|
| 220 |
+
-1
|
| 221 |
+
-1
|
| 222 |
+
1
|
| 223 |
+
1
|
| 224 |
+
-1
|
| 225 |
+
1
|
| 226 |
+
-1
|
| 227 |
+
-1
|
| 228 |
+
1
|
| 229 |
+
1
|
| 230 |
+
-1
|
| 231 |
+
1
|
| 232 |
+
1
|
| 233 |
+
-1
|
| 234 |
+
1
|
| 235 |
+
-1
|
| 236 |
+
1
|
| 237 |
+
-1
|
| 238 |
+
1
|
| 239 |
+
1
|
| 240 |
+
-1
|
| 241 |
+
-1
|
| 242 |
+
-1
|
| 243 |
+
-1
|
| 244 |
+
1
|
| 245 |
+
1
|
| 246 |
+
1
|
| 247 |
+
-1
|
| 248 |
+
1
|
| 249 |
+
-1
|
| 250 |
+
-1
|
| 251 |
+
1
|
| 252 |
+
1
|
| 253 |
+
1
|
| 254 |
+
-1
|
| 255 |
+
-1
|
| 256 |
+
-1
|
| 257 |
+
-1
|
| 258 |
+
1
|
| 259 |
+
-1
|
| 260 |
+
1
|
| 261 |
+
-1
|
| 262 |
+
-1
|
| 263 |
+
1
|
| 264 |
+
-1
|
| 265 |
+
1
|
| 266 |
+
1
|
| 267 |
+
1
|
| 268 |
+
1
|
| 269 |
+
1
|
| 270 |
+
-1
|
| 271 |
+
-1
|
| 272 |
+
1
|
| 273 |
+
-1
|
| 274 |
+
-1
|
| 275 |
+
-1
|
| 276 |
+
-1
|
| 277 |
+
1
|
| 278 |
+
-1
|
| 279 |
+
-1
|
| 280 |
+
1
|
| 281 |
+
-1
|
| 282 |
+
-1
|
| 283 |
+
1
|
| 284 |
+
-1
|
| 285 |
+
1
|
| 286 |
+
1
|
| 287 |
+
-1
|
| 288 |
+
-1
|
| 289 |
+
-1
|
| 290 |
+
1
|
| 291 |
+
-1
|
| 292 |
+
1
|
| 293 |
+
-1
|
| 294 |
+
1
|
| 295 |
+
-1
|
| 296 |
+
1
|
| 297 |
+
1
|
| 298 |
+
1
|
| 299 |
+
-1
|
| 300 |
+
-1
|
| 301 |
+
1
|
| 302 |
+
-1
|
| 303 |
+
-1
|
| 304 |
+
-1
|
| 305 |
+
-1
|
| 306 |
+
1
|
| 307 |
+
-1
|
| 308 |
+
-1
|
| 309 |
+
1
|
| 310 |
+
1
|
| 311 |
+
1
|
| 312 |
+
1
|
| 313 |
+
-1
|
| 314 |
+
1
|
| 315 |
+
-1
|
| 316 |
+
-1
|
| 317 |
+
1
|
| 318 |
+
-1
|
| 319 |
+
1
|
| 320 |
+
1
|
| 321 |
+
1
|
| 322 |
+
-1
|
| 323 |
+
1
|
| 324 |
+
-1
|
| 325 |
+
-1
|
| 326 |
+
-1
|
| 327 |
+
1
|
| 328 |
+
1
|
| 329 |
+
1
|
| 330 |
+
-1
|
| 331 |
+
1
|
| 332 |
+
-1
|
| 333 |
+
-1
|
| 334 |
+
1
|
| 335 |
+
-1
|
| 336 |
+
-1
|
| 337 |
+
1
|
| 338 |
+
1
|
| 339 |
+
-1
|
| 340 |
+
-1
|
| 341 |
+
1
|
| 342 |
+
1
|
| 343 |
+
-1
|
| 344 |
+
-1
|
| 345 |
+
-1
|
| 346 |
+
1
|
| 347 |
+
-1
|
| 348 |
+
-1
|
| 349 |
+
-1
|
| 350 |
+
-1
|
| 351 |
+
1
|
| 352 |
+
1
|
| 353 |
+
-1
|
| 354 |
+
-1
|
| 355 |
+
1
|
| 356 |
+
-1
|
| 357 |
+
-1
|
| 358 |
+
1
|
| 359 |
+
-1
|
| 360 |
+
1
|
| 361 |
+
-1
|
| 362 |
+
1
|
| 363 |
+
-1
|
| 364 |
+
1
|
| 365 |
+
1
|
| 366 |
+
-1
|
| 367 |
+
-1
|
| 368 |
+
-1
|
| 369 |
+
1
|
| 370 |
+
-1
|
| 371 |
+
1
|
| 372 |
+
-1
|
| 373 |
+
-1
|
| 374 |
+
-1
|
| 375 |
+
1
|
| 376 |
+
-1
|
| 377 |
+
-1
|
| 378 |
+
-1
|
| 379 |
+
-1
|
| 380 |
+
1
|
| 381 |
+
-1
|
| 382 |
+
-1
|
| 383 |
+
-1
|
| 384 |
+
1
|
| 385 |
+
-1
|
| 386 |
+
1
|
| 387 |
+
-1
|
| 388 |
+
-1
|
| 389 |
+
1
|
| 390 |
+
-1
|
| 391 |
+
-1
|
| 392 |
+
-1
|
| 393 |
+
-1
|
| 394 |
+
-1
|
| 395 |
+
1
|
| 396 |
+
1
|
| 397 |
+
1
|
| 398 |
+
-1
|
| 399 |
+
1
|
| 400 |
+
1
|
| 401 |
+
1
|
| 402 |
+
-1
|
| 403 |
+
1
|
| 404 |
+
1
|
| 405 |
+
-1
|
| 406 |
+
1
|
| 407 |
+
-1
|
| 408 |
+
-1
|
| 409 |
+
1
|
| 410 |
+
-1
|
| 411 |
+
1
|
| 412 |
+
1
|
| 413 |
+
-1
|
| 414 |
+
-1
|
| 415 |
+
1
|
| 416 |
+
-1
|
| 417 |
+
1
|
| 418 |
+
1
|
| 419 |
+
1
|
| 420 |
+
1
|
| 421 |
+
1
|
| 422 |
+
1
|
| 423 |
+
1
|
| 424 |
+
1
|
| 425 |
+
-1
|
| 426 |
+
-1
|
| 427 |
+
1
|
| 428 |
+
1
|
| 429 |
+
1
|
| 430 |
+
1
|
| 431 |
+
-1
|
| 432 |
+
1
|
| 433 |
+
-1
|
| 434 |
+
-1
|
| 435 |
+
-1
|
| 436 |
+
1
|
| 437 |
+
1
|
| 438 |
+
-1
|
| 439 |
+
-1
|
| 440 |
+
1
|
| 441 |
+
-1
|
| 442 |
+
-1
|
| 443 |
+
1
|
| 444 |
+
1
|
| 445 |
+
-1
|
| 446 |
+
1
|
| 447 |
+
1
|
| 448 |
+
-1
|
| 449 |
+
1
|
| 450 |
+
1
|
| 451 |
+
1
|
| 452 |
+
1
|
| 453 |
+
-1
|
| 454 |
+
-1
|
| 455 |
+
1
|
| 456 |
+
-1
|
| 457 |
+
-1
|
| 458 |
+
1
|
| 459 |
+
-1
|
| 460 |
+
1
|
| 461 |
+
1
|
| 462 |
+
-1
|
| 463 |
+
-1
|
| 464 |
+
1
|
| 465 |
+
1
|
| 466 |
+
-1
|
| 467 |
+
1
|
| 468 |
+
1
|
| 469 |
+
-1
|
| 470 |
+
1
|
| 471 |
+
1
|
| 472 |
+
1
|
| 473 |
+
-1
|
| 474 |
+
1
|
| 475 |
+
-1
|
| 476 |
+
1
|
| 477 |
+
-1
|
| 478 |
+
-1
|
| 479 |
+
-1
|
| 480 |
+
1
|
| 481 |
+
-1
|
| 482 |
+
-1
|
| 483 |
+
1
|
| 484 |
+
-1
|
| 485 |
+
1
|
| 486 |
+
1
|
| 487 |
+
-1
|
| 488 |
+
-1
|
| 489 |
+
-1
|
| 490 |
+
-1
|
| 491 |
+
-1
|
| 492 |
+
1
|
| 493 |
+
-1
|
| 494 |
+
-1
|
| 495 |
+
1
|
| 496 |
+
-1
|
| 497 |
+
-1
|
| 498 |
+
-1
|
| 499 |
+
-1
|
| 500 |
+
-1
|
benchmark/IO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|
+
-1
|
| 84 |
+
-1
|
| 85 |
+
-1
|
| 86 |
+
1
|
| 87 |
+
-1
|
| 88 |
+
-1
|
| 89 |
+
-1
|
| 90 |
+
1
|
| 91 |
+
1
|
| 92 |
+
1
|
| 93 |
+
1
|
| 94 |
+
-1
|
| 95 |
+
1
|
| 96 |
+
-1
|
| 97 |
+
1
|
| 98 |
+
1
|
| 99 |
+
-1
|
| 100 |
+
1
|
| 101 |
+
-1
|
| 102 |
+
-1
|
| 103 |
+
1
|
| 104 |
+
-1
|
| 105 |
+
1
|
| 106 |
+
-1
|
| 107 |
+
1
|
| 108 |
+
-1
|
| 109 |
+
1
|
| 110 |
+
1
|
| 111 |
+
-1
|
| 112 |
+
-1
|
| 113 |
+
-1
|
| 114 |
+
1
|
| 115 |
+
1
|
| 116 |
+
-1
|
| 117 |
+
-1
|
| 118 |
+
1
|
| 119 |
+
1
|
| 120 |
+
-1
|
| 121 |
+
-1
|
| 122 |
+
1
|
| 123 |
+
1
|
| 124 |
+
-1
|
| 125 |
+
1
|
| 126 |
+
1
|
| 127 |
+
-1
|
| 128 |
+
1
|
| 129 |
+
-1
|
| 130 |
+
1
|
| 131 |
+
1
|
| 132 |
+
1
|
| 133 |
+
1
|
| 134 |
+
-1
|
| 135 |
+
-1
|
| 136 |
+
1
|
| 137 |
+
-1
|
| 138 |
+
-1
|
| 139 |
+
-1
|
| 140 |
+
-1
|
| 141 |
+
1
|
| 142 |
+
1
|
| 143 |
+
-1
|
| 144 |
+
-1
|
| 145 |
+
-1
|
| 146 |
+
-1
|
| 147 |
+
1
|
| 148 |
+
-1
|
| 149 |
+
-1
|
| 150 |
+
1
|
| 151 |
+
-1
|
| 152 |
+
-1
|
| 153 |
+
-1
|
| 154 |
+
-1
|
| 155 |
+
1
|
| 156 |
+
1
|
| 157 |
+
-1
|
| 158 |
+
1
|
| 159 |
+
1
|
| 160 |
+
-1
|
| 161 |
+
-1
|
| 162 |
+
1
|
| 163 |
+
1
|
| 164 |
+
1
|
| 165 |
+
-1
|
| 166 |
+
1
|
| 167 |
+
-1
|
| 168 |
+
1
|
| 169 |
+
1
|
| 170 |
+
1
|
| 171 |
+
1
|
| 172 |
+
-1
|
| 173 |
+
-1
|
| 174 |
+
1
|
| 175 |
+
-1
|
| 176 |
+
1
|
| 177 |
+
-1
|
| 178 |
+
1
|
| 179 |
+
1
|
| 180 |
+
1
|
| 181 |
+
1
|
| 182 |
+
1
|
| 183 |
+
-1
|
| 184 |
+
-1
|
| 185 |
+
1
|
| 186 |
+
-1
|
| 187 |
+
1
|
| 188 |
+
1
|
| 189 |
+
1
|
| 190 |
+
-1
|
| 191 |
+
1
|
| 192 |
+
1
|
| 193 |
+
1
|
| 194 |
+
-1
|
| 195 |
+
-1
|
| 196 |
+
-1
|
| 197 |
+
1
|
| 198 |
+
-1
|
| 199 |
+
1
|
| 200 |
+
-1
|
| 201 |
+
1
|
| 202 |
+
1
|
| 203 |
+
1
|
| 204 |
+
1
|
| 205 |
+
1
|
| 206 |
+
1
|
| 207 |
+
-1
|
| 208 |
+
-1
|
| 209 |
+
-1
|
| 210 |
+
1
|
| 211 |
+
-1
|
| 212 |
+
-1
|
| 213 |
+
-1
|
| 214 |
+
1
|
| 215 |
+
-1
|
| 216 |
+
-1
|
| 217 |
+
-1
|
| 218 |
+
-1
|
| 219 |
+
1
|
| 220 |
+
1
|
| 221 |
+
1
|
| 222 |
+
-1
|
| 223 |
+
-1
|
| 224 |
+
1
|
| 225 |
+
-1
|
| 226 |
+
1
|
| 227 |
+
-1
|
| 228 |
+
-1
|
| 229 |
+
1
|
| 230 |
+
1
|
| 231 |
+
1
|
| 232 |
+
1
|
| 233 |
+
1
|
| 234 |
+
1
|
| 235 |
+
1
|
| 236 |
+
-1
|
| 237 |
+
1
|
| 238 |
+
1
|
| 239 |
+
1
|
| 240 |
+
1
|
| 241 |
+
-1
|
| 242 |
+
-1
|
| 243 |
+
-1
|
| 244 |
+
1
|
| 245 |
+
-1
|
| 246 |
+
1
|
| 247 |
+
-1
|
| 248 |
+
1
|
| 249 |
+
-1
|
| 250 |
+
-1
|
| 251 |
+
1
|
| 252 |
+
-1
|
| 253 |
+
1
|
| 254 |
+
1
|
| 255 |
+
1
|
| 256 |
+
1
|
| 257 |
+
-1
|
| 258 |
+
1
|
| 259 |
+
1
|
| 260 |
+
-1
|
| 261 |
+
1
|
| 262 |
+
1
|
| 263 |
+
1
|
| 264 |
+
1
|
| 265 |
+
1
|
| 266 |
+
-1
|
| 267 |
+
-1
|
| 268 |
+
-1
|
| 269 |
+
-1
|
| 270 |
+
1
|
| 271 |
+
1
|
| 272 |
+
-1
|
| 273 |
+
1
|
| 274 |
+
-1
|
| 275 |
+
-1
|
| 276 |
+
1
|
| 277 |
+
1
|
| 278 |
+
1
|
| 279 |
+
1
|
| 280 |
+
1
|
| 281 |
+
-1
|
| 282 |
+
1
|
| 283 |
+
1
|
| 284 |
+
-1
|
| 285 |
+
1
|
| 286 |
+
1
|
| 287 |
+
-1
|
| 288 |
+
-1
|
| 289 |
+
1
|
| 290 |
+
1
|
| 291 |
+
1
|
| 292 |
+
1
|
| 293 |
+
1
|
| 294 |
+
1
|
| 295 |
+
-1
|
| 296 |
+
-1
|
| 297 |
+
1
|
| 298 |
+
1
|
| 299 |
+
-1
|
| 300 |
+
1
|
| 301 |
+
1
|
| 302 |
+
1
|
| 303 |
+
-1
|
| 304 |
+
1
|
| 305 |
+
1
|
| 306 |
+
1
|
| 307 |
+
1
|
| 308 |
+
-1
|
| 309 |
+
1
|
| 310 |
+
1
|
| 311 |
+
1
|
| 312 |
+
-1
|
| 313 |
+
1
|
| 314 |
+
-1
|
| 315 |
+
1
|
| 316 |
+
-1
|
| 317 |
+
1
|
| 318 |
+
-1
|
| 319 |
+
1
|
| 320 |
+
1
|
| 321 |
+
1
|
| 322 |
+
-1
|
| 323 |
+
1
|
| 324 |
+
-1
|
| 325 |
+
-1
|
| 326 |
+
-1
|
| 327 |
+
1
|
| 328 |
+
-1
|
| 329 |
+
-1
|
| 330 |
+
-1
|
| 331 |
+
1
|
| 332 |
+
1
|
| 333 |
+
-1
|
| 334 |
+
1
|
| 335 |
+
1
|
| 336 |
+
-1
|
| 337 |
+
1
|
| 338 |
+
-1
|
| 339 |
+
1
|
| 340 |
+
1
|
| 341 |
+
-1
|
| 342 |
+
-1
|
| 343 |
+
-1
|
| 344 |
+
-1
|
| 345 |
+
-1
|
| 346 |
+
1
|
| 347 |
+
-1
|
| 348 |
+
1
|
| 349 |
+
-1
|
| 350 |
+
1
|
| 351 |
+
-1
|
| 352 |
+
-1
|
| 353 |
+
-1
|
| 354 |
+
1
|
| 355 |
+
-1
|
| 356 |
+
-1
|
| 357 |
+
-1
|
| 358 |
+
1
|
| 359 |
+
-1
|
| 360 |
+
-1
|
| 361 |
+
1
|
| 362 |
+
1
|
| 363 |
+
1
|
| 364 |
+
-1
|
| 365 |
+
-1
|
| 366 |
+
1
|
| 367 |
+
1
|
| 368 |
+
1
|
| 369 |
+
-1
|
| 370 |
+
-1
|
| 371 |
+
-1
|
| 372 |
+
1
|
| 373 |
+
1
|
| 374 |
+
-1
|
| 375 |
+
1
|
| 376 |
+
-1
|
| 377 |
+
-1
|
| 378 |
+
-1
|
| 379 |
+
1
|
| 380 |
+
-1
|
| 381 |
+
-1
|
| 382 |
+
-1
|
| 383 |
+
-1
|
| 384 |
+
-1
|
| 385 |
+
-1
|
| 386 |
+
1
|
| 387 |
+
1
|
| 388 |
+
-1
|
| 389 |
+
-1
|
| 390 |
+
1
|
| 391 |
+
-1
|
| 392 |
+
1
|
| 393 |
+
-1
|
| 394 |
+
1
|
| 395 |
+
-1
|
| 396 |
+
1
|
| 397 |
+
1
|
| 398 |
+
1
|
| 399 |
+
1
|
| 400 |
+
1
|
| 401 |
+
-1
|
| 402 |
+
-1
|
| 403 |
+
-1
|
| 404 |
+
-1
|
| 405 |
+
1
|
| 406 |
+
-1
|
| 407 |
+
-1
|
| 408 |
+
1
|
| 409 |
+
-1
|
| 410 |
+
-1
|
| 411 |
+
-1
|
| 412 |
+
-1
|
| 413 |
+
1
|
| 414 |
+
1
|
| 415 |
+
-1
|
| 416 |
+
1
|
| 417 |
+
-1
|
| 418 |
+
-1
|
| 419 |
+
1
|
| 420 |
+
1
|
| 421 |
+
-1
|
| 422 |
+
1
|
| 423 |
+
1
|
| 424 |
+
1
|
| 425 |
+
-1
|
| 426 |
+
1
|
| 427 |
+
1
|
| 428 |
+
1
|
| 429 |
+
1
|
| 430 |
+
-1
|
| 431 |
+
1
|
| 432 |
+
-1
|
| 433 |
+
1
|
| 434 |
+
-1
|
| 435 |
+
-1
|
| 436 |
+
-1
|
| 437 |
+
-1
|
| 438 |
+
1
|
| 439 |
+
1
|
| 440 |
+
-1
|
| 441 |
+
-1
|
| 442 |
+
-1
|
| 443 |
+
-1
|
| 444 |
+
1
|
| 445 |
+
-1
|
| 446 |
+
1
|
| 447 |
+
1
|
| 448 |
+
1
|
| 449 |
+
-1
|
| 450 |
+
1
|
| 451 |
+
-1
|
| 452 |
+
-1
|
| 453 |
+
-1
|
| 454 |
+
-1
|
| 455 |
+
-1
|
| 456 |
+
1
|
| 457 |
+
1
|
| 458 |
+
-1
|
| 459 |
+
-1
|
| 460 |
+
1
|
| 461 |
+
1
|
| 462 |
+
1
|
| 463 |
+
1
|
| 464 |
+
-1
|
| 465 |
+
1
|
| 466 |
+
1
|
| 467 |
+
1
|
| 468 |
+
1
|
| 469 |
+
1
|
| 470 |
+
-1
|
| 471 |
+
-1
|
| 472 |
+
1
|
| 473 |
+
1
|
| 474 |
+
-1
|
| 475 |
+
-1
|
| 476 |
+
1
|
| 477 |
+
1
|
| 478 |
+
1
|
| 479 |
+
1
|
| 480 |
+
-1
|
| 481 |
+
-1
|
| 482 |
+
1
|
| 483 |
+
-1
|
| 484 |
+
1
|
| 485 |
+
-1
|
| 486 |
+
-1
|
| 487 |
+
-1
|
| 488 |
+
-1
|
| 489 |
+
1
|
| 490 |
+
1
|
| 491 |
+
1
|
| 492 |
+
-1
|
| 493 |
+
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"id": "7c130e37-a029-4011-b741-14adb0bc15bb",
|
| 6 |
+
"metadata": {},
|
| 7 |
+
"source": [
|
| 8 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 9 |
+
"\n",
|
| 10 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 11 |
+
"\n",
|
| 12 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Antique/Solution/Antique_Solution.ipynb)"
|
| 13 |
+
]
|
| 14 |
+
},
|
| 15 |
+
{
|
| 16 |
+
"cell_type": "markdown",
|
| 17 |
+
"id": "3ae71b15-8e97-4896-90a2-000c9cd6e683",
|
| 18 |
+
"metadata": {},
|
| 19 |
+
"source": [
|
| 20 |
+
"# Antique Painting Authentication: Reference Solution"
|
| 21 |
+
]
|
| 22 |
+
},
|
| 23 |
+
{
|
| 24 |
+
"cell_type": "markdown",
|
| 25 |
+
"id": "44bf0dce",
|
| 26 |
+
"metadata": {},
|
| 27 |
+
"source": [
|
| 28 |
+
"## Step 1: Train Your Model"
|
| 29 |
+
]
|
| 30 |
+
},
|
| 31 |
+
{
|
| 32 |
+
"cell_type": "code",
|
| 33 |
+
"execution_count": null,
|
| 34 |
+
"id": "5bd6db06",
|
| 35 |
+
"metadata": {},
|
| 36 |
+
"outputs": [],
|
| 37 |
+
"source": [
|
| 38 |
+
"import os\n",
|
| 39 |
+
"import sys\n",
|
| 40 |
+
"\n",
|
| 41 |
+
"# 1. Get the current working directory\n",
|
| 42 |
+
"current_dir = os.getcwd()\n",
|
| 43 |
+
"\n",
|
| 44 |
+
"# 2. Check if the path contains \"Individual-Contest/Antique\" and trim it to that point\n",
|
| 45 |
+
"if \"Individual-Contest/Antique\" in current_dir:\n",
|
| 46 |
+
" root_index = current_dir.index(\"Individual-Contest/Antique\") + len(\"Individual-Contest/Antique\")\n",
|
| 47 |
+
" project_root = current_dir[:root_index]\n",
|
| 48 |
+
"else:\n",
|
| 49 |
+
" raise Exception(\"Project root directory not found. Please check the folder structure.\")\n",
|
| 50 |
+
"\n",
|
| 51 |
+
"# 3. Change working directory to the project root\n",
|
| 52 |
+
"os.chdir(project_root)\n",
|
| 53 |
+
"print(\"Working directory set to:\", os.getcwd())\n",
|
| 54 |
+
"\n",
|
| 55 |
+
"# 4. Add module search path (e.g., where metrics.py is located)\n",
|
| 56 |
+
"sys.path.append(os.path.join(project_root, \"Scoring\"))"
|
| 57 |
+
]
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"cell_type": "code",
|
| 61 |
+
"execution_count": null,
|
| 62 |
+
"id": "03dae883",
|
| 63 |
+
"metadata": {},
|
| 64 |
+
"outputs": [],
|
| 65 |
+
"source": [
|
| 66 |
+
"import pandas as pd\n",
|
| 67 |
+
"import numpy as np\n",
|
| 68 |
+
"from sklearn.cluster import SpectralClustering\n",
|
| 69 |
+
"from collections import Counter\n",
|
| 70 |
+
"from sklearn.svm import SVC\n",
|
| 71 |
+
"import os\n",
|
| 72 |
+
"\n",
|
| 73 |
+
"TRAIN_PATH = \"./training_set/\" # The address of trainig set\n",
|
| 74 |
+
"\n",
|
| 75 |
+
"train = pd.read_csv(TRAIN_PATH + \"training_set.csv\")\n",
|
| 76 |
+
"\n",
|
| 77 |
+
"X = np.array(train.iloc[:,:5])\n",
|
| 78 |
+
"y = np.array(train.iloc[:,5])\n",
|
| 79 |
+
"\n",
|
| 80 |
+
"labeled_mask = y != 0\n",
|
| 81 |
+
"unlabeled_mask = y == 0\n",
|
| 82 |
+
"X_labeled = X[labeled_mask]\n",
|
| 83 |
+
"y_labeled = y[labeled_mask]\n",
|
| 84 |
+
"X_unlabeled = X[unlabeled_mask]\n",
|
| 85 |
+
"\n",
|
| 86 |
+
"n_clusters = 2\n",
|
| 87 |
+
"spectral = SpectralClustering(n_clusters=n_clusters, affinity='rbf', gamma=10, random_state=42)\n",
|
| 88 |
+
"cluster_labels = spectral.fit_predict(X) \n",
|
| 89 |
+
"\n",
|
| 90 |
+
"cluster_to_label = {}\n",
|
| 91 |
+
"for cluster in range(n_clusters):\n",
|
| 92 |
+
"\n",
|
| 93 |
+
" labeled_in_cluster = y_labeled[cluster_labels[labeled_mask] == cluster]\n",
|
| 94 |
+
"\n",
|
| 95 |
+
" if len(labeled_in_cluster) > 0:\n",
|
| 96 |
+
" most_common_label = Counter(labeled_in_cluster).most_common(1)[0][0]\n",
|
| 97 |
+
" cluster_to_label[cluster] = most_common_label\n",
|
| 98 |
+
"\n",
|
| 99 |
+
"pseudo_labels = np.array([cluster_to_label[cluster] for cluster in cluster_labels])\n",
|
| 100 |
+
"\n",
|
| 101 |
+
"svm = SVC(kernel='rbf', C=1.0, gamma='scale', random_state=42)\n",
|
| 102 |
+
"svm.fit(X, pseudo_labels)"
|
| 103 |
+
]
|
| 104 |
+
},
|
| 105 |
+
{
|
| 106 |
+
"cell_type": "markdown",
|
| 107 |
+
"id": "a2049ba4",
|
| 108 |
+
"metadata": {},
|
| 109 |
+
"source": [
|
| 110 |
+
"## Step 2: Make Predictions on the Validation and Test Set"
|
| 111 |
+
]
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"cell_type": "code",
|
| 115 |
+
"execution_count": null,
|
| 116 |
+
"id": "c69d9d92",
|
| 117 |
+
"metadata": {},
|
| 118 |
+
"outputs": [],
|
| 119 |
+
"source": [
|
| 120 |
+
"VAL_DATA_PATH = \"./Solution/validation_set/\"\n",
|
| 121 |
+
"TEST_DATA_PATH = \"./Solution/test_set/\"\n",
|
| 122 |
+
"\n",
|
| 123 |
+
"testA = np.array(pd.read_csv(VAL_DATA_PATH + \"validation_set.csv\"))\n",
|
| 124 |
+
"testB = np.array(pd.read_csv(TEST_DATA_PATH + \"test_set.csv\"))\n",
|
| 125 |
+
"\n",
|
| 126 |
+
"predA = svm.predict(testA)\n",
|
| 127 |
+
"predB = svm.predict(testB)"
|
| 128 |
+
]
|
| 129 |
+
},
|
| 130 |
+
{
|
| 131 |
+
"cell_type": "markdown",
|
| 132 |
+
"id": "3e2141d8",
|
| 133 |
+
"metadata": {},
|
| 134 |
+
"source": [
|
| 135 |
+
"## Step 3: Generate `submission.zip` for Submission"
|
| 136 |
+
]
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
"cell_type": "code",
|
| 140 |
+
"execution_count": null,
|
| 141 |
+
"id": "342e6ddb",
|
| 142 |
+
"metadata": {},
|
| 143 |
+
"outputs": [],
|
| 144 |
+
"source": [
|
| 145 |
+
"import zipfile\n",
|
| 146 |
+
"import os\n",
|
| 147 |
+
"\n",
|
| 148 |
+
"submissionA = pd.DataFrame(predA)\n",
|
| 149 |
+
"submissionA.to_csv(\"./Scoring/submissionA.csv\", index=False, header=False)\n",
|
| 150 |
+
"\n",
|
| 151 |
+
"submissionB = pd.DataFrame(predB)\n",
|
| 152 |
+
"submissionB.to_csv(\"./Scoring/submissionB.csv\", index=False, header=False)\n",
|
| 153 |
+
"\n",
|
| 154 |
+
"files_to_zip = ['./Scoring/submissionA.csv', './Scoring/submissionB.csv']\n",
|
| 155 |
+
"zip_filename = './Scoring/submission.zip'\n",
|
| 156 |
+
"\n",
|
| 157 |
+
"with zipfile.ZipFile(zip_filename, 'w') as zipf:\n",
|
| 158 |
+
" for file in files_to_zip:\n",
|
| 159 |
+
" zipf.write(file, os.path.basename(file))\n",
|
| 160 |
+
"\n",
|
| 161 |
+
"print(f'{zip_filename} is created succefully!')"
|
| 162 |
+
]
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"cell_type": "markdown",
|
| 166 |
+
"id": "e65766d9",
|
| 167 |
+
"metadata": {},
|
| 168 |
+
"source": [
|
| 169 |
+
"### Evaluate the Model Performance"
|
| 170 |
+
]
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"cell_type": "code",
|
| 174 |
+
"execution_count": null,
|
| 175 |
+
"id": "04d9f1be",
|
| 176 |
+
"metadata": {},
|
| 177 |
+
"outputs": [],
|
| 178 |
+
"source": [
|
| 179 |
+
"%run Scoring/metrics.py"
|
| 180 |
+
]
|
| 181 |
+
}
|
| 182 |
+
],
|
| 183 |
+
"metadata": {
|
| 184 |
+
"kernelspec": {
|
| 185 |
+
"display_name": "Python 3 (ipykernel)",
|
| 186 |
+
"language": "python",
|
| 187 |
+
"name": "python3"
|
| 188 |
+
},
|
| 189 |
+
"language_info": {
|
| 190 |
+
"codemirror_mode": {
|
| 191 |
+
"name": "ipython",
|
| 192 |
+
"version": 3
|
| 193 |
+
},
|
| 194 |
+
"file_extension": ".py",
|
| 195 |
+
"mimetype": "text/x-python",
|
| 196 |
+
"name": "python",
|
| 197 |
+
"nbconvert_exporter": "python",
|
| 198 |
+
"pygments_lexer": "ipython3",
|
| 199 |
+
"version": "3.12.9"
|
| 200 |
+
}
|
| 201 |
+
},
|
| 202 |
+
"nbformat": 4,
|
| 203 |
+
"nbformat_minor": 5
|
| 204 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Solution/test_set/test_set.csv
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
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583
|
| 3 |
+
3.948972152282053,6.333083746200214,-0.6451950627515897,1.104413463441475,3.4953066138798925
|
| 4 |
+
1.2948223277173185,6.687754329640868,-0.1501851462795965,1.116735682546362,3.9242457456180895
|
| 5 |
+
-3.7242151071367493,1.2460920913080056,0.2571217487649086,0.9120771105011015,4.276480286373389
|
| 6 |
+
1.8003779948004017,5.293923485343816,0.09232486669993754,0.771986152660485,4.569032338380467
|
| 7 |
+
1.185019923034553,-0.01370383056819266,-0.0910595744799738,0.5633978416277934,3.245277135805331
|
| 8 |
+
5.242461515945136,3.396125783892347,-0.15759223402617062,1.225054794397566,4.684770203482029
|
| 9 |
+
8.4075343431176,0.914530056603238,0.20250094462599252,0.6296279074584699,4.057661534693195
|
| 10 |
+
5.314958274272154,5.551348959388589,0.3756680457096472,1.336020171160244,3.8390538006411035
|
| 11 |
+
6.24626707026006,-1.1552186610799635,0.5636468869613898,1.0365385053035545,3.647076438757988
|
| 12 |
+
2.2155819124241605,5.026943423246652,0.18962275192872843,0.5972410600790736,3.619338202503751
|
| 13 |
+
9.211246669157214,1.3343304257601767,-0.011120389837235008,0.48267189884457395,4.070238862268973
|
| 14 |
+
1.4831229773774348,0.16410158261953398,-0.33042602940945337,1.2038214012065507,4.209130640096965
|
| 15 |
+
-0.9782728342378895,5.0711868038934185,-0.21033261963156416,1.0198686614124224,4.025360058744744
|
| 16 |
+
0.5337695518951586,-0.1446102028854298,-0.10990039454704838,1.1828846321921793,3.5773837183399264
|
| 17 |
+
5.489517080001017,-0.3983098382535474,0.3055658652751141,0.8185609975681908,3.94526630577554
|
| 18 |
+
-3.0544849770133684,1.638300763787812,0.11178112673920906,0.6001400364783467,4.09508230889835
|
| 19 |
+
6.127634539931132,3.8502816137430846,0.10279777012933489,1.5544537084707155,3.3583240904984946
|
| 20 |
+
-0.4123163077287438,0.8947958635293949,-0.33744482886857624,0.8619049673017739,3.756542027234127
|
| 21 |
+
4.302656508655678,-0.7026981133023348,-0.5384643571121152,0.7447408932098103,3.747932226903089
|
| 22 |
+
-2.2270519973486724,3.2249247483825503,0.8685379145275695,1.5818528124437077,4.273748980571376
|
| 23 |
+
-0.3609488208410887,4.764647917425725,0.0920907830880417,1.0479227645216298,4.459584766248414
|
| 24 |
+
5.687649292849376,1.4244919820948894,-0.20044343738068776,0.46279592024695215,4.010135584818452
|
| 25 |
+
0.5329655772411528,6.546741024251524,0.194052168545013,0.3076989685334459,4.046971423456012
|
| 26 |
+
11.948630125437822,4.5884105023872905,-0.12486249578100744,1.2663216380749438,4.194521988310285
|
| 27 |
+
9.749597118868444,3.2367024919054934,0.37910597027420273,1.0208378738821875,4.0411955304181655
|
| 28 |
+
-3.0603860475336635,3.0049414602262265,0.06959009015791603,0.6638750073951587,4.092126792700754
|
| 29 |
+
0.4932182140635176,-0.28700182160470455,-0.25472089986955554,1.2564894491044725,3.8044251469626738
|
| 30 |
+
-0.7848489400073755,0.11920561294624438,0.3033012029565699,1.4618956776001748,4.271893054334467
|
| 31 |
+
2.4561006711854922,-1.6260877946090484,-0.07085667382205801,0.37376715397148896,4.041480356552603
|
| 32 |
+
1.860316154808964,2.7555974225356095,-0.14083262049468118,1.1062760715701148,4.134186615424303
|
| 33 |
+
-5.043774318599625,-0.7844756719812107,-0.39386795404081637,0.9599672029174584,3.7718861244950634
|
| 34 |
+
6.084724772766561,6.770952900604211,0.5426616668333272,1.0026593187235062,4.283700889984602
|
| 35 |
+
0.09881826984363778,-0.8167148906762145,-0.0662989959433506,1.0484998633239238,3.7038355161271594
|
| 36 |
+
13.368351433690988,6.722853959798489,0.07746320817438777,0.9068579572358005,4.018053498236158
|
| 37 |
+
-0.5876399361314344,5.222396669805287,-0.12591836687403962,1.342398569671071,4.584003682753436
|
| 38 |
+
9.794586954707562,1.4872986752334207,-0.20156163987383674,1.4441133718542565,4.021502977187101
|
| 39 |
+
-5.965795501658427,-1.9136064279721325,0.6343489115421395,1.1484405598618237,3.811464886007262
|
| 40 |
+
-0.5718613117537306,4.249154096767561,0.29340454318405906,0.5510647609520617,4.386509946360088
|
| 41 |
+
-4.846043950799499,1.7506742363503032,0.6860819924580571,1.0814829002919888,3.9721244828763034
|
| 42 |
+
6.171413119366278,-0.22008361226019568,-0.03348390611064171,1.311622049077797,4.954339374556961
|
| 43 |
+
-0.23072247619726527,4.195836291748114,-0.39626505477840296,1.3102255851948337,4.382427169340288
|
| 44 |
+
4.407411350995789,5.78554592259967,0.42635859656165986,0.8848296469281512,3.744969307696764
|
| 45 |
+
1.181487202412575,5.1298834874911465,0.06169564818515519,0.8563462652673267,3.76337282349985
|
| 46 |
+
12.662395159874805,4.79899353255954,0.1393479354262001,0.82213169979359,4.5977081234365755
|
| 47 |
+
3.674659680760655,-1.1113538237751683,-0.14963773961971863,0.9361778664897864,4.3139527979511705
|
| 48 |
+
11.046177676718434,3.5304884117877418,-0.17340088130201028,0.42699597683356394,3.5096615821591124
|
| 49 |
+
10.615074621236223,3.9322676743186706,-0.12465092101103196,1.3303697691701786,3.8220135618605284
|
| 50 |
+
5.116982523214673,1.8159582989540852,0.10581292515809132,1.142999443477178,3.3925324802629473
|
| 51 |
+
0.9676868216135404,5.393715072623548,0.0564269321044014,1.169962369012907,3.8758226135671867
|
| 52 |
+
6.042760561149466,-0.815931821302728,0.20582763141121876,0.8958647826245953,4.196068703257602
|
| 53 |
+
4.459757744718083,4.428120753115912,-0.08115800249539758,0.8979587559642829,4.525367217761804
|
| 54 |
+
-5.755914522224312,-2.0358371303832574,-0.447670795330354,0.6471942461960591,3.954727616057153
|
| 55 |
+
7.251493440854947,-0.4204315767940763,-0.35110766272740285,0.7240648373746436,4.131222939062823
|
| 56 |
+
1.2817490731728727,5.611870414366775,-0.3855818920754626,0.7421913571977209,3.990903749868652
|
| 57 |
+
-4.772977970545331,0.5031167833881908,-0.1785491933369204,0.7573454363722643,3.967061389069374
|
| 58 |
+
3.1607347783275257,-1.1838367474366847,-0.22182594914720571,1.1206132105168864,3.6678153145873362
|
| 59 |
+
5.61716265077332,5.669878700110231,-0.21246550379542373,1.4069677997302537,3.8449374991565066
|
| 60 |
+
-5.490775140777221,-0.34334135001144817,-0.01879824814082656,1.0320655748248657,3.8717636307028913
|
| 61 |
+
-5.705360288339805,-0.9822469181133864,-0.18419704211728097,0.7637127443391588,4.033052987768554
|
| 62 |
+
-1.07198837386301,-2.36567402645015,-0.2542350555826745,1.373782352717659,3.556283417207925
|
| 63 |
+
6.943371956405029,4.0231086453931555,0.4587904063963351,1.2802667108317773,4.074855815673517
|
| 64 |
+
6.535873229126852,3.4742250604845415,-0.3121839764695957,1.559856260952377,4.065304875089117
|
| 65 |
+
-5.202429983740002,-0.7043593663614734,0.0422341543908887,1.2515827912154087,3.877872360594994
|
| 66 |
+
-0.09961480300929673,0.37460531976457856,0.5107197192897618,1.308203396598082,4.059908494878545
|
| 67 |
+
2.7930919483133754,-2.0255901879175022,0.47895838256681744,0.6018800412291587,3.542128531867553
|
| 68 |
+
6.347908080878838,-0.16551726119846322,-0.48174867557520074,1.2037977563946172,4.4225683929074835
|
| 69 |
+
2.723576504908495,-2.6953570515003937,-0.1855426936004942,1.3668454206436993,3.9276003169082414
|
| 70 |
+
6.167986333226479,4.53602833626947,0.5130563869443431,1.2167276820490707,3.8413427286489075
|
| 71 |
+
11.482514838373865,4.890947306611087,0.03113343636845971,1.098656898411171,3.6667261744528856
|
| 72 |
+
13.375034427477893,6.519988485826229,-0.240274354057967,0.5440800593821972,3.3696864302838527
|
| 73 |
+
2.6545724061772136,-1.1653407124079302,-0.4517387785028857,1.4909149088893021,4.08698674755547
|
| 74 |
+
3.876865482094988,5.662314321741328,0.07926683838507995,1.8034099949547393,3.1982661307448925
|
| 75 |
+
1.7906343538903058,5.448930526962977,0.14541137522597658,0.9620814140436134,4.153144427269278
|
| 76 |
+
1.161462739340062,3.090785098600306,0.647945537518385,1.0153922906541788,3.4619301275957985
|
| 77 |
+
-4.472725125095155,2.8772876086608994,0.012898384421309668,0.7360990126561987,4.086470918328465
|
| 78 |
+
-0.3364316010054349,4.615723655247807,0.21271640909398606,1.0311165972321716,4.460426192688347
|
| 79 |
+
5.57121568470102,5.332790341295575,-0.27530191935219006,0.4795677008042477,3.1987945993491156
|
| 80 |
+
6.082094698960414,2.3241245942003332,0.29200528675807824,0.547387241782333,4.418783062664882
|
| 81 |
+
-5.6255586228594,-1.5654349038646629,0.29373581874644705,0.9771339482931299,4.039275351106212
|
| 82 |
+
9.761722464893314,2.81931197667469,0.1414277699707703,0.6273918804238182,4.125534990056015
|
| 83 |
+
-0.8389834517177641,-0.6957404626043353,-0.5359284658800775,1.0727436301564863,4.416525716807837
|
| 84 |
+
-3.4663131152149385,2.6428003497046255,-0.34921579418602927,1.5458105546238934,4.676965323330989
|
| 85 |
+
5.423993056046742,3.69965977561306,0.161598542443919,1.22951253933042,3.9010367516039435
|
| 86 |
+
6.183335846236463,6.322513336641055,-0.0762985471266124,1.7296774682956315,3.964825278105827
|
| 87 |
+
12.64139156532028,5.491885468977474,-0.010617326706439513,1.1925978851758356,3.8164736243601864
|
| 88 |
+
-1.6429329674087358,4.277180355157405,-0.14798785271467393,1.0178459199381795,3.9634053499017377
|
| 89 |
+
-4.0586340114405255,1.3214967806715605,0.19729612359407483,1.018073853957647,4.198796283671148
|
| 90 |
+
-5.6290957872919325,-1.0396946839578143,0.10601862953091933,0.6697833715852297,4.0666813236123724
|
| 91 |
+
0.7591923181921518,0.8275719438432738,-0.032995883654279835,0.6565446927796008,3.8564941224233174
|
| 92 |
+
10.762594215169127,2.5385604827886254,-0.1291934254317156,1.0171967064286753,4.334214306774042
|
| 93 |
+
3.0112940149596445,-0.637355748229872,-0.3613123107004926,1.3020284995550415,3.830521256593485
|
| 94 |
+
1.6066767792081404,0.8778544147263483,0.10331202715704102,1.6551810603487187,3.8444256312675926
|
| 95 |
+
6.564364323800437,3.7184708520320022,0.05797636767756715,0.627693474165145,4.460197358610547
|
| 96 |
+
12.417852444741838,5.012385072133844,-0.14560563218668754,0.5288264909341042,4.071622159644456
|
| 97 |
+
-3.364289236504783,2.5890020308924813,0.24862994171865083,0.8460852964505539,4.399233217664115
|
| 98 |
+
12.921949127561572,5.495815943258762,-0.24368059662200597,0.7960173779227834,4.21617608422811
|
| 99 |
+
1.7988997718626185,3.2347672777783694,0.17015337799379612,0.8193974411708113,4.355448347362566
|
| 100 |
+
6.5337984033249645,5.084303148658747,0.07140605581599264,0.8172397095117019,4.108131724875844
|
| 101 |
+
10.915169906681133,3.468334972352899,0.0723289773163412,0.737494549835219,3.9535670404171754
|
| 102 |
+
6.164151916521885,5.8169429456892745,0.26463682774739283,0.9924695654572336,4.241334089359375
|
| 103 |
+
1.3776307125424847,5.787873920674183,-0.8844433889385811,0.8365461809921624,3.9503393528359636
|
| 104 |
+
-0.3324662918007616,1.9243824972643888,-0.6545950277996092,0.9283355864723046,3.8602278228486036
|
| 105 |
+
-1.4083407851088579,3.714365670384369,-0.5452193008898373,0.9197354379392085,3.8734797002287724
|
| 106 |
+
3.6553214913640533,-0.9962343659565867,-0.03160261028748288,1.5535805548968797,3.7713350821815745
|
| 107 |
+
2.872863647132781,5.708392276483325,-0.07056807528186565,0.9946602606504127,3.8891428858909736
|
| 108 |
+
0.9552572458144355,-0.26386194746780045,0.6279461898857196,1.369485143919671,4.102237585506893
|
| 109 |
+
-6.228437120161422,-0.8668039709675159,-0.16442151953521048,1.4049810960278009,4.166356369907745
|
| 110 |
+
8.472010193053201,1.4914311763058872,-0.49212589810362406,0.7129944805958831,3.5627222248539514
|
| 111 |
+
8.748924327312888,1.6329332650143005,0.6610108951466429,1.0170592479682448,3.93951015844733
|
| 112 |
+
6.185097233573719,4.387607142218278,0.05701780232051168,0.5311474277655327,4.057567041361539
|
| 113 |
+
-5.162324186433029,-0.6054364438589324,-0.4011781626525585,1.2066083599353823,3.665855849557179
|
| 114 |
+
-2.4960035718368747,3.0379377979495326,0.327933737480356,1.2553585868028816,4.159780517992408
|
| 115 |
+
1.8870050182352538,-2.261613501103963,-0.0399453467778797,0.9420236637885153,3.821731461656304
|
| 116 |
+
2.286795925158817,-0.4962426266136215,-0.2773247446027535,0.754932637022564,3.978668656612584
|
| 117 |
+
0.07842689989706786,5.923234404627014,-0.12731270093861263,1.3332835861855294,4.63958643857112
|
| 118 |
+
-3.419765633071258,2.5949174661211325,-0.5899804936016787,0.31284613509688197,4.037741253387973
|
| 119 |
+
10.351507808880665,3.436149930361006,0.20215911757655985,0.9818801159928514,3.6724001893464866
|
| 120 |
+
1.018759337554014,2.18083179513551,-0.07079852523795468,1.3540420358866705,4.036211433003359
|
| 121 |
+
-1.9076277901590832,3.653345670081047,-0.35102981495922475,0.6286380702988494,4.283623500400427
|
| 122 |
+
-6.049377073574474,-0.5613618930051835,0.25075423687167187,0.6617072073001915,3.895817023889106
|
| 123 |
+
10.950974639889676,3.8292773319395645,0.03383028088703206,1.2599738314878899,3.907496711634079
|
| 124 |
+
7.827574672863166,-0.3354631102669767,0.12612066991947268,0.6377269921424056,3.5577072481344603
|
| 125 |
+
-5.465917676415637,0.6969004489284373,0.2544758621892791,0.5413346569017465,4.1037592699727705
|
| 126 |
+
7.6673576642040455,0.7930574221915374,0.0004792832062405597,1.1772697946280037,4.144538565049446
|
| 127 |
+
13.966228053544828,6.871564971173152,-0.3470476599222119,1.2375477235423398,4.393469795251827
|
| 128 |
+
5.356044910708011,6.745973092131991,-0.1898094500781689,0.6760109745267493,3.867877102016278
|
| 129 |
+
3.40600012583666,-1.0468635309601648,-0.3235293302623232,0.6043357835139636,3.8215191163555273
|
| 130 |
+
5.182658450812697,6.550400847675393,0.06554793923555026,0.8432524056309748,4.219033974192166
|
| 131 |
+
0.19712947041969975,2.6714625799919096,0.27763483612480744,1.102315095326129,3.503613648904022
|
| 132 |
+
2.880636573924415,-1.452265306337997,-0.001035453422082031,0.8273536330843013,3.694004124363419
|
| 133 |
+
8.0165629807729,1.2522599459657298,-0.021546486581761455,1.398300125262029,3.5893388020667225
|
| 134 |
+
1.1656789220101311,-2.3640361782733104,-0.31270163102917975,1.1330099585235118,3.896056780387258
|
| 135 |
+
-1.6426607369830204,4.130817814500493,-0.13312542568378805,0.948863773994341,3.824234418870836
|
| 136 |
+
6.507365236541906,5.429002893228631,-0.030417665046895588,1.0890780249770275,4.171073604360863
|
| 137 |
+
8.690096039682256,0.5982837822470428,0.8279476793716769,1.1637660617063463,4.295420610843156
|
| 138 |
+
-6.081186113731287,-1.461947886802436,0.21960775793899073,0.9752324665289932,4.192626685388515
|
| 139 |
+
0.4974895068414318,6.011468423060988,0.34284342329175216,1.594245723983228,3.958191611568276
|
| 140 |
+
5.777853061246002,7.234789797795308,0.1479256193508068,1.0151671744066493,3.9614780431953043
|
| 141 |
+
-4.542223841118212,1.8726754708576936,0.2834621653207251,1.3726620638205045,4.251652569717611
|
| 142 |
+
4.345413706956557,-2.6970420210377215,0.231016983155261,0.7755601995449601,3.5651177849410565
|
| 143 |
+
9.385590000456217,1.9085794573214703,-0.1338384690629097,1.5303157323963084,4.058006436568785
|
| 144 |
+
2.1067221786857675,6.392414389733212,-0.06320023202233227,1.1754735212009835,3.9080525182873904
|
| 145 |
+
-2.612086790492329,2.963251384222662,0.1849497467822559,1.250810574045175,3.762786269011588
|
| 146 |
+
6.2006471297605605,3.790715905770733,0.42475560241692967,1.068756462754019,4.381307955999158
|
| 147 |
+
-0.281121880219537,4.068908253898001,-0.3720670630713537,0.6209509718767621,3.9485293337113236
|
| 148 |
+
0.9672338271295913,1.141967520071699,0.40523725254183907,1.0269834218272336,4.602141405826942
|
| 149 |
+
-3.902955200372464,1.8728396360211672,0.26306301456635645,1.201679243006398,4.379399184025641
|
| 150 |
+
5.938683946671328,2.2624217415250993,0.13407278931678512,1.1118215683398878,3.4695750827616765
|
| 151 |
+
4.35412193655625,-1.2926238226416387,-0.5769750089254989,1.2292159337597288,3.913645764532576
|
| 152 |
+
7.508459303352755,5.727260077140615,-0.0254585066060942,1.3285997954291853,3.8347131938062655
|
| 153 |
+
5.633936071381346,5.464731307980745,0.4009112612696314,1.1705515599312193,4.245844217029893
|
| 154 |
+
5.938723545802805,5.1380971871486505,0.11325845716744322,1.181897147388002,3.9850199810710403
|
| 155 |
+
-4.151114931597979,0.2657992815059472,0.08746540090184206,0.737582643073344,4.060837749134528
|
| 156 |
+
13.467626472921117,7.696251257909326,-0.003041791946443068,0.45193943113853463,4.548489437516366
|
| 157 |
+
7.381511471428689,-0.7136454122133951,-0.055746625608993836,0.7258424764896211,3.858315233436627
|
| 158 |
+
6.313231647808358,2.648616963585178,0.0464759504165705,0.6971788955217402,4.202822826974127
|
| 159 |
+
0.33467594753547864,-0.26716721867317045,-0.09370977568336038,1.18620889642146,4.228809630321535
|
| 160 |
+
6.584537264266025,-0.049309305786984226,0.1570145421596353,1.373514050280421,4.718990106018475
|
| 161 |
+
6.971314099304047,4.451099834969461,-0.3154370808612009,1.154381347961126,4.032643609823521
|
| 162 |
+
4.942045355448656,6.01614513726328,0.07827825228522868,0.45454665642003456,4.15664763828373
|
| 163 |
+
13.762946691138396,6.094444917990541,0.48872176648352417,1.3100468512070083,3.7343042637014086
|
| 164 |
+
7.81272672571658,1.4210897108087304,-0.07399260530017163,0.6769139091208503,3.9615347332272037
|
| 165 |
+
3.3302427002831134,-1.2594158500909494,0.19762294367130853,0.5537419307834269,3.7317681208703744
|
| 166 |
+
4.444952671341749,7.528063225701226,-0.03483123595959492,1.2904709714089946,3.7018713741732165
|
| 167 |
+
9.27064484138211,2.2876808196769356,0.33534938077763904,0.9750684773343091,4.202618439731393
|
| 168 |
+
5.799335865052864,3.780126198586399,-0.6771230472591644,1.36628057547899,4.161383839008188
|
| 169 |
+
6.511305843714644,-0.5084971341427154,-0.29084248235868765,1.3085024330637762,4.495218107240718
|
| 170 |
+
-0.396270908467563,-2.0189298220182508,0.12026144154122059,1.1687059483465394,4.179655075394566
|
| 171 |
+
11.245412027562104,5.702537063003733,0.6494020171429679,1.4623456520005282,4.312328809166243
|
| 172 |
+
1.7258143885133466,2.2942097962858017,-0.28601690458181184,0.9534463912934303,4.019330463837741
|
| 173 |
+
4.213503366844961,7.8139995741150905,-0.2704378205182584,1.307316449045426,3.7660256034596564
|
| 174 |
+
5.558834940253673,5.441449008174549,0.24754704826432594,0.5742690199309645,3.7833838937609223
|
| 175 |
+
10.618550526355042,2.7855021309262087,-0.11744024404814854,0.4232377990751838,4.413899389797349
|
| 176 |
+
4.039543412059486,5.9028119308280225,-0.24213228265288264,1.1457671482524205,3.8238400540123676
|
| 177 |
+
1.1304719068306315,1.1216112742996829,-0.13223079679755448,0.5985997761440861,4.071489550539148
|
| 178 |
+
7.231686641593977,5.570583704578966,0.09395248881682285,0.5880542757324452,4.1153712711064765
|
| 179 |
+
7.905289437659113,0.9471243060918236,-0.17036347752420886,0.7558678522934501,3.7690784149814376
|
| 180 |
+
12.449097587812458,4.527436425721217,-0.33726149793772936,0.7080055138173678,4.160069941286976
|
| 181 |
+
11.342942611299472,4.314758895081345,-0.2893554272930439,0.6845270215108386,4.384951703151242
|
| 182 |
+
10.462320763888588,2.9846922404551632,-0.30919550653509875,1.6107133649018976,3.4965319833101116
|
| 183 |
+
0.43701937195681856,0.022625938236550514,-0.1495743801669821,0.8551904653827233,4.220933336183973
|
| 184 |
+
6.580929312505223,3.129116135542712,-0.2951829539234765,1.2698189928571986,3.952389697898991
|
| 185 |
+
2.5700863326547214,6.907542481107854,0.08375311612253505,1.1719042381237212,3.8758105205546016
|
| 186 |
+
4.175551361200527,-1.2378034156245978,-0.09602044117035759,1.0895921095083179,3.895633056525979
|
| 187 |
+
-0.11998700431711362,4.888411911952175,0.2963146463892463,1.0535303863446877,3.048750841320315
|
| 188 |
+
5.512134179852867,0.20364033049957042,0.6529087320859536,1.2484241512974155,4.464082164057094
|
| 189 |
+
8.621448313247159,2.2044915295725294,0.20517454629696905,1.5617747879133765,3.847535138566199
|
| 190 |
+
1.363055287389066,0.33458050609965906,0.04993403320685493,0.9583935195640333,4.276513097377735
|
| 191 |
+
-4.421194145620847,1.5750171723620938,-0.02010403983208649,0.6025055913889612,4.101027021133949
|
| 192 |
+
6.404931257877518,-0.47597017698010835,0.1649839059304539,1.2876789078125062,4.162299690484937
|
| 193 |
+
10.10356059489943,3.76240201249204,0.10374887280269976,0.9226454241932142,4.201539502850235
|
| 194 |
+
4.469742510228621,-0.7199540798050298,-0.08579114290116693,1.0369271783772376,4.482645418624459
|
| 195 |
+
-6.219751558622149,-2.915100166543473,-0.03766871047920995,0.29715549797671403,4.043085032337628
|
| 196 |
+
4.110352672361774,7.368020708719727,-0.10093884227356403,1.6411967376297634,3.911532264309898
|
| 197 |
+
1.7554377946256805,6.691295421918501,0.2282632799181252,1.5027376815557691,3.8165507277565474
|
| 198 |
+
7.201707538032892,0.16203061286303333,0.2629186774845861,0.8689354437645862,4.501342944498161
|
| 199 |
+
5.482023921104694,7.0117975826543155,-0.42313197942434644,0.6789489410245003,4.177438475095833
|
| 200 |
+
11.687620530475117,4.976111281371376,0.4420566577542949,0.6068791152404991,4.433569897147317
|
| 201 |
+
0.33453348958675866,4.56792348711022,-0.13856254289175826,0.989471708000048,3.71953862357942
|
| 202 |
+
5.092725173207934,-1.0010565531300115,-0.1344649843682795,0.6874300589059638,4.215094487514291
|
| 203 |
+
6.169896966248693,-0.7147651834590931,-0.02667679450342753,0.9046658645936831,3.8729783505134443
|
| 204 |
+
0.9745109479892039,-1.2174126722091545,-0.1432805915844653,1.3012503630643524,4.541501082787792
|
| 205 |
+
12.460032159147056,4.221168019585436,-0.13469553517812616,0.6521566414838489,3.951116807634119
|
| 206 |
+
2.242514714178326,-0.6765902338217104,0.14714777452015362,1.027794530164757,3.9552709671117414
|
| 207 |
+
4.954099355321425,-0.7687158309753077,0.0786791588076945,1.4007865314717236,4.012034998121838
|
| 208 |
+
2.635777567657989,5.8263570221953715,0.2843983922067514,1.1848613877059855,4.353006003130953
|
| 209 |
+
-2.8698546580534448,2.775633232012428,-0.08593121268733261,0.2525958047454824,3.911263431571572
|
| 210 |
+
6.903317526211074,6.141013766898279,-0.1756618576854367,0.7249776940002841,3.9472557600105094
|
| 211 |
+
2.974876318969004,-0.6349706259249618,0.24008066816924362,1.1689761400621845,4.326200460423597
|
| 212 |
+
6.571663849644108,4.5179613014654585,-0.08714576974555924,0.7721252103148987,4.135281259741638
|
| 213 |
+
3.990826961402015,5.941808593640293,-0.1749028322467828,0.9642260554634515,4.0747438650246055
|
| 214 |
+
5.085549355080644,7.390762602413542,0.17291880456442854,1.2146703966661525,4.037786357786676
|
| 215 |
+
1.0562829901300141,1.6578981920264446,0.15945759804538964,1.1029794151440733,3.9382678768429513
|
| 216 |
+
5.837178597592648,2.4605356668928455,0.06211918373227555,0.902814241883205,4.250527152623191
|
| 217 |
+
-3.837495021673844,1.8635380434913948,-0.19109080966666692,0.642002793955267,3.8119951064411453
|
| 218 |
+
-4.927497609886807,-1.1424875537929111,-0.14917397996925158,1.061019975565892,4.239252665915361
|
| 219 |
+
6.306069043290946,3.577207358765288,-0.04350892811807499,1.1048714038727665,3.5385121202451337
|
| 220 |
+
2.633549083296889,-1.0786736034910107,0.1380332976487101,0.6596149429760516,4.46185144562171
|
| 221 |
+
1.4476205139122889,0.8586475358158789,0.00016946964956343993,0.83133999572235,4.131021265626047
|
| 222 |
+
8.673250640200608,1.2484960549250275,0.10485679999721957,1.1230082053887573,4.229112582316979
|
| 223 |
+
6.083856102782613,3.574907621284074,-0.06271850214535077,1.1727738614310041,3.805839347577266
|
| 224 |
+
7.529483453864122,7.14302932081339,0.17293786590745353,0.6051007614561357,4.081074806826907
|
| 225 |
+
12.443021055914649,5.0369248251080325,-0.04188529702271142,0.6823232547065503,3.823382394621741
|
| 226 |
+
-1.2839693149615707,4.628905679402815,-0.1500690391435849,0.9755407007376165,4.175830592318238
|
| 227 |
+
4.33635857161773,-1.1075700255198035,0.3039979929726547,1.3290744943453245,3.369031836570739
|
| 228 |
+
5.988470474696748,6.607668745403937,-0.060517373955077225,1.0845814069561341,4.037105675341094
|
| 229 |
+
6.750357688845895,4.205200714395297,-0.31951911038377984,1.435845688153234,4.149172332002296
|
| 230 |
+
7.06617882266339,-0.13457848836506958,-0.15224653159454493,1.1633682823078615,4.18979794272947
|
| 231 |
+
11.836037606046636,4.493668880175995,0.17772252701353453,0.5852371920713595,3.9304332618835964
|
| 232 |
+
12.612086683589103,5.8076659611060135,0.7534437509749831,1.6331360101946895,3.9642620466782255
|
| 233 |
+
5.071214121613103,-0.5022943167659765,-0.31279778405438263,0.7930942423571097,4.1676340556382305
|
| 234 |
+
4.359469761180517,-2.261852369740626,0.059754299080103504,0.9286344164212437,3.9336386286018885
|
| 235 |
+
9.573728243790265,1.3769750285138405,-0.2367789073672334,0.6475325658673434,4.25640848512981
|
| 236 |
+
1.0904503963885603,0.22674151214443022,0.4975588917229393,0.47435068980620543,3.8573080207439165
|
| 237 |
+
7.03458822933732,3.075457132996232,-0.26048633653461195,1.3779383366404103,4.250724257750379
|
| 238 |
+
1.8720566089179835,-0.7426008342298692,-0.291263248426391,1.23047131762775,3.4057818218513987
|
| 239 |
+
5.83286750653045,-1.9996180466148141,0.1007013919285725,1.3766683442422818,3.7564160404238773
|
| 240 |
+
9.050668074294022,0.7041532232232932,0.18175349458039125,0.5591541540776706,3.8241044180409354
|
| 241 |
+
8.199770979400927,0.5540798110936384,-0.01613191332763717,1.0976775077765173,4.242843124134346
|
| 242 |
+
-4.367930175129062,-0.9577650894112055,-0.3404066950814095,0.6663465198284027,3.909744216557424
|
| 243 |
+
-2.4330652613786743,2.2959399709990143,-0.06055747239810715,0.434518398559988,3.819445880671834
|
| 244 |
+
-6.970528402385721,-2.3351108663768487,-0.028980969852819054,1.2744123382508463,4.200076087096376
|
| 245 |
+
12.582885811400274,6.253122018937765,0.09043573574738156,1.336982575390229,4.175850781266934
|
| 246 |
+
2.2475507351512563,6.240120864315955,-0.6232085028301848,0.9735791749429779,4.269840555784694
|
| 247 |
+
1.536678392189733,1.9678306831249903,0.1356213285738866,1.580697108722984,3.8171225293927313
|
| 248 |
+
-2.348039267546049,2.998306648179341,0.20601545236850602,0.6644041420548796,3.801280703845737
|
| 249 |
+
9.46355378180675,2.7594546500273003,0.10730649632503282,0.784478999107444,3.866741231192543
|
| 250 |
+
-6.587581511022948,-1.651417503196592,0.23522940672923215,1.4371175454955847,3.5033669987764022
|
| 251 |
+
5.517387321134469,3.8641689408161133,-0.17206443845806726,1.2034141525029227,3.959646547455185
|
| 252 |
+
13.043423950739886,3.6658756061400286,-0.057688485011138074,1.1631952426854701,4.2268872039096825
|
| 253 |
+
1.8925723338961173,4.486169090276463,0.13003778685471634,0.8754905304019198,4.388758231010149
|
| 254 |
+
0.8423181260678902,-2.2995115668577757,-0.8448933198732435,1.0400892810840143,4.3459266629920394
|
| 255 |
+
4.110229003105234,-1.4883778162905472,-0.1466329623803283,1.0318179433369714,3.6840363440218176
|
| 256 |
+
1.330881080847921,2.380414708232888,-0.2495564926905497,0.6065881766446957,3.7512767844359667
|
| 257 |
+
0.6186214749565138,-0.19846358917101242,-0.09034460560969629,0.54529371070132,3.4350299182284907
|
| 258 |
+
5.5423416120220255,6.854138972181815,-0.4965131301002651,1.0327969933680423,4.267311789852627
|
| 259 |
+
0.828604754894658,0.862236990012911,0.6348442870056183,1.117155793140692,3.754584566646158
|
| 260 |
+
0.10555099796919354,-1.457868257713181,-0.13534116851992908,1.3715570887915307,3.8550399369621644
|
| 261 |
+
0.26075311181858285,4.573349851916557,-0.17189101457464495,1.117935890827958,4.002079541905529
|
| 262 |
+
2.6073180242525416,-1.9763517046949333,0.13652497730747676,1.1891807522183306,3.9104834550890253
|
| 263 |
+
8.035373670546004,1.867956855971666,-0.042830746881087164,0.913491017731426,3.849083760353225
|
| 264 |
+
10.964626748148682,4.228925889823875,-0.12331843070831248,0.7456133808059908,3.836211128524501
|
| 265 |
+
11.497010011098048,4.866143078360759,0.4004580662505813,1.212607047960856,4.0867073440474915
|
| 266 |
+
-0.6180713240205302,-0.32063183688748925,0.641938714694062,1.230820693130168,3.6105834417387435
|
| 267 |
+
6.676296284789618,5.404335214396314,-0.17918195207813284,1.1713441030364888,4.165137239968581
|
| 268 |
+
-5.242082420215079,-1.1928182226835076,-0.26339041835971394,0.8793988428303585,3.726938677475253
|
| 269 |
+
-1.9214230402206685,3.576803159381937,-0.021926043576952114,0.9238787407458925,4.5298376895762935
|
| 270 |
+
0.05451546145405217,5.282686717139727,-0.4022910830552052,0.4998475315242926,4.027875753524945
|
| 271 |
+
7.555945180736843,0.4654506162766676,-0.16544447269662235,0.8205658549811902,3.5863755835150344
|
| 272 |
+
12.466127304295993,6.449528735983438,0.23506876849263109,1.0003789170979551,3.2970220903313225
|
| 273 |
+
-5.527497538006056,0.16972701208708463,0.404888479636978,1.6603210665847263,4.15208715689538
|
| 274 |
+
2.1039601146663096,-1.0737798015847213,0.228438313214206,1.4616820560926285,3.8582819949945453
|
| 275 |
+
-1.6539000567477782,2.9896788741741016,-0.05250901371211899,1.2638421113196894,4.191053219101771
|
| 276 |
+
0.048597212879118334,5.96642299376562,0.1817838802152516,1.142659942303645,4.000009979952666
|
| 277 |
+
-0.3452323467372299,1.168711296615204,0.0175354256567528,0.9218449860720708,3.7440048632608254
|
| 278 |
+
10.832797762864178,2.1777284071365086,0.2322171192564574,1.5328769925431955,3.9613920081835134
|
| 279 |
+
4.837744381960829,1.4176402119035,0.2583999181494337,0.7323892846818785,3.8796559391450764
|
| 280 |
+
13.199521501648546,7.734645234385584,0.4615446017080387,1.0753415939434103,3.8318283193665015
|
| 281 |
+
12.53479565349436,5.150565816268946,-0.048641599207453534,0.9465899281968491,4.017169352771385
|
| 282 |
+
-4.863769110440985,-0.37072525290417513,-0.10385566700175773,1.383079414430775,3.840043551850283
|
| 283 |
+
11.3547727549821,4.583240179709665,0.005297243771827544,1.1821865974015506,4.154041073184323
|
| 284 |
+
12.255698692987304,5.52884264478449,-0.04107526977378688,0.9241665715750351,4.212161144903183
|
| 285 |
+
6.39833000692296,4.256576402714877,-0.2431238145539205,0.8394145619016382,3.8915975024423357
|
| 286 |
+
6.834981910832882,0.038977891139355236,-0.07273372843741366,0.9691010039127348,4.1555546398256205
|
| 287 |
+
8.86499772908967,0.4605554346569911,0.13790437068116368,0.9071740659173764,3.9470334098626103
|
| 288 |
+
4.461633940223267,4.612508355764294,0.2317603754054918,0.8417134387530192,4.014869223888171
|
| 289 |
+
1.4740102686907754,4.201066843275058,0.2204501746062683,0.6082425072439914,4.175935346954123
|
| 290 |
+
5.761063019975643,1.746986527228143,-0.24553299713930574,0.9556976202416619,4.297268519852797
|
| 291 |
+
11.863238449091114,4.444769346236302,-0.1125321769947869,0.34353143676295517,3.9854303798769957
|
| 292 |
+
3.8599421745543494,-0.5125458283463714,0.16195057460767942,1.0611791142644342,4.221161164975628
|
| 293 |
+
1.8921590196930604,-0.014974754841245719,-0.006880341199621461,0.5329710192974544,4.262547356654015
|
| 294 |
+
-0.2577155462946088,1.7878113950069767,-0.02766148712989738,1.0410578577630287,4.2045283880278435
|
| 295 |
+
-0.06358290335305955,-1.3818041017514866,-0.2592675645538526,1.023611945561139,3.9804838402998906
|
| 296 |
+
-2.0160931024344015,2.6264904327047023,0.121190105322475,0.7098797729038777,3.379738242476847
|
| 297 |
+
7.318797072817557,5.908594292200633,0.1541597558168309,0.9976415834122634,5.089948744384421
|
| 298 |
+
1.7567877369671563,2.876554857443402,-0.34156565133205,0.7403320577223289,4.489760528071264
|
| 299 |
+
11.86555767996445,4.1428849569690565,0.5740115389690746,1.6142427801843642,3.3760547355454595
|
| 300 |
+
-3.421061748515573,1.6854121471310222,-0.38626635595588815,0.5099359537696962,4.044242996190251
|
| 301 |
+
7.267741476218941,-1.0652847661614238,-0.3633380789371642,1.0044699634152154,3.71462310727631
|
| 302 |
+
6.019839804979369,-0.7378564915256496,-0.39820605507389234,0.6100115169832216,4.063103314756016
|
| 303 |
+
0.9602339451893923,-0.18873376742893114,-0.21233520215554,1.1811759516620317,3.861731763233348
|
| 304 |
+
6.764009157358921,5.337876491801681,-0.9528495943627591,1.4391748785268532,3.688445264531186
|
| 305 |
+
0.8974243801163251,-1.734423367162123,-0.038978467900029366,1.2698226118071545,4.018626746054074
|
| 306 |
+
2.621061687550816,-0.9794601011092496,-0.475708330283851,0.4137696225817368,4.357323652432953
|
| 307 |
+
8.647027637969341,0.35124634010416445,-0.27430489472763164,1.0421680773989035,4.644663347266419
|
| 308 |
+
1.7014970340898468,2.770014956958483,0.5528568217179511,1.2174782938420168,4.0510063604130835
|
| 309 |
+
4.365450404950718,6.439724072990381,0.08922275638401561,0.7245308064963856,3.6648756548431125
|
| 310 |
+
1.8117645607665707,0.5775188011956717,0.21916072608545964,1.6173951951368375,3.866820996959196
|
| 311 |
+
10.303093045116503,2.426700735980779,0.021361349342788535,0.493140400197432,4.464269006642109
|
| 312 |
+
-0.3140369961496182,-1.912333822824193,-0.4211642325181536,1.4194327965189462,3.665963952470739
|
| 313 |
+
-5.228619743105723,0.20725657408597487,-0.1882167014975368,1.4346687178560469,3.308208649617269
|
| 314 |
+
13.733786053274372,5.841188238500182,0.2734867709091343,0.9634047650262485,4.462978763182358
|
| 315 |
+
4.52141356331772,6.471735238110474,-0.5318016184054609,0.8916387454267025,3.89710904836484
|
| 316 |
+
13.059910703390381,7.191470781055153,-0.07084280039163411,1.3798171765088587,4.5047927767029
|
| 317 |
+
4.0933984898404026,6.59001030106689,-0.03169577046297781,1.0131129142554243,4.162522457739556
|
| 318 |
+
5.4761991859915415,1.7979128589415614,-0.09365446845701263,0.8527397754236816,4.015970117812765
|
| 319 |
+
-5.019569826369578,-0.4993830047411901,-0.061481163778531946,0.712545010072932,3.7118284610589756
|
| 320 |
+
10.411050671142414,2.852794723542008,-0.020843233292452513,1.160466728143818,4.130365318163537
|
| 321 |
+
6.336395891108048,1.23454408979612,0.2356820695364805,0.7802641023618834,3.787191695744081
|
| 322 |
+
12.607523881775538,4.770839684812371,0.03574500952994094,0.7033673682520353,3.8159766069685954
|
| 323 |
+
6.059821907469577,3.495749442789217,0.246141991232147,1.0780601751369001,3.4709359297578457
|
| 324 |
+
11.833018359431946,5.702005654021643,-0.011789672780480523,0.8964936932215526,4.2828777975228665
|
| 325 |
+
1.9255695728968938,5.514281957164756,0.09031621299093044,0.923118952721994,4.073439295286434
|
| 326 |
+
6.535542781825472,6.251875511276712,0.025657985490617596,0.7819690101745371,3.9871306019947097
|
| 327 |
+
6.522742987205908,2.631598944611822,-0.27563439451513416,1.0703660709448155,3.8253608042603426
|
| 328 |
+
2.0015921337862492,0.20523550871574553,-0.2952381921575464,0.6089367913470412,4.117895532269821
|
| 329 |
+
5.6511586167393055,4.161240458108811,0.319861688051394,0.4767105563068721,4.347606914877358
|
| 330 |
+
-1.6873267188326233,3.1310542615663204,-0.031203947666835905,1.0373856742485574,3.63659901582022
|
| 331 |
+
-6.288417554501769,-1.6142621000906827,-0.021888997954618516,0.7777727667545816,3.547207211388563
|
| 332 |
+
12.15881000836172,5.92320511996865,-0.5369515805660855,0.43916272968253867,4.300607495310157
|
| 333 |
+
11.734692508315227,4.306666115815575,-0.09735845883918648,1.2842235417175492,4.0244869253776105
|
| 334 |
+
1.3582685225416873,5.801058453554097,0.101838401608643,1.1887679792386654,3.7142984591109984
|
| 335 |
+
1.083253842353784,-0.18018135243506528,-0.35178900015977027,0.7547528193041629,4.146492582683033
|
| 336 |
+
9.22331406296815,2.235885487674074,0.12084151162433188,1.1410749697628297,4.169587504878781
|
| 337 |
+
6.381548303522499,2.063399771885751,-0.06097416846973415,1.316459640521448,4.140151526572755
|
| 338 |
+
6.615279570722915,1.2447515183076803,0.3960171709621366,1.561328922111091,4.089095166895814
|
| 339 |
+
-1.663016598481172,3.4321617818655312,0.6988825422035817,1.0754342727909083,3.8525408977582227
|
| 340 |
+
8.734942150773207,1.9726212861655927,0.4831207919246389,1.5880532659327948,3.7275701201075577
|
| 341 |
+
11.99256493247179,4.702921777608579,-0.18469029608554613,1.330083959978139,4.609590057629481
|
| 342 |
+
5.9261683196326,7.090184977541917,-0.4750377565683643,1.13692507736083,4.0338343778310355
|
| 343 |
+
3.1612636047867912,7.597539939543661,-0.31523909919105947,1.4346654901366884,3.672107774864578
|
| 344 |
+
-5.228653339723586,0.6853948268415948,0.39255382044914244,1.3124058973000712,3.9659996597726326
|
| 345 |
+
0.6577714201249081,4.275783499318315,0.05844543161187922,1.4034674597905492,3.964805406226813
|
| 346 |
+
-5.538167876314111,-1.07455848312403,0.01675588739606668,0.9343685242042233,3.558610998894517
|
| 347 |
+
4.473168904018564,-0.5663164146607244,-0.47857024878220034,0.9633433586015928,3.8532794912806105
|
| 348 |
+
-2.6332014594859947,3.276321780950404,0.4588503215529345,0.8075723093991785,4.531976866686279
|
| 349 |
+
3.89714828914111,-1.226771131130326,-0.3589226426570082,0.39781631891705604,4.221267887628337
|
| 350 |
+
4.1224936342930665,6.410553776368951,-0.026986802181364195,0.4981225632891445,3.601657970903814
|
| 351 |
+
1.0651011018192653,-1.4241841627558998,0.37672552821762706,0.579109098850267,4.175457607600358
|
| 352 |
+
-1.943532522838844,4.510732854916093,-0.19608256937950327,1.1994092038288788,4.100709120543589
|
| 353 |
+
5.772598889232801,5.3544062575510525,0.45017427184269343,1.3294833585358141,4.20967225717204
|
| 354 |
+
3.141265698127639,6.256386773100764,-0.4049830798020258,1.1184308383752037,4.200192958707209
|
| 355 |
+
0.8891384959784228,-0.24027334247822874,-0.14127379783299046,1.474712482563758,4.222553936477434
|
| 356 |
+
-2.1607165960566945,3.7479810603025543,-0.5012610649240085,0.9656807379998704,3.697889916015049
|
| 357 |
+
6.469703587397097,3.566138766526869,0.16757738092372607,1.1605736137703306,4.085967756482182
|
| 358 |
+
5.7521516432988555,5.102897759146117,-0.4271151949469856,0.8131275457277221,4.192275070450445
|
| 359 |
+
0.5195505325403121,1.8587404600628301,-0.16988500880246643,1.36306161799504,3.9411729523689987
|
| 360 |
+
2.9209170867093066,5.81981374916673,0.0941638029145011,1.301769845486204,3.8725918635453724
|
| 361 |
+
3.530232388436602,6.793697199446851,-0.004199066227858911,0.7373947486354089,3.78518329588659
|
| 362 |
+
7.008304995564413,0.04465897803984742,-0.0412568914077545,1.0465411998990473,3.94881874911331
|
| 363 |
+
0.08710990717020034,0.7770590494223475,-0.07163173451526511,1.8116068597493555,3.6775947080800715
|
| 364 |
+
12.120493360048396,6.22538342882309,0.6183804690125698,1.2136041651292309,3.8693210684366885
|
| 365 |
+
2.1597517995555777,5.442104706368243,0.00675417501571178,0.7222234578217213,3.913727736930626
|
| 366 |
+
1.421018072612068,6.862711062656266,-0.14122274494604362,0.9664136378535095,4.418221664312624
|
| 367 |
+
2.055285735412355,0.8796133325627777,0.1435075209732274,1.3829517489343202,3.8362036553443035
|
| 368 |
+
2.1443721657019874,-2.1902528334992595,-0.04030347106868671,0.9482207298180351,4.326108230474985
|
| 369 |
+
3.948315907449563,-0.9958731789247238,0.3327903378097254,1.1885748734876374,3.9994128117687446
|
| 370 |
+
-2.0379695408243377,3.29613648009705,0.1726145680413063,0.8098970077643544,4.0527965125693095
|
| 371 |
+
1.793231564834151,5.618025543751097,-0.09789630780599486,0.979664254448405,4.519750382277047
|
| 372 |
+
-2.845541401988005,3.404855224988772,0.29717811172012565,1.797283919788089,3.9029727598324584
|
| 373 |
+
1.129346624089526,3.0143744992811357,0.29332680602681616,1.2391714975864225,4.043254489584973
|
| 374 |
+
9.797467410486682,1.57086318455963,0.018933694051249655,1.3154535373989724,4.167567623149192
|
| 375 |
+
6.708229894558914,3.7219841585431963,0.1439337290788808,0.9743363012285838,3.7429181321807805
|
| 376 |
+
0.23675767828027028,1.6297742669190907,-0.3282062836817548,0.560832199327971,4.664176895897433
|
| 377 |
+
6.39336611867393,4.8429809494690605,-0.4906262605621442,0.9070754239865404,3.82734663875125
|
| 378 |
+
6.095037935277256,4.656769060392705,-0.213745128793041,1.1662145540985565,4.617039822685027
|
| 379 |
+
6.610921457683545,5.196969869245681,-0.057747223965372595,1.4425955801042372,4.174450562924507
|
| 380 |
+
6.1799369819546275,-1.2581933846719058,-0.16467003029375357,1.4676804840190587,3.699652681183819
|
| 381 |
+
-5.216254127730545,0.2101226139425545,-0.3516858775180946,1.3259434349687385,4.300233217882661
|
| 382 |
+
-2.8858022594471264,1.5562664067013405,0.2818990411276409,1.7128359482984612,3.5644445267725886
|
| 383 |
+
3.9373970543625134,6.062190727554495,0.5653284546027633,0.4515253085690364,3.9639532598907814
|
| 384 |
+
5.01135928813863,6.6860534936116585,0.18656308412319797,0.8436671351693807,3.599285731914491
|
| 385 |
+
0.7828393808727572,5.762822302391784,-0.1368182043097954,1.2027932995657433,4.6656734308524985
|
| 386 |
+
6.787806896586417,3.034822138085551,-0.21573900505608742,1.0053483522438205,3.8903598933806287
|
| 387 |
+
2.3272806039439127,-0.9349019298765073,-0.05251133242039297,0.6581959747666374,3.887892814836628
|
| 388 |
+
10.379349356814394,2.7834216094248303,0.09357003254169444,0.9378505220493414,4.098752026581309
|
| 389 |
+
6.999487296917308,2.2008498589032883,-0.3347195839944475,1.2575448260358366,3.6453747409850936
|
| 390 |
+
-2.9698950935335615,2.160556767550415,0.4668877057546932,0.8980076232591195,3.3286268243450423
|
| 391 |
+
11.59160103096465,2.8867370195877973,0.8392214123317261,0.9460540226493903,3.870262311759537
|
| 392 |
+
4.027899968691042,6.551960262366458,-0.26961337794921003,1.1010161919714476,3.824479113350833
|
| 393 |
+
4.718643301260586,-1.2645797809514263,0.10946610600979906,0.9122868496722633,4.344029233158392
|
| 394 |
+
1.6723353752933159,5.797757186788295,0.11358515685597027,0.7339837154808184,4.196033883835086
|
| 395 |
+
1.3119620227345439,-2.5561605319235623,0.13315365590710562,0.8601384851888594,3.8988264063248805
|
| 396 |
+
-1.2349709881400206,3.221261389662845,-0.04794168043648534,0.5589293152104959,4.577416463549529
|
| 397 |
+
7.924806980617085,0.8598182268317042,-0.36752706273013874,0.944391550453722,4.221295841031429
|
| 398 |
+
4.743609691204028,-1.1608823339376562,0.3330970617457572,1.1812652071722891,3.863061352405551
|
| 399 |
+
0.022325245564075336,1.9734283119912086,0.2119345238196211,1.2468579257479635,3.920170247698935
|
| 400 |
+
9.995272510465874,2.596797580851401,-0.09712046546617593,1.8618911584822073,3.9646886854377117
|
| 401 |
+
3.368573879841586,-0.8933833521914113,0.4051349552667509,1.0197780205651603,4.538192516073084
|
| 402 |
+
4.111952333466059,7.010280979949104,0.17404868237277296,1.0619274597092172,3.460234922042064
|
| 403 |
+
-1.8342962887351566,4.343019242189315,-0.6562228675498474,1.0281728303426827,4.235665566828643
|
| 404 |
+
0.37957414494775876,4.5767457295292795,0.14113064317764934,0.6446224321247414,4.271512588614689
|
| 405 |
+
1.5543284992117767,5.738318200706383,-0.04978099627782746,0.875251136066246,3.9885649751625265
|
| 406 |
+
1.6706382429695092,-1.1193061273943983,-0.2163591490750824,0.9548255981977343,3.8084269399910635
|
| 407 |
+
2.034349146114523,5.620443977275009,-0.5707774271089493,0.5715940522250933,3.63375092455287
|
| 408 |
+
0.05231178208804099,5.5115522157318715,-0.48014101837465073,0.8804284291064868,3.741669225402815
|
| 409 |
+
0.13462384252607704,0.0925301085680858,-0.35024915344228086,1.53321462617992,3.546501072685709
|
| 410 |
+
-5.08410193943936,0.7007841776473406,0.11888322660110934,0.827481298040408,4.160643156810749
|
| 411 |
+
-7.505788907687285,-1.8487929438865274,-0.4732780162215549,1.5659298936174788,4.207052397814464
|
| 412 |
+
6.074688736638093,4.096984068521975,-0.23599555446691353,0.4384259104238909,3.9716802848587704
|
| 413 |
+
-5.56815902889319,-2.0250563701708506,0.15036293717493268,0.7249986412006857,4.082264239007486
|
| 414 |
+
1.0581628418920395,-1.8842835999481524,-0.15518843749853678,0.741563617312193,4.326076664742447
|
| 415 |
+
7.080118859315747,0.18750070382173445,-0.25608456411173713,0.8444321741970391,4.054920634591966
|
| 416 |
+
6.352704923699121,5.287564753618388,-0.15510137286470274,1.0175246958394624,4.191387777550889
|
| 417 |
+
0.8746551402231013,2.444941165256027,-0.4079148088975348,1.5038013209868264,4.265751739470016
|
| 418 |
+
5.0785102606334025,7.258816990752694,-0.16739657524285914,0.464121632661635,4.1735276868577
|
| 419 |
+
5.3049016143788235,5.40458333686806,0.01377722872091445,0.872689610474322,4.220100291340696
|
| 420 |
+
1.9457080152396786,0.9525624633404957,-0.3183238988185467,1.3624959679028523,3.520562442662235
|
| 421 |
+
4.958696705663911,-1.6377085434746257,-0.24854721484832384,1.062010815700889,3.935144518042199
|
| 422 |
+
1.5019969918857212,6.758535103659659,0.0308248537175561,0.8518754853850347,4.093645576695451
|
| 423 |
+
10.457902783854015,3.3984435794309498,-0.49036188983007734,1.507505262404609,4.0785100679676525
|
| 424 |
+
4.681371694189892,-1.3409760792339884,0.13428802886250202,0.8955443629170048,3.9214698986689758
|
| 425 |
+
1.4948244786782374,-0.4182891906940003,0.20146922219800126,0.3947550072492857,4.331174650249029
|
| 426 |
+
6.818591809877806,6.47100984691013,-0.16828335153236484,0.6188127592536302,4.092380469069979
|
| 427 |
+
3.835895251608059,-0.25990544105255564,0.4369339011956333,0.588207715922926,3.9488521642579957
|
| 428 |
+
0.370426614472361,0.5867927392474476,0.3888995546689807,0.6548974493317784,3.861679742459499
|
| 429 |
+
10.203690000385535,2.659925843730208,-0.006136075872962033,1.1972954707572105,4.2458301359904125
|
| 430 |
+
0.9417543588359873,-0.08620977515357917,0.05911317541033102,0.9781200208614852,3.9896538489011246
|
| 431 |
+
-1.5878594382264728,4.0849148347432935,-0.524121744034293,0.5245733768756021,3.7372869768714754
|
| 432 |
+
4.113088540397929,0.05610787878345175,0.39500061145890575,1.1720760025622385,3.359428933949017
|
| 433 |
+
-2.7118971482054888,2.556519891484916,0.08973980171234476,0.9768340271082102,3.550890639188651
|
| 434 |
+
3.898393282979536,-1.5093135996352562,-0.023282420785948128,1.1458964487734757,4.076881899658006
|
| 435 |
+
-0.7567678624977401,4.441748891994474,0.3139861643762452,0.7533309885131658,4.1275331806459725
|
| 436 |
+
-5.4866902876549215,-0.3580460541253483,-0.15263480206167007,1.0793221226730898,3.983553974155605
|
| 437 |
+
-3.823010924445952,1.3950528194545124,0.18669948505919814,0.6991120519447982,4.0071723013246805
|
| 438 |
+
-3.583288730073816,2.0680680178973425,0.2585814790533528,0.681098139310562,3.3968103453732144
|
| 439 |
+
10.955892814924573,3.463033582123843,0.7187527871298883,0.8035402592447176,4.009056224174156
|
| 440 |
+
2.4404580909698783,1.598679833521006,-0.41776982276012015,0.6463349122288992,4.338343766246373
|
| 441 |
+
-5.287863834526108,-1.1054790781677575,-0.43988858921844254,0.6256582008626614,3.81500914052271
|
| 442 |
+
1.878187184194802,5.9321663599572885,0.18019011540590646,0.9199503553068549,3.8297591468917167
|
| 443 |
+
-0.9743921995561746,4.055772781026794,0.007005617671446069,0.9284460424329528,4.0556987066977195
|
| 444 |
+
-4.363403788573654,0.7477203398422737,0.25507439079050875,0.7329952648847055,4.135101981166226
|
| 445 |
+
9.472315544281392,1.6744426203442955,0.3169463906114575,0.5655585634076639,3.884761145085902
|
| 446 |
+
2.6926425130477893,5.323393952188184,0.3590649954688015,1.32457228816422,3.7909095026904582
|
| 447 |
+
1.0161867255276644,-0.06937531043580344,0.4108997267241566,1.2493868091809175,4.075017185603679
|
| 448 |
+
13.58045934134453,5.648586794260353,0.10403307552290032,1.3712798253415688,4.017088067174203
|
| 449 |
+
7.985209923462952,1.0949166690359946,-0.4490633145540899,1.1913436470901426,3.6264965098289386
|
| 450 |
+
-1.57930694342716,4.024292122806994,-0.17104117101908897,0.9057035822951196,4.1583088875446865
|
| 451 |
+
6.893502644493052,0.16866119879874997,-0.46825013466645443,1.154947932748043,3.675154651965474
|
| 452 |
+
3.353551287073622,5.418001976026533,0.5445172062361723,1.0213635845814744,4.254494053072272
|
| 453 |
+
4.683650067850291,6.3195442183759525,0.16507547976824344,0.7722478309086891,3.9864958914040987
|
| 454 |
+
-2.8082135163192516,3.1190972178679814,-0.10725742747965121,0.6648980328401631,4.437485698814267
|
| 455 |
+
4.212033492238812,5.547074290048201,-0.2948308342803507,0.6150901438567342,3.942506302750699
|
| 456 |
+
7.512373288129508,5.188157708300652,0.049630144242787236,0.9846587963494517,4.974806575912739
|
| 457 |
+
10.528525881084565,2.800791970657657,-0.37303253431008687,1.051262914921329,4.646424314894739
|
| 458 |
+
3.365435598074076,-1.3164161814530326,-0.1839525332934012,0.8233807432204674,4.173533255504857
|
| 459 |
+
5.796952983463883,3.136541768186615,-0.17250711432809268,0.9250149565909842,3.82498524965643
|
| 460 |
+
5.342469901944079,8.279221382425845,0.14086911187535545,1.4838225442716289,3.4913174206266033
|
| 461 |
+
1.1306150765619534,-1.1367658073178337,0.062096578953962756,1.1304526800071422,4.295796879445462
|
| 462 |
+
0.3004942738088486,1.5050258847186995,0.20924293375161832,1.136145952613519,4.1571866066175
|
| 463 |
+
3.3587344775836354,-1.619424653257501,-0.6775569785503933,1.0817593444406794,3.980390989636733
|
| 464 |
+
6.320457457643553,0.728309308601736,0.5108681025374217,0.7187598389628961,4.312128312672111
|
| 465 |
+
1.0472442881486834,4.696148654708512,-0.21890201832430728,0.44545073462627305,4.079808606270289
|
| 466 |
+
11.283248730266441,3.199238390362766,-0.018416228280290894,1.0503817174119965,3.6856950735354
|
| 467 |
+
5.008241443521404,-0.6459611927813655,-0.4400311735209946,0.7814078347633664,4.1837775523569976
|
| 468 |
+
12.222364605760578,5.16266383874214,0.024007944627972413,1.024138833107952,3.861988370525511
|
| 469 |
+
5.335311180926474,1.7290800170803782,0.4104195255313756,1.0338892487560598,4.144280134714831
|
| 470 |
+
4.3624182294356535,-0.3517776933003427,0.3996094749685047,0.8305575345195773,4.3874832080081445
|
| 471 |
+
1.6585342595737023,4.815039985049599,0.057412281226526606,1.666518265622274,3.6629581260903117
|
| 472 |
+
-4.4949668706483825,1.3136717377365246,-0.4697830963245896,0.684835006897319,4.565257556624375
|
| 473 |
+
4.323918705167962,-1.15738493628729,-0.3650030782097951,1.4537710139363724,4.573992842216179
|
| 474 |
+
2.5088454337446624,0.8932383301600761,0.19325374733797393,0.6935214398719167,4.227721478082069
|
| 475 |
+
2.8473972020644247,6.712974035080227,-0.19904126761583577,0.5863973151562607,4.381217717570996
|
| 476 |
+
5.166208410772823,4.787282356574947,-0.025550013477834314,0.8213180525243642,4.490150904467495
|
| 477 |
+
4.821040027244941,2.242537934098945,0.4733530381958002,0.9797543326580019,4.307042825812975
|
| 478 |
+
9.934006489234843,2.6283371970808163,-0.5598085874757783,1.069023154598712,4.276248594887003
|
| 479 |
+
9.408636990884089,2.0759718839313184,-0.07264512949323823,0.6754082126957097,3.961372719247106
|
| 480 |
+
1.7869712285162236,0.5235731957999942,0.3222774884492707,0.6178874082025096,4.094593377043315
|
| 481 |
+
-4.247562739306057,1.1042285155856582,-0.03460324123935668,0.9394818584049113,3.9549940593266473
|
| 482 |
+
-1.9026901523458597,3.3127490587617454,-0.4024475864175389,1.5388384060852043,3.974587871261232
|
| 483 |
+
7.123309230389724,0.5445655138345175,0.09343250778655965,0.548894066146018,3.67647942671459
|
| 484 |
+
2.377838831134058,6.743717029932175,-0.5877313644148187,1.0851766078464977,4.026841315442325
|
| 485 |
+
7.277432999429414,0.8628527803998202,0.1062294158158228,1.4063045537563315,3.7172623813100882
|
| 486 |
+
-3.438205589060304,1.3316185293850258,-0.013780999307613834,0.6919762453011069,3.9383975807968876
|
| 487 |
+
4.561563167251368,5.968697084257734,0.08205216802119102,1.051069878321507,3.8196011387578483
|
| 488 |
+
3.1073417976705797,5.183993082780461,-0.023051242838083574,1.2590937110833715,3.881215024273141
|
| 489 |
+
-0.0957654609910028,4.548525898994549,-0.10969371499614984,1.1355986526598154,3.870726421599944
|
| 490 |
+
0.5653011978845779,2.3721637714989776,0.11300587028397739,1.2386035681057597,3.9120565748945944
|
| 491 |
+
1.6159626424762963,3.2451369282908944,0.07117648802463683,1.169553657418135,4.068713139614195
|
| 492 |
+
0.9709659261858726,-1.8807781487450081,-0.2027624980693782,1.217540478016346,3.9903919569391544
|
| 493 |
+
0.675273404376828,5.373045222781837,0.27613698551693094,1.0302385461439794,4.08718380951884
|
| 494 |
+
6.258470474825269,5.587322453303748,0.35964075790250655,0.9737534267823934,3.933362174103988
|
| 495 |
+
6.158664294285348,3.200835919871551,0.35346283654781707,0.771820730521442,4.233028023041219
|
| 496 |
+
-3.4522616970961275,3.214070862699155,0.17708221059819126,0.6384001465340551,3.930553538606442
|
| 497 |
+
9.3030778003616,2.2469294129713377,0.07671711589731192,0.9955080494832438,3.7804506915307265
|
| 498 |
+
7.316939635163304,0.6633529593460336,0.03749392855820645,0.996475364588105,4.1469843035774225
|
| 499 |
+
-5.40351554260756,-1.2866762550664164,0.04757563849005052,1.420534529687116,4.185733406915905
|
| 500 |
+
0.4539093701196797,5.607141302960484,0.039254494562291846,0.7969121280586998,3.9080517252619558
|
| 501 |
+
-3.9866829769185204,1.9127175259627622,-0.3023216391817043,0.6903173052484064,3.9361786486503685
|
benchmark/IOAI/IOAI2025/Individual-Contest/Antique/Solution/validation_set/validation_set.csv
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
feature1,feature2,feature3,feature4,feature5
|
| 2 |
+
4.891379954565867,-1.6340327895456703,-0.03553468176494172,1.0711630459596264,3.988173385338206
|
| 3 |
+
2.2169634418389412,-2.1962050911072213,-0.17919054358652484,0.6938921278108754,4.0563675907162065
|
| 4 |
+
11.918512913344143,4.170174072514784,-0.3556329069653745,0.6708296292470535,3.6892633508165495
|
| 5 |
+
-1.6926214862764892,4.376455224466741,0.09209272120071624,1.1028902036191721,4.254179056274554
|
| 6 |
+
3.155467466509674,-1.2588074853779099,0.06227437688258551,0.4516489167078629,3.3929325512416044
|
| 7 |
+
13.022946917742157,6.171010418815634,0.22383209700588952,0.8705604704769043,4.123976058332366
|
| 8 |
+
-1.162796635937521,4.540128746863401,-0.41887485757357334,0.6179084823104664,4.017047983561414
|
| 9 |
+
1.1533799211171636,6.821436640778078,-0.17864807575301098,1.028622334092914,4.422207374240565
|
| 10 |
+
-5.151288257839033,-0.6120768877864535,0.4209159335782452,1.7646791327167466,4.034289791603037
|
| 11 |
+
5.647276985219591,2.844673948279455,0.3410613410441292,0.822648395171364,4.177666651028464
|
| 12 |
+
6.43027361648847,4.292619070895601,-0.35380459818247184,0.7182142637777907,3.497181272429905
|
| 13 |
+
6.596890607086714,3.843415106898844,0.029406652238558047,1.20717493697184,4.0756952544566145
|
| 14 |
+
11.32481353676497,4.156870825605148,0.47597888327531324,0.9379436469568488,3.9178181650843538
|
| 15 |
+
10.61506993879137,1.9091322006117284,0.1983766568164246,1.312409098749845,3.552733290041163
|
| 16 |
+
4.619759891628102,0.8659654612215459,-0.1226247640759647,1.1688530740283345,4.220149403013806
|
| 17 |
+
1.4912020551299854,2.6650277933348576,0.3437961170735995,0.9302978928902588,4.414500075006531
|
| 18 |
+
1.2354913959820732,6.232031636920941,0.7037284910406167,0.8904945315790724,3.716385252876298
|
| 19 |
+
6.391475650785695,-0.34447699940551646,-0.4494714012026745,0.7472630355453151,4.224414411164067
|
| 20 |
+
-5.278655929188144,0.9684911365552815,-0.4654651333143186,1.2200600012396425,3.7072934134079643
|
| 21 |
+
11.906301469881653,5.095628645336175,0.27947138226064433,1.3178318695704383,3.9690595630086256
|
| 22 |
+
8.654510037292292,1.23929622906856,0.20530776129503867,1.2994327287436576,4.079690244559435
|
| 23 |
+
5.255497766103298,5.7314047889260795,0.617209895143994,0.8893686222622261,4.321631653820156
|
| 24 |
+
6.65463244197938,4.650747523827245,0.005361844909624681,1.260253765443537,3.761759526117317
|
| 25 |
+
-2.598890603078118,2.780954924234922,-0.3521720941575307,0.7675637952917871,3.5964333165094513
|
| 26 |
+
1.0237162681833891,1.213359837125094,-0.44609502656584427,1.0570332225816572,4.274307820564943
|
| 27 |
+
8.682814867423339,0.7456803045121112,-0.23685081319859336,0.4325632092189249,4.06347805956226
|
| 28 |
+
0.6736845466220769,5.035935919061218,-0.6689274984101659,1.110466676202529,4.222956139935796
|
| 29 |
+
8.98427252888063,0.1994807236514804,0.037777654699117924,1.1338292170071043,3.7774067249669505
|
| 30 |
+
8.9072706287617,1.4969879387153713,0.2083030673453241,1.17513254514851,4.263455043269682
|
| 31 |
+
5.669954179271249,1.5631187938382922,0.34539114630262235,0.9905655318705608,4.254423732476571
|
| 32 |
+
4.1797882523843555,-1.2125882920976743,0.25362833498935106,0.6181509949305852,4.3021015645521565
|
| 33 |
+
-0.7352979516223433,0.4521947459298269,0.05276283660625031,0.8204012714559751,4.269059756125611
|
| 34 |
+
-5.895545465091228,0.04863923650694579,-0.15510128910638793,0.8340574657881684,4.3227195746544025
|
| 35 |
+
10.170763054377655,2.9374394155170047,-0.5336346119530856,0.7562851229945771,3.904173599502433
|
| 36 |
+
-0.36175121954169764,5.559763638590427,-0.15201717662949596,1.0016800096019478,4.060626126784456
|
| 37 |
+
-3.8231553336465223,1.151298021726923,-0.20729293179766206,1.0642481446125844,4.265985667445233
|
| 38 |
+
7.225462120196701,0.5902341128777342,-0.43986566925714116,1.1049879638705826,3.756761676840893
|
| 39 |
+
4.1121842459532205,5.800563747569504,0.3549775480862538,1.4235430421363082,4.276849077426967
|
| 40 |
+
6.010178279666081,2.998610517733208,-0.3449208713005188,1.3506971736061884,3.8625770826769807
|
| 41 |
+
-0.9603696987841304,4.555911688436703,-0.3134062943563642,1.321517731966416,3.915333291995051
|
| 42 |
+
8.709941664109795,1.3784707983385833,0.24084672565748386,0.48731808071342786,4.085650825184434
|
| 43 |
+
-1.875933059624052,4.502776627354245,0.22938094114654753,1.467846933155117,3.9441313167809184
|
| 44 |
+
9.259241669641632,1.1240838504378243,-0.24574259241795732,0.4082650628839508,3.930054767572542
|
| 45 |
+
9.327772429363792,1.3476411495893956,0.2306074151204928,1.3652952452411085,3.345261917836899
|
| 46 |
+
-0.20119796896726494,2.215970429267802,-0.22854794793747976,0.629175658661937,3.714795942586695
|
| 47 |
+
3.91581692154845,7.057022789650262,-0.3548727856937597,1.0862667053144235,3.7649017674771987
|
| 48 |
+
2.387822655667264,5.949873624715692,-0.006449221479673922,0.9019329800689779,4.0219156202363395
|
| 49 |
+
0.5564992505852813,0.250741280924189,-0.25621453145405065,1.38662849790545,4.221024099694026
|
| 50 |
+
7.936990019659908,1.2557249923426639,-0.31293733521342065,1.2340414591690394,3.837061558113311
|
| 51 |
+
1.536443153645315,1.0614072518444833,0.27267762511404875,0.68195493454923,3.8761894320440136
|
| 52 |
+
1.2269333787326824,1.1560837184260337,0.3849161192585607,0.6162008393231486,4.2098648382507085
|
| 53 |
+
4.3085303639114905,6.358875727130055,-0.3131242376521382,1.1357376941466233,4.012060714950955
|
| 54 |
+
0.3097118385218691,5.178952969639721,0.08803566859029334,0.8719434328928655,3.3449789338034663
|
| 55 |
+
5.849286926288439,-1.2097169967745713,-0.41018321141846376,0.7203388858049303,4.007000787030457
|
| 56 |
+
5.154020506882336,6.663264598825366,0.1776620440658036,0.7938657198250695,4.320854237708803
|
| 57 |
+
-5.645175062466715,-1.233216881837311,0.0140346952552122,1.420297736905456,4.138490119266064
|
| 58 |
+
0.9360349105035273,0.32891892148938384,0.029741892184620814,1.0438027480345766,4.162445412798846
|
| 59 |
+
1.6595957247745412,-1.6445454977121463,0.1453756774452383,1.0497608242405743,4.698190040810228
|
| 60 |
+
-0.506424158106447,5.009023123741969,0.37331846852819095,1.434958432658444,3.652684265561971
|
| 61 |
+
0.9392318401130867,-1.9859223544491957,0.614263462081024,0.8007096240112483,4.19505727443848
|
| 62 |
+
-2.0996451212436273,3.32630822747061,0.26420485225223284,1.275242492564202,3.633172210194761
|
| 63 |
+
1.780679272645463,5.76108764935362,-0.3655137591368192,0.35999805883354885,4.20666912163957
|
| 64 |
+
-4.515127751398545,1.5479366041282294,0.487174318380664,0.6141987262181405,3.947282809071141
|
| 65 |
+
-4.604187543931208,0.898971457420778,0.6434144332483872,1.4558356609859748,4.254642878626461
|
| 66 |
+
0.283183759949027,5.4385758153672885,-0.010153203631798603,0.6885291060364805,3.947000553556952
|
| 67 |
+
-4.095633269213887,0.7422371565590156,0.00446550775322937,1.2827574799232544,4.1610877075066215
|
| 68 |
+
0.7317370592944437,-0.4393069453560598,0.15327633024405818,1.165577458227257,4.135495846042057
|
| 69 |
+
0.25016765648616923,4.848080645665153,0.269589006717989,0.894780564005677,4.229883068185619
|
| 70 |
+
4.929805202100098,6.2114043504404055,0.3815504136433208,0.9254126653990382,4.201362905588875
|
| 71 |
+
7.917357598573841,1.0684512153665704,-0.5784056646996343,0.5929253553342937,3.821763339705536
|
| 72 |
+
8.320280278401173,1.012209387782102,-0.2599611543012411,0.5601771856620053,4.593183764357658
|
| 73 |
+
1.761285424688954,-2.115461872163199,-0.3617223590982755,1.0629074278995096,3.858862142533009
|
| 74 |
+
2.87270331877354,-1.7074657297401221,-0.48245631822823226,0.7687417017253371,3.689578337959227
|
| 75 |
+
0.16673457628829597,-0.33161777050035013,0.7518512864159813,1.2889766636490676,3.786197441210088
|
| 76 |
+
6.362008276154379,0.8273350879768517,-0.048503206425620414,1.2600430542102976,3.085611508677105
|
| 77 |
+
3.651961526195427,6.769631793451663,0.6438334152559705,0.7270950597389867,3.6857400891753147
|
| 78 |
+
1.932828377186963,5.672034886229883,0.09738443718178526,0.6260744699626064,3.6895296996550404
|
| 79 |
+
-2.985713234545848,1.8680050817083658,-0.31624240789346364,1.1589916695716627,3.6238372237612095
|
| 80 |
+
-1.53831434165162,4.050464851066215,-0.4011309746503324,0.4555131335065873,3.6940160720249917
|
| 81 |
+
5.905396130051337,3.9852961137490457,-0.22672899089164816,0.833021247550784,3.373274341286762
|
| 82 |
+
11.103577993492225,3.742155707497992,0.0511274420703181,0.9377854377866408,4.1217595446880555
|
| 83 |
+
10.233216144052074,1.6877888976053452,-0.10502014073015316,0.47501758100786995,4.020160503812992
|
| 84 |
+
-4.75185322880288,-1.0384667160861651,0.24346734561480457,1.1162249206704233,3.9616643639559577
|
| 85 |
+
11.25494375826167,3.729074804759077,0.309771060224285,0.3843139574256079,4.016160348262314
|
| 86 |
+
2.1681732292436156,2.3836859742967436,0.2935956338505675,1.0816401398923354,4.4951800874436305
|
| 87 |
+
7.469192417012903,0.219575965191094,-0.2259248420005981,1.4240695610920473,3.9775140939984497
|
| 88 |
+
11.39612972393423,3.34744298571235,-0.6924498545954889,0.9481732952306585,3.5578825374292986
|
| 89 |
+
1.9342134866979217,7.0723488134629715,0.3586295243244031,0.9203326846164712,4.323908860357119
|
| 90 |
+
6.194897676387555,-0.8358472866334998,-0.03242055904633823,1.0243736025802639,3.5621967523958644
|
| 91 |
+
-4.8249704250760574,1.3465243307676422,0.2530056329656192,1.0162343524744932,4.128462312988574
|
| 92 |
+
11.598775618691741,5.142929229229855,-0.30327557583371195,1.8951039784294672,4.070615946853399
|
| 93 |
+
0.8093246686262414,5.516622975628552,0.02602405418295135,0.6197407090905864,3.9278983145407484
|
| 94 |
+
0.783595338122068,2.2081540942005806,-0.09987256099826224,1.2870384727846185,3.5892395318363617
|
| 95 |
+
1.5290615500164901,-0.11106408752564778,-0.5640926099248147,0.9895111910767844,3.775478506898193
|
| 96 |
+
2.048801536350252,5.432419985678409,0.2524199584276483,1.1564588383700916,4.202931573344014
|
| 97 |
+
0.4755873300796335,2.8477967274444222,0.2014018665165552,1.1587462297918838,4.353389420262004
|
| 98 |
+
-2.7263478835569215,2.7770827428539526,-0.1089505244152429,0.7964969985199797,4.003158159445723
|
| 99 |
+
8.71796986804096,1.0906904009201979,-0.04142726153528982,1.6623105161244265,3.883756773803303
|
| 100 |
+
5.160717657196474,-0.4224435561366717,-0.6556962613304131,0.8344817554724416,3.6787620342980603
|
| 101 |
+
1.2222772529138726,0.46739426561587655,-0.5214926457899628,0.8728657619027078,4.309099512025122
|
| 102 |
+
2.888998457956337,6.121649803877749,0.6025046824712326,1.1418008065429792,4.0803429713236525
|
| 103 |
+
12.227307582971228,6.928404917782863,0.402883108264816,0.956712334888676,4.4087011329878
|
| 104 |
+
2.634639286977372,-1.2563026652947347,0.39772820828265,0.748477714531246,4.237874518207602
|
| 105 |
+
3.9570754596680775,-2.0226032447762945,-0.13880653311829005,1.0349239507084902,4.127034528686832
|
| 106 |
+
-0.053473115245378455,5.755683580264513,-0.12058042595817425,0.5763961455595378,4.373225213722737
|
| 107 |
+
2.952438363964416,6.7818937624030005,0.41362948851413023,1.1908144597801278,3.9060843979699063
|
| 108 |
+
7.108944561969257,4.580705128129928,0.129258097280944,0.8495360719085618,4.0385992739848575
|
| 109 |
+
0.9674031154860484,1.5733908312208253,0.11741200931754767,1.3603228539097005,3.9026005141117825
|
| 110 |
+
6.752175152465775,5.119376784733665,0.05263366424434445,1.2666755764697042,4.498027731266159
|
| 111 |
+
4.813623273667316,-1.2960066143556013,0.019700124337494743,0.7528104251668645,3.8245705337342146
|
| 112 |
+
2.950964883011338,5.873276517745403,-0.24059509034013848,1.5173092853625443,3.9314517414435093
|
| 113 |
+
12.771327714744118,6.5340177040479475,0.37896937271786907,1.0242236558602416,4.184300733358441
|
| 114 |
+
3.8295380603081632,7.79280271170185,0.2283677711225774,0.8286340499032356,4.249115594101243
|
| 115 |
+
-2.4980242961971095,3.0839064340173428,-0.007771737870316705,0.9683564038806075,4.043525806734909
|
| 116 |
+
5.865541028395805,-1.3732484707382493,0.044812589843166835,0.9927256716401648,4.099536384488967
|
| 117 |
+
1.2512627861138048,0.43929578865811414,0.0269909395486477,0.598791169860248,3.958742914996215
|
| 118 |
+
-5.006059116122399,-0.8134453376690214,0.1721135382953841,1.037013803971802,4.25528876412459
|
| 119 |
+
0.48247549468358,3.810140366627614,0.2170420105684853,0.4621992141260778,4.634911456975698
|
| 120 |
+
-1.8683757304552924,3.7457994900642824,0.021717625544505546,0.8252571019721631,4.304590644416494
|
| 121 |
+
7.849960404114502,1.159320044834159,0.46797929162120755,0.5063393731195794,3.8474796724477724
|
| 122 |
+
10.974028277787582,3.9455768458923663,0.00537955225681837,1.084460247157996,3.595179953909792
|
| 123 |
+
1.8207908505278936,0.002245927153950611,0.12414323185636147,1.269582968959733,3.648612369656905
|
| 124 |
+
0.36474606537052184,1.1543561916157752,0.43301062533864226,0.9425159651924304,4.141257812853132
|
| 125 |
+
5.332998011264214,-1.3210103544560279,-0.04339741059969841,0.5613461214135338,3.9177896357490214
|
| 126 |
+
-2.661261072519024,3.448201203900808,-0.022185690993695092,0.5067043397477087,3.962832817712644
|
| 127 |
+
7.972187482685433,-0.3607415224390249,-0.05360968204430935,1.0285103768526342,3.755414294163606
|
| 128 |
+
7.190872772759824,0.08739190548472586,-0.3854658613086311,1.3482587652311726,4.165415662624038
|
| 129 |
+
0.7542583811194283,-2.2835706957984105,-0.050776296958419655,0.6950275364383887,3.753795105110119
|
| 130 |
+
3.4492688268194067,-1.6051248815949533,-0.4573466210234247,1.2512231824814903,3.577585465841025
|
| 131 |
+
0.53246241795693,0.6568618241644741,0.02751498916037561,0.8488517394003627,3.562292415934442
|
| 132 |
+
-5.625738745665049,-1.354432144925937,-0.32398847667897224,1.0017342493586348,3.6474094135911463
|
| 133 |
+
5.5917639966797275,5.8012184386330805,-0.07085195552295592,0.5257039576237459,4.32434768885383
|
| 134 |
+
-1.4975872980287768,4.125458144584945,-0.37575716532979203,0.5555700139466002,4.114762522663553
|
| 135 |
+
5.4476672689617205,1.3531638167825026,0.3400258909080255,1.3244639359143418,4.040120764696384
|
| 136 |
+
6.077823216166313,4.338402959096979,0.3120366669660487,1.1247405110232218,4.0494333990477305
|
| 137 |
+
5.540126676242514,4.501502010020811,0.11392867937978676,1.2426727839163987,4.105540208036489
|
| 138 |
+
6.366711835214802,0.829028544795061,-0.27866195851025516,1.2286658647513384,3.766061864665229
|
| 139 |
+
1.1376425048077115,-1.6596691354957815,0.37771232129900983,1.0580805790119958,4.0443229227704
|
| 140 |
+
0.7868408736802261,5.51628748668854,-0.0880389706306783,1.3209514352677705,3.995224015321314
|
| 141 |
+
1.1383466781517444,5.679097338180048,0.2966141625342045,0.9925368559659317,3.8086450639389513
|
| 142 |
+
8.336617561140606,1.9842468446264863,-0.24121256923826898,0.8157608448887633,3.9910744461419903
|
| 143 |
+
0.23476582062305668,-0.5102385576105783,-0.0933206189243165,1.094834540007574,3.995376572283668
|
| 144 |
+
0.7559096011304925,2.126052633643147,0.44790891866318167,1.2680492512568393,4.0417043366995955
|
| 145 |
+
1.5986274707873802,0.2804212265137812,0.02801805297559662,1.0523260461287665,4.047919332536306
|
| 146 |
+
2.120745346138698,1.5819834178036767,-0.24864533049705384,0.9993698900220591,3.8986027216327765
|
| 147 |
+
6.3799695786233865,5.391402611970778,0.16537345904928494,1.0934793406269883,4.737249836765978
|
| 148 |
+
5.7541506702799134,5.760093314390824,0.8363298388954404,1.221956682770608,4.010621392339868
|
| 149 |
+
9.768344814400722,1.8460808221611957,0.30166815142987774,0.8743963204465215,4.059473631384753
|
| 150 |
+
10.087704187499872,3.006126162148967,-0.360375439331432,0.1421887759378221,3.9799832741241055
|
| 151 |
+
6.4884030363030085,3.468641156674663,0.166809699913643,1.0556051657592285,3.662919255622042
|
| 152 |
+
5.618518359235024,5.2495314070197505,0.13905164303908746,1.343927770389116,3.4996159803047115
|
| 153 |
+
5.655561842707564,0.2041224504939747,-0.1675937391281801,1.1279714250207669,4.501673285457619
|
| 154 |
+
-0.9689714443889202,1.0564976381582882,0.1940134284371461,0.9117286884533752,3.9369989539447463
|
| 155 |
+
4.450109893855052,-0.7899572823236494,0.398662862700381,1.0181811848872158,3.818943247407572
|
| 156 |
+
4.258616933246112,5.742048609112612,0.400752970706487,1.0687936601872887,3.690595011310724
|
| 157 |
+
-5.306118672336529,-0.03724037158760107,0.10664068209004182,1.2558318734707885,3.5164375156941503
|
| 158 |
+
-6.333545426869186,-0.195165373774412,0.3234507136603481,0.8860463764075169,4.234575379232581
|
| 159 |
+
0.841134436792552,1.021265265260157,-0.0293217228552013,1.3294166662998577,3.927349277346479
|
| 160 |
+
12.852973192199311,5.244282087949976,-0.17608815239774464,1.1570236888691783,4.529517528642553
|
| 161 |
+
5.312797638144084,2.750406674528848,0.42025886476909763,0.5015624715059364,4.583097574878841
|
| 162 |
+
0.9964482600445601,-1.316846821589194,-0.40231668867457165,1.1209549904527647,3.7448628414016905
|
| 163 |
+
4.215713845248794,-1.0606700929629316,-0.03736803066017973,1.269094842571664,3.800350874269612
|
| 164 |
+
3.36247608588406,-1.6348621022145895,-0.278646914736698,0.7029198063727764,4.025669630624846
|
| 165 |
+
-0.3991722390149086,4.820275445593276,-0.1985527533195666,1.2447164105150093,3.4691206198193885
|
| 166 |
+
5.24311278713513,5.207096143925143,-0.24993282594877017,1.4619244609093383,4.286367075270712
|
| 167 |
+
11.178491710702163,4.36241773625222,-0.12301970246913155,1.334365499200738,4.051471638703405
|
| 168 |
+
-5.908222638628944,-0.403333112965488,-0.6142231919960498,0.9051117864188422,3.5644311558892103
|
| 169 |
+
5.862264151512767,1.4139312500242713,-0.1934119199624377,0.8075981701523625,4.0803252164276245
|
| 170 |
+
2.5808859839725713,-0.8231721462721464,-0.16396841769821302,1.346093561857853,3.788720411581789
|
| 171 |
+
-1.679789946448495,4.64338446728343,-0.08758930094387873,0.9114913554717113,3.802379168206817
|
| 172 |
+
11.317166270051015,3.825844821269329,-0.31949258410215425,0.8713110606852493,3.9347129414072795
|
| 173 |
+
11.811833741007089,3.352150740811093,-0.20432409384658315,0.572232263434587,4.166752520132415
|
| 174 |
+
4.072513537819328,-0.8787699061352008,0.05507633449485867,0.8612905934849326,4.205495486491771
|
| 175 |
+
3.671461571594853,5.586923147763879,0.14101162604336737,0.6799233779231699,4.356778357763946
|
| 176 |
+
11.831515059737809,3.1714207019557645,-0.1930036283781635,1.3713706541991013,3.847258231592399
|
| 177 |
+
6.12320710401766,0.07121283170527293,-0.4232827275851578,0.8851291722145591,4.319498026324492
|
| 178 |
+
12.612638826208354,6.395279393724898,-0.09326832535487954,0.5970591457831058,3.9936217081394765
|
| 179 |
+
3.449772134816966,6.366945241790389,-0.1353642125989701,1.0029572922954175,4.464150211645342
|
| 180 |
+
-0.4248518931852189,1.7381287209619218,-0.10750924936220266,0.7083869649388508,3.813043153814047
|
| 181 |
+
5.9052026420114885,5.558330923535748,0.1399201835362623,1.1329185248666767,3.673301029174266
|
| 182 |
+
-5.55544502994677,-1.0799964069489218,-0.46300273328781505,0.46872483298718715,3.33063072860328
|
| 183 |
+
7.872581981297034,0.5464011462190389,0.08985148061891365,0.8466503343626253,3.7477686239708956
|
| 184 |
+
5.787732358130968,6.239886802168582,-0.2123289088028277,1.1275492480238578,4.540722555634106
|
| 185 |
+
4.090043038034274,-1.1168140496847858,-0.0946241160463278,1.199541217021338,4.282235567142404
|
| 186 |
+
-5.058231878674113,0.27340344529795235,-0.13472646095898227,1.0613146132607012,3.8803496002543603
|
| 187 |
+
11.942018803493557,5.315475415683543,-0.2852068870724652,1.0508077466886652,4.2367725317903435
|
| 188 |
+
5.403406893602105,5.029676835111551,0.05844106928808771,1.0462546225992617,4.051258790047341
|
| 189 |
+
-0.8803848250275874,4.525398746995795,0.4910155518470797,0.7355435410796056,3.9516980228918452
|
| 190 |
+
0.9276380138892965,-1.8268769050828864,0.3960749034352287,0.5363764637831192,4.170171840726092
|
| 191 |
+
10.482679506104311,4.310521875234975,0.01547119269058778,1.1271296268529396,4.36612841496847
|
| 192 |
+
2.223600872529323,6.156494462415905,0.25087053720080815,0.9078656691089221,3.9999792780938472
|
| 193 |
+
11.765826331788933,4.829760774442921,0.536544777715981,0.8024732514955791,3.792379263856219
|
| 194 |
+
2.6546662075729217,-1.5118619831702205,0.2043149482839385,1.2514075328065166,4.153642323030978
|
| 195 |
+
2.8205497384921627,-1.4349869156215584,-0.03106915539546634,1.5692428067914856,3.570099181172621
|
| 196 |
+
7.035028155812352,3.6121053973681243,0.24104262614264993,1.0412898279405585,3.9922228410978358
|
| 197 |
+
10.556145410898205,2.5733561814749706,0.5991187179594323,0.8444451502809167,3.2372388177638127
|
| 198 |
+
0.3895525794556262,-0.04787552412725428,0.43340358734700346,0.8731954656444033,4.615626442669338
|
| 199 |
+
0.043187804638122634,0.6752864810903164,-0.3579905211721486,0.7919640515653308,3.7803303953727454
|
| 200 |
+
0.8215651021602093,5.6554028718448155,0.08118172608317646,0.9261886536523117,3.92450391795281
|
| 201 |
+
-2.3261603606367025,2.8805988262461115,0.24582088752849476,0.8467882181849339,3.53513583081448
|
| 202 |
+
11.824099840100152,5.9530648803676804,0.24795066123214624,1.179163188168935,3.844505450208851
|
| 203 |
+
4.402823758990745,-0.9301051179533515,0.026881705400500003,0.9513498778401278,4.250182491246417
|
| 204 |
+
2.409808501719276,-0.48808152540791205,-0.2803421626497366,1.3811570461708416,4.649770914082966
|
| 205 |
+
3.9303432710642316,5.3360512699063625,0.18488795970686142,1.5051863226446716,3.269605945978194
|
| 206 |
+
12.69576089708896,7.11733462593345,0.4436605762951658,0.6206698350511255,4.032303811388072
|
| 207 |
+
0.7018423590682098,-0.017217993576925425,0.3520528924798016,1.109364778449778,4.320928854929664
|
| 208 |
+
6.69220419375508,-0.18564435138182245,0.35953585193869353,1.0654286883586113,4.584319819886918
|
| 209 |
+
4.307966794536003,-0.7079507063657051,-0.04940529094192565,1.0459176680323101,4.519903934911792
|
| 210 |
+
1.067399427447541,5.986418957174868,-0.2691197243504719,1.510939084231079,4.208300859478134
|
| 211 |
+
3.172896227174637,-1.4824932450755353,-0.08891429629397961,1.3247293837619167,4.164707955248186
|
| 212 |
+
6.175528782752233,6.179667512058471,-0.4629943872546033,0.7531214625856213,3.8738550245353007
|
| 213 |
+
0.42847760110540384,2.073506360276036,0.24373705167996915,0.8088102566949614,3.942882691989438
|
| 214 |
+
12.785570766483099,5.666483728517862,-0.3969116979612573,1.339335064371612,3.6142968879106947
|
| 215 |
+
-1.4191971387772364,4.043264337670672,-0.32571366642498856,1.0606589608783126,3.529742423556494
|
| 216 |
+
-0.19367279236187596,5.310188584217251,0.5020267909488332,0.5977445270721273,3.9764236021104464
|
| 217 |
+
3.6916585553116494,-0.6851155479875118,0.1448194504440947,0.734333028452983,4.185582241714597
|
| 218 |
+
0.0019762922627185597,-1.6648644198390854,0.012454858258257238,0.8948931631185599,3.73078365639031
|
| 219 |
+
-4.559189972258338,1.323334792445094,-0.3831388949182282,0.510868215553902,4.053590599205915
|
| 220 |
+
1.6007831847479719,5.692268198328432,-0.14958053762494114,1.1881898419832102,4.022645272027403
|
| 221 |
+
-5.32756282438681,-0.6827914977656836,-0.0372926116039009,1.2789356543246142,4.222160334685232
|
| 222 |
+
6.157381553375991,5.512301320602166,0.02879893990109007,0.8032938777474408,4.333938539531521
|
| 223 |
+
1.4615195752514765,-0.5094572184586064,0.30804241361280904,0.5524998811473614,4.236254889173545
|
| 224 |
+
0.8661908881797993,2.6344190873925566,0.027044398131604988,0.8257047406938658,3.8521026763726325
|
| 225 |
+
5.737980325213398,5.918653204957705,-0.05930395966887618,1.0524818495703858,3.3851942577122376
|
| 226 |
+
12.84312937957566,6.253756646647718,0.3250603196306901,1.195996833148976,4.2113127118136555
|
| 227 |
+
-3.369588964670836,2.5404507487322756,0.17535931992029752,0.4274724961176918,3.873154960443206
|
| 228 |
+
3.839546445162731,6.029246218859626,0.02227923563573452,1.0601333439399219,3.665049492920067
|
| 229 |
+
10.857407079069073,3.98645977735436,-0.04741212824103854,0.9409478646382575,3.9566195466028034
|
| 230 |
+
8.57016567758495,1.3719560418863266,-0.368522982618122,1.1697988608788608,4.4063018123549575
|
| 231 |
+
5.66104510000746,5.805181742395566,-0.4752369044426701,0.4468960688674858,3.8238532902850895
|
| 232 |
+
12.464411353853597,6.563602514516442,-0.5532855772804237,0.790168686666612,3.899049576014685
|
| 233 |
+
0.3428521947716868,2.555599142736585,-0.03861638747857791,1.4618273192624873,4.289452773988781
|
| 234 |
+
3.9093415667313023,6.201185109058461,0.11811522267984476,1.1008134343728544,3.7045151938498297
|
| 235 |
+
0.943499144438359,1.8034448660677476,-0.4636877021435607,0.8341388825742326,3.98667218771049
|
| 236 |
+
-3.8795970172811636,1.4729527251541743,0.589890172472218,1.0463472626881096,3.5484656850959566
|
| 237 |
+
1.942589783930046,0.5255760307931453,0.33958024198118913,1.5144478257651226,3.7764269885863437
|
| 238 |
+
0.9707929795325798,6.066115104030027,-0.035034066509497835,1.2704875505585886,3.838118216284593
|
| 239 |
+
8.302217050119195,1.6703318178742215,0.5691955526308812,0.8265955471543692,3.547199116983985
|
| 240 |
+
9.10326912594636,0.8179085428475675,-0.861157994165254,1.0873890964983872,4.27671611628001
|
| 241 |
+
7.696058690235022,3.454930637809564,0.07074282530117834,1.3610207075991863,3.965681494837528
|
| 242 |
+
6.123359521128034,6.165108232312251,-0.07125522028303549,0.674548834658867,4.282092641125765
|
| 243 |
+
6.66855764245349,4.641738132206696,-0.6896903371736365,0.1943592883872215,3.990025787346786
|
| 244 |
+
-6.517691373552072,-2.0894320519728593,-0.020253617125350155,1.176872983471497,3.8345850379056334
|
| 245 |
+
9.867357848536916,1.8587294183102898,-0.7413744655763044,1.2419389929917644,3.741717775741195
|
| 246 |
+
6.427679446492983,-0.5724341001665036,0.5426495828625558,1.3621727987318457,3.6374749141531675
|
| 247 |
+
12.585476477445583,4.665198337702168,-0.500523215505845,0.6670775527726405,4.182232432551429
|
| 248 |
+
-4.9222316232747785,0.6147236117257262,0.09239060236740056,0.8510584556103378,3.711815533697152
|
| 249 |
+
1.0661390967744595,-1.9202660927691169,-0.18367850854560983,0.7826282774811857,4.140556083105227
|
| 250 |
+
6.31499892356795,5.621350718000871,-0.09129190635282318,1.0712360723051426,3.838483162222401
|
| 251 |
+
5.929265651735611,3.329152953922548,-0.1223992908447305,1.5132463472916975,3.996774077833372
|
| 252 |
+
13.266169829983811,5.030943607420871,-0.471012150309956,0.7012812151486657,3.9389732263348898
|
| 253 |
+
3.942533103004889,-2.1791821190678995,0.3330694073864134,0.7917560746086056,4.250735006090105
|
| 254 |
+
0.48926720550424324,-0.08498489253655234,-0.15640341113372078,1.7364484375977614,3.7399240697327008
|
| 255 |
+
3.878437446559054,4.73637019475451,0.39699817636557105,0.5653118937158291,4.062932024131852
|
| 256 |
+
-4.370535507997305,-0.6322569402081918,0.007362249222141959,0.5414066039083107,3.8148413598048116
|
| 257 |
+
-1.9481794205051313,4.560508507054495,-0.061903619739878867,1.412253895229373,4.0531533800433595
|
| 258 |
+
5.79623271527683,5.298311326125307,0.08206819975961287,0.7825583724833637,3.6513271334728263
|
| 259 |
+
13.152561322255623,6.51676400334707,0.3527609479107464,1.1603169465775909,4.168447029013906
|
| 260 |
+
-4.836310690862733,0.2902454892072487,0.010957535674405152,0.9489088054615964,3.7904622299006796
|
| 261 |
+
1.4115422932616875,0.6368997919067237,-0.4272812628216417,1.0268130318886821,4.1887839911377664
|
| 262 |
+
0.1776873794430749,5.165596709910164,0.05964514096401198,1.2734209788855242,3.982589498252797
|
| 263 |
+
6.139152726602978,6.08560047696084,-0.012122272895069942,0.8710744372706412,4.5051023849645855
|
| 264 |
+
2.0776278775926715,2.8530855826051282,-0.0829872997823861,1.1061436385860517,3.8406809383110194
|
| 265 |
+
4.270734557166099,5.56358617984788,0.3694136323760768,1.4205646795170521,3.8817835868730945
|
| 266 |
+
0.5392482431990029,-0.6350644142641577,0.18264930944107016,1.3972063917539337,3.8899519448404614
|
| 267 |
+
0.8926054749246699,-0.5360958137668035,-0.432506686884436,0.6921378992886766,4.262617493691974
|
| 268 |
+
11.145458801880059,5.1752820952199645,-0.24154160087794738,0.24529388084965054,3.8305221628756008
|
| 269 |
+
9.49384719137066,3.3369444648139424,0.11453869572747874,0.9587462877822699,4.056241974505793
|
| 270 |
+
12.746297584228955,4.901828972995806,0.0441068190809383,1.072627303206866,3.9110695470504435
|
| 271 |
+
3.020997147126822,5.613479996673273,-0.3844061197907091,0.9696690196565969,4.179411069206141
|
| 272 |
+
-2.4463341005913373,3.5908740713533165,0.12393962868117629,0.9186159921069263,4.079992808868678
|
| 273 |
+
6.2272667896845295,-0.20171898560047286,0.6866822523963211,1.0141720400555134,3.676708867884
|
| 274 |
+
6.6927500654469565,3.9768514981533456,-0.5950753016178858,1.0903492520229339,4.530580079136528
|
| 275 |
+
5.733919144782795,3.2510108654539067,-0.2285949233025089,1.0955746174661058,4.511244310368405
|
| 276 |
+
-4.448299789775153,0.37408710433773895,0.08023629572213652,0.12724276119003386,4.128274295918673
|
| 277 |
+
-1.0067220894223918,3.9183829796121565,0.06894978170598735,1.034670429284545,3.8340975140961286
|
| 278 |
+
1.2641188126856402,-0.7525567275829249,0.20693036614479718,1.3410282418832167,3.6320952313676527
|
| 279 |
+
-5.874874547516821,-1.7460950467632654,-0.01853808932865812,0.4468263407229416,3.6511348767688556
|
| 280 |
+
6.334671771346779,3.4758665232642265,0.04669305349445209,0.9474164843861713,4.145134663634891
|
| 281 |
+
8.763071727112042,1.9029597718546505,0.05548647504649712,0.31875276943899633,4.028469569914367
|
| 282 |
+
-4.341096756421967,2.739744502511563,0.23309005291286317,0.8711623855529613,4.248751272063301
|
| 283 |
+
4.174673625071007,5.149388494448621,-0.47455616523839084,0.9728254305480221,3.574735363377804
|
| 284 |
+
2.026803181641297,-0.7298905845368822,-0.26288840104701505,1.1296902937132596,3.939046033545877
|
| 285 |
+
5.457506583972471,5.801986836819482,0.4627644535872597,0.8375480457823787,3.9590558945291043
|
| 286 |
+
6.649247803114264,-0.8202479637354316,-0.38853403205819576,0.4930480427753817,4.011010953830191
|
| 287 |
+
2.7514343393047977,-1.453073644599506,-0.008156587360256349,0.6941425654427693,3.5491623305896844
|
| 288 |
+
1.4488303081604998,5.808425294996292,0.27566145428634825,1.360892331011933,3.7601602522089537
|
| 289 |
+
-2.9427198260234873,1.2611770824308262,0.38039423977881487,1.0234235116401587,4.139917281541806
|
| 290 |
+
-1.8040316467717588,4.185370761784627,-0.466420534027143,1.3800433139864992,4.139913353478664
|
| 291 |
+
4.231569589149051,-1.3160165991100201,-0.013113783737847017,1.0506804628137716,4.090347820782466
|
| 292 |
+
-3.9390666236624012,2.2530158657449393,-0.22485283615272328,1.323925064124674,3.8204324607241897
|
| 293 |
+
12.350872489880304,4.789258596661797,0.23607385696367625,1.0883283369765162,3.637068516948543
|
| 294 |
+
-5.443013381410563,-0.6099415283057008,0.2466138611167919,0.9353660926310886,4.721886503443615
|
| 295 |
+
12.006044955271612,4.736584993210519,0.2391538311692141,1.1360810249979405,3.3273736697142606
|
| 296 |
+
1.1989104364475875,6.388942745285743,-0.3881551198905811,1.392734722773799,4.414718235055834
|
| 297 |
+
0.8777608170409081,0.5068743366042321,0.3823206763713945,0.05989579257136535,3.975670281970897
|
| 298 |
+
8.246338411291742,0.786225334368076,0.4826228266895302,1.2204339243780276,4.159767252730892
|
| 299 |
+
7.61470572082628,1.2665338169184175,-0.2555157809023332,0.9715289587761418,3.856711648253093
|
| 300 |
+
3.1419363897075776,5.315709933519977,-0.5220884709074656,1.0682412803063408,4.11197818926018
|
| 301 |
+
-1.0051978968123811,4.103698788112867,-0.31975186857875443,0.844691991500993,3.534049354272178
|
| 302 |
+
1.3875445271516258,3.1136316362570122,0.2944081986523479,0.7404774427300327,3.574870528222794
|
| 303 |
+
4.986199447267028,6.900322310087328,0.02631078821701202,0.8029348465817977,4.063413573419492
|
| 304 |
+
4.272890000439379,5.9235982300000805,-0.16503739996365305,1.1882274434565774,4.069833752120424
|
| 305 |
+
-5.042067746404362,1.7439260447293814,0.33675862807368506,0.7858436034407671,4.206320997084273
|
| 306 |
+
2.5422646937683444,5.458858822108825,0.31173395485202443,0.9418539967555264,4.013175929844188
|
| 307 |
+
1.643340476349901,-1.4917608885067315,0.1550345628287695,1.819736624068792,4.099946288136254
|
| 308 |
+
5.764749512284364,3.8861159132470036,0.17181044557067468,1.2954901399513086,3.9310001970321
|
| 309 |
+
-4.293585160298917,0.9764399591070115,-0.1641945546410005,0.5499298497368827,3.8204160136442966
|
| 310 |
+
3.4436405270677706,-2.027447257088901,-0.1287893957202869,1.077230886213737,4.2828799070386685
|
| 311 |
+
1.7450775068600413,-1.1860823367382705,0.5710515232010966,1.624361747585145,3.864131415855109
|
| 312 |
+
9.08726481611619,2.945330898478783,0.2355054169455026,1.0598743436549252,4.254620835143369
|
| 313 |
+
4.918147080415574,2.0141448390137815,0.5287200719098727,1.1842607676170576,4.316315103524549
|
| 314 |
+
7.835628206600278,3.430831881759728,0.11447966789866351,1.3590741894702698,3.6792353051568627
|
| 315 |
+
2.415723547754528,-0.6776490333732157,0.11753433255688453,1.0170153071699612,4.312262191797455
|
| 316 |
+
-4.593845264515286,2.513987060144714,-0.05167184459667624,0.8525112417695937,3.9153559570274687
|
| 317 |
+
5.033049665837325,6.551954496792342,-0.09517362318923041,1.3415010513108196,3.9760664688813163
|
| 318 |
+
11.939637700516556,3.810944165239647,0.027536494272609437,0.7777965112619298,3.706072493454546
|
| 319 |
+
-0.9574184881534191,3.9011105886374198,-0.2461590516872566,0.46755902638501634,4.675077440257445
|
| 320 |
+
2.558094448010043,-0.396738811457365,0.12201252812958907,1.348586757491213,4.199989359100576
|
| 321 |
+
0.0603369402220727,-1.7275647824603757,-0.22428398626966653,1.0224346889036913,4.184821591220776
|
| 322 |
+
1.9099777259199788,2.525706309329356,0.13733272244661088,0.3110007185565614,4.23821898319534
|
| 323 |
+
-3.056264184707364,2.27175538256696,0.12494206391045112,1.1469569324027133,3.3358416825212616
|
| 324 |
+
6.8499208359394785,-0.6230686293705205,0.4976756067595921,0.8838809716798619,3.9119985424080577
|
| 325 |
+
6.561424114058406,3.5992280283275444,-0.08361281820491107,0.9757082360466199,3.3775117219420676
|
| 326 |
+
-4.547837967894496,0.09145168312138496,-0.29595584067665714,1.5240146401531085,4.161672502492116
|
| 327 |
+
7.045987530617161,4.384407529489846,-0.13572343904752301,1.1320271071278154,4.2422394918280375
|
| 328 |
+
7.479353268870615,1.1029845636309297,0.5766056813361216,1.0589585568203246,3.633529637428563
|
| 329 |
+
13.073089689470592,7.01819329527817,-0.7495947637001769,0.9218614325927319,4.109081663690098
|
| 330 |
+
3.3287374035852286,-1.5626103698839173,0.3538065351159742,1.334007542952031,4.018925401736927
|
| 331 |
+
1.7735133915701873,6.728898979075537,-0.6969170372330376,1.5779660917505063,3.3910275102586493
|
| 332 |
+
5.734440464005214,-0.6987175135808176,-0.31232320068371855,0.8698976665955416,4.678142413728412
|
| 333 |
+
-3.8716095613421846,2.39670811037053,-0.8609969079519955,1.0346993896241719,3.5109182826175274
|
| 334 |
+
2.2888451587916787,7.4832271076020165,0.39885320397934754,1.498329462943741,4.623713456403678
|
| 335 |
+
2.399962917254093,-0.3374543741923868,-0.8965055092096085,0.3726594848331318,3.92573505804797
|
| 336 |
+
1.8969238963782438,6.004334462915222,0.020249494811751523,0.7772700249769978,4.242447702709252
|
| 337 |
+
5.714233631515474,5.738012593212856,0.4631471739678034,1.0018535015451546,4.160565132221097
|
| 338 |
+
7.860948965808731,0.6675539865311129,0.21931913755567856,0.953260962130169,4.115019338988267
|
| 339 |
+
5.08093267998231,-2.0700952439415023,-0.46994060618390476,0.9046748442153787,3.9655287134602704
|
| 340 |
+
5.722516524487162,3.0581965850645414,-0.1334955554467529,0.8922360250430841,4.221401679938647
|
| 341 |
+
6.167984373876876,4.753911086681178,0.11907301776623797,0.8641504549112237,4.128524266104397
|
| 342 |
+
11.058013448683417,4.861997015483173,0.3210207233773857,1.1430095758584224,3.652926437310148
|
| 343 |
+
5.159854811486285,-0.35321523377413955,0.0766691203257837,0.8633189374763106,4.352972353198067
|
| 344 |
+
-5.438919226017625,0.07958250740907491,-0.642215421504229,1.1751203939803672,3.965822214083165
|
| 345 |
+
-2.189162720069695,2.7598545599925437,-0.09411232448216747,1.2826766164549008,3.851150160296748
|
| 346 |
+
2.828364591658067,3.6559933093788644,0.10831947754449243,1.102241490795422,4.032064792022765
|
| 347 |
+
6.557400906736232,-0.7474305739510048,-0.5421826537328786,0.8605746348068354,4.038018174957399
|
| 348 |
+
-5.191450125731264,-0.6732356113811215,-0.09711863936535435,1.0529551552051812,3.833253930796731
|
| 349 |
+
-4.8816224533166945,-0.1695345450815926,0.11360287116779613,0.7553767133445908,4.263870108558182
|
| 350 |
+
-1.3823689223170512,4.9854348055408515,0.09544802379291842,1.2696945666688153,3.3992962229668358
|
| 351 |
+
0.5583356305575018,6.6579198936990265,0.13117680501817752,0.6430674546587001,4.057457704654186
|
| 352 |
+
10.47825544652821,3.1933070946736533,0.23523885767319289,0.6933694445410385,3.880971783656346
|
| 353 |
+
3.2787236902674524,-0.6831110446778025,0.1643140087351231,0.7562223489070079,3.8651514141583805
|
| 354 |
+
2.8360970422729515,5.3950973013353005,-0.04127978121206559,0.9391651056916004,3.996716432250702
|
| 355 |
+
6.324847194277249,5.903707446042311,-0.5663993740898978,0.5169398963850523,3.8791609994051854
|
| 356 |
+
10.608520135057443,3.0948662536317655,0.26062445783763905,0.6691885204205428,4.092908513038935
|
| 357 |
+
6.7097275139198524,3.189229894768797,0.13253456571341285,1.211485387160221,4.0063109843424645
|
| 358 |
+
-2.406582222102097,2.5092948886341286,0.00797225388800849,0.8067924845875356,4.094380643391334
|
| 359 |
+
1.8380222059524547,-0.5384518579580743,-0.4789407203323448,1.0379428499582155,3.930465876550135
|
| 360 |
+
1.5902998254219045,5.660285679054068,0.4356829143241521,0.6940852212423814,3.9956145195751787
|
| 361 |
+
13.278519753560602,5.338035380547525,0.07954430899208452,0.4718853335973747,4.0620952818215885
|
| 362 |
+
-5.445889494184094,-0.5696547297099914,0.16780611565880113,0.8148512064018532,3.49868391801669
|
| 363 |
+
5.062717523068605,-0.8143923560681587,0.16540248829772605,1.2165094015550688,4.246015749628048
|
| 364 |
+
1.5437075843351,4.993171392567324,-0.13242749139271737,0.8692124426189227,4.495281954515719
|
| 365 |
+
5.3744103262859,0.9911191888426621,0.0236941974446828,0.788389537019176,3.7583124653434092
|
| 366 |
+
4.506149891024876,-1.6979694852835774,-0.117041356862826,0.799935810672942,3.737001821606775
|
| 367 |
+
-5.266041864980453,-0.07130351746519681,-0.4320089087904687,0.646093008019986,3.6804858984177184
|
| 368 |
+
6.754930065364737,4.4871216818470305,0.24542610323496303,0.8679956410024185,4.154796587592137
|
| 369 |
+
-5.892515353944005,-3.618454346802813,-0.43855747717123084,0.8237813738638,4.110027283148194
|
| 370 |
+
1.1225674836416641,0.19741029136604835,-0.2779384363174327,1.192888330847215,3.85306366697784
|
| 371 |
+
1.818115094989689,5.920499961761948,0.0675573208013991,1.1229041156879842,3.9578914371521505
|
| 372 |
+
0.39931761262426646,-0.5970097716664955,0.09389759191322625,1.272541413225532,3.5071855345563727
|
| 373 |
+
4.357168536237943,6.449153152729914,-0.10426712830398902,0.5843351445585191,4.046665914085924
|
| 374 |
+
-0.7493991044668376,4.784514610073685,0.3351651543047823,0.8127707693790236,4.073943796030946
|
| 375 |
+
-4.750705379869201,0.6756532787199816,-0.1412402048751677,1.4143175783719975,3.9275369147709465
|
| 376 |
+
9.886144918020372,2.2737249887399287,-0.14611383561050276,0.6526069113214918,4.48661572409578
|
| 377 |
+
5.618426348947519,3.568285260323771,0.4057238427396069,1.3919129831865868,4.080807259072829
|
| 378 |
+
-2.129308279686237,3.4852488642048423,0.4764487554320323,1.2964182714364034,3.6981223521053734
|
| 379 |
+
-4.676463197038263,0.47608957931392126,-0.19121440196173395,0.800466956066909,4.079718478288004
|
| 380 |
+
-2.908071745268815,2.0358746968887367,0.008278397257155673,1.1816572334500814,3.9448535258905912
|
| 381 |
+
1.3436886046155272,-0.7973239252508825,-0.08032949793094853,0.8495785133625708,3.7657195816797175
|
| 382 |
+
-2.0301721510453845,3.0407956722812313,-0.24248053410484302,0.865607746517864,4.186242890282507
|
| 383 |
+
5.361171063891285,4.177921652916592,-0.18066535282434362,1.0336677786305368,3.7641802812299097
|
| 384 |
+
7.017174124655196,4.658363336536111,-0.09694757454974338,1.1775360515448812,4.010176811752175
|
| 385 |
+
10.769043936285856,5.380641615436922,-0.3718180890400123,0.9471795340043685,4.287483123080582
|
| 386 |
+
3.1141492431439417,6.162760760142189,0.19083513770918759,0.9177660480305337,4.135643719322957
|
| 387 |
+
0.5822426967999179,0.44162394291867935,0.1268870855994484,1.199921638354299,3.827541194026938
|
| 388 |
+
1.6654895674812638,4.611198435570442,0.07089333844654491,1.2948075654139983,3.8634637319801293
|
| 389 |
+
-4.256779594057786,2.2728741500008356,-0.7635822335564807,0.9937885975098263,4.062042957486121
|
| 390 |
+
1.739897889237029,-0.6707865672202542,-0.3438394458674472,0.7394690002154307,3.783339871966515
|
| 391 |
+
3.008727221680066,6.9132749015028505,0.3533876026116424,0.6182142637253385,3.656687694117603
|
| 392 |
+
6.194471353278785,6.982143461201108,-0.11468952955806419,0.9159855565556388,3.2694775114999004
|
| 393 |
+
-0.11219210512873201,4.587842904836171,-0.08250850779925376,1.066247308458917,3.5825380790241113
|
| 394 |
+
6.284342129410946,5.4128732999441205,-0.09867626994167518,0.5724752841182812,4.413690539233066
|
| 395 |
+
-5.704872372424254,-0.9617952260844943,-0.04959428281825539,0.610633112831849,3.72118895955692
|
| 396 |
+
5.01264370524143,-1.6373621840869923,0.33165462305655796,1.1225565650970606,3.870132468401815
|
| 397 |
+
12.617562710427444,7.253733619212112,-0.11152058323070034,0.7000641984892748,4.147212374236892
|
| 398 |
+
5.874146844460839,0.1513530049755345,0.39854506191085715,1.237468578753988,4.336571313615338
|
| 399 |
+
2.8782346637093186,6.6335110717847545,0.6371663114861881,0.862999339994199,4.231047928437272
|
| 400 |
+
9.767075949010922,2.173003927946217,0.2678611300671007,0.8916912877423169,4.274256627465722
|
| 401 |
+
-0.001444624300172559,-1.4987932981772887,0.05758035973665449,0.6663071552899396,3.43987084647676
|
| 402 |
+
9.443655401306735,0.7732085714336998,0.46677200277278497,0.7552412606923798,4.412036768966413
|
| 403 |
+
4.97466065486056,2.739437502145865,1.0150634667945349,1.0090005215138529,3.8644959819668783
|
| 404 |
+
12.481462718341469,7.096512493752136,0.19072586473774372,0.4782459104343678,4.129025653998348
|
| 405 |
+
4.180668238391982,-2.1252124052180674,-0.10892910009557297,1.0972587290157105,3.6373904648852293
|
| 406 |
+
-6.566282650297363,-3.8256121579414804,-0.11024605917317482,1.1592900230425343,4.647913268170295
|
| 407 |
+
12.597501717376197,6.081922635711726,0.033589259958780364,0.8833507693617996,3.473945127873973
|
| 408 |
+
-5.826569820615686,-1.9709218143576022,-0.36705484029891405,0.6505291530170694,3.0905178062389727
|
| 409 |
+
6.126859675933735,2.678362015959102,-0.4304789106285464,1.1792514074274638,4.502636737138728
|
| 410 |
+
0.9503497815260532,2.2559959997190213,-0.4514126576089313,1.2872427841169858,4.031464588424383
|
| 411 |
+
-2.4635687987442183,2.7929791663705505,-0.022139403256437543,0.7223102612622403,3.9613056101547746
|
| 412 |
+
0.44508373709439575,1.2168256644358797,-0.24082290820400853,1.6680426356349372,3.6311952138625814
|
| 413 |
+
12.183474408344534,4.611154013675646,-0.11081214865940611,0.4926992770127605,3.563536465260266
|
| 414 |
+
-4.591174415916034,-0.6755799969239518,0.09531233973791996,0.8748724905731591,4.132100080339157
|
| 415 |
+
5.81039259258466,6.886138416434572,-0.5009161064278611,0.9226315198403582,3.706831751575712
|
| 416 |
+
7.777286717642606,0.6561049693601584,0.607964736232058,0.9637398339682963,3.6452827430925083
|
| 417 |
+
-5.396200614846964,-0.6192332410110096,0.5785755870205702,0.9159612097066884,4.042488089225081
|
| 418 |
+
0.41690043930852994,0.061325728866100215,-0.07855496278236332,1.4098161111632845,3.8111809434048642
|
| 419 |
+
6.888035639828612,-0.07378203101282732,-0.5083267479228326,1.206331034487649,3.915408094449754
|
| 420 |
+
0.832321471506637,0.5690997144446108,-0.2245258416420344,1.6595119378553234,4.198806709463627
|
| 421 |
+
3.4341205555014422,-0.7305083618685946,-0.38105880458857355,1.0341951837436059,4.027617365954859
|
| 422 |
+
4.480159052854177,-0.9427561004427607,-0.11292231657230868,0.2552686333095847,4.6959998950764925
|
| 423 |
+
0.84077920967814,-1.1627553222775262,-0.3130363732598157,0.22716703977417052,4.108115106630819
|
| 424 |
+
0.024419144739016574,0.9126530429181243,0.04926493891447009,1.3152514269503648,4.467024656069496
|
| 425 |
+
11.290713617497607,4.049491215808221,0.4851381947811105,0.522668377000745,4.274074107914825
|
| 426 |
+
5.667271426017223,3.068333902587213,-0.18577349177234695,0.6137217422770935,3.8122201498611608
|
| 427 |
+
7.148844074564924,3.831795599669082,-0.03372719874266219,1.514650865007295,4.135980395195835
|
| 428 |
+
1.5516191146475542,-1.4886896513619163,0.5623802276103188,0.625301555271842,4.108015242350244
|
| 429 |
+
3.9900055959624425,-0.47712020911843367,-0.18882664209196026,1.3998644880198305,4.5809693936598235
|
| 430 |
+
3.49036367736153,-2.0826887956383473,0.04010668476029299,1.0089137862705877,3.742981376042751
|
| 431 |
+
2.0464599173897784,-0.8132922294514432,0.326931985910136,1.7808516425687686,4.25242899306965
|
| 432 |
+
3.876922307090951,6.373068004650097,-0.12093572630211279,0.9934538892072933,3.8185132327931246
|
| 433 |
+
0.4467110927187278,1.908762447802995,-0.7538857382456979,0.9675596896491493,4.067552423199419
|
| 434 |
+
5.093939702853882,4.916180951012651,0.11436368553766554,1.0334566037040893,3.793610181433776
|
| 435 |
+
-3.6904660283304205,2.236715936592711,-0.20683325933200358,1.1214583418984092,3.9551691956932054
|
| 436 |
+
-6.245867443409343,-1.7349048560242937,0.052701041208910525,1.334625808558312,4.077359471172537
|
| 437 |
+
2.77856940950727,-0.3692565048554746,-0.46050680869968313,1.1031291278344189,4.137394265401784
|
| 438 |
+
10.741080031698278,2.7843838122911575,-0.6207912335743647,1.1963135685858735,4.431355064693018
|
| 439 |
+
5.331455465484911,5.9532191296794315,-0.23167885453407766,1.1465591089810383,3.8353095589475155
|
| 440 |
+
4.343000317520984,6.84625472512336,-0.27082615055008036,1.329832520799104,3.866092363162721
|
| 441 |
+
7.710055108152384,2.1438124167013277,0.1765199376154232,0.8484845818714958,4.323853520296628
|
| 442 |
+
-3.5135249625368283,1.9339441145229435,-0.01534954140576428,1.0656077316563948,4.06349244217393
|
| 443 |
+
-0.4392740017631409,5.249167934763758,-0.13636539027035188,1.4535899659256655,4.079800273888005
|
| 444 |
+
11.640743471818096,5.070157446971794,0.2419156683883547,0.6564084570481455,3.8001438929956004
|
| 445 |
+
5.59154245310746,-1.0432981779715509,0.08348176584539407,0.8305768910944096,3.9557665173533416
|
| 446 |
+
-4.68685237076666,-0.4244689108110121,0.3597437672122736,1.3054009277950798,4.145227412192812
|
| 447 |
+
7.087437764782598,0.18948824030741285,0.1267951475066011,1.0626791883323923,4.101414294332485
|
| 448 |
+
7.204647536598706,0.6412652131293871,-0.36448602241325356,1.1505267928389473,3.7256275011047615
|
| 449 |
+
-3.8697035183034187,1.8240969654955879,-0.287329136977525,0.8272349832113818,3.828320953702593
|
| 450 |
+
0.7484313595808016,-0.24894839939920377,-0.1875566238403831,1.1350379075354438,4.5391905653911735
|
| 451 |
+
9.650999494579661,2.197301535647641,-0.4784616938848692,1.375405587228919,4.2050643831301375
|
| 452 |
+
3.2276117091593406,-1.1222809761219834,-0.2026390944486829,0.9762355868081797,3.8564565790169443
|
| 453 |
+
10.092809894861661,2.200076159352779,0.21548985125196796,0.9125024934145419,3.550367743513867
|
| 454 |
+
5.275478476275505,2.760527120910341,-0.3595619248266285,1.0725492397036418,3.325752767205914
|
| 455 |
+
6.058053244307046,4.540410107882327,0.017254438467609715,1.28566394996289,3.8697580446869257
|
| 456 |
+
6.835995267987846,0.40549797961677037,0.1350111260184886,1.2616063667333477,3.828891742449991
|
| 457 |
+
6.722507561418613,6.0181508913389505,-0.016790618477937717,1.281814951015014,3.7897018559185507
|
| 458 |
+
2.4664462702417493,6.4947790538664325,-0.05224151053305749,0.7910446897553505,4.184440453440578
|
| 459 |
+
1.74715692140418,0.01014259342804441,0.4706546096401985,0.9767278968787253,3.2192003854684104
|
| 460 |
+
3.954594328728411,6.793267037436063,-0.10839369728579863,1.081325652294316,3.376852837485393
|
| 461 |
+
11.695187242345876,4.591749225487641,-0.4712057346167996,1.1027963480891436,3.6256328143782923
|
| 462 |
+
10.067059232614309,3.584622720614354,-0.49386252688565313,0.9030466187627753,4.208095507547903
|
| 463 |
+
6.401755623471683,5.061842260025143,-0.5248845662484033,0.8995413047025003,4.540486091901998
|
| 464 |
+
1.393582473775577,4.85544023452389,0.16232246517730353,1.5184016360874952,4.340272387387365
|
| 465 |
+
1.2457834013541347,-1.4482778038190318,0.1213327820219319,0.17009057468779387,4.292062314407589
|
| 466 |
+
-0.26310763815376825,1.8594205614831147,0.21248625633422816,0.9289169783140994,4.042244775200203
|
| 467 |
+
0.753492660120219,5.47313185667055,-0.04364387400299317,0.5536827556601435,3.9601963674454344
|
| 468 |
+
13.622228811183078,6.319316022768265,-0.6554769807660831,1.1901747303171164,3.7482272931430893
|
| 469 |
+
0.9532301387072206,0.3701009821633325,-0.04112231976803423,0.7147459476451767,4.0025457431899225
|
| 470 |
+
-0.18585865382825495,4.723994664949614,-0.24789534598603621,0.8176110441612011,3.745275891727954
|
| 471 |
+
4.68784994628597,-1.4693274255970283,-0.37442902688712804,0.8141996971365717,3.5813279849923902
|
| 472 |
+
10.473162353106888,2.0265892415051407,-0.023007377024426248,0.7806848347661599,3.963953069382487
|
| 473 |
+
4.389812461280325,-1.1763445108176922,0.14090546486789074,1.4797919441006886,4.055009194383679
|
| 474 |
+
5.9230266298422,3.812012384749848,0.4169256963699856,1.5563015631795962,3.806547491620334
|
| 475 |
+
12.758373157717482,6.300207390844772,-0.1970003603029261,0.645724974977091,4.079655052861051
|
| 476 |
+
5.900993657909756,4.6768920689311395,0.12299981389129902,1.2891676765161397,4.178138197308454
|
| 477 |
+
0.6669322225485396,2.7702219368976597,0.2849862702402758,1.0196611869384586,3.9874286844945206
|
| 478 |
+
-4.567521885068363,0.21880732008059667,-0.2410956306532277,0.904865237762719,4.039991512253105
|
| 479 |
+
5.787553750776727,2.390891403809462,0.38343390479666245,0.5741670541473366,3.9350806491630586
|
| 480 |
+
-3.2899987185788535,2.7114699093070533,0.28726236337269984,0.9361876363105821,4.549741569825184
|
| 481 |
+
1.959320837749872,-0.050675563566796256,-0.27109918574849406,0.7608500777337333,3.849004809629477
|
| 482 |
+
-4.955474889544352,0.4299868972977593,0.07098750245329521,1.7976779911724698,4.268008692122104
|
| 483 |
+
2.9792725964499276,5.274062951112863,-0.013770350376529012,0.6066218447897415,3.9956825096462505
|
| 484 |
+
13.143610172509185,4.800179471250967,-0.819133663195403,1.5276737648638872,3.5854618371852593
|
| 485 |
+
4.775393185085038,6.082008702155275,-0.07044883408012383,0.8064538427926301,3.878388618685835
|
| 486 |
+
4.6909602606482625,-1.1842400867143028,-0.4311895177718107,0.8018930997071194,4.42905657415614
|
| 487 |
+
4.517493832372775,-1.9835028780666284,-0.4169644800718963,1.066691410315005,3.991357347138413
|
| 488 |
+
1.0485648963159442,5.385397376892073,0.13110015834177507,1.0892896131224004,3.9717102333971273
|
| 489 |
+
-2.6862861570179035,3.1506288815617918,-0.02058559221172706,0.7578385773257568,4.26677659042211
|
| 490 |
+
5.458006905739348,2.280526270191633,-0.06135630110381086,1.691767573314819,4.046126832426367
|
| 491 |
+
6.032028723591454,5.512600890949843,-0.3573738070396923,0.2394960601847944,4.222713191354942
|
| 492 |
+
-6.183028275680128,-1.8056612841680435,-0.35421547588204816,1.0979901312914437,4.06016200939773
|
| 493 |
+
11.704901932829499,4.748631808758723,-0.25603835484387955,1.1715125015292285,3.8159199707042095
|
| 494 |
+
1.6204351466569742,3.6199383881236793,-0.0998974054943199,1.2222861210631466,4.000561393444994
|
| 495 |
+
4.7164151128181,6.744414919738656,-0.4655816575380605,0.6502749251059525,4.138653247245077
|
| 496 |
+
12.2196907263077,5.053141617049666,-0.5393697076907767,0.9845571136564443,4.122334718036941
|
| 497 |
+
3.575572461654795,6.526766107470518,-0.10177379494920649,0.8360096839065366,3.6190979370861416
|
| 498 |
+
0.6071535079234962,4.898349724046017,-0.4409863347579311,0.661599202346113,3.9798521038517496
|
| 499 |
+
3.5061913678250862,6.788202892044298,0.23210652060397724,1.0074770857796453,4.101855194544335
|
| 500 |
+
6.652768125219133,4.697454026053618,-0.07533322522903786,0.9948131961647406,3.787808771926498
|
| 501 |
+
5.060941109165189,6.621648588780431,-0.2598719979395391,1.6820975379006216,4.15141290519508
|
benchmark/IOAI/IOAI2025/Individual-Contest/Antique/training_set/training_set.csv
ADDED
|
@@ -0,0 +1,501 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
feature1,feature2,feature3,feature4,feature5,Authenticated
|
| 2 |
+
0.5997578506721972,0.012165582918438084,0.20926965163336753,1.0879263525582294,4.088241393787232,0
|
| 3 |
+
-5.5123236982598645,-0.42657645490943663,-0.09233597349605054,0.5014311251216328,3.844388824104646,0
|
| 4 |
+
-3.387748747899123,2.7864766182931593,0.19559724704398684,1.5408585959998025,4.148680080138314,0
|
| 5 |
+
-4.690195342708568,-1.0240812161868462,-0.10157062070265248,0.9816189966944231,3.7122957240587935,0
|
| 6 |
+
7.990252187164856,0.39834274504789324,-0.3022863347312122,1.3095356388552684,3.870291748298714,0
|
| 7 |
+
6.867840687857392,-0.3727823683245972,0.16267064591512964,1.2019964208372458,3.34573950017213,0
|
| 8 |
+
-5.272268733278578,0.34278432518487456,-0.2634111415672655,0.8008842934447491,3.8526270775432625,0
|
| 9 |
+
-4.711990283749461,0.2020572472815252,0.16901358379722675,0.5582077583957243,3.8756063720228004,0
|
| 10 |
+
4.315288144525312,4.623942948382816,0.23702829742119624,1.3436750418234216,3.4604877995697434,0
|
| 11 |
+
-0.1853205653206531,4.956684982372259,-0.1898635694887625,0.7820393540128792,3.578049768464518,0
|
| 12 |
+
-0.5503882532811326,-1.176127727340058,-0.1535254087880785,1.4698830218200745,3.8977132130129335,0
|
| 13 |
+
-0.9294625356867838,5.806943352477685,-0.27495320525891287,0.8640931729962954,4.089733938098975,0
|
| 14 |
+
-5.899074259546988,-3.148696155761339,-0.07898386523976085,1.3221256825630876,3.976637805027333,0
|
| 15 |
+
13.050297973075114,5.2887949613535366,0.12065498380793829,0.398724933505494,4.1265944564179655,0
|
| 16 |
+
-4.843422920626562,0.2143852013727976,0.3355227192889686,0.921608583596669,4.22767743471396,0
|
| 17 |
+
4.190106297905771,-2.0189573028749805,-0.05611564677817865,1.5396048668733093,4.007307687781618,0
|
| 18 |
+
2.013250772176239,1.1060147356724452,-0.17367501688724815,1.5299349116749419,3.23962894481741,0
|
| 19 |
+
0.659363568357048,5.6905911654092725,0.04566919897570832,1.566567915998837,3.2649684418000064,0
|
| 20 |
+
1.5818694862740252,0.7931699817102549,-0.15612995683040523,1.8173094161340102,4.0978757470686125,0
|
| 21 |
+
2.74495698388596,0.12668901117851988,0.2475266415355788,0.7560750281788454,4.1785176976617535,0
|
| 22 |
+
1.5962803442497975,7.342512903342881,0.24268871281758206,1.366537403054733,3.913746403343757,0
|
| 23 |
+
0.42030096931751854,1.1671271324042138,0.46654324803439,1.3707197750204376,4.183096335848211,0
|
| 24 |
+
3.4890060749454888,6.972319612553628,-0.17852650611554768,1.2463930925507367,4.436554415300805,0
|
| 25 |
+
7.203486656300705,-0.6653710519321452,-0.11616150383513073,0.9811189605903199,3.6766174974274737,0
|
| 26 |
+
-0.525219400882049,4.873083428416656,0.09184092818074234,0.8060732306885117,3.977841497760175,0
|
| 27 |
+
5.791211417377373,4.909349600567108,0.22613962917827987,0.5712640763328263,3.8174133338106655,0
|
| 28 |
+
2.4399931142398765,6.836757652662107,0.32340565209024924,1.096511763589726,4.028718852813086,0
|
| 29 |
+
-3.1731083351077514,2.460700723406528,0.17054765731384905,0.9959025464764849,3.89888273205644,0
|
| 30 |
+
1.094444735147695,5.198676259673009,0.11059757120107015,1.2135325127624683,3.7354064953361314,0
|
| 31 |
+
6.83525286824306,2.9906443998785472,-0.5351296912351224,0.7243121226429003,4.334014437190746,0
|
| 32 |
+
4.352029702051009,-0.00517567930530205,-0.17644561084088506,0.786149409692229,3.933481236635701,0
|
| 33 |
+
-5.7748474038594555,-1.7523662010311631,0.10409088793716192,0.39700186606396126,4.018737789028101,0
|
| 34 |
+
5.520341844182832,5.7278765187861715,0.10277601259102241,1.0351807707567733,3.4979214923182487,0
|
| 35 |
+
4.634432369032286,5.826209195186163,0.0294902034944871,1.078947948150483,3.8662444087303003,0
|
| 36 |
+
1.6569205460075451,-0.22052078184620816,0.2970378938785264,0.9811082167170109,3.747709479809016,0
|
| 37 |
+
0.2940370694299195,3.8691356044300704,-0.5228780164895298,1.6440664676729566,3.6537509788660194,0
|
| 38 |
+
0.3275375594188037,0.4263824141812039,-0.016363294305737432,0.9363181701145089,3.9638085211219827,0
|
| 39 |
+
1.9686749710397673,2.827422979837302,-0.15729465879691773,0.5538171574017478,3.769240206287317,0
|
| 40 |
+
10.141726648014782,2.856499740478712,0.31672732658067165,0.710066914038807,3.3295187174270424,0
|
| 41 |
+
6.107416961714474,3.1559087155542254,0.37967863731862067,1.1444889569836232,3.8736788069621535,0
|
| 42 |
+
-0.31959042280671546,0.5664430682307857,-0.10316778678243499,1.8689647985118631,3.7231643031505373,0
|
| 43 |
+
7.089574492156218,4.729499153379134,-0.1143642984609529,0.9680624233297018,3.6737825674715294,0
|
| 44 |
+
4.998473636859236,6.180839934479939,-0.5050921117462145,0.23208703270568043,3.643098876809955,0
|
| 45 |
+
9.39038294321254,0.9853302946738955,0.35164349362106195,0.6172159395369771,3.649982975248032,0
|
| 46 |
+
9.31029323554058,1.2417752770484447,0.3893085249297689,0.7627746735983219,4.017755424694222,0
|
| 47 |
+
4.028857106175845,6.232977913461694,-0.0565049658689131,0.8599336912905811,4.02842965480412,0
|
| 48 |
+
-0.5338746958313072,4.896797964828191,0.657972955899915,1.2692584304877657,3.6266386487088407,-1
|
| 49 |
+
-1.9029130238943701,4.350535451251031,0.1755602210316425,0.8769014766608052,4.3571270359288246,0
|
| 50 |
+
-2.237046971479681,2.3581706332364263,0.004496434663336622,0.6874124359080624,4.1630641496984016,0
|
| 51 |
+
11.86394236484599,5.572231764799216,-0.37479859417531014,1.4122300183398706,4.551892106206377,0
|
| 52 |
+
3.949400080354751,-1.6416036636868785,0.36528148315111486,1.148411610812751,4.24283456656923,0
|
| 53 |
+
7.4529095303074815,-0.595748212390367,-0.15109817970426384,1.211511300412136,4.196750797210827,0
|
| 54 |
+
-5.433710686375598,-0.29348397551259386,0.24945229812377068,1.005730563124713,3.9979537915918457,0
|
| 55 |
+
4.263558939895116,-2.1954736507334545,-0.005355946379575844,0.3929790742442191,4.296738908086338,0
|
| 56 |
+
5.755040038001341,5.2634889939552005,-0.498117167470851,1.246305502385265,4.221848532697318,0
|
| 57 |
+
-0.520562239300921,5.063177949625363,0.07305434116427058,1.2749591696018512,3.802122276808835,0
|
| 58 |
+
7.829784621189634,0.059256885520050595,-0.059259081670806166,1.4163133023297905,3.8868709486808415,0
|
| 59 |
+
6.874227086083005,7.4176582093171,0.0437662779322386,1.305049464932124,3.757038201655872,0
|
| 60 |
+
6.145797509648783,5.941884353544886,-0.20845186789770995,1.8382005895316014,4.3091660840740795,0
|
| 61 |
+
2.721777165364097,5.821339250615135,-0.4085436762313043,1.3377493518152581,3.5913052960619436,0
|
| 62 |
+
9.00847793414949,1.5362774801031727,-0.16137724492802782,1.2878026999490355,4.142017508357556,0
|
| 63 |
+
4.695332450480228,5.270403318320541,-0.0023811668418757446,1.2651082178482662,4.045328934431334,0
|
| 64 |
+
13.452603291430721,6.415783234606387,0.05125336971508979,1.2271492991136186,3.973341162092679,0
|
| 65 |
+
3.815867952057896,-1.2987811624069652,0.1226860643076477,1.1236697073631539,4.957353407073732,0
|
| 66 |
+
-0.32882207483343034,-0.7253162850941426,-0.16802312121978583,0.6164760204485097,3.9940059899044935,0
|
| 67 |
+
8.71460303804957,1.5966942739737786,-0.3055627480742475,1.1594221868854,4.182368356091225,0
|
| 68 |
+
7.5268387608720815,6.147276132630937,0.5447400176868235,1.3872234562187131,3.7342712266868117,0
|
| 69 |
+
1.072302796011567,-0.7289292043675928,0.03494998841009992,1.1166455216466113,4.008087703883154,0
|
| 70 |
+
-0.7062917152653716,4.454302622641286,-0.44501534578066154,0.9229817765819796,4.208194962282723,0
|
| 71 |
+
5.878666999665159,5.029571809767409,-0.05484988494553527,0.8292077750575182,4.286158342001087,0
|
| 72 |
+
11.239380835486834,4.441524828741428,-0.030985610642701278,0.7446804383744685,3.735654374894226,0
|
| 73 |
+
5.086834645437971,3.647513518331942,-0.10549671093671555,1.1500693908843478,4.101212785165405,0
|
| 74 |
+
1.8971801521120821,-1.0025023711012788,-0.11215233769368238,1.1419563370118355,4.258518919217995,0
|
| 75 |
+
4.64479026913753,-1.5206532334228717,0.39647576049174915,1.0021598840959351,3.9483458311163337,0
|
| 76 |
+
3.2488747790720973,7.070816459619174,-0.3302336540759458,1.0788043968465015,4.320365497803373,0
|
| 77 |
+
-4.621045683743849,0.037978188762618936,-0.12491790265629582,1.3953246802425694,4.179768985291648,0
|
| 78 |
+
1.5843687781289457,5.453445962980774,0.02380274502427281,0.84485243880422,3.99919981445278,0
|
| 79 |
+
7.63550921784763,0.8302636510389705,0.3223798567386034,0.9689735600941648,3.8487028021235394,0
|
| 80 |
+
10.446762873618148,3.0474325327794807,0.26737285284559587,1.4916047715420726,4.084381818289484,0
|
| 81 |
+
-1.8991537183310598,3.381924063550522,-0.007275478662931288,0.8232987322007017,3.9496602262099083,0
|
| 82 |
+
7.87749399495444,0.6286842296029412,-0.17594374350628525,1.306068533187021,4.0146401481328144,0
|
| 83 |
+
-2.6145917208358602,3.2395950660859114,-0.33035309502358773,1.271657094144836,3.5160500557402354,0
|
| 84 |
+
12.355041373002006,5.924993334012264,-0.23969395953797928,1.1814176366842035,3.953160900939248,0
|
| 85 |
+
8.130517873160386,0.8003690894168811,0.11848091539701236,0.9506081599482318,3.715453305156969,0
|
| 86 |
+
-2.067246996249928,4.128106378769419,0.03776333970143297,0.8175572104249226,4.508878312639427,0
|
| 87 |
+
2.4195664596801594,-1.8511161495371249,0.073249696709715,1.615143982767156,4.345040026313842,0
|
| 88 |
+
6.6965628475886385,5.169281163942058,0.18377611905204036,1.0075261217995626,3.993197875123849,0
|
| 89 |
+
8.941267371271085,1.2911461204848522,-0.21660938538252877,0.5266565658331481,3.895892977857833,0
|
| 90 |
+
-0.1390927253763805,1.4507283010994372,-0.2688072926302547,0.7902972331833755,3.93907547744504,0
|
| 91 |
+
1.8936020477476199,1.786489135752329,-0.043470834617305575,1.2560876442357847,4.0176229900558,0
|
| 92 |
+
1.94355258994684,-1.6881291902000708,0.24768934963096595,1.348888493042735,3.8475213536628177,0
|
| 93 |
+
3.1575853687020965,-1.6841505094951725,-0.22490367674010173,1.376110669797979,4.670254597029272,0
|
| 94 |
+
-5.795678394244708,-1.2493827945740958,-0.04921817641296603,0.6634944929688126,3.50957806695008,0
|
| 95 |
+
-1.8153447536377347,4.286272849922004,0.4361327596975943,0.5973748136195112,3.6668815655651206,0
|
| 96 |
+
2.576027918813784,-1.3828775056139464,-0.01269382966411346,0.9926628360343036,3.866769273103979,0
|
| 97 |
+
0.9494581556843941,5.295763356555048,-0.3035289407412167,0.6793481569200479,3.284190300796357,0
|
| 98 |
+
9.993551764117289,1.5973575398775162,0.123888863948894,0.5076376191238086,4.471040113928138,0
|
| 99 |
+
0.8160289652813324,5.994080355532573,0.10093030773649406,1.8651357226480672,4.028557557882131,0
|
| 100 |
+
-4.384106135873942,1.3390482205197927,0.1125125858252736,0.6896584429058386,4.589471168464012,0
|
| 101 |
+
5.79082796539806,4.429208031264184,0.3563107080286197,0.5101418986767196,3.7053975866648576,0
|
| 102 |
+
6.395424912118015,4.454524077961104,-0.2862531992632232,1.194449298056953,4.403065218494192,0
|
| 103 |
+
8.42058380829635,0.2197279643647202,-0.43660355024910097,1.0593224076124819,4.3142621463764455,0
|
| 104 |
+
4.1863153608566215,0.6116289453689546,0.2245232808080709,1.0381823806285226,4.21013467311594,0
|
| 105 |
+
1.8816914782445127,0.0007140074892891257,0.12252426908669425,0.9061895390069102,4.163872527950458,0
|
| 106 |
+
-6.640876893649677,-1.920057376830576,-0.003957255843621861,0.6767735228232534,3.8990120237135217,0
|
| 107 |
+
12.884051865093474,6.356035343132536,-0.10793929597179584,0.9078314976065841,4.490897964600798,0
|
| 108 |
+
0.39791953445779116,-2.195102424257829,0.12564396135219527,1.1567754377355126,4.092414045909344,0
|
| 109 |
+
12.357669560886041,3.822873351288899,0.6008065207714262,0.6305100210308587,3.8980420229757797,0
|
| 110 |
+
0.7493731144271706,2.1069167191051945,0.1106367199699576,1.5452822190926834,3.758430656159166,0
|
| 111 |
+
11.63298804551167,3.4094197103991664,-0.12717709759561296,1.45526583466132,3.6196114520081233,0
|
| 112 |
+
5.239799199501206,-0.18226286970735694,0.31890014253176835,1.405021426125814,3.768625238452215,0
|
| 113 |
+
12.122436105782478,5.308171189691906,-0.40880910625841477,0.6134950822205952,4.430965938283733,0
|
| 114 |
+
5.180524421129195,0.6577398254835628,0.3020256569937889,1.7457168443425757,4.028666565734172,0
|
| 115 |
+
3.4029643750389065,6.528603447407324,0.40961035142632235,0.9488465266926843,3.915575905712215,0
|
| 116 |
+
13.062567653541178,6.779710031491883,-0.21658676725179413,1.2383318938157233,4.769448727765138,0
|
| 117 |
+
-0.25274499428909314,5.052847921767634,-0.24651293198916818,0.794106908764909,3.883119128623609,0
|
| 118 |
+
-3.980208435115655,1.2931964124093036,0.3240080862291963,1.3053369023774921,3.827644124194461,0
|
| 119 |
+
12.267999442121761,5.211675528450564,0.17994583794011498,1.21406821085737,4.008240338225511,0
|
| 120 |
+
-0.19226863014829199,-0.32221905089364145,-0.22043065184145802,0.4978496314104519,3.9772400947473407,0
|
| 121 |
+
-2.16288044879446,3.0177234605696177,-0.012439878063854017,0.6298436425207228,3.648666797844861,0
|
| 122 |
+
-6.562524864426621,-1.0472624269762467,-0.3372840148366249,1.3235539926200228,4.132254618256435,0
|
| 123 |
+
3.9923802958897445,7.210701694661911,-0.19312989648626613,0.9997846062543531,3.6172724223572383,0
|
| 124 |
+
5.694605562189896,-1.4679630426823884,0.005650505213422851,1.1721893553241673,3.8059194372894023,0
|
| 125 |
+
3.9019955570050673,-2.0350687946266905,0.023827344343195906,1.7301816481839853,4.092471800287465,0
|
| 126 |
+
13.556154902308265,7.751932651832705,-0.2811732883095369,1.1454850963087106,3.9471717972493106,0
|
| 127 |
+
0.8816769518296578,-0.8513102697631297,0.07702928795007205,0.8566495077523846,4.20932509685365,0
|
| 128 |
+
4.465760026566298,6.839489987982077,0.30323619909438,0.934877310592644,4.052320274745122,0
|
| 129 |
+
5.911932329653811,-1.1082572612517232,0.2719065541849706,1.0854795037745575,4.030929988500233,0
|
| 130 |
+
-1.3459550183173248,4.731830871176074,0.4841920433362548,0.8845315663533841,3.714786956766381,0
|
| 131 |
+
7.247540055304577,3.745524119383286,-0.15420841035007374,0.8842717350525773,4.321690516928716,0
|
| 132 |
+
0.27037166908769755,0.3442857629574549,-0.27961586697615914,0.9427943141197712,3.5288678843471546,0
|
| 133 |
+
1.1088072950651724,-1.0848839318229038,0.14875799298980164,1.2546929668174773,4.2825860685333375,0
|
| 134 |
+
1.5918035113599993,3.238817038686627,0.0058470449058463225,1.4390684348312297,3.7628969518068573,0
|
| 135 |
+
12.547059312870516,5.565000529876357,0.04993458269677384,1.1158305304766956,3.380809628991002,0
|
| 136 |
+
12.752479555511767,5.367270965228597,0.03482950194203946,1.190164410872126,3.8096207931900077,0
|
| 137 |
+
2.4476687894365297,5.331670531378425,-0.19993061030442785,0.8707349512751023,4.390570682871122,0
|
| 138 |
+
5.054179453157065,-1.3450573241300645,-0.04739820802552311,0.9288931659765807,4.155012282468385,0
|
| 139 |
+
5.309949092180588,6.8188104610104325,0.004514631232659833,0.9698318444776842,4.2386423856848205,0
|
| 140 |
+
1.0991715744776152,2.2868594374869065,0.382806785594291,1.6783166597607058,4.365632198106862,0
|
| 141 |
+
-4.483207574566107,-0.5974363790466996,0.662316965734021,1.0086714691415375,3.9612712223969573,0
|
| 142 |
+
1.4516538093168854,-0.9325250810910878,-0.45963191221533906,0.8399872211261485,3.6382666246559237,0
|
| 143 |
+
3.188243239942172,-2.9400958771065273,-0.4037555862859223,0.7374874206075955,3.8424647065284057,1
|
| 144 |
+
1.3237592933652451,5.739563575394253,0.1419432471767932,0.446699234498239,3.816859059042498,0
|
| 145 |
+
1.8954647270304337,5.154745096239747,-0.13274134434201165,0.8688281314472583,4.5848508953013924,0
|
| 146 |
+
5.545659131411668,5.909013215328316,-0.3104902072284354,0.7625884683219015,3.899439823991871,0
|
| 147 |
+
-5.322293444985797,0.7026325551300496,0.266930324709279,0.7139342568335366,3.8263063423916437,0
|
| 148 |
+
7.099323806960431,0.35776943382881143,0.3172592020838993,0.871870707754208,3.851006786715295,0
|
| 149 |
+
6.579977565386191,2.496275113744362,-0.028349486151628234,1.420793632455698,3.606437524359346,0
|
| 150 |
+
-3.0117037848277297,3.125994754359048,0.08925595589527739,1.3297232375060113,4.470092194314934,0
|
| 151 |
+
13.280304108094006,6.592487170554781,0.010179794799601363,0.7463965367310903,4.406875097043851,0
|
| 152 |
+
1.0274297755224095,0.03492615649505687,0.07393811469991383,0.9156171527224836,4.263438079612705,0
|
| 153 |
+
10.902368447964463,2.554885894346819,0.09379480978846215,1.1234702866740975,4.2034370135266546,0
|
| 154 |
+
-0.268220825494646,0.30804412169960704,0.2532822323673702,1.0219889553786352,3.7569018499888482,0
|
| 155 |
+
12.280619950455739,5.762168776527391,0.5215091520281184,1.1297910189762965,4.041296728445035,0
|
| 156 |
+
7.591319991271356,0.6737889652315369,-0.06186310816154182,1.2914615224843118,4.325127977797406,0
|
| 157 |
+
-6.055729580698318,-0.533196341822728,-0.12550366963659715,0.49880416220714563,3.682895932870245,0
|
| 158 |
+
4.208643834465262,-0.22589388328393212,0.30607109622994666,1.3138307347239242,4.340302132279919,0
|
| 159 |
+
0.3115131241519494,0.005712097722736051,-0.08311915009871669,0.9470361227089058,4.103745750822139,0
|
| 160 |
+
6.661166061875583,3.762948892229578,0.2203731207256941,1.2817139762871403,4.071866783814549,0
|
| 161 |
+
-1.3067186935449462,4.261701336195643,0.005720247597511503,1.0309272736381105,3.84107757733691,0
|
| 162 |
+
3.2651602897005465,6.5034437187970005,-0.022581516965349775,1.2604532929155623,3.953076115873366,0
|
| 163 |
+
6.36925094947472,7.289936777157575,0.2785774677261785,0.8804428868111664,3.632631949566071,0
|
| 164 |
+
6.50739767261174,2.676859641313626,-0.5779509533315936,0.9317462912007649,4.048497755952623,0
|
| 165 |
+
5.4697388489842105,2.6378494443356573,-0.48567421931732496,0.8635977316425509,3.982379881859762,0
|
| 166 |
+
3.5635838490604494,-1.7087622745325926,0.19916505457674474,1.0715446146889727,3.6360964584053224,0
|
| 167 |
+
8.474649637312368,0.6476150289703294,-0.032427831155898576,0.9270074661988729,4.0641431404089685,0
|
| 168 |
+
5.1243431512365865,5.156259397107258,0.024528178164877575,1.4791820301482035,3.9067913636469425,0
|
| 169 |
+
4.783504982018655,6.541686704928802,-0.0438967549710418,1.11691186841294,3.545304956191567,0
|
| 170 |
+
0.10187215089304535,5.858007216595456,-0.43516377774068765,1.028108105056283,3.7371920377861594,0
|
| 171 |
+
0.9779372348402604,2.249540812949533,-0.3731779963963958,0.6661122660502761,4.209124910269716,0
|
| 172 |
+
5.493417790938647,5.730977855726493,0.07702626711877335,0.852832290289943,4.5647932045600905,0
|
| 173 |
+
0.7586324499267785,-0.1352135104200106,0.39051671846263275,1.8662103209671057,4.156763117744063,0
|
| 174 |
+
-6.0613320939280415,-1.6711899241143156,-0.19816833340875836,0.5214828250792864,3.8642721906543374,0
|
| 175 |
+
-2.5305772734498273,2.684866980163962,-0.01177393950690877,1.0839634783288172,4.413588816973139,0
|
| 176 |
+
3.979145130031184,-0.6899726597742061,-0.34436679443672297,1.200695337018137,3.777347428229717,0
|
| 177 |
+
1.0423269266840514,5.893552961679724,-0.4912887485151442,0.7170935585598384,3.52538554318212,0
|
| 178 |
+
4.619649375848299,7.197433869341561,0.5631208631684597,0.6310835113475952,3.9701727627963646,0
|
| 179 |
+
-0.7476596860632121,4.206057679517844,0.5616311682094002,1.2310039813471443,3.986506191901569,0
|
| 180 |
+
6.499220374289714,5.117179578372449,0.023450789108982285,0.8376492788934228,4.288019195924714,0
|
| 181 |
+
7.615218488464114,5.781973937404949,0.41197695127593076,1.188185586804402,3.767487090437302,0
|
| 182 |
+
0.06582218460741474,1.6089673970197813,-0.8657026878964607,1.2619983911378978,3.6597953440431166,0
|
| 183 |
+
0.3157837405832655,-1.3142495009525463,0.12613766617931269,0.9478106903373846,3.686092417511478,0
|
| 184 |
+
12.170832355564427,6.432841575683348,-0.030263367198178456,0.4671990445011234,3.884140656222717,1
|
| 185 |
+
3.840061379149983,7.791374401656391,0.08713682509828695,0.7989648223960195,4.254074422606791,0
|
| 186 |
+
8.056406074986649,0.9375595582378834,0.44409130249557555,0.7127016949941305,4.650893804683559,0
|
| 187 |
+
-5.377834558089978,-0.4480458573857231,-0.6191215332363779,0.9879705759904573,3.881640467568718,0
|
| 188 |
+
6.48052241632148,4.664103389994916,-0.3018430415375355,1.042250772906539,3.440003685869465,0
|
| 189 |
+
1.1027794106367368,2.6811147094168555,0.09218901500376553,0.7234874781285572,3.905959559520394,0
|
| 190 |
+
-1.1284576148887355,3.414385950533462,-0.119250900405724,1.070467578361333,4.101480386838985,0
|
| 191 |
+
0.9237204797155912,2.12197634374627,-0.12043512818366653,0.7968351087517792,3.8722288363711423,0
|
| 192 |
+
1.2403893079211947,0.9331861492135286,-0.39159034771163465,0.671748593100761,3.899170226761242,0
|
| 193 |
+
4.844349656183654,4.974411475080219,0.28884096524773945,0.2620924766436873,3.835866338910369,0
|
| 194 |
+
4.547330186217636,4.957747104956146,0.15092935535763757,0.6564064459539842,3.705272282225395,0
|
| 195 |
+
8.51799077109703,1.4822070419253888,0.2724976209898493,0.9794246213753088,4.029040339026849,0
|
| 196 |
+
-6.562843984252265,-2.1083501649914473,-0.11666837388550105,0.6370998787039017,3.677595210269077,0
|
| 197 |
+
1.1671300418647468,5.8355906794464305,-0.10541154259991702,0.7252584684007704,4.005091153413543,0
|
| 198 |
+
4.329571322924696,-1.222784279898373,-0.31556932656026554,0.89474971728372,4.0301620506394285,0
|
| 199 |
+
9.946885915469274,2.3906763106842037,-0.3199870836348046,1.0534534610769848,4.207977533632943,0
|
| 200 |
+
10.23728831275908,0.7933424685804314,0.1977018877361725,0.697576419838672,4.0768996115822915,0
|
| 201 |
+
11.19707383630299,4.165891924141121,-0.3152137951277569,1.096175504954839,3.701121702563129,0
|
| 202 |
+
6.672873095217085,3.4119248884354016,0.10074472924295369,1.420421536327155,3.6876303713346887,0
|
| 203 |
+
0.41515402703220683,-0.019763230051692893,0.04703048922029535,1.0268059890117804,3.5908122180623057,0
|
| 204 |
+
3.0972539406207833,-2.346866990303053,0.37780813528032636,1.483872290104092,4.175843178519745,0
|
| 205 |
+
6.850469215101613,-0.18803109398993767,-0.014941471880461233,1.1008114185801874,4.5698128845143176,0
|
| 206 |
+
-2.6767264764137297,2.347792472315747,0.3559155259577546,0.6622512539229942,3.665518460596497,0
|
| 207 |
+
2.335166979315537,1.406108373484687,-0.17987612878209394,0.7798168333669219,4.0086789560478335,0
|
| 208 |
+
-0.5622130205290695,0.3555373639976857,0.6196681733793781,0.8456482934631069,4.207366303195433,0
|
| 209 |
+
-7.25010241925604,-2.1401373067842266,-0.4640656616086768,0.9923794521644945,3.896715024341036,0
|
| 210 |
+
2.5703835160152453,6.2415397178770595,-0.5867620105908634,0.6488795839754236,3.897391960985294,0
|
| 211 |
+
3.6395494033963223,-1.0767293650827696,-0.05851546698770658,0.7305829475270427,4.083005382581175,0
|
| 212 |
+
7.476435000251014,4.476218800595282,0.16062728943554327,0.9764040076475777,4.433963642005625,0
|
| 213 |
+
2.7587748513680443,-1.2386152765914438,-0.21414706184188276,0.9961817574705032,4.3444125275504195,0
|
| 214 |
+
5.064666677390819,-0.9152011575628497,0.06196360138811164,1.088679210162329,4.349612512233307,0
|
| 215 |
+
7.754520405928556,0.4430305714620415,0.364133025712956,0.46935427487662784,4.410285857195419,0
|
| 216 |
+
1.1391052201346021,2.4637471232122143,-0.25142097135756525,1.1353697307257635,4.341798521601573,0
|
| 217 |
+
-4.674347453806702,0.18150113469912488,-0.08972930102002473,1.2074975994470343,3.8392227404790433,0
|
| 218 |
+
11.915523156869611,3.2086228920432087,0.024475776622330084,0.4112746268405445,4.182366567011155,0
|
| 219 |
+
5.993089544604195,4.519534314061474,-0.31649285251235015,0.9324754846292719,3.545911992467984,0
|
| 220 |
+
9.801978437130336,2.780617537390627,-0.3182037610410123,1.2058802934935469,3.7695192014786993,0
|
| 221 |
+
-5.887760217011346,-0.9307861476110902,0.24538916829109667,0.7699693907332013,3.945541990649884,0
|
| 222 |
+
-3.122380956868407,1.9372529543205517,0.1667895348819387,0.9782562061774603,4.93651001918922,0
|
| 223 |
+
1.7055988344357222,-1.6537866410637612,-0.10143553626299805,1.0026672394787997,2.961328265530005,0
|
| 224 |
+
3.8559640575404903,-1.0372733963161607,-0.26538357986252104,1.326808069184553,3.973237427442589,0
|
| 225 |
+
2.5289110193779356,-1.7788525600943836,-0.07350927502518537,1.2333928763590474,3.9976257689198236,0
|
| 226 |
+
-0.16293201105738397,4.467997313565302,-0.15262312152005342,1.2971478046513516,3.7828457622285674,0
|
| 227 |
+
2.1232657711609617,-1.450425250991917,-0.7232176540152139,0.7541339623320933,4.033747463693495,0
|
| 228 |
+
5.276674818969259,3.875935348760132,0.10504831591396267,0.823712859589098,4.490549067773942,0
|
| 229 |
+
-1.6791794464885479,4.674413424533327,-0.185790312914743,0.6720369991831352,4.141729953402246,0
|
| 230 |
+
6.2121215002440096,2.595302446741734,0.09928588330339196,1.3661660206613846,4.233565133729198,0
|
| 231 |
+
3.058814301769366,-0.23417898669431503,0.09036388002505273,1.5838703334593336,4.859989591591588,0
|
| 232 |
+
7.073806669714096,3.1315926971860604,0.5400862887048671,1.2485664305023523,3.816784916257425,0
|
| 233 |
+
5.8056303285847175,3.5410548717702666,0.7296093871678606,0.782213167123427,3.761239679673521,0
|
| 234 |
+
2.0361905314779607,-1.3427935648194333,-0.18916372544199536,1.4042262994501806,4.068260616501005,0
|
| 235 |
+
3.6028895735196,6.760201784894708,-0.02217202484479452,0.633032402260693,3.871667341210548,0
|
| 236 |
+
5.340125552208388,6.0367452033847995,0.044296238556043734,1.0577699118325998,3.883398115715892,0
|
| 237 |
+
-4.729613327438027,0.524438569252516,0.2057944305765238,0.7979083757004678,4.052297241501567,0
|
| 238 |
+
10.681826127895928,2.2831713331512375,0.13402700167983567,0.7422183478626969,4.455497069572554,0
|
| 239 |
+
9.175233366098752,2.1159740420386908,-0.34415053394184,0.7800239228368147,3.6774360418006427,0
|
| 240 |
+
-0.6709690190898381,4.554836257206876,-0.2235564736869216,1.5327221292428848,3.750873250513667,0
|
| 241 |
+
5.953229796188118,2.055283219314615,-0.6995898824119275,1.1744057244288384,4.1402267587305985,0
|
| 242 |
+
3.894770981946241,6.749036927642116,-0.14469844412821634,1.317841013559639,3.796210657134159,0
|
| 243 |
+
2.1739786996103696,5.50707732840578,0.18793846596294259,0.9634538047027114,4.30232195101369,0
|
| 244 |
+
5.407755868933346,-1.4136483266042217,-0.3043869340727388,1.4732678212452366,4.028606908831476,0
|
| 245 |
+
8.973205636796491,1.3494929953570227,-0.9390068495852029,1.2541973888467568,3.737554433539149,0
|
| 246 |
+
10.361926759292407,2.0557673917202504,-0.010283947047881855,1.1164693399792256,4.263348980218275,0
|
| 247 |
+
4.527937075628698,5.66611867785479,-0.01460172038681432,0.8169556491593768,3.4775570476237823,0
|
| 248 |
+
1.3400308689259934,5.2572836233961056,0.28227972249742467,1.4629089876149548,4.325501565123645,0
|
| 249 |
+
8.779451953075421,0.8363791868693505,-0.1696147746772316,1.5384379668662513,3.8700087310130105,0
|
| 250 |
+
-2.684505737715148,2.5115301711345985,0.019064942264018492,1.3726029068563432,3.659852841503407,0
|
| 251 |
+
11.689876582004256,4.419439301428205,0.0280443415636522,0.9718744328273415,4.292051899727416,0
|
| 252 |
+
0.3777995821393212,0.5584703938607017,0.07590088497477918,0.9792292853936538,4.012255435464479,0
|
| 253 |
+
-2.559512558238821,2.1866230542897993,-0.4265348247474933,1.0660241497067129,3.664396777633587,0
|
| 254 |
+
1.947031471185912,-1.6220024640313557,0.13047770417473567,0.5001196873912288,3.7376114859227116,0
|
| 255 |
+
6.1986250536013685,4.422753405587752,-0.3530767676817605,1.4287935136472196,3.906747496024375,0
|
| 256 |
+
10.84583565946553,2.6960087645797453,0.4040186930418157,1.1314557813001542,4.271175163418989,0
|
| 257 |
+
0.8116099726488544,0.6485747160018788,0.1718368782850562,0.6755394135193106,4.271010605520035,0
|
| 258 |
+
-0.15744261435449225,1.477556544620942,0.2872839943480937,0.938553062495186,3.8747541990321888,0
|
| 259 |
+
5.926416340309674,-0.3485223891209589,0.24427668902270205,1.4442977680635272,3.5555431392125563,0
|
| 260 |
+
3.03719678579147,5.57150621638677,-0.06137572399370283,1.0405612964026467,4.0988316652678,0
|
| 261 |
+
4.677953010403187,-0.3254842341802241,-0.032240429310702576,1.2195335512039904,3.847516417056706,0
|
| 262 |
+
10.867658167857392,3.0962167352331367,0.3584063223735659,0.8014917903385517,4.557994949873996,0
|
| 263 |
+
3.530002795063795,5.694691175782781,-0.40916143961007995,0.7475004135081729,3.513910388502915,0
|
| 264 |
+
0.23436805728335192,1.8527205010629593,-0.40368201957027544,1.0035938529785324,4.231445490268557,0
|
| 265 |
+
5.118337852567602,6.067282036856952,0.06852551736801366,1.2862834513280084,3.8846949359790215,0
|
| 266 |
+
4.882256213143302,5.924625736134603,0.5500376838065172,0.8863412839538178,3.779840214218906,0
|
| 267 |
+
-3.7825192860328407,0.39171568370256515,0.23401000973104993,0.9323182323647229,4.05395955439278,0
|
| 268 |
+
8.057337455419395,0.5063495180378018,-0.11420356209594439,1.152610781834386,4.029850048821334,0
|
| 269 |
+
3.8901374787019645,6.689190844783249,-0.2415667575516066,1.0307490461029987,3.87797340884662,0
|
| 270 |
+
7.160337462311448,-0.3378080684714082,-0.21433889447138582,0.8498261103660172,3.801942416044261,0
|
| 271 |
+
-4.775811184485213,0.5682801705902137,0.20577225578421587,0.9431799978881109,3.6179485682460166,0
|
| 272 |
+
0.9650405483997628,2.0518119314715717,0.09654338014860113,1.155326961810723,4.252989389249273,0
|
| 273 |
+
5.5448761729165,6.371566860291196,0.025520580573314557,0.866609638592887,3.711580387609138,0
|
| 274 |
+
6.281854519489164,-0.47844039604453104,-0.0021101703396062396,1.0615906766230752,4.4680501583454575,0
|
| 275 |
+
-4.084440586235051,1.3934383922980804,0.28802119218453387,0.869038278286035,4.460577601283348,0
|
| 276 |
+
-6.801002799290441,-2.9865482664076057,0.5108547188352058,1.286615559437023,4.469275070419544,0
|
| 277 |
+
1.442802014348083,1.0037803808240728,0.1135168534452031,0.5399136695398692,3.6119345028733996,0
|
| 278 |
+
-5.675841494995043,0.759219785860781,-0.4938624302898067,0.7212750405895266,4.698000592040038,0
|
| 279 |
+
5.3129586524623065,6.063319051994742,0.656212925426194,0.6672401382627016,3.956907973864892,0
|
| 280 |
+
1.9051257635211458,-0.6275908818051447,0.13803910576807035,0.9279375366302769,3.8663157785082016,0
|
| 281 |
+
13.354262175840436,6.750136154732665,0.40709344801269504,1.1853026259389003,3.8394933065724275,0
|
| 282 |
+
5.713672908464292,4.265708147963002,-0.5236363615446679,0.9301682218203738,4.391766987032596,0
|
| 283 |
+
8.08698312077725,0.44575067524152656,0.31265621160991924,1.017342559456415,4.1065728290881145,0
|
| 284 |
+
6.628340012127337,0.246595939691432,0.14237722806959652,1.405766958590899,4.119800020794142,0
|
| 285 |
+
13.692605165513852,6.358882925176649,-0.3771829546769962,0.7820193807264016,4.038387287493729,0
|
| 286 |
+
4.463332936403844,-0.9890363279327824,-0.37927952262388037,1.2135373120918502,3.743408458498098,0
|
| 287 |
+
5.86770511204897,4.417392913112769,-0.3330057383542674,0.8296191831637312,4.053514352139128,0
|
| 288 |
+
1.6506786014253532,6.383711300545422,-0.2144915213300265,0.9996610044773656,3.6405419603717055,0
|
| 289 |
+
6.657808620698994,0.7547376826786794,0.2591534615645196,1.1408042137600007,4.601245898219915,0
|
| 290 |
+
-2.4824254388981126,3.4765068877456526,0.19284456881146264,1.062542789546565,3.963672198310262,0
|
| 291 |
+
1.4299622814492028,1.9144216825972273,-0.049517239364401194,1.0632652945957723,4.044314061649753,0
|
| 292 |
+
3.37559427159819,1.4557765501174842,0.5903036821073316,0.547594774645321,4.120555035875468,0
|
| 293 |
+
-3.7846808754378745,1.6125321546342806,1.0502263797510951,1.2307179092791245,4.394212970258692,0
|
| 294 |
+
11.013281412551601,4.336386314123085,-0.06523462070666416,0.8766275031334573,3.5226998308455535,0
|
| 295 |
+
1.44919829557668,6.48918954183615,0.6160943488018793,1.071962333420338,4.511892243091496,0
|
| 296 |
+
11.878940222103832,5.971827274315214,0.07951462067072795,0.23002985146442567,3.9878565433017603,0
|
| 297 |
+
7.511359342119942,0.032022071487326165,-0.22714847555158266,1.051830473941773,4.189309385524651,0
|
| 298 |
+
1.5900514661968166,-0.7887437135185741,0.10857669825273737,0.9243962873864363,4.65925964125866,0
|
| 299 |
+
1.8229582672608755,-1.4303618647400724,0.03732541364276085,1.4076892572962092,4.061977637727927,0
|
| 300 |
+
0.460584571426331,4.680093231807828,-0.3045585204323339,1.2302607142258282,3.7387249095446307,0
|
| 301 |
+
7.222448551231107,0.011813618872417497,0.03719541437040723,1.1730320489753538,4.206910885418934,0
|
| 302 |
+
-3.8426366177814697,0.45703869482204107,0.42979816130838694,1.1560034259183043,3.9232518943670054,0
|
| 303 |
+
12.064972302733969,6.0365398955478105,0.10429365576653876,1.4169615300002576,3.7563240119493413,0
|
| 304 |
+
12.323102209317938,4.989556853068889,-0.4588398881295954,0.4718717669166663,3.95242227567463,0
|
| 305 |
+
4.5829957349351425,5.650377502086694,-0.19340144513620386,1.195681564417952,4.333853195540593,0
|
| 306 |
+
5.71318774473253,4.021137751841453,0.34023979079000344,0.7718202457320452,3.7865844938548583,0
|
| 307 |
+
0.541950292437212,1.6041953035303387,-0.42703872414631566,0.8858813854571815,3.7467526586804105,0
|
| 308 |
+
1.655277089470038,1.8063467788357974,-0.21271992091279762,0.8042093316289453,4.056658615132205,0
|
| 309 |
+
-4.118196905094003,0.9547863388473875,-0.17839624741045698,0.7171899188598099,3.861603699806738,0
|
| 310 |
+
3.9179148884121595,6.47564546911118,-0.19058077250140346,0.7460763553625536,3.8634079077735817,0
|
| 311 |
+
4.679429996022181,-0.04619477519770898,-0.1688697526128871,0.6659623350768104,4.2856808841183955,0
|
| 312 |
+
2.8750717464738536,-2.474502280312084,0.13285215373027948,1.0761344149728278,3.851211810861995,0
|
| 313 |
+
-5.352443935478514,-0.24912455174545456,0.033839715531228366,0.6997345378753932,3.8713336823899955,0
|
| 314 |
+
13.014786620408298,6.801356478369803,0.17186636597045782,0.684933384660483,3.9239510832112474,0
|
| 315 |
+
6.37545990710254,3.0091769239915895,-0.343552304223197,0.6376981069487385,4.099192999495743,0
|
| 316 |
+
5.848946158216056,3.9699718891639235,-0.02065698678670425,1.249700322626832,3.941653133447691,0
|
| 317 |
+
0.35024567523362216,2.96472211834002,0.10644248095664201,0.9247672807136306,3.9889517021057848,0
|
| 318 |
+
1.970535595896244,0.17057052298915854,-0.1415136805639809,0.8934347433845392,4.2554057652821475,0
|
| 319 |
+
1.3738518564576818,-0.8614189462015334,0.3998214898646065,1.3996780516763474,3.8465059372303467,0
|
| 320 |
+
3.754641241955276,-0.9573877871845403,-0.016238668959769657,0.7923146337250067,3.4455070514672332,0
|
| 321 |
+
11.42734594639957,3.729656151230505,-0.5970286752032298,0.7987258494000284,4.313362449591935,0
|
| 322 |
+
9.477202221202525,2.488032075069695,-0.069443365312652,1.186434598118907,4.679754659215425,0
|
| 323 |
+
4.6605066633180945,-0.8251210337784914,0.5615957792957983,1.3461644303872897,3.8959419620892906,0
|
| 324 |
+
-3.2909618275847485,2.5133727041879736,-0.39837655978290604,1.717521417434917,3.9682887568170275,0
|
| 325 |
+
5.978190442653404,3.3961638122872504,0.05708772398931029,1.4181447581723776,4.41401918989763,0
|
| 326 |
+
-0.3523977826134501,-1.020508583976165,0.43220636893113235,1.2972145389138494,3.882086012587479,0
|
| 327 |
+
5.663352916100032,0.2996721029905891,0.6263759883857872,1.4998238830332067,3.9647280227375172,0
|
| 328 |
+
12.746203256217129,7.105100631097569,0.5755038878189709,1.1680492040117503,3.7184634890032875,0
|
| 329 |
+
6.142790708271638,-0.9419632337951012,0.20821255761192287,1.1894798537083946,4.127820074524742,0
|
| 330 |
+
7.754594175616457,0.10317125994282583,0.3708095111082424,1.2351660726007376,3.852594097775131,0
|
| 331 |
+
7.819147048336438,4.862916946832293,0.4836411368996081,1.0675192068724577,3.570427947260934,0
|
| 332 |
+
1.5409948180687927,3.5836949120264356,0.5000103930682754,1.143377451310961,3.8019209246000396,0
|
| 333 |
+
1.3640820072265292,4.930409035758059,0.43917283960778364,0.6090934858906111,3.9344786749893963,0
|
| 334 |
+
13.200411974182881,5.660096371573493,0.13211642781991192,0.9633988225714457,4.107150834717206,0
|
| 335 |
+
9.784830706707416,2.6341818338353296,-0.1435331642250803,0.9338934985346873,3.9715465145696225,0
|
| 336 |
+
1.558063893916398,5.173027408528093,0.5386492634473691,0.9801701374453561,4.0592795723311195,0
|
| 337 |
+
-4.02764686877378,1.325615688277169,-0.413987754962791,0.7382301985405432,4.204123650051358,0
|
| 338 |
+
4.102169035024237,4.743902952415347,-0.006972795567479879,1.0533950382987252,4.0547176516245935,0
|
| 339 |
+
1.477283684335489,0.045133259645775664,-0.40031417820303095,1.308585228293893,4.347259785969324,0
|
| 340 |
+
1.0827528564323683,-0.9953470304729278,-0.24637667421055465,0.9299184644587501,3.9992972113337046,0
|
| 341 |
+
4.040698006561068,-1.781293769086862,0.4608137194248938,1.245883735383657,4.2115121264794,0
|
| 342 |
+
2.0036069120307682,6.318995895620163,0.012498183300353197,1.25504863511195,3.486213255462447,0
|
| 343 |
+
1.447044380638852,2.899115493092014,-0.3354305871013624,0.8843385728488945,3.278507139105621,0
|
| 344 |
+
11.635380722866147,3.8210971716619127,0.08765701532749352,0.6847227662955355,4.125345289764429,0
|
| 345 |
+
2.346344640937943,-2.2013488036186644,0.6603812304482832,0.6361228705745543,4.070364819427245,0
|
| 346 |
+
9.403157399558799,2.4889135879543147,0.12540305845444297,0.5427720117056105,3.559523105132334,0
|
| 347 |
+
5.834527386508264,3.302987840172638,-0.29133314139077365,0.8903328955411343,4.046814720722982,0
|
| 348 |
+
1.0624839775823667,1.1814780526841508,-0.03250051144356935,1.2794254544201231,4.203436502509262,0
|
| 349 |
+
7.589488447662739,0.07075079892568237,0.035506862592259394,0.710588407173902,4.188327606367115,0
|
| 350 |
+
1.3599782653760564,6.341522517316527,-0.3876123882388257,1.3589412363512305,4.467383990370083,0
|
| 351 |
+
6.4790537855148305,6.163804346928666,0.26006108780018194,0.7312508201018806,3.9644602556644695,0
|
| 352 |
+
-4.486951010955971,0.9839142521496422,0.07622703896471829,1.0924091730423482,3.648555980930931,0
|
| 353 |
+
0.7800380627161461,1.3027051233760498,-0.1418884474298703,1.1519856681737108,4.040714243867789,0
|
| 354 |
+
10.568125702194704,1.8095431662769923,0.05223613046443193,0.6134429803325503,3.812803327091159,0
|
| 355 |
+
10.252628508378393,1.0530633566103802,-0.2723257164281612,0.9364805754246828,4.291989242645873,0
|
| 356 |
+
-5.1938113660512535,1.7948345075238563,-0.025257786763515564,0.8626736685181797,3.9758895839518007,0
|
| 357 |
+
6.600633710366635,5.437516520355167,0.11323735078074129,1.3208931187402606,4.261810694387166,0
|
| 358 |
+
5.4945744788556405,7.096481926656004,-0.023512100041802545,0.9675785038916156,3.9909328752183884,0
|
| 359 |
+
5.119470687512202,5.429959916049866,-0.47963382748526545,1.096415134580829,3.8036070963323048,0
|
| 360 |
+
4.0228672639095375,6.290500144652928,0.18235635283149546,1.0716422253562967,3.7095810177622135,0
|
| 361 |
+
-5.56970069327706,0.024117523933625096,-0.40373391973984174,1.7794835550535404,3.9429575649927044,0
|
| 362 |
+
3.5047899770668147,5.786878076508154,-0.5982608197280341,1.0687758944398784,4.271356772531685,0
|
| 363 |
+
13.409874118533974,6.152078318723305,0.18666083372783185,0.6460058022744712,3.6392106176479646,0
|
| 364 |
+
-6.1812596320273165,-1.2174101954885301,0.1420877742753858,0.8028880922081164,3.9837381724828136,0
|
| 365 |
+
5.651249723851988,3.442132831644403,0.3102155787365083,0.6121174908450384,3.738824972254083,0
|
| 366 |
+
-4.014420716400001,2.01675433703648,0.2771513704871957,1.1377166393766396,4.037608581469826,0
|
| 367 |
+
1.6223409628122034,4.469570730599407,0.20071880669587566,0.9129548709920658,3.847588013977722,0
|
| 368 |
+
1.3472526369555475,1.119745861297259,-0.4644969588545605,1.4714019006864862,3.841464527409891,0
|
| 369 |
+
5.759933123973955,4.606140054188273,0.01030036410325897,1.180116617883238,3.577451684686344,0
|
| 370 |
+
-2.9221661080403023,2.769216295368803,-0.30601156656848433,1.292739585801188,3.9152740866296383,0
|
| 371 |
+
-2.2193649244942635,3.491292032265449,-0.14351663776192541,1.1563166535900349,4.14316273914061,0
|
| 372 |
+
9.335216243258152,0.8869001905222195,0.17867880744619785,0.6567552427998802,4.193463679295722,0
|
| 373 |
+
5.358010518765185,-0.3194272273884289,-0.3019576379830648,0.5514452967810888,3.4893277909398392,0
|
| 374 |
+
7.516279962687332,6.580262867739643,-0.05760452932719501,1.0323176206409876,4.249736058591677,0
|
| 375 |
+
-2.6830086797744115,1.8477696280963154,-0.30285993743673556,0.7015951810853639,3.6811936105928775,0
|
| 376 |
+
0.4060752001304219,-0.19162139062301725,-0.0018971355462142436,1.1375927343825392,4.292144475311992,0
|
| 377 |
+
4.503334198083158,5.103050906710737,-0.6407269977673917,1.4199766969906489,3.61747882168284,0
|
| 378 |
+
3.998621455213769,6.266563287472848,0.32512877813913993,1.0103890135746585,3.659443751382326,0
|
| 379 |
+
-4.062588305698777,1.5366202302888088,-0.0037776877339032715,0.8823252783401019,4.07992332108135,0
|
| 380 |
+
13.520326329388975,8.730531703862512,-0.554614958759886,0.7186807862294542,4.222062810838803,0
|
| 381 |
+
-3.2238771492343816,1.4716882728455964,0.04257096098963712,1.2153781815965394,3.800927400534762,-1
|
| 382 |
+
-5.800165825061796,-2.077054294119004,0.3771014553412038,0.4223298615151102,3.7433411858573478,0
|
| 383 |
+
0.9043754135879551,-2.625111904177672,-0.11107840341079818,0.7621006054074684,3.74840824994909,0
|
| 384 |
+
-5.0596939149864655,-0.47680779022763575,-0.4951459573247645,1.320508803192532,4.130308882329449,0
|
| 385 |
+
-1.2967966065338288,4.226760331481531,0.620448669615696,0.922400456507099,3.9786984186126575,0
|
| 386 |
+
8.401414493964817,0.7913756910676714,-0.19044124558645373,0.915534075104578,3.3921702848107116,0
|
| 387 |
+
-3.2072592016741712,2.21437400384628,-0.22445656234365707,0.7486021267425238,3.5617489851376587,0
|
| 388 |
+
2.281660035818759,6.341903387724157,-0.18225352470978262,0.9223041371486511,3.7080876919709813,0
|
| 389 |
+
6.109747982902273,0.053619625520999525,0.2997310667058537,1.1687687105848799,3.61430400775878,0
|
| 390 |
+
-0.08869120358031468,5.473626717881015,0.06477001171829398,0.846705988270692,4.061159112593741,0
|
| 391 |
+
14.704240958816722,6.765230118439419,-0.07560819880280661,1.2285450879511752,3.5402275792894975,0
|
| 392 |
+
6.956602316658039,6.548774848261246,0.28086333453692097,0.4860577483656141,4.027508128146193,0
|
| 393 |
+
1.8737254596201056,6.414380183954944,0.08827383647210345,0.9075901378318434,4.075779597245532,0
|
| 394 |
+
10.957661366966743,4.279267167491347,0.2152328292212016,1.7908498221775186,4.080124045323038,0
|
| 395 |
+
13.328808660666212,6.231872125970142,-0.27588050736458797,1.0654345599045374,3.6045130722931575,0
|
| 396 |
+
0.42847840211208066,0.36084564596816954,0.08383457214769449,1.1490965220451828,4.087084497592081,0
|
| 397 |
+
6.731528398912347,1.8877727208881168,-0.21363904703492134,0.9953660757945948,3.843601917902608,0
|
| 398 |
+
1.2432020258223422,5.759306717299995,-0.2713763712630231,0.5073295158923949,4.17072997288202,0
|
| 399 |
+
6.893029694960635,3.8208256287233473,-0.12197554799972284,1.4167867335096183,3.676600375364717,0
|
| 400 |
+
13.263288796908983,5.798433328140792,0.06494712750085571,1.2997243940776229,3.92879568613126,0
|
| 401 |
+
10.588416715249778,3.6084186467369155,0.009003283922231667,0.7490848421327525,4.1335407349911115,0
|
| 402 |
+
2.570082373133494,-1.1088444827583748,0.3599510954872853,0.8795602129086816,3.994893325367219,0
|
| 403 |
+
4.088609235146114,-0.8468492143810464,-0.004832974038842629,1.0132297155004266,3.99653792190541,0
|
| 404 |
+
4.8724109435081955,-0.7147750853572467,-0.24954251948563808,0.9070153170983516,3.891268575973776,0
|
| 405 |
+
9.737066908478518,2.224213179084805,0.10159620513383065,1.3642850574076364,3.406457854631179,0
|
| 406 |
+
6.247836106475671,-0.4845428295167734,0.31915039534262285,0.7648333897653585,4.120515987313718,0
|
| 407 |
+
3.5333684183457392,-0.9840516829621356,-0.2572011547474221,0.721452188376615,3.547889838593528,0
|
| 408 |
+
0.08821040152750659,-2.247449944552884,0.09155162850357511,0.8191069402221413,3.7520743581747267,0
|
| 409 |
+
2.15659998209936,-1.5357186205146995,-0.3804120031668545,1.0560018044025696,3.0126240625577485,0
|
| 410 |
+
5.5766735123995534,5.0132090817322865,-0.14200640964318448,0.8636886952153296,4.126484900761549,0
|
| 411 |
+
6.1951785013344365,3.3593106941506248,0.2781716343999393,1.0769629286091242,3.92727475446675,0
|
| 412 |
+
1.369240032875913,5.803347714033385,0.006981171997373846,0.907421641054414,3.489563531714514,0
|
| 413 |
+
6.639931297745838,4.743406047530625,-0.24472824063792095,0.7765657674196502,4.103203413236651,0
|
| 414 |
+
-1.6532541724213903,4.188584795501617,0.15797882848595382,0.9391899978045642,4.4782844841976885,0
|
| 415 |
+
6.964546633387324,0.9965284798690083,0.18422146344708154,1.486887912364153,4.173846304186161,0
|
| 416 |
+
3.8260304194334234,7.059991717052398,0.37914357398212345,0.63495759863414,4.3698437208263075,0
|
| 417 |
+
-4.944567825321949,0.8312173833649992,-0.30064152706956504,0.7939365687243387,3.98809960279161,0
|
| 418 |
+
-2.069976235567683,3.244515678465728,0.17876324493501944,1.1903501148674727,4.215577972251051,0
|
| 419 |
+
2.61883781310985,-1.6942359042986466,-0.08402241399728089,0.8645916462697565,3.9801822124183666,0
|
| 420 |
+
6.134056976034356,-0.403346916561065,0.20227616860316353,1.4192303450349173,4.1597792630697965,0
|
| 421 |
+
-2.4489253520630276,2.658558284925802,0.7636191453436753,1.165368419440843,3.628972351502946,0
|
| 422 |
+
1.372365124631253,3.865904671272699,-0.21592216911460413,1.8770275208150877,4.147586157886021,0
|
| 423 |
+
-4.705467650278258,-0.07185220076544985,0.05848045007000022,1.2382359967356333,4.564720707906981,0
|
| 424 |
+
3.3716833458352435,6.727559782528479,-0.017352970110763234,0.6393179791279195,4.231602085747724,0
|
| 425 |
+
4.410841811525783,6.742222536896426,-0.1722892429274331,1.3823101024605582,3.8099321249108646,0
|
| 426 |
+
0.634909404334623,-0.2766398194474312,-0.26206675702252097,0.8474243195928723,3.88803952464255,0
|
| 427 |
+
5.260704591568915,5.918512414324437,0.010996023489791663,1.4978716828302503,4.180372553488792,0
|
| 428 |
+
10.573389607541325,2.4421180861341796,0.13489343506005821,1.0533623024555592,3.336912324662264,0
|
| 429 |
+
7.716860796487008,0.8031850624558291,0.08665502162616154,1.334073730056864,3.8584824764264565,0
|
| 430 |
+
-3.638043341518669,1.1723608091783526,-0.5922753792933073,1.164655106610399,3.555181895973311,0
|
| 431 |
+
7.017373226850395,3.2842982473155553,-0.01679858665524919,0.7971080296911124,4.280843323481089,0
|
| 432 |
+
-6.368958197890434,-1.7162374047747924,0.17634096813318625,0.871416817212127,3.619402819140727,0
|
| 433 |
+
6.363806875327319,3.730555751211607,0.410605154970395,1.280548591475673,3.708849357038866,0
|
| 434 |
+
5.633483218523841,6.265106368908,0.13281724549713333,1.5926654978118902,3.7546131206930182,0
|
| 435 |
+
5.60124606740439,-1.5070483348551678,-0.07917549636440285,0.9056463953665963,3.830898132504204,0
|
| 436 |
+
10.126266790424248,2.849502858896091,-0.7475812531519624,1.2684235107397086,3.761438266091701,0
|
| 437 |
+
4.729284210896147,0.9454633031900717,-0.4291172269587213,1.1851449937519751,4.224411639930687,0
|
| 438 |
+
11.561380820828454,3.087120571317583,0.39302814766213917,1.7358329915248019,3.8433104080624334,0
|
| 439 |
+
1.1413553121449063,0.7404348116793489,0.3045405458975005,0.7512464277859444,4.092162223282807,0
|
| 440 |
+
0.9711676531923651,-1.3757885999727248,0.16412006247110938,1.1868389078121238,3.996925833274203,0
|
| 441 |
+
7.436942401579951,4.44604959467953,-0.102720333360502,0.6913172212220331,4.135636771785122,0
|
| 442 |
+
3.422743514852712,-2.557955992003744,-0.47232545888219507,0.9508958836973134,3.4790769270337205,0
|
| 443 |
+
9.272880254387553,1.9737175755197174,-0.06555983572539208,0.4513979956642459,4.3604009469676335,0
|
| 444 |
+
4.654888379228131,7.004237634377352,-0.031575917810332164,0.49498482189448845,3.8338159781414163,0
|
| 445 |
+
2.5733844437849904,6.0013133715648745,0.23638483901883364,0.8072448749176806,4.4645783767774665,0
|
| 446 |
+
11.807040399210111,5.010925752582307,0.09402983509932133,1.2832487566206123,4.137318671539132,0
|
| 447 |
+
-3.835331514313073,0.8567280289021505,0.1703055724966387,0.7732037167250063,4.095846275020852,0
|
| 448 |
+
11.50707218396835,3.951674430479247,0.02758497387226994,0.8054328752406416,3.639128636722998,0
|
| 449 |
+
-0.10709281945187366,1.7522816573798836,-0.24671365890464575,0.4829467349476617,3.8734342533451724,0
|
| 450 |
+
4.703028717257269,5.769121484387749,-0.40514970744758516,0.9148067150204161,4.0683869535025,0
|
| 451 |
+
-4.754996772207888,0.5233494932427968,-0.5007971754306165,1.3912281553585686,4.043332309708558,0
|
| 452 |
+
3.206365637550992,6.250935805332844,0.4987844259061363,1.0746979661426643,3.8924339713927,0
|
| 453 |
+
6.348738631421354,1.4588072836249675,0.28760104882489695,0.8828166106854944,4.398463605670328,0
|
| 454 |
+
6.40741073203946,5.86096185104032,0.14916103986681362,1.0864872073395728,4.121543353101014,0
|
| 455 |
+
6.790345559563014,6.385051030269475,0.21727054965242415,1.5605257121103993,3.9713675361042404,0
|
| 456 |
+
1.6591875892885641,-1.6307458791417873,0.715121375287238,1.2429580439656895,4.14655558452118,0
|
| 457 |
+
2.1444477660106624,-0.2487421746888856,-0.2599900947863331,0.949635547736305,4.312707737671222,0
|
| 458 |
+
-6.1534438180189985,-0.7819897817514876,-0.32648780297501007,1.0666389107702112,3.9343702560997493,0
|
| 459 |
+
3.77851048578958,6.89086760960907,-0.18884944404915968,0.9440810585105966,3.160809879229111,0
|
| 460 |
+
5.037265151786165,5.622796984591119,-0.1263962085904946,0.6251056067170362,4.106831210959476,0
|
| 461 |
+
-1.5690020745676487,2.8004966810069014,-0.07054907562109941,1.4980072618052067,3.8102440472946464,0
|
| 462 |
+
-4.726196671721421,0.47147862535539753,0.41056404255763523,1.7809144690671603,4.145474184000442,0
|
| 463 |
+
2.2736687198273557,-0.8495109234244943,-0.0031224431549609698,1.6361946784225994,3.860395340139557,0
|
| 464 |
+
-1.5783294562504417,4.065719292097999,0.3447287761457271,0.6422901512632078,4.0224154393957825,0
|
| 465 |
+
2.8530333812905972,-0.6851243302718824,-0.40790373020714554,1.34646156279242,4.176533020597517,0
|
| 466 |
+
3.9945352767807756,7.927850946249972,-0.04596915653367221,1.3220781979627052,4.1148723638697895,0
|
| 467 |
+
-2.301924878684573,3.4617619523552725,-0.012998834490256668,1.0513054189582225,3.78137414574659,0
|
| 468 |
+
0.7164330114942141,4.569443602034711,-0.09911767047136555,1.1057050628555212,4.3353995202015,0
|
| 469 |
+
0.45131276652659724,3.2540495091675594,-0.24839892144229606,1.0750945630189115,3.8632617329990966,0
|
| 470 |
+
1.6694218628967357,0.7501122730950377,0.002529685638945541,0.895154775030384,4.563617067130535,0
|
| 471 |
+
-0.8550633209219023,5.383132826943429,-0.21676974044317743,0.9922225751900533,3.5944707774999687,0
|
| 472 |
+
9.029082148810646,2.3160482246108915,-0.6534271519468463,0.9732279135507974,4.227226284663716,0
|
| 473 |
+
2.1060215568145058,-1.5642878350606875,-0.15922136031374862,0.6332375731015576,3.8141789479296975,0
|
| 474 |
+
0.9107989732054723,-0.48430757431381133,-0.300530216838099,1.4919970704262102,3.5964883198057924,0
|
| 475 |
+
2.68776960488936,5.7578972688567145,-0.2648443964018557,1.3336829179600787,3.7497443200653984,0
|
| 476 |
+
4.286021792868895,6.12465009102244,-0.3035040486039426,0.8255048333649684,4.430212757491906,0
|
| 477 |
+
2.7024084297741453,7.459209322250665,-0.07676237772308521,1.2218394809871198,4.2203168027762565,0
|
| 478 |
+
11.763917581154399,4.869803098241248,0.1987333218763723,0.768546354976775,3.6092919136070543,0
|
| 479 |
+
1.994758216810972,6.423311387880289,0.11565428905575016,1.6952100685693339,3.923251802831894,0
|
| 480 |
+
9.872950570555279,2.407617558625375,-0.23470313736189508,1.4548353936735499,4.345842705932687,0
|
| 481 |
+
11.315469492562194,4.321976277874105,0.5218606706985136,1.321935889030308,3.965416366901054,0
|
| 482 |
+
0.33260323760515736,0.7867725010863579,-0.09837596733757935,0.835176855957061,4.056416861413612,0
|
| 483 |
+
7.005061246157033,2.469971498695168,0.21874567985312884,0.7913000720815324,3.640509226255191,0
|
| 484 |
+
11.89624515825188,4.889936087510274,-0.2130260587831732,0.7456499210576653,4.152000380817427,0
|
| 485 |
+
-5.837043458290636,-1.8564325645258117,0.22611510448992345,0.7043649434967038,3.784507557038172,0
|
| 486 |
+
-2.993536129934677,2.7214181085403886,0.4305258537702857,0.806742666869301,3.652107790644484,0
|
| 487 |
+
13.618489879915881,7.4297955100738715,-0.09365108020412233,0.7296762235514161,4.231622660907496,0
|
| 488 |
+
9.467034412103954,1.0327219776634688,-0.07044697636564433,0.9733560400071225,4.719195383250961,0
|
| 489 |
+
9.833162208327357,2.2313481979632956,-0.7875193044101579,1.3242636643467722,4.150269584018232,0
|
| 490 |
+
-4.666214498241525,-0.13693867607424104,0.24739854661688637,1.3099905406337422,4.14498291114249,0
|
| 491 |
+
12.494832339407782,5.071048336946422,-0.023198217599774678,1.2632326817830757,4.786232247183966,0
|
| 492 |
+
6.190563176238836,2.452051663640579,-0.04538730162137009,0.7409778023196499,3.712167151039748,0
|
| 493 |
+
5.924033958648822,4.5350259490845355,-0.05808138602267984,1.1213968810637538,4.057573760537757,0
|
| 494 |
+
3.653565856806667,-1.6189380964841713,0.05388547702947961,0.17639737628180863,3.9861543684327567,0
|
| 495 |
+
2.5000463926848546,-1.4177105351133719,0.30100294656462395,1.3307297635978863,3.7632417953617603,0
|
| 496 |
+
0.5861829865235462,5.317135870799727,-0.09068856336967626,0.5375893056300209,3.796430051746058,0
|
| 497 |
+
2.6923828541337995,-1.3152512875961941,0.5446144692685054,1.033572293619329,3.509520644925842,0
|
| 498 |
+
-2.1099520964428646,4.009235046849061,0.16004755625489228,1.0156212403094709,3.55996763161238,0
|
| 499 |
+
6.08185919520162,-0.4257403555222894,0.04514670279844255,0.4163215775792778,4.223411223532171,0
|
| 500 |
+
3.562750765833563,5.979981087298701,0.07066433345063636,1.481011765524121,4.26875428865562,0
|
| 501 |
+
6.424277486778378,4.908259487874455,-0.39288396562468914,1.4682832637302692,3.620288229567522,0
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/Chicken_Counting_Solution.ipynb
ADDED
|
@@ -0,0 +1,723 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"cells": [
|
| 3 |
+
{
|
| 4 |
+
"cell_type": "markdown",
|
| 5 |
+
"metadata": {},
|
| 6 |
+
"source": [
|
| 7 |
+
"<img src=\"./figs/IOAI-Logo.png\" alt=\"IOAI Logo\" width=\"200\" height=\"auto\">\n",
|
| 8 |
+
"\n",
|
| 9 |
+
"[IOAI 2025 (Beijing, China), Individual Contest](https://ioai-official.org/china-2025)\n",
|
| 10 |
+
"\n",
|
| 11 |
+
"[](https://colab.research.google.com/github/IOAI-official/IOAI-2025/blob/main/Individual-Contest/Chicken_Counting/Solution/Chicken_Counting_Solution.ipynb)"
|
| 12 |
+
]
|
| 13 |
+
},
|
| 14 |
+
{
|
| 15 |
+
"cell_type": "markdown",
|
| 16 |
+
"metadata": {},
|
| 17 |
+
"source": [
|
| 18 |
+
"# Chicken Counting: Reference Solution"
|
| 19 |
+
]
|
| 20 |
+
},
|
| 21 |
+
{
|
| 22 |
+
"cell_type": "markdown",
|
| 23 |
+
"metadata": {},
|
| 24 |
+
"source": [
|
| 25 |
+
"## Imports"
|
| 26 |
+
]
|
| 27 |
+
},
|
| 28 |
+
{
|
| 29 |
+
"cell_type": "code",
|
| 30 |
+
"execution_count": null,
|
| 31 |
+
"metadata": {
|
| 32 |
+
"executionInfo": {
|
| 33 |
+
"elapsed": 5616,
|
| 34 |
+
"status": "ok",
|
| 35 |
+
"timestamp": 1753592556976,
|
| 36 |
+
"user": {
|
| 37 |
+
"displayName": "陈红涛",
|
| 38 |
+
"userId": "16480124546172497377"
|
| 39 |
+
},
|
| 40 |
+
"user_tz": -480
|
| 41 |
+
},
|
| 42 |
+
"id": "t-7tiKDEs5N7"
|
| 43 |
+
},
|
| 44 |
+
"outputs": [],
|
| 45 |
+
"source": [
|
| 46 |
+
"import os\n",
|
| 47 |
+
"import torch\n",
|
| 48 |
+
"import torch.nn as nn\n",
|
| 49 |
+
"import torch.nn.functional as F\n",
|
| 50 |
+
"import torch.optim as optim\n",
|
| 51 |
+
"from torch.utils.data import Dataset, DataLoader\n",
|
| 52 |
+
"from datasets import load_from_disk\n",
|
| 53 |
+
"import logging\n",
|
| 54 |
+
"from torchvision import transforms\n",
|
| 55 |
+
"from tqdm import tqdm\n",
|
| 56 |
+
"import numpy as np\n",
|
| 57 |
+
"import math\n",
|
| 58 |
+
"from PIL import Image\n",
|
| 59 |
+
"import zipfile\n",
|
| 60 |
+
"from typing import Optional\n",
|
| 61 |
+
"import random\n",
|
| 62 |
+
"\n",
|
| 63 |
+
"np.random.seed(42)\n",
|
| 64 |
+
"random.seed(42)\n",
|
| 65 |
+
"torch.manual_seed(42) \n",
|
| 66 |
+
"torch.cuda.manual_seed(42) \n",
|
| 67 |
+
"torch.cuda.manual_seed_all(42)\n",
|
| 68 |
+
"\n",
|
| 69 |
+
"TRAIN_PATH = \"/bohr/train-adnz/v1/\"\n",
|
| 70 |
+
"TRAINING_SET = TRAIN_PATH + \"train\"\n",
|
| 71 |
+
"BASE_MODEL_PATH = TRAIN_PATH + \"base.pth\"\n",
|
| 72 |
+
"DTYPE = torch.float32\n",
|
| 73 |
+
"DEVICE = torch.device(\"cuda:0\" if torch.cuda.is_available() else \"cpu\")\n",
|
| 74 |
+
"scale = 300.0"
|
| 75 |
+
]
|
| 76 |
+
},
|
| 77 |
+
{
|
| 78 |
+
"cell_type": "markdown",
|
| 79 |
+
"metadata": {},
|
| 80 |
+
"source": [
|
| 81 |
+
"## Logging Utilities"
|
| 82 |
+
]
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"cell_type": "code",
|
| 86 |
+
"execution_count": null,
|
| 87 |
+
"metadata": {
|
| 88 |
+
"executionInfo": {
|
| 89 |
+
"elapsed": 28,
|
| 90 |
+
"status": "ok",
|
| 91 |
+
"timestamp": 1753592562308,
|
| 92 |
+
"user": {
|
| 93 |
+
"displayName": "陈红涛",
|
| 94 |
+
"userId": "16480124546172497377"
|
| 95 |
+
},
|
| 96 |
+
"user_tz": -480
|
| 97 |
+
},
|
| 98 |
+
"id": "SMii-32Qs5N9"
|
| 99 |
+
},
|
| 100 |
+
"outputs": [],
|
| 101 |
+
"source": [
|
| 102 |
+
"def logging_level(level='info'):\n",
|
| 103 |
+
" str_format = '%(asctime)s - %(levelname)s: %(message)s'\n",
|
| 104 |
+
" if level == 'debug':\n",
|
| 105 |
+
" logging.basicConfig(level=logging.DEBUG, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')\n",
|
| 106 |
+
" elif level == 'info':\n",
|
| 107 |
+
" logging.basicConfig(level=logging.INFO, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')\n",
|
| 108 |
+
" return logging\n",
|
| 109 |
+
"\n",
|
| 110 |
+
"\n",
|
| 111 |
+
"class BatchLossLogger:\n",
|
| 112 |
+
" def __init__(self, log_interval=100):\n",
|
| 113 |
+
" self.losses = []\n",
|
| 114 |
+
" self.batch_number = 0\n",
|
| 115 |
+
" self.log_interval = log_interval\n",
|
| 116 |
+
"\n",
|
| 117 |
+
" def log(self, loss):\n",
|
| 118 |
+
" self.losses.append(loss)\n",
|
| 119 |
+
" self.batch_number += 1\n",
|
| 120 |
+
" if self.batch_number % self.log_interval == 0:\n",
|
| 121 |
+
" logging.info(f'Batch No. {self.batch_number:7d} - loss: {loss:.6f}')"
|
| 122 |
+
]
|
| 123 |
+
},
|
| 124 |
+
{
|
| 125 |
+
"cell_type": "markdown",
|
| 126 |
+
"metadata": {},
|
| 127 |
+
"source": [
|
| 128 |
+
"## Traininng Your Model\n",
|
| 129 |
+
"### Model Definition\n",
|
| 130 |
+
"Pretrained weights of the FeatureExtraction model is provided, along with a function to load them. And a completed UNet structure is applied."
|
| 131 |
+
]
|
| 132 |
+
},
|
| 133 |
+
{
|
| 134 |
+
"cell_type": "code",
|
| 135 |
+
"execution_count": null,
|
| 136 |
+
"metadata": {
|
| 137 |
+
"executionInfo": {
|
| 138 |
+
"elapsed": 113,
|
| 139 |
+
"status": "ok",
|
| 140 |
+
"timestamp": 1753592562424,
|
| 141 |
+
"user": {
|
| 142 |
+
"displayName": "陈红涛",
|
| 143 |
+
"userId": "16480124546172497377"
|
| 144 |
+
},
|
| 145 |
+
"user_tz": -480
|
| 146 |
+
},
|
| 147 |
+
"id": "VWPcNgjUvXq5"
|
| 148 |
+
},
|
| 149 |
+
"outputs": [],
|
| 150 |
+
"source": [
|
| 151 |
+
"class DoubleConv(nn.Module):\n",
|
| 152 |
+
" \"\"\"(convolution => [BN] => ReLU) * 2\"\"\"\n",
|
| 153 |
+
"\n",
|
| 154 |
+
" def __init__(self, in_channels, out_channels, mid_channels=None):\n",
|
| 155 |
+
" super().__init__()\n",
|
| 156 |
+
" if not mid_channels:\n",
|
| 157 |
+
" mid_channels = out_channels\n",
|
| 158 |
+
" self.double_conv = nn.Sequential(\n",
|
| 159 |
+
" nn.Conv2d(in_channels, mid_channels, kernel_size=3, padding=1, bias=False),\n",
|
| 160 |
+
" nn.BatchNorm2d(mid_channels),\n",
|
| 161 |
+
" nn.ReLU(inplace=True),\n",
|
| 162 |
+
" nn.Conv2d(mid_channels, out_channels, kernel_size=3, padding=1, bias=False),\n",
|
| 163 |
+
" nn.BatchNorm2d(out_channels),\n",
|
| 164 |
+
" nn.ReLU(inplace=True)\n",
|
| 165 |
+
" )\n",
|
| 166 |
+
"\n",
|
| 167 |
+
" def forward(self, x):\n",
|
| 168 |
+
" return self.double_conv(x)\n",
|
| 169 |
+
"\n",
|
| 170 |
+
"\n",
|
| 171 |
+
"class Down(nn.Module):\n",
|
| 172 |
+
" \"\"\"Downscaling with maxpool then double conv\"\"\"\n",
|
| 173 |
+
"\n",
|
| 174 |
+
" def __init__(self, in_channels, out_channels):\n",
|
| 175 |
+
" super().__init__()\n",
|
| 176 |
+
" self.maxpool_conv = nn.Sequential(\n",
|
| 177 |
+
" nn.MaxPool2d(2),\n",
|
| 178 |
+
" DoubleConv(in_channels, out_channels)\n",
|
| 179 |
+
" )\n",
|
| 180 |
+
"\n",
|
| 181 |
+
" def forward(self, x):\n",
|
| 182 |
+
" return self.maxpool_conv(x)\n",
|
| 183 |
+
"\n",
|
| 184 |
+
"\n",
|
| 185 |
+
"class Up(nn.Module):\n",
|
| 186 |
+
" \"\"\"Upscaling then double conv\"\"\"\n",
|
| 187 |
+
"\n",
|
| 188 |
+
" def __init__(self, in_channels, out_channels, bilinear=True):\n",
|
| 189 |
+
" super().__init__()\n",
|
| 190 |
+
"\n",
|
| 191 |
+
" # if bilinear, use the normal convolutions to reduce the number of channels\n",
|
| 192 |
+
" if bilinear:\n",
|
| 193 |
+
" self.up = nn.Upsample(scale_factor=2, mode='bilinear', align_corners=True)\n",
|
| 194 |
+
" self.conv = DoubleConv(in_channels, out_channels, in_channels // 2)\n",
|
| 195 |
+
" else:\n",
|
| 196 |
+
" self.up = nn.ConvTranspose2d(in_channels, in_channels // 2, kernel_size=2, stride=2)\n",
|
| 197 |
+
" self.conv = DoubleConv(in_channels, out_channels)\n",
|
| 198 |
+
"\n",
|
| 199 |
+
" def forward(self, x1, x2):\n",
|
| 200 |
+
" x1 = self.up(x1)\n",
|
| 201 |
+
" # input is CHW\n",
|
| 202 |
+
" diffY = x2.size()[2] - x1.size()[2]\n",
|
| 203 |
+
" diffX = x2.size()[3] - x1.size()[3]\n",
|
| 204 |
+
"\n",
|
| 205 |
+
" x1 = F.pad(x1, [diffX // 2, diffX - diffX // 2,\n",
|
| 206 |
+
" diffY // 2, diffY - diffY // 2])\n",
|
| 207 |
+
" # if you have padding issues, see\n",
|
| 208 |
+
" # https://github.com/HaiyongJiang/U-Net-Pytorch-Unstructured-Buggy/commit/0e854509c2cea854e247a9c615f175f76fbb2e3a\n",
|
| 209 |
+
" # https://github.com/xiaopeng-liao/Pytorch-UNet/commit/8ebac70e633bac59fc22bb5195e513d5832fb3bd\n",
|
| 210 |
+
" x = torch.cat([x2, x1], dim=1)\n",
|
| 211 |
+
" return self.conv(x)\n",
|
| 212 |
+
"\n",
|
| 213 |
+
"\n",
|
| 214 |
+
"class OutConv(nn.Module):\n",
|
| 215 |
+
" def __init__(self, in_channels, out_channels):\n",
|
| 216 |
+
" super(OutConv, self).__init__()\n",
|
| 217 |
+
" self.conv = nn.Conv2d(in_channels, out_channels, kernel_size=1)\n",
|
| 218 |
+
"\n",
|
| 219 |
+
" def forward(self, x):\n",
|
| 220 |
+
" return self.conv(x)\n",
|
| 221 |
+
"\n",
|
| 222 |
+
"class UNet(nn.Module):\n",
|
| 223 |
+
" def __init__(self, n_channels, n_classes, bilinear=False):\n",
|
| 224 |
+
" super(UNet, self).__init__()\n",
|
| 225 |
+
" self.n_channels = n_channels\n",
|
| 226 |
+
" self.n_classes = n_classes\n",
|
| 227 |
+
" self.bilinear = bilinear\n",
|
| 228 |
+
"\n",
|
| 229 |
+
" self.inc = (DoubleConv(n_channels, 64))\n",
|
| 230 |
+
" self.down1 = (Down(64, 128))\n",
|
| 231 |
+
" self.down2 = (Down(128, 256))\n",
|
| 232 |
+
" self.down3 = (Down(256, 512))\n",
|
| 233 |
+
" factor = 2 if bilinear else 1\n",
|
| 234 |
+
" self.down4 = (Down(512, 1024 // factor))\n",
|
| 235 |
+
" self.up1 = (Up(1024, 512 // factor, bilinear))\n",
|
| 236 |
+
" self.up2 = (Up(512, 256 // factor, bilinear))\n",
|
| 237 |
+
" # self.up2 = (Up(512, 64, bilinear))\n",
|
| 238 |
+
" self.up3 = (Up(256, 128 // factor, bilinear))\n",
|
| 239 |
+
" self.up4 = (Up(128, 64, bilinear))\n",
|
| 240 |
+
" self.outc = (OutConv(64, n_classes))\n",
|
| 241 |
+
"\n",
|
| 242 |
+
" def forward(self, x):\n",
|
| 243 |
+
" x1 = self.inc(x)\n",
|
| 244 |
+
" x2 = self.down1(x1)\n",
|
| 245 |
+
" x3 = self.down2(x2)\n",
|
| 246 |
+
" x4 = self.down3(x3)\n",
|
| 247 |
+
" x5 = self.down4(x4)\n",
|
| 248 |
+
" x = self.up1(x5, x4)\n",
|
| 249 |
+
" x = self.up2(x, x3)\n",
|
| 250 |
+
" x = self.up3(x, x2)\n",
|
| 251 |
+
" x = self.up4(x, x1)\n",
|
| 252 |
+
" logits = self.outc(x)\n",
|
| 253 |
+
" logits = F.relu(logits)\n",
|
| 254 |
+
" return logits"
|
| 255 |
+
]
|
| 256 |
+
},
|
| 257 |
+
{
|
| 258 |
+
"cell_type": "code",
|
| 259 |
+
"execution_count": null,
|
| 260 |
+
"metadata": {
|
| 261 |
+
"executionInfo": {
|
| 262 |
+
"elapsed": 13,
|
| 263 |
+
"status": "ok",
|
| 264 |
+
"timestamp": 1753592562452,
|
| 265 |
+
"user": {
|
| 266 |
+
"displayName": "陈红涛",
|
| 267 |
+
"userId": "16480124546172497377"
|
| 268 |
+
},
|
| 269 |
+
"user_tz": -480
|
| 270 |
+
},
|
| 271 |
+
"id": "5glRHs1Fs5N_"
|
| 272 |
+
},
|
| 273 |
+
"outputs": [],
|
| 274 |
+
"source": [
|
| 275 |
+
"class FeatureExtraction(nn.Module):\n",
|
| 276 |
+
" def __init__(self, in_channels=3):\n",
|
| 277 |
+
" super(FeatureExtraction, self).__init__()\n",
|
| 278 |
+
" self.conv1 = nn.Conv2d(in_channels, 64, kernel_size=3, padding=2, dilation=2)\n",
|
| 279 |
+
" self.conv2 = nn.Conv2d(64, 64, kernel_size=3, padding=2, dilation=2)\n",
|
| 280 |
+
" self.pool2 = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)\n",
|
| 281 |
+
"\n",
|
| 282 |
+
" self.conv3 = nn.Conv2d(64, 128, kernel_size=3, padding=2, dilation=2)\n",
|
| 283 |
+
" self.conv4 = nn.Conv2d(128, 128, kernel_size=3, padding=2, dilation=2)\n",
|
| 284 |
+
" self.pool4 = nn.MaxPool2d(kernel_size=2, stride=2, padding=0)\n",
|
| 285 |
+
"\n",
|
| 286 |
+
"\n",
|
| 287 |
+
" def forward(self, x):\n",
|
| 288 |
+
" x = F.relu(self.conv1(x))\n",
|
| 289 |
+
" x = F.relu(self.conv2(x))\n",
|
| 290 |
+
" x = self.pool2(x)\n",
|
| 291 |
+
" x = F.relu(self.conv3(x))\n",
|
| 292 |
+
" x = F.relu(self.conv4(x))\n",
|
| 293 |
+
" x = self.pool4(x)\n",
|
| 294 |
+
"\n",
|
| 295 |
+
" return x\n",
|
| 296 |
+
"\n",
|
| 297 |
+
" def load_pretrained_weights_partial(self, weights_path, num_layers=4):\n",
|
| 298 |
+
" save_model = torch.load(weights_path)\n",
|
| 299 |
+
" partial_state_dict = {}\n",
|
| 300 |
+
" expected_layers = [\n",
|
| 301 |
+
" 'feature_extraction.conv1.weight', 'feature_extraction.conv1.bias',\n",
|
| 302 |
+
" 'feature_extraction.conv2.weight', 'feature_extraction.conv2.bias',\n",
|
| 303 |
+
" 'feature_extraction.conv3.weight', 'feature_extraction.conv3.bias',\n",
|
| 304 |
+
" 'feature_extraction.conv4.weight', 'feature_extraction.conv4.bias',\n",
|
| 305 |
+
" ]\n",
|
| 306 |
+
" state_dict = {k.split('.', 1)[-1]: v for k, v in save_model.items() if k in expected_layers[:2 * num_layers]}\n",
|
| 307 |
+
" model_dict = self.state_dict()\n",
|
| 308 |
+
"\n",
|
| 309 |
+
" for k in state_dict:\n",
|
| 310 |
+
" if k in model_dict:\n",
|
| 311 |
+
" partial_state_dict[k] = state_dict[k]\n",
|
| 312 |
+
" print(k)\n",
|
| 313 |
+
"\n",
|
| 314 |
+
" self.load_state_dict(partial_state_dict)\n",
|
| 315 |
+
"\n",
|
| 316 |
+
"\n",
|
| 317 |
+
"class ChickenCounting(nn.Module):\n",
|
| 318 |
+
" def __init__(self):\n",
|
| 319 |
+
" super(ChickenCounting, self).__init__()\n",
|
| 320 |
+
" self.feature_extraction = FeatureExtraction()\n",
|
| 321 |
+
" self.unet = UNet(n_channels=128, n_classes=1)\n",
|
| 322 |
+
"\n",
|
| 323 |
+
"\n",
|
| 324 |
+
" def forward(self, x):\n",
|
| 325 |
+
" x = self.feature_extraction(x)\n",
|
| 326 |
+
" x = self.unet(x)\n",
|
| 327 |
+
" return x"
|
| 328 |
+
]
|
| 329 |
+
},
|
| 330 |
+
{
|
| 331 |
+
"cell_type": "markdown",
|
| 332 |
+
"metadata": {},
|
| 333 |
+
"source": [
|
| 334 |
+
"### Reading the Dataset"
|
| 335 |
+
]
|
| 336 |
+
},
|
| 337 |
+
{
|
| 338 |
+
"cell_type": "code",
|
| 339 |
+
"execution_count": null,
|
| 340 |
+
"metadata": {
|
| 341 |
+
"executionInfo": {
|
| 342 |
+
"elapsed": 14,
|
| 343 |
+
"status": "ok",
|
| 344 |
+
"timestamp": 1753592562479,
|
| 345 |
+
"user": {
|
| 346 |
+
"displayName": "陈红涛",
|
| 347 |
+
"userId": "16480124546172497377"
|
| 348 |
+
},
|
| 349 |
+
"user_tz": -480
|
| 350 |
+
},
|
| 351 |
+
"id": "u-Pb0-1Ps5OA"
|
| 352 |
+
},
|
| 353 |
+
"outputs": [],
|
| 354 |
+
"source": [
|
| 355 |
+
"train_dataset = load_from_disk(TRAINING_SET)\n",
|
| 356 |
+
"\n",
|
| 357 |
+
"image_transform = transforms.Compose([\n",
|
| 358 |
+
" transforms.ToTensor(),\n",
|
| 359 |
+
"])\n",
|
| 360 |
+
"\n",
|
| 361 |
+
"def collate_fn(batch, scale = scale):\n",
|
| 362 |
+
" return {\n",
|
| 363 |
+
" \"image\": torch.stack([image_transform(item[\"image\"]) for item in batch]),\n",
|
| 364 |
+
" \"density\": torch.stack([torch.tensor(item[\"density\"], dtype=DTYPE).unsqueeze(0) * scale for item in batch])\n",
|
| 365 |
+
" }\n",
|
| 366 |
+
"\n",
|
| 367 |
+
"train_loader = DataLoader(train_dataset, batch_size=1, shuffle=True, collate_fn=collate_fn)\n",
|
| 368 |
+
"val_loader = DataLoader(train_dataset, batch_size=1, shuffle=False, collate_fn=collate_fn)"
|
| 369 |
+
]
|
| 370 |
+
},
|
| 371 |
+
{
|
| 372 |
+
"cell_type": "markdown",
|
| 373 |
+
"metadata": {},
|
| 374 |
+
"source": [
|
| 375 |
+
"### Training"
|
| 376 |
+
]
|
| 377 |
+
},
|
| 378 |
+
{
|
| 379 |
+
"cell_type": "code",
|
| 380 |
+
"execution_count": null,
|
| 381 |
+
"metadata": {
|
| 382 |
+
"executionInfo": {
|
| 383 |
+
"elapsed": 35,
|
| 384 |
+
"status": "ok",
|
| 385 |
+
"timestamp": 1753592562517,
|
| 386 |
+
"user": {
|
| 387 |
+
"displayName": "陈红涛",
|
| 388 |
+
"userId": "16480124546172497377"
|
| 389 |
+
},
|
| 390 |
+
"user_tz": -480
|
| 391 |
+
},
|
| 392 |
+
"id": "RN2VW6yTs5OB"
|
| 393 |
+
},
|
| 394 |
+
"outputs": [],
|
| 395 |
+
"source": [
|
| 396 |
+
"def train_chickenfcn(model, train_loader, val_loader, optimizer, scheduler, num_epochs, device, save_path):\n",
|
| 397 |
+
" model.train()\n",
|
| 398 |
+
" criterion_mse = torch.nn.MSELoss(reduction='sum').to(device)\n",
|
| 399 |
+
" criterion_mae = torch.nn.L1Loss(reduction='sum').to(device)\n",
|
| 400 |
+
" best_loss = float('inf')\n",
|
| 401 |
+
" print(train_loader.__len__())\n",
|
| 402 |
+
"\n",
|
| 403 |
+
" for epoch in range(num_epochs):\n",
|
| 404 |
+
" train_loss_mse = 0.0\n",
|
| 405 |
+
" train_loss_mae = 0.0\n",
|
| 406 |
+
"\n",
|
| 407 |
+
" train_loader_tqdm = tqdm(train_loader, desc=f'Epoch {epoch + 1}/{num_epochs}', leave=False)\n",
|
| 408 |
+
"\n",
|
| 409 |
+
" for i, data in enumerate(train_loader_tqdm, 0):\n",
|
| 410 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 411 |
+
" inputs = inputs.to(device).float()\n",
|
| 412 |
+
" targets = targets.to(device).float()\n",
|
| 413 |
+
" # print(targets.shape)\n",
|
| 414 |
+
" # t = np.sum((targets[0] / scale).cpu().numpy().squeeze())\n",
|
| 415 |
+
" # print(t)\n",
|
| 416 |
+
"\n",
|
| 417 |
+
" optimizer.zero_grad()\n",
|
| 418 |
+
"\n",
|
| 419 |
+
" outputs = model(inputs)\n",
|
| 420 |
+
"\n",
|
| 421 |
+
" loss_mse = criterion_mse(outputs, targets)\n",
|
| 422 |
+
" loss_mae = criterion_mae(outputs, targets)\n",
|
| 423 |
+
" loss_mae.backward()\n",
|
| 424 |
+
"\n",
|
| 425 |
+
" torch.nn.utils.clip_grad_norm_(model.parameters(), max_norm=2.0)\n",
|
| 426 |
+
"\n",
|
| 427 |
+
" optimizer.step()\n",
|
| 428 |
+
" train_loss_mse += loss_mse.item()\n",
|
| 429 |
+
" train_loss_mae += loss_mae.item()\n",
|
| 430 |
+
"\n",
|
| 431 |
+
" train_loader_tqdm.set_postfix({'Train MSE Loss': loss_mse.item(), 'Train MAE Loss': loss_mae.item()})\n",
|
| 432 |
+
"\n",
|
| 433 |
+
" train_loss_mse /= (len(train_loader))\n",
|
| 434 |
+
" train_loss_mae /= (len(train_loader))\n",
|
| 435 |
+
" logging.info(\n",
|
| 436 |
+
" f'Epoch [{epoch + 1}/{num_epochs}], Train MSE loss: {train_loss_mse:.8f}, MAE loss: {train_loss_mae:.8f}')\n",
|
| 437 |
+
"\n",
|
| 438 |
+
" scheduler.step()\n",
|
| 439 |
+
"\n",
|
| 440 |
+
" # Validation\n",
|
| 441 |
+
" model.eval()\n",
|
| 442 |
+
" val_loss_mse = 0.0\n",
|
| 443 |
+
" val_loss_mae = 0.0\n",
|
| 444 |
+
"\n",
|
| 445 |
+
" val_loader_tqdm = tqdm(val_loader, desc=f'Validation Epoch {epoch + 1}/{num_epochs}', leave=False)\n",
|
| 446 |
+
"\n",
|
| 447 |
+
" with torch.no_grad():\n",
|
| 448 |
+
" for i, data in enumerate(val_loader_tqdm, 0):\n",
|
| 449 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 450 |
+
" inputs = inputs.to(device).float()\n",
|
| 451 |
+
" targets = targets.to(device).float()\n",
|
| 452 |
+
"\n",
|
| 453 |
+
" outputs = model(inputs)\n",
|
| 454 |
+
" mse_loss = criterion_mse(outputs, targets)\n",
|
| 455 |
+
" mae_loss = criterion_mae(outputs, targets)\n",
|
| 456 |
+
" val_loss_mse += mse_loss.item()\n",
|
| 457 |
+
" val_loss_mae += mae_loss.item()\n",
|
| 458 |
+
"\n",
|
| 459 |
+
" val_loader_tqdm.set_postfix(\n",
|
| 460 |
+
" {'Validation MSE Loss': mse_loss.item(), 'Validation MAE Loss': mae_loss.item()})\n",
|
| 461 |
+
"\n",
|
| 462 |
+
" val_loss_mse /= (len(val_loader))\n",
|
| 463 |
+
" val_loss_mae /= (len(val_loader))\n",
|
| 464 |
+
" logging.info(\n",
|
| 465 |
+
" f'Epoch [{epoch + 1}/{num_epochs}], Validation MSE Loss: {val_loss_mse:.8f}, MAE Loss: {val_loss_mae:.8f}')\n",
|
| 466 |
+
"\n",
|
| 467 |
+
" # Save Model\n",
|
| 468 |
+
" if val_loss_mae < best_loss:\n",
|
| 469 |
+
" best_loss = val_loss_mae\n",
|
| 470 |
+
" torch.save(model.state_dict(), save_path)\n",
|
| 471 |
+
"\n",
|
| 472 |
+
" print('Finished Training ChickenFCN')"
|
| 473 |
+
]
|
| 474 |
+
},
|
| 475 |
+
{
|
| 476 |
+
"cell_type": "code",
|
| 477 |
+
"execution_count": null,
|
| 478 |
+
"metadata": {
|
| 479 |
+
"colab": {
|
| 480 |
+
"base_uri": "https://localhost:8080/"
|
| 481 |
+
},
|
| 482 |
+
"executionInfo": {
|
| 483 |
+
"elapsed": 917027,
|
| 484 |
+
"status": "ok",
|
| 485 |
+
"timestamp": 1753593479556,
|
| 486 |
+
"user": {
|
| 487 |
+
"displayName": "陈红涛",
|
| 488 |
+
"userId": "16480124546172497377"
|
| 489 |
+
},
|
| 490 |
+
"user_tz": -480
|
| 491 |
+
},
|
| 492 |
+
"id": "oAoNLtC5s5OC",
|
| 493 |
+
"outputId": "f700e0dc-5a4c-4f5f-bdc9-2aa074bc3d60"
|
| 494 |
+
},
|
| 495 |
+
"outputs": [],
|
| 496 |
+
"source": [
|
| 497 |
+
"logging = logging_level('info')\n",
|
| 498 |
+
"logging.debug('use debug level logging setting')\n",
|
| 499 |
+
"\n",
|
| 500 |
+
"################################################################################\n",
|
| 501 |
+
"# Experiment Settings\n",
|
| 502 |
+
"################################################################################\n",
|
| 503 |
+
"learning_rate = 1e-4\n",
|
| 504 |
+
"lr_decay = 1e-5\n",
|
| 505 |
+
"weight_decay = 0.0001\n",
|
| 506 |
+
"save_path = \"model.pth\"\n",
|
| 507 |
+
"\n",
|
| 508 |
+
"epochs = 30\n",
|
| 509 |
+
"\n",
|
| 510 |
+
"################################################################################\n",
|
| 511 |
+
"# Dataset paths\n",
|
| 512 |
+
"################################################################################\n",
|
| 513 |
+
"\n",
|
| 514 |
+
"model = ChickenCounting().to(DEVICE)\n",
|
| 515 |
+
"model.feature_extraction.load_pretrained_weights_partial(BASE_MODEL_PATH)\n",
|
| 516 |
+
"print('load model success')\n",
|
| 517 |
+
"\n",
|
| 518 |
+
"optimizer = optim.Adam(model.parameters(), lr=learning_rate, weight_decay=weight_decay)\n",
|
| 519 |
+
"# optimizer = optim.SGD(model.parameters(), lr=learning_rate, momentum=momentum, weight_decay=weight_decay)\n",
|
| 520 |
+
"scheduler = optim.lr_scheduler.StepLR(optimizer, step_size=1, gamma=1 - lr_decay)\n",
|
| 521 |
+
"\n",
|
| 522 |
+
"logging.info('Begin training single view model...')\n",
|
| 523 |
+
"train_chickenfcn(model, train_loader, val_loader, optimizer, scheduler, epochs, DEVICE, save_path=save_path)\n",
|
| 524 |
+
"logging.info('Finished training single view model.')"
|
| 525 |
+
]
|
| 526 |
+
},
|
| 527 |
+
{
|
| 528 |
+
"cell_type": "markdown",
|
| 529 |
+
"metadata": {},
|
| 530 |
+
"source": [
|
| 531 |
+
"### Evaluate Model"
|
| 532 |
+
]
|
| 533 |
+
},
|
| 534 |
+
{
|
| 535 |
+
"cell_type": "code",
|
| 536 |
+
"execution_count": null,
|
| 537 |
+
"metadata": {
|
| 538 |
+
"executionInfo": {
|
| 539 |
+
"elapsed": 3,
|
| 540 |
+
"status": "ok",
|
| 541 |
+
"timestamp": 1753593479563,
|
| 542 |
+
"user": {
|
| 543 |
+
"displayName": "陈红涛",
|
| 544 |
+
"userId": "16480124546172497377"
|
| 545 |
+
},
|
| 546 |
+
"user_tz": -480
|
| 547 |
+
},
|
| 548 |
+
"id": "_PuMTMDKs5OE"
|
| 549 |
+
},
|
| 550 |
+
"outputs": [],
|
| 551 |
+
"source": [
|
| 552 |
+
"def evaluate(model, val_loader, device, scale): # Function used for final scoring.\n",
|
| 553 |
+
" model.eval() # Set the model to evaluation mode\n",
|
| 554 |
+
"\n",
|
| 555 |
+
" # Initialize metrics\n",
|
| 556 |
+
" mse = 0.0\n",
|
| 557 |
+
" mae = 0.0\n",
|
| 558 |
+
" predict_num = 0.0\n",
|
| 559 |
+
" true_num = 0.0\n",
|
| 560 |
+
" rate = 0.0\n",
|
| 561 |
+
"\n",
|
| 562 |
+
" with torch.no_grad(): # Disable gradient calculation for inference\n",
|
| 563 |
+
" for i, data in enumerate(val_loader, 0):\n",
|
| 564 |
+
" inputs, targets = data[\"image\"], data[\"density\"]\n",
|
| 565 |
+
" inputs = inputs.to(device).float() # Move inputs to device and convert to float\n",
|
| 566 |
+
" targets = targets.to(device).float() # Move targets to device and convert to float\n",
|
| 567 |
+
"\n",
|
| 568 |
+
" # Get the model predictions\n",
|
| 569 |
+
" outputs = model(inputs) / scale # Adjusting for the scaling factor\n",
|
| 570 |
+
"\n",
|
| 571 |
+
" # Convert tensors to numpy for visualization and metrics calculation\n",
|
| 572 |
+
" inputs_np = inputs.cpu().numpy() # Convert inputs to numpy\n",
|
| 573 |
+
" targets_np = targets.cpu().numpy() # Convert targets to numpy\n",
|
| 574 |
+
" outputs_np = outputs.cpu().numpy() # Convert outputs to numpy\n",
|
| 575 |
+
" # imshow_res(inputs_np, targets_np, outputs_np, scale) # Uncomment to visualize results\n",
|
| 576 |
+
"\n",
|
| 577 |
+
" # Calculate true and predicted sums for comparison\n",
|
| 578 |
+
" t = np.sum((targets[0] / scale).cpu().numpy().squeeze()) # Ground truth sum\n",
|
| 579 |
+
" g = np.sum(outputs.cpu().numpy().squeeze()) # Predicted sum\n",
|
| 580 |
+
" print(f'NO.{i} true_sum={t}, get_sum={g}, abs={abs(t - g)}, rate={abs(1 - g / t)}')\n",
|
| 581 |
+
"\n",
|
| 582 |
+
" # Update metrics\n",
|
| 583 |
+
" predict_num += g\n",
|
| 584 |
+
" true_num += t\n",
|
| 585 |
+
" rate += abs(1 - g / t)\n",
|
| 586 |
+
" mae += abs(t - g)\n",
|
| 587 |
+
" mse += abs(t - g) * abs(t - g)\n",
|
| 588 |
+
"\n",
|
| 589 |
+
" # Calculate average metrics across all batches\n",
|
| 590 |
+
" mae /= len(val_loader)\n",
|
| 591 |
+
" mse /= len(val_loader)\n",
|
| 592 |
+
" predict_num /= len(val_loader)\n",
|
| 593 |
+
" true_num /= len(val_loader)\n",
|
| 594 |
+
" rate /= len(val_loader)\n",
|
| 595 |
+
"\n",
|
| 596 |
+
" # Log the results\n",
|
| 597 |
+
" logging.info(\n",
|
| 598 |
+
" f'test ---- Score: {math.exp(-rate):.3f}, MSE: {mse:.4f}, MAE: {mae:.4f}, Chicken_avg: {predict_num:.4f}')\n",
|
| 599 |
+
" return math.exp(-rate)"
|
| 600 |
+
]
|
| 601 |
+
},
|
| 602 |
+
{
|
| 603 |
+
"cell_type": "code",
|
| 604 |
+
"execution_count": null,
|
| 605 |
+
"metadata": {
|
| 606 |
+
"colab": {
|
| 607 |
+
"base_uri": "https://localhost:8080/"
|
| 608 |
+
},
|
| 609 |
+
"executionInfo": {
|
| 610 |
+
"elapsed": 12124,
|
| 611 |
+
"status": "ok",
|
| 612 |
+
"timestamp": 1753593491690,
|
| 613 |
+
"user": {
|
| 614 |
+
"displayName": "陈红涛",
|
| 615 |
+
"userId": "16480124546172497377"
|
| 616 |
+
},
|
| 617 |
+
"user_tz": -480
|
| 618 |
+
},
|
| 619 |
+
"id": "0yFgonMZs5OF",
|
| 620 |
+
"outputId": "f4a0fe9d-d185-4133-8f8e-4bc2e2c8fa77"
|
| 621 |
+
},
|
| 622 |
+
"outputs": [],
|
| 623 |
+
"source": [
|
| 624 |
+
"model.load_state_dict(torch.load(save_path, map_location=DEVICE))\n",
|
| 625 |
+
"model.to(DEVICE)\n",
|
| 626 |
+
"evaluate(model, val_loader, DEVICE, scale)"
|
| 627 |
+
]
|
| 628 |
+
},
|
| 629 |
+
{
|
| 630 |
+
"cell_type": "markdown",
|
| 631 |
+
"metadata": {
|
| 632 |
+
"id": "xVQtmZ55s5OG"
|
| 633 |
+
},
|
| 634 |
+
"source": [
|
| 635 |
+
"## Submission\n",
|
| 636 |
+
"Please read through the following code carefully. Make sure to following the file naming conventions."
|
| 637 |
+
]
|
| 638 |
+
},
|
| 639 |
+
{
|
| 640 |
+
"cell_type": "code",
|
| 641 |
+
"execution_count": null,
|
| 642 |
+
"metadata": {
|
| 643 |
+
"colab": {
|
| 644 |
+
"base_uri": "https://localhost:8080/"
|
| 645 |
+
},
|
| 646 |
+
"executionInfo": {
|
| 647 |
+
"elapsed": 22942,
|
| 648 |
+
"status": "ok",
|
| 649 |
+
"timestamp": 1753593514634,
|
| 650 |
+
"user": {
|
| 651 |
+
"displayName": "陈红涛",
|
| 652 |
+
"userId": "16480124546172497377"
|
| 653 |
+
},
|
| 654 |
+
"user_tz": -480
|
| 655 |
+
},
|
| 656 |
+
"id": "siCztiUEs5OI",
|
| 657 |
+
"outputId": "79ea01ce-a3c9-45fb-a511-01815386db75"
|
| 658 |
+
},
|
| 659 |
+
"outputs": [],
|
| 660 |
+
"source": [
|
| 661 |
+
"test_path = os.environ.get(\"DATA_PATH\", \"datasets\")\n",
|
| 662 |
+
"\n",
|
| 663 |
+
"def collate_fn(batch): # The test datasets will not provide target densities\n",
|
| 664 |
+
" return torch.stack([image_transform(item[\"image\"]) for item in batch])\n",
|
| 665 |
+
"\n",
|
| 666 |
+
"test_dataset = load_from_disk(os.path.join(test_path, \"test_a\"))\n",
|
| 667 |
+
"test_loader = DataLoader(test_dataset, batch_size=16, shuffle=False, collate_fn=collate_fn)\n",
|
| 668 |
+
"\n",
|
| 669 |
+
"predictions = []\n",
|
| 670 |
+
"model.eval()\n",
|
| 671 |
+
"with torch.no_grad():\n",
|
| 672 |
+
" for batch in tqdm(test_loader):\n",
|
| 673 |
+
" outputs = model(batch.to(DEVICE)) / scale\n",
|
| 674 |
+
" predictions.append(outputs.cpu().numpy())\n",
|
| 675 |
+
"\n",
|
| 676 |
+
"pred_a = np.concatenate(predictions, axis=0)\n",
|
| 677 |
+
"\n",
|
| 678 |
+
"del test_dataset\n",
|
| 679 |
+
"del test_loader\n",
|
| 680 |
+
"del predictions\n",
|
| 681 |
+
"\n",
|
| 682 |
+
"test_dataset = load_from_disk(os.path.join(test_path, \"test_b\"))\n",
|
| 683 |
+
"test_loader = DataLoader(test_dataset, batch_size=16, shuffle=False, collate_fn=collate_fn)\n",
|
| 684 |
+
"\n",
|
| 685 |
+
"predictions = []\n",
|
| 686 |
+
"with torch.no_grad():\n",
|
| 687 |
+
" for batch in tqdm(test_loader):\n",
|
| 688 |
+
" outputs = model(batch.to(DEVICE)) / scale\n",
|
| 689 |
+
" predictions.append(outputs.cpu().numpy())\n",
|
| 690 |
+
"\n",
|
| 691 |
+
"pred_b = np.concatenate(predictions, axis=0)\n",
|
| 692 |
+
"\n",
|
| 693 |
+
"np.savez('submission.npz', pred_a=pred_a, pred_b=pred_b) # save your submissions in an npz file with the keys `pred_a` and `pred_b`"
|
| 694 |
+
]
|
| 695 |
+
}
|
| 696 |
+
],
|
| 697 |
+
"metadata": {
|
| 698 |
+
"accelerator": "GPU",
|
| 699 |
+
"colab": {
|
| 700 |
+
"gpuType": "T4",
|
| 701 |
+
"provenance": []
|
| 702 |
+
},
|
| 703 |
+
"kernelspec": {
|
| 704 |
+
"display_name": "Python 3 (ipykernel)",
|
| 705 |
+
"language": "python",
|
| 706 |
+
"name": "python3"
|
| 707 |
+
},
|
| 708 |
+
"language_info": {
|
| 709 |
+
"codemirror_mode": {
|
| 710 |
+
"name": "ipython",
|
| 711 |
+
"version": 3
|
| 712 |
+
},
|
| 713 |
+
"file_extension": ".py",
|
| 714 |
+
"mimetype": "text/x-python",
|
| 715 |
+
"name": "python",
|
| 716 |
+
"nbconvert_exporter": "python",
|
| 717 |
+
"pygments_lexer": "ipython3",
|
| 718 |
+
"version": "3.12.9"
|
| 719 |
+
}
|
| 720 |
+
},
|
| 721 |
+
"nbformat": 4,
|
| 722 |
+
"nbformat_minor": 4
|
| 723 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/Scoring/metrics.py
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import numpy as np
|
| 2 |
+
import logging
|
| 3 |
+
import math
|
| 4 |
+
import json
|
| 5 |
+
from datasets import load_from_disk
|
| 6 |
+
import os
|
| 7 |
+
|
| 8 |
+
# Function to configure logging levels
|
| 9 |
+
def logging_level(level='info'):
|
| 10 |
+
str_format = '%(asctime)s - %(levelname)s: %(message)s'
|
| 11 |
+
if level == 'debug':
|
| 12 |
+
logging.basicConfig(level=logging.DEBUG, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')
|
| 13 |
+
elif level == 'info':
|
| 14 |
+
logging.basicConfig(level=logging.INFO, format=str_format, datefmt='%Y-%m-%d %H:%M:%S')
|
| 15 |
+
return logging
|
| 16 |
+
|
| 17 |
+
|
| 18 |
+
def validate_predictions_shape(predictions_np, expected_shape_suffix):
|
| 19 |
+
"""
|
| 20 |
+
Validate that predictions have the correct shape.
|
| 21 |
+
Accepts either (n, 1, 180, 320) or (n, 180, 320) for this competition.
|
| 22 |
+
Number of samples (n) must be exactly 100.
|
| 23 |
+
"""
|
| 24 |
+
if not isinstance(predictions_np, np.ndarray):
|
| 25 |
+
return False, "Prediction data must be a numpy array"
|
| 26 |
+
|
| 27 |
+
# Accept (n, 1, 180, 320) or (n, 180, 320)
|
| 28 |
+
if len(predictions_np.shape) == 4:
|
| 29 |
+
# (n, 1, 180, 320)
|
| 30 |
+
if predictions_np.shape[1:] != expected_shape_suffix:
|
| 31 |
+
return False, "Prediction data has incorrect dimensions"
|
| 32 |
+
if predictions_np.shape[1] != 1:
|
| 33 |
+
return False, "Prediction data must have exactly 1 channel"
|
| 34 |
+
if predictions_np.shape[0] != 100:
|
| 35 |
+
return False, "Invalid number of samples in prediction data"
|
| 36 |
+
elif len(predictions_np.shape) == 3:
|
| 37 |
+
# (n, 180, 320)
|
| 38 |
+
if predictions_np.shape[1:] != expected_shape_suffix[1:]:
|
| 39 |
+
return False, "Prediction data has incorrect dimensions"
|
| 40 |
+
if predictions_np.shape[0] != 100:
|
| 41 |
+
return False, "Invalid number of samples in prediction data"
|
| 42 |
+
else:
|
| 43 |
+
return False, "Incorrect dimensions in prediction data"
|
| 44 |
+
|
| 45 |
+
return True, None
|
| 46 |
+
|
| 47 |
+
|
| 48 |
+
def validate_predictions_values(predictions_np):
|
| 49 |
+
"""
|
| 50 |
+
Validate that prediction values are reasonable (real, non-negative, finite).
|
| 51 |
+
"""
|
| 52 |
+
if np.iscomplexobj(predictions_np):
|
| 53 |
+
return False, "Prediction data contains complex values"
|
| 54 |
+
|
| 55 |
+
if not np.isfinite(predictions_np).all():
|
| 56 |
+
return False, "Prediction data contains non-finite values"
|
| 57 |
+
|
| 58 |
+
if (predictions_np < 0).any():
|
| 59 |
+
return False, "Prediction data contains negative values"
|
| 60 |
+
|
| 61 |
+
return True, None
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
def safe_evaluate_predictions(predictions_np, targets_np):
|
| 65 |
+
"""
|
| 66 |
+
Safely evaluate predictions with error handling for mathematical operations.
|
| 67 |
+
"""
|
| 68 |
+
try:
|
| 69 |
+
N = predictions_np.shape[0]
|
| 70 |
+
preds_sum = predictions_np.reshape(N, -1).sum(axis=1)
|
| 71 |
+
true_sum = targets_np.reshape(N, -1).sum(axis=1)
|
| 72 |
+
|
| 73 |
+
# Check for invalid sums
|
| 74 |
+
if not np.isfinite(preds_sum).all() or not np.isfinite(true_sum).all():
|
| 75 |
+
return None, "Invalid sum values detected"
|
| 76 |
+
|
| 77 |
+
diffs = np.abs(preds_sum - true_sum)
|
| 78 |
+
|
| 79 |
+
# Safe division - handle division by zero
|
| 80 |
+
with np.errstate(divide='ignore', invalid='ignore'):
|
| 81 |
+
rates = np.abs(1 - preds_sum / true_sum)
|
| 82 |
+
# Replace inf and nan values with a high penalty
|
| 83 |
+
rates = np.where(np.isfinite(rates), rates, 1.0)
|
| 84 |
+
|
| 85 |
+
mae = diffs.mean()
|
| 86 |
+
mse = (diffs**2).mean()
|
| 87 |
+
rate = rates.mean()
|
| 88 |
+
predict_num_avg = preds_sum.mean()
|
| 89 |
+
true_num_avg = true_sum.mean()
|
| 90 |
+
|
| 91 |
+
# Check for invalid intermediate results
|
| 92 |
+
if not all(np.isfinite([mae, mse, rate, predict_num_avg, true_num_avg])):
|
| 93 |
+
return None, "Invalid intermediate calculation results"
|
| 94 |
+
|
| 95 |
+
# Safe exponential calculation
|
| 96 |
+
if rate > 100: # Prevent exp overflow
|
| 97 |
+
score = 0.0
|
| 98 |
+
else:
|
| 99 |
+
score = math.exp(-rate)
|
| 100 |
+
|
| 101 |
+
logging.info(f'test ---- Score: {score:.3f}, MSE: {mse:.4f}, MAE: {mae:.4f}, Chicken_avg: {predict_num_avg:.4f}')
|
| 102 |
+
return score, None
|
| 103 |
+
|
| 104 |
+
except Exception as e:
|
| 105 |
+
logging.error(f"Error in evaluation: {str(e)}")
|
| 106 |
+
return None, "Evaluation calculation failed"
|
| 107 |
+
|
| 108 |
+
|
| 109 |
+
# Add function to evaluate predictions and targets arrays
|
| 110 |
+
def evaluate_predictions(predictions_np, targets_np):
|
| 111 |
+
score, error = safe_evaluate_predictions(predictions_np, targets_np)
|
| 112 |
+
if error:
|
| 113 |
+
raise ValueError(error)
|
| 114 |
+
return score
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
def safe_test(preds, test_path, expected_shape):
|
| 118 |
+
"""
|
| 119 |
+
Safely run the test with comprehensive error handling.
|
| 120 |
+
"""
|
| 121 |
+
try:
|
| 122 |
+
# Validate prediction shape
|
| 123 |
+
valid_shape, shape_error = validate_predictions_shape(preds, expected_shape)
|
| 124 |
+
if not valid_shape:
|
| 125 |
+
return None, shape_error
|
| 126 |
+
|
| 127 |
+
# Validate prediction values
|
| 128 |
+
valid_values, values_error = validate_predictions_values(preds)
|
| 129 |
+
if not valid_values:
|
| 130 |
+
return None, values_error
|
| 131 |
+
|
| 132 |
+
# Load target dataset
|
| 133 |
+
test_dataset = load_from_disk(test_path)
|
| 134 |
+
|
| 135 |
+
# Extract density data directly as numpy arrays without torch
|
| 136 |
+
targets = []
|
| 137 |
+
for item in test_dataset:
|
| 138 |
+
density = np.array(item["density"], dtype=np.float32)
|
| 139 |
+
# Add batch dimension to match expected shape
|
| 140 |
+
targets.append(density[np.newaxis, :])
|
| 141 |
+
|
| 142 |
+
# Concatenate all targets into a single numpy array
|
| 143 |
+
targets = np.concatenate(targets, axis=0)
|
| 144 |
+
|
| 145 |
+
# Remove channel dimension from predictions for shape comparison and evaluation
|
| 146 |
+
# Predictions are (n, 1, 180, 320), targets are (n, 180, 320)
|
| 147 |
+
if len(preds.shape) == 4 and preds.shape[1] == 1:
|
| 148 |
+
preds_squeezed = preds.squeeze(axis=1) # Remove channel dimension
|
| 149 |
+
else:
|
| 150 |
+
return None, "Invalid prediction format for evaluation"
|
| 151 |
+
|
| 152 |
+
# Validate that prediction and target shapes match after removing channel
|
| 153 |
+
if preds_squeezed.shape != targets.shape:
|
| 154 |
+
return None, "Prediction and target data shape mismatch"
|
| 155 |
+
|
| 156 |
+
# Safely evaluate predictions (using squeezed predictions without channel dim)
|
| 157 |
+
score, eval_error = safe_evaluate_predictions(preds_squeezed, targets)
|
| 158 |
+
if eval_error:
|
| 159 |
+
return None, eval_error
|
| 160 |
+
|
| 161 |
+
# Final safety check: clamp score to [0.0, 1.0]
|
| 162 |
+
if score < 0.0 or score > 1.0:
|
| 163 |
+
logging.warning(f"Score {score} out of valid range, setting to 0.0")
|
| 164 |
+
score = 0.0
|
| 165 |
+
|
| 166 |
+
return score, None
|
| 167 |
+
|
| 168 |
+
except Exception as e:
|
| 169 |
+
logging.error(f"Error in test function: {str(e)}")
|
| 170 |
+
return None, "Test execution failed"
|
| 171 |
+
|
| 172 |
+
|
| 173 |
+
# Main function to run the validation
|
| 174 |
+
def test(preds, test_path):
|
| 175 |
+
score, error = safe_test(preds, test_path, (1, 180, 320))
|
| 176 |
+
if error:
|
| 177 |
+
raise ValueError(error)
|
| 178 |
+
return score
|
| 179 |
+
|
| 180 |
+
|
| 181 |
+
def create_error_response(error_message):
|
| 182 |
+
"""Create standardized error response."""
|
| 183 |
+
return {
|
| 184 |
+
"status": False,
|
| 185 |
+
"score": {
|
| 186 |
+
"public_a": 0.0,
|
| 187 |
+
"private_b": 0.0,
|
| 188 |
+
},
|
| 189 |
+
"msg": f"Error: {error_message}",
|
| 190 |
+
}
|
| 191 |
+
|
| 192 |
+
|
| 193 |
+
def create_success_response(score_a, score_b):
|
| 194 |
+
"""Create standardized success response."""
|
| 195 |
+
# 处理 NaN 和 inf,替换为 0.0
|
| 196 |
+
if not np.isfinite(score_a): # np.isfinite 同时检查 NaN 和 inf
|
| 197 |
+
score_a = 0.0
|
| 198 |
+
if not np.isfinite(score_b):
|
| 199 |
+
score_b = 0.0
|
| 200 |
+
return {
|
| 201 |
+
"status": True,
|
| 202 |
+
"score": {
|
| 203 |
+
"public_a": score_a,
|
| 204 |
+
"private_b": score_b,
|
| 205 |
+
},
|
| 206 |
+
"msg": "Success!",
|
| 207 |
+
}
|
| 208 |
+
|
| 209 |
+
|
| 210 |
+
if __name__ == '__main__':
|
| 211 |
+
################################################################################
|
| 212 |
+
# Dataset paths
|
| 213 |
+
if os.environ.get('METRIC_PATH'):
|
| 214 |
+
METRIC_PATH = os.environ.get("METRIC_PATH") + "/"
|
| 215 |
+
else:
|
| 216 |
+
METRIC_PATH = "" # Fallback for local testing
|
| 217 |
+
testA_path = METRIC_PATH + "test_a_targets"
|
| 218 |
+
testB_path = METRIC_PATH + "test_b_targets"
|
| 219 |
+
|
| 220 |
+
try:
|
| 221 |
+
# Safely load the npz file
|
| 222 |
+
try:
|
| 223 |
+
preds = np.load("submission.npz", allow_pickle=False)
|
| 224 |
+
except FileNotFoundError:
|
| 225 |
+
ret_json = create_error_response("Submission file not found")
|
| 226 |
+
except Exception as e:
|
| 227 |
+
ret_json = create_error_response("Failed to load submission file")
|
| 228 |
+
else:
|
| 229 |
+
# Check for required keys
|
| 230 |
+
required_keys = ['pred_a', 'pred_b']
|
| 231 |
+
missing_keys = [key for key in required_keys if key not in preds.files]
|
| 232 |
+
|
| 233 |
+
if missing_keys:
|
| 234 |
+
ret_json = create_error_response(f"Missing required keys in submission file")
|
| 235 |
+
else:
|
| 236 |
+
try:
|
| 237 |
+
# Extract predictions safely
|
| 238 |
+
pred_a = preds['pred_a']
|
| 239 |
+
pred_b = preds['pred_b']
|
| 240 |
+
|
| 241 |
+
logging = logging_level('info')
|
| 242 |
+
|
| 243 |
+
# Test both predictions with error handling
|
| 244 |
+
score_a, error_a = safe_test(pred_a, testA_path, (1, 180, 320))
|
| 245 |
+
if error_a:
|
| 246 |
+
ret_json = create_error_response(f"Error in test A evaluation: {error_a}")
|
| 247 |
+
else:
|
| 248 |
+
score_b, error_b = safe_test(pred_b, testB_path, (1, 180, 320))
|
| 249 |
+
if error_b:
|
| 250 |
+
ret_json = create_error_response(f"Error in test B evaluation: {error_b}")
|
| 251 |
+
else:
|
| 252 |
+
# Final safety check on scores
|
| 253 |
+
score_a = max(0.0, min(1.0, score_a))
|
| 254 |
+
score_b = max(0.0, min(1.0, score_b))
|
| 255 |
+
|
| 256 |
+
ret_json = create_success_response(score_a, score_b)
|
| 257 |
+
|
| 258 |
+
except Exception as e:
|
| 259 |
+
logging.error(f"Unexpected error during evaluation: {str(e)}")
|
| 260 |
+
ret_json = create_error_response("Evaluation failed due to invalid submission format")
|
| 261 |
+
|
| 262 |
+
except Exception as e:
|
| 263 |
+
logging.error(f"Critical error: {str(e)}")
|
| 264 |
+
ret_json = create_error_response("Critical evaluation error")
|
| 265 |
+
|
| 266 |
+
# Write result to file
|
| 267 |
+
try:
|
| 268 |
+
with open('score.json', 'w') as f:
|
| 269 |
+
f.write(json.dumps(ret_json))
|
| 270 |
+
except Exception as e:
|
| 271 |
+
logging.error(f"Failed to write score file: {str(e)}")
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/test_set/dataset_info.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"citation": "",
|
| 3 |
+
"description": "",
|
| 4 |
+
"features": {
|
| 5 |
+
"image": {
|
| 6 |
+
"_type": "Image"
|
| 7 |
+
}
|
| 8 |
+
},
|
| 9 |
+
"homepage": "",
|
| 10 |
+
"license": ""
|
| 11 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/test_set/labels/dataset_info.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"citation": "",
|
| 3 |
+
"description": "",
|
| 4 |
+
"features": {
|
| 5 |
+
"density": {
|
| 6 |
+
"shape": [
|
| 7 |
+
180,
|
| 8 |
+
320
|
| 9 |
+
],
|
| 10 |
+
"dtype": "float32",
|
| 11 |
+
"_type": "Array2D"
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"homepage": "",
|
| 15 |
+
"license": ""
|
| 16 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/test_set/labels/state.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_data_files": [
|
| 3 |
+
{
|
| 4 |
+
"filename": "data-00000-of-00001.arrow"
|
| 5 |
+
}
|
| 6 |
+
],
|
| 7 |
+
"_fingerprint": "bc9d05534957ddb2",
|
| 8 |
+
"_format_columns": null,
|
| 9 |
+
"_format_kwargs": {},
|
| 10 |
+
"_format_type": null,
|
| 11 |
+
"_output_all_columns": false,
|
| 12 |
+
"_split": null
|
| 13 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/test_set/state.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_data_files": [
|
| 3 |
+
{
|
| 4 |
+
"filename": "data-00000-of-00001.arrow"
|
| 5 |
+
}
|
| 6 |
+
],
|
| 7 |
+
"_fingerprint": "ab0299f7034bc8c9",
|
| 8 |
+
"_format_columns": null,
|
| 9 |
+
"_format_kwargs": {},
|
| 10 |
+
"_format_type": null,
|
| 11 |
+
"_output_all_columns": false,
|
| 12 |
+
"_split": null
|
| 13 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/validation_set/dataset_info.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"citation": "",
|
| 3 |
+
"description": "",
|
| 4 |
+
"features": {
|
| 5 |
+
"image": {
|
| 6 |
+
"_type": "Image"
|
| 7 |
+
}
|
| 8 |
+
},
|
| 9 |
+
"homepage": "",
|
| 10 |
+
"license": ""
|
| 11 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/validation_set/labels/dataset_info.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"citation": "",
|
| 3 |
+
"description": "",
|
| 4 |
+
"features": {
|
| 5 |
+
"density": {
|
| 6 |
+
"shape": [
|
| 7 |
+
180,
|
| 8 |
+
320
|
| 9 |
+
],
|
| 10 |
+
"dtype": "float32",
|
| 11 |
+
"_type": "Array2D"
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"homepage": "",
|
| 15 |
+
"license": ""
|
| 16 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/validation_set/labels/state.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_data_files": [
|
| 3 |
+
{
|
| 4 |
+
"filename": "data-00000-of-00001.arrow"
|
| 5 |
+
}
|
| 6 |
+
],
|
| 7 |
+
"_fingerprint": "4b041db09ac22198",
|
| 8 |
+
"_format_columns": null,
|
| 9 |
+
"_format_kwargs": {},
|
| 10 |
+
"_format_type": null,
|
| 11 |
+
"_output_all_columns": false,
|
| 12 |
+
"_split": null
|
| 13 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/Solution/validation_set/state.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_data_files": [
|
| 3 |
+
{
|
| 4 |
+
"filename": "data-00000-of-00001.arrow"
|
| 5 |
+
}
|
| 6 |
+
],
|
| 7 |
+
"_fingerprint": "b1f28ace55e76c57",
|
| 8 |
+
"_format_columns": null,
|
| 9 |
+
"_format_kwargs": {},
|
| 10 |
+
"_format_type": null,
|
| 11 |
+
"_output_all_columns": false,
|
| 12 |
+
"_split": null
|
| 13 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/training_set/train/dataset_info.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"citation": "",
|
| 3 |
+
"description": "",
|
| 4 |
+
"features": {
|
| 5 |
+
"image": {
|
| 6 |
+
"_type": "Image"
|
| 7 |
+
},
|
| 8 |
+
"density": {
|
| 9 |
+
"shape": [
|
| 10 |
+
180,
|
| 11 |
+
320
|
| 12 |
+
],
|
| 13 |
+
"dtype": "float32",
|
| 14 |
+
"_type": "Array2D"
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"homepage": "",
|
| 18 |
+
"license": ""
|
| 19 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Chicken_Counting/training_set/train/state.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_data_files": [
|
| 3 |
+
{
|
| 4 |
+
"filename": "data-00000-of-00001.arrow"
|
| 5 |
+
}
|
| 6 |
+
],
|
| 7 |
+
"_fingerprint": "bc95c8e6a169a796",
|
| 8 |
+
"_format_columns": null,
|
| 9 |
+
"_format_kwargs": {},
|
| 10 |
+
"_format_type": null,
|
| 11 |
+
"_output_all_columns": false,
|
| 12 |
+
"_split": null
|
| 13 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/Concepts_Solution.ipynb
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/Scoring/metrics.py
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import os
|
| 2 |
+
import pickle
|
| 3 |
+
import json
|
| 4 |
+
import math
|
| 5 |
+
import httpx
|
| 6 |
+
from httpx import AsyncClient
|
| 7 |
+
from datasets import load_from_disk
|
| 8 |
+
from tqdm import tqdm
|
| 9 |
+
import json
|
| 10 |
+
from asyncio import Semaphore
|
| 11 |
+
import asyncio
|
| 12 |
+
from tenacity import retry, stop_after_attempt, wait_exponential, retry_if_exception_type
|
| 13 |
+
|
| 14 |
+
if os.environ.get('DATA_PATH'):
|
| 15 |
+
TEST_PATH = os.environ.get("DATA_PATH") + "/test/"
|
| 16 |
+
else:
|
| 17 |
+
TEST_PATH = ""
|
| 18 |
+
|
| 19 |
+
TEST_A_LEN = 50
|
| 20 |
+
TEST_B_LEN = 100
|
| 21 |
+
API_URL = ""
|
| 22 |
+
API_KEY = "" # God API key for evaluation
|
| 23 |
+
# Please import your LLM API, such as from open router
|
| 24 |
+
|
| 25 |
+
a_client = AsyncClient()
|
| 26 |
+
|
| 27 |
+
class APIError(Exception):
|
| 28 |
+
pass
|
| 29 |
+
|
| 30 |
+
def read_clues(path: str):
|
| 31 |
+
with open(path, 'r') as f:
|
| 32 |
+
return [json.loads(line) for line in f]
|
| 33 |
+
|
| 34 |
+
def hits_at_10(predictions, correct_answer):
|
| 35 |
+
return 1.0 if correct_answer in predictions[:10] else 0.0
|
| 36 |
+
|
| 37 |
+
def ndcg_at_10(predictions, correct_answer):
|
| 38 |
+
if correct_answer not in predictions:
|
| 39 |
+
return 0.0
|
| 40 |
+
try:
|
| 41 |
+
rank = predictions[:10].index(correct_answer) + 1
|
| 42 |
+
except ValueError:
|
| 43 |
+
return 0.0
|
| 44 |
+
return 1 / math.log2(rank + 1)
|
| 45 |
+
|
| 46 |
+
@retry(
|
| 47 |
+
stop=stop_after_attempt(3),
|
| 48 |
+
wait=wait_exponential(multiplier=1, min=4, max=10),
|
| 49 |
+
retry=retry_if_exception_type((httpx.HTTPStatusError, httpx.TimeoutException, httpx.ConnectError, httpx.RequestError, ValueError))
|
| 50 |
+
)
|
| 51 |
+
async def get_predictions(clues, options):
|
| 52 |
+
guesser_response = await a_client.post(f"{API_URL}/guess", json={
|
| 53 |
+
"clues": clues,
|
| 54 |
+
"options": options
|
| 55 |
+
}, headers={
|
| 56 |
+
"Authorization": f"Bearer {API_KEY}"
|
| 57 |
+
}, timeout=60)
|
| 58 |
+
guesser_response = guesser_response.json()
|
| 59 |
+
if "guesses" not in guesser_response:
|
| 60 |
+
raise ValueError(f"Unable to generate guesses: {guesser_response}")
|
| 61 |
+
if not isinstance(guesser_response["guesses"], list):
|
| 62 |
+
raise ValueError(f"Guesses is not a list: {guesser_response}")
|
| 63 |
+
predictions = [p.lower() for p in guesser_response["guesses"]]
|
| 64 |
+
return predictions
|
| 65 |
+
|
| 66 |
+
async def evaluate(clues, testset, test_len, test_name):
|
| 67 |
+
# Validate all inputs first
|
| 68 |
+
for i in range(test_len):
|
| 69 |
+
if not isinstance(clues[i], list):
|
| 70 |
+
raise TypeError(f"`{test_name}[{i}]` must be a list, but got {type(clues[i])}")
|
| 71 |
+
if len(clues[i]) > 4:
|
| 72 |
+
raise ValueError(f"Too many elements in `{test_name}[{i}]`. You can only provide up to 4 sequences of markers.")
|
| 73 |
+
for sequence in clues[i]:
|
| 74 |
+
if not isinstance(sequence, list):
|
| 75 |
+
raise TypeError(f"Each sequence in `{test_name}[{i}]` must be a list, but got {type(sequence)}")
|
| 76 |
+
if len(sequence) > 8:
|
| 77 |
+
raise ValueError(f"Too many markers in `{test_name}[{i}]`. You can only provide up to 8 markers per sequence.")
|
| 78 |
+
for marker in sequence:
|
| 79 |
+
if not isinstance(marker, int):
|
| 80 |
+
raise TypeError(f"Each marker in `{test_name}[{i}]` must be an integer, but got {type(marker)}")
|
| 81 |
+
if marker < 0 or marker > 117:
|
| 82 |
+
raise ValueError(f"Invalid marker value in `{test_name}[{i}]`. Expected an integer between 0 and 117.")
|
| 83 |
+
|
| 84 |
+
# Create semaphore for concurrency control (max 50 parallel requests)
|
| 85 |
+
semaphore = asyncio.Semaphore(50)
|
| 86 |
+
|
| 87 |
+
async def process_single_item(i):
|
| 88 |
+
async with semaphore:
|
| 89 |
+
try:
|
| 90 |
+
predictions = await get_predictions(clues[i], testset[i]['options'])
|
| 91 |
+
hit10 = hits_at_10(predictions, testset[i]['label'])
|
| 92 |
+
ndcg10 = ndcg_at_10(predictions, testset[i]['label'])
|
| 93 |
+
score = 0.9 * hit10 + 0.1 * ndcg10
|
| 94 |
+
return score
|
| 95 |
+
|
| 96 |
+
except Exception as e:
|
| 97 |
+
if isinstance(e, httpx.HTTPStatusError):
|
| 98 |
+
print(f"HTTP Error {e.response.status_code}: {e.response.text}")
|
| 99 |
+
try:
|
| 100 |
+
error_detail = e.response.json().get("detail", "Unknown error")
|
| 101 |
+
print(f"Error details: {error_detail}")
|
| 102 |
+
except:
|
| 103 |
+
print(f"Could not parse error response {e.response.text}")
|
| 104 |
+
|
| 105 |
+
elif isinstance(e, ValueError):
|
| 106 |
+
print(f"Value error: {e}")
|
| 107 |
+
|
| 108 |
+
elif isinstance(e, httpx.TimeoutException):
|
| 109 |
+
print("request timed out")
|
| 110 |
+
|
| 111 |
+
elif isinstance(e, httpx.ConnectError):
|
| 112 |
+
print(f"Could not connect to {API_URL}")
|
| 113 |
+
|
| 114 |
+
elif isinstance(e, httpx.RequestError):
|
| 115 |
+
print(f"Request error: {e}")
|
| 116 |
+
|
| 117 |
+
else:
|
| 118 |
+
print(f"Unknown error: {e}")
|
| 119 |
+
raise APIError(f"Error getting predictions for {test_name}[{i}]", e)
|
| 120 |
+
|
| 121 |
+
# Create tasks for all items
|
| 122 |
+
tasks = [process_single_item(i) for i in range(test_len)]
|
| 123 |
+
|
| 124 |
+
# Run all tasks in parallel with progress tracking
|
| 125 |
+
scores = []
|
| 126 |
+
with tqdm(total=test_len, desc=f"Evaluating {test_name}") as pbar:
|
| 127 |
+
for coro in asyncio.as_completed(tasks):
|
| 128 |
+
try:
|
| 129 |
+
score = await coro
|
| 130 |
+
scores.append(score)
|
| 131 |
+
pbar.update(1)
|
| 132 |
+
except Exception as e:
|
| 133 |
+
pbar.close()
|
| 134 |
+
raise e
|
| 135 |
+
|
| 136 |
+
return scores
|
| 137 |
+
|
| 138 |
+
async def main():
|
| 139 |
+
testset_a = load_from_disk(os.path.join(TEST_PATH, "test_a"))["test"]
|
| 140 |
+
testset_b = load_from_disk(os.path.join(TEST_PATH, "test_b"))["test"]
|
| 141 |
+
try:
|
| 142 |
+
clues_a = read_clues("clues_a.jsonl")
|
| 143 |
+
clues_b = read_clues("clues_b.jsonl")
|
| 144 |
+
if not isinstance(clues_a, list):
|
| 145 |
+
raise TypeError(f"`clues_a` must be a list, but got {type(clues_a)}")
|
| 146 |
+
if not isinstance(clues_b, list):
|
| 147 |
+
raise TypeError(f"`clues_b` must be a list, but got {type(clues_b)}")
|
| 148 |
+
if len(clues_a) != TEST_A_LEN:
|
| 149 |
+
raise ValueError(f"{"Too many" if len(clues_a) > TEST_A_LEN else "Too few"} clues in `clues_a`. Expected {TEST_A_LEN} clues.")
|
| 150 |
+
if len(clues_b) != TEST_B_LEN:
|
| 151 |
+
raise ValueError(f"{"Too many" if len(clues_b) > TEST_B_LEN else "Too few"} clues in `clues_b`. Expected {TEST_B_LEN} clues.")
|
| 152 |
+
scores_a = await evaluate(clues_a, testset_a, TEST_A_LEN, "clues_a")
|
| 153 |
+
scores_b = await evaluate(clues_b, testset_b, TEST_B_LEN, "clues_b")
|
| 154 |
+
score_a = sum(scores_a) / len(scores_a)
|
| 155 |
+
score_b = sum(scores_b) / len(scores_b)
|
| 156 |
+
print(f"Average score for clues_a: {score_a}")
|
| 157 |
+
print(f"Average score for clues_b: {score_b}")
|
| 158 |
+
import math
|
| 159 |
+
|
| 160 |
+
# 假设 score_a 和 score_b 已经定义
|
| 161 |
+
# 检查并处理 score_a
|
| 162 |
+
if math.isnan(score_a) or math.isinf(score_a):
|
| 163 |
+
score_a = 0
|
| 164 |
+
|
| 165 |
+
# 检查并处理 score_b
|
| 166 |
+
if math.isnan(score_b) or math.isinf(score_b):
|
| 167 |
+
score_b = 0
|
| 168 |
+
|
| 169 |
+
ret_json = {
|
| 170 |
+
"status": True,
|
| 171 |
+
"score": {
|
| 172 |
+
"public_a": score_a,
|
| 173 |
+
"private_b": score_b,
|
| 174 |
+
},
|
| 175 |
+
"message": "Success!"
|
| 176 |
+
}
|
| 177 |
+
with open("score.json", "w") as f:
|
| 178 |
+
json.dump(ret_json, f)
|
| 179 |
+
|
| 180 |
+
except Exception as e:
|
| 181 |
+
print(f"Error: {e}")
|
| 182 |
+
ret_json = {
|
| 183 |
+
"status": False,
|
| 184 |
+
"score": {
|
| 185 |
+
"public_a": 0.0,
|
| 186 |
+
"private_b": 0.0,
|
| 187 |
+
},
|
| 188 |
+
"message": str(e)
|
| 189 |
+
}
|
| 190 |
+
with open("score.json", "w") as f:
|
| 191 |
+
json.dump(ret_json, f)
|
| 192 |
+
|
| 193 |
+
if __name__ == "__main__":
|
| 194 |
+
asyncio.run(main())
|
benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/test_set/dataset_dict.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{"splits": ["test"]}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/test_set/test/dataset_info.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"builder_name": "parquet",
|
| 3 |
+
"citation": "",
|
| 4 |
+
"config_name": "default",
|
| 5 |
+
"dataset_name": "ioai-concepts-onsite",
|
| 6 |
+
"dataset_size": 178180,
|
| 7 |
+
"description": "",
|
| 8 |
+
"download_checksums": {
|
| 9 |
+
"hf://datasets/afaji/ioai-concepts-onsite@3c43069345dca6f825ff0eb4ca75a5e0e6fbbd58/data/train-00000-of-00001.parquet": {
|
| 10 |
+
"num_bytes": 54331,
|
| 11 |
+
"checksum": null
|
| 12 |
+
}
|
| 13 |
+
},
|
| 14 |
+
"download_size": 54331,
|
| 15 |
+
"features": {
|
| 16 |
+
"label": {
|
| 17 |
+
"dtype": "string",
|
| 18 |
+
"_type": "Value"
|
| 19 |
+
},
|
| 20 |
+
"options": {
|
| 21 |
+
"feature": {
|
| 22 |
+
"dtype": "string",
|
| 23 |
+
"_type": "Value"
|
| 24 |
+
},
|
| 25 |
+
"_type": "Sequence"
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"homepage": "",
|
| 29 |
+
"license": "",
|
| 30 |
+
"size_in_bytes": 232511,
|
| 31 |
+
"splits": {
|
| 32 |
+
"train": {
|
| 33 |
+
"name": "train",
|
| 34 |
+
"num_bytes": 178180,
|
| 35 |
+
"num_examples": 150,
|
| 36 |
+
"dataset_name": "ioai-concepts-onsite"
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
"version": {
|
| 40 |
+
"version_str": "0.0.0",
|
| 41 |
+
"major": 0,
|
| 42 |
+
"minor": 0,
|
| 43 |
+
"patch": 0
|
| 44 |
+
}
|
| 45 |
+
}
|
benchmark/IOAI/IOAI2025/Individual-Contest/Concepts/Solution/test_set/test/state.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"_data_files": [
|
| 3 |
+
{
|
| 4 |
+
"filename": "data-00000-of-00001.arrow"
|
| 5 |
+
}
|
| 6 |
+
],
|
| 7 |
+
"_fingerprint": "46a3d5a421222500",
|
| 8 |
+
"_format_columns": null,
|
| 9 |
+
"_format_kwargs": {},
|
| 10 |
+
"_format_type": null,
|
| 11 |
+
"_output_all_columns": false,
|
| 12 |
+
"_split": "train"
|
| 13 |
+
}
|