egrace479 commited on
Commit
afe2302
1 Parent(s): c15b558

Add files relating to the deduplication process

Browse files
deduplication_process/Jiggins_Zenodo_Img_Master_3477891Patch.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f4637db343cfed4e3be1f393485410dcc32a72bd1ccb648968f854f3a9045180
3
+ size 15528648
deduplication_process/README.md ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Summary of Deduplication of Jiggins Data
2
+
3
+ We explored our downloaded images in `notebooks/EDA-DL-0-3.ipynb`, and established the following causes of duplication along with remedies:
4
+ 1. The "patch" record (record 3477891) which required alignment in `../notebooks/Data-gen-1-1.ipynb`, resulting in `Jiggins_Zenodo_Img_Master_3477891Patch.csv` used for download, is a duplication of all listed records. Additionally, it introduced extra copies of 4 images with incorrect labels for their views (i.e., dorsal vs ventral).
5
+ - Solution: This record will be removed.
6
+ 2. The remaining duplication (430 images x2) comes from 5 records: [4291095](https://zenodo.org/records/4291095), [2813153](https://zenodo.org/records/2813153), [5526257](https://zenodo.org/records/5526257), [2553977](https://zenodo.org/records/2553977), and [2552371](https://zenodo.org/records/2552371).
7
+ - Though there is nothing in their descriptions on Zenodo to indicate this overlap occurred, record 4291095 duplicated 415 images from record 2813153. 104 of these images had their view/side labels (dorsal vs ventral) updated to reflect an earlier mislabeling in record 2813153; these were all RAW copies of the images. All other metadata was consistent across records.
8
+ - Solution: Copies of these images and their metadata will be retained from the newer record, record 4291095.
9
+ - Record 5526257 has 10 images that were added twice. All their metadata is consistent, so we will just keep the first instance of each image.
10
+ - Records 2553977 and 2552371 are both "Miscellaneous Heliconius wing photographs (2001-2019)" Parts 3 & 1, respectively. Record 2553977 has duplicated images with matching metadata, though 3 of the 4 images have different filenames (`Image_name`). It seems to have resulted from typos or not indicating `cut`, as they are all close-up crops of a single wing. From this perspective, the view labels (dorsal) don't seem appropriate when we have more fine-grained indicators such as "forewing dorsal".
11
+ - Suggestion that the entries in this record with `cut` in the filename not be used for general classification unless this variety is desired. These also appear to be all the `tif` images, which are often ignored.
12
+ - Record 2552371 has one image duplicated with two different `CAMID`s assigned (different views as well). These will both be removed as the image has no indicator of the specimen ID in it. Note that these also were labeled `Heliconius sp.`.
13
+ 3. Looking at images that were not duplicates, there are clearly still multiple images of the same specimen from the same perspective (eg., two dorsal images) that are also of the same file type (eg., both jpgs). Duplication was checked at the pixel level, so there is no guarantee that they are truly different images, but due to the scope of this collection (over 20 years), it does not seem unlikely that multiple images could have been taken of the same specimen.
14
+ - Suggestion/Solution: When determining splits using this data, follow these steps:
15
+ 1. Ensure you are looking at only **_one_** view (eg., dorsal or ventral).
16
+ 2. Ensure you are only looking one file type (`raw`, `jpg`, or `tif`).
17
+ 3. Reduce to only unique `CAMID`s.
18
+ 4. Generate splits as desired.
19
+ 5. Add images to splits based on matched `CAMID`s if multiple views are desired (i.e., if a `CAMID` is present in the dorsal training, add the matching ventral image to the training set).
20
+ 6. Be sure to check only desired categories are included, such as excluding hybrids or cross types, or specimens not labeled to the level of classification.
21
+
22
+
23
+ Final deduplication following this process was completed in `../notebooks/Data-gen-1-2.ipynb`.
24
+
25
+ # Other Notes on Using this Data
26
+
27
+ Not all images are labeled with the same detail. For instance, there are images labeled to the subspecies and species levels, while some images are not labeled past genus (eg., `Heliconius sp.`, `Heliconius hybrid`). If classifying to the subspecies level, be sure to only include images that have labels in the subspecies column, similarly, when doing species classification, don't include those not labeled past genus.
28
+
29
+ The `Taxonomic_Name` column has been standardized to `<Genus> <species> ssp. <subspecies>` (where species and subspecies are available).
30
+
31
+ Cross type specimens (those mixed in a lab to generate hybrids or back-crosses) are indicated by a non-null value in the `Cross_Type` column. Their subspecies column is written out in full indicating parentage (eg., `(plesseni x malleti) x malleti`), unlike in the `Taxonomic_Name` column, where they're standardized to match the formatting of other hybrids. Use the following code to filter back crosses and F2 hybrids if just F1s are desired:
32
+
33
+ ```
34
+ import pandas as pd
35
+
36
+ df = pd.read_csv(MASTER_FILE_PATH, low_memory = False)
37
+
38
+ cross_types_rm = []
39
+ for ssp in list(df.loc[df["Cross_Type"].notna(), "subspecies"].unique()):
40
+ if " x " in ssp:
41
+ split_x = ssp.split(" x ")
42
+ if len(split_x) > 2:
43
+ cross_types_rm.append(ssp)
44
+
45
+ print(len(cross_types_rm))
46
+
47
+ non_bcross = df.loc[~df["subspecies"].isin(cross_types_rm)]
48
+ ```
49
+
deduplication_process/metadata/Jiggins_Zenodo_Img_Master_3477891Patch_checksums.csv ADDED
The diff for this file is too large to render. See raw diff
 
deduplication_process/metadata/Jiggins_Zenodo_Img_Master_3477891Patch_downloaded.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f072f8db4287853ef187075b9e5f6b120a75e08cce0892ce289b1de56b086dbe
3
+ size 19388136
deduplication_process/metadata/Jiggins_Zenodo_Img_Master_3477891Patch_error_log.csv ADDED
The diff for this file is too large to render. See raw diff
 
deduplication_process/metadata/Jiggins_Zenodo_Img_Master_3477891Patch_error_log_(readable).json ADDED
The diff for this file is too large to render. See raw diff
 
deduplication_process/metadata/Jiggins_Zenodo_Img_Master_3477891Patch_log_(readable).json ADDED
The diff for this file is too large to render. See raw diff
 
deduplication_process/notebooks/EDA-DL-0-1.ipynb ADDED
The diff for this file is too large to render. See raw diff
 
deduplication_process/notebooks/EDA-DL-0-2.ipynb ADDED
@@ -0,0 +1,843 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "code",
5
+ "execution_count": 1,
6
+ "metadata": {},
7
+ "outputs": [],
8
+ "source": [
9
+ "import pandas as pd\n",
10
+ "import json"
11
+ ]
12
+ },
13
+ {
14
+ "cell_type": "code",
15
+ "execution_count": 2,
16
+ "metadata": {},
17
+ "outputs": [
18
+ {
19
+ "name": "stdout",
20
+ "output_type": "stream",
21
+ "text": [
22
+ "<class 'pandas.core.frame.DataFrame'>\n",
23
+ "RangeIndex: 50 entries, 0 to 49\n",
24
+ "Data columns (total 4 columns):\n",
25
+ " # Column Non-Null Count Dtype \n",
26
+ "--- ------ -------------- ----- \n",
27
+ " 0 File name 50 non-null object\n",
28
+ " 1 ID 49 non-null object\n",
29
+ " 2 Side 49 non-null object\n",
30
+ " 3 Unnamed: 3 49 non-null object\n",
31
+ "dtypes: object(4)\n",
32
+ "memory usage: 1.7+ KB\n"
33
+ ]
34
+ }
35
+ ],
36
+ "source": [
37
+ "# Record 4289223 is most of our initial 404s (ultimately just second most), \n",
38
+ "# looks like they align with 0.2.rachel.blow.mel.tim.ikiam.csv, so we'll check\n",
39
+ "fof_df = pd.read_csv(\"../metadata/Zenodo_meta_files/0.2.rachel.blow.mel.tim.ikiam.csv\", low_memory = False)\n",
40
+ "fof_df.info(show_counts=True)"
41
+ ]
42
+ },
43
+ {
44
+ "cell_type": "code",
45
+ "execution_count": 3,
46
+ "metadata": {},
47
+ "outputs": [
48
+ {
49
+ "data": {
50
+ "text/html": [
51
+ "<div>\n",
52
+ "<style scoped>\n",
53
+ " .dataframe tbody tr th:only-of-type {\n",
54
+ " vertical-align: middle;\n",
55
+ " }\n",
56
+ "\n",
57
+ " .dataframe tbody tr th {\n",
58
+ " vertical-align: top;\n",
59
+ " }\n",
60
+ "\n",
61
+ " .dataframe thead th {\n",
62
+ " text-align: right;\n",
63
+ " }\n",
64
+ "</style>\n",
65
+ "<table border=\"1\" class=\"dataframe\">\n",
66
+ " <thead>\n",
67
+ " <tr style=\"text-align: right;\">\n",
68
+ " <th></th>\n",
69
+ " <th>File name</th>\n",
70
+ " <th>ID</th>\n",
71
+ " <th>Side</th>\n",
72
+ " <th>Unnamed: 3</th>\n",
73
+ " </tr>\n",
74
+ " </thead>\n",
75
+ " <tbody>\n",
76
+ " <tr>\n",
77
+ " <th>0</th>\n",
78
+ " <td>CAM028501d.JPG</td>\n",
79
+ " <td>CAM028501</td>\n",
80
+ " <td>dorsal</td>\n",
81
+ " <td>d.JPG</td>\n",
82
+ " </tr>\n",
83
+ " <tr>\n",
84
+ " <th>1</th>\n",
85
+ " <td>CAM028501v.JPG</td>\n",
86
+ " <td>CAM028501</td>\n",
87
+ " <td>ventral</td>\n",
88
+ " <td>v.JPG</td>\n",
89
+ " </tr>\n",
90
+ " <tr>\n",
91
+ " <th>2</th>\n",
92
+ " <td>CAM028502d.JPG</td>\n",
93
+ " <td>CAM028502</td>\n",
94
+ " <td>dorsal</td>\n",
95
+ " <td>d.JPG</td>\n",
96
+ " </tr>\n",
97
+ " <tr>\n",
98
+ " <th>3</th>\n",
99
+ " <td>CAM028502v.JPG</td>\n",
100
+ " <td>CAM028502</td>\n",
101
+ " <td>ventral</td>\n",
102
+ " <td>v.JPG</td>\n",
103
+ " </tr>\n",
104
+ " <tr>\n",
105
+ " <th>4</th>\n",
106
+ " <td>CAM028503d.JPG</td>\n",
107
+ " <td>CAM028503</td>\n",
108
+ " <td>dorsal</td>\n",
109
+ " <td>d.JPG</td>\n",
110
+ " </tr>\n",
111
+ " </tbody>\n",
112
+ "</table>\n",
113
+ "</div>"
114
+ ],
115
+ "text/plain": [
116
+ " File name ID Side Unnamed: 3\n",
117
+ "0 CAM028501d.JPG CAM028501 dorsal d.JPG\n",
118
+ "1 CAM028501v.JPG CAM028501 ventral v.JPG\n",
119
+ "2 CAM028502d.JPG CAM028502 dorsal d.JPG\n",
120
+ "3 CAM028502v.JPG CAM028502 ventral v.JPG\n",
121
+ "4 CAM028503d.JPG CAM028503 dorsal d.JPG"
122
+ ]
123
+ },
124
+ "execution_count": 3,
125
+ "metadata": {},
126
+ "output_type": "execute_result"
127
+ }
128
+ ],
129
+ "source": [
130
+ "fof_df.head()"
131
+ ]
132
+ },
133
+ {
134
+ "cell_type": "markdown",
135
+ "metadata": {},
136
+ "source": [
137
+ "These don't have a URL, but it could be reconstructed from the record number. Let's check if these are the files that had the 404 error from that record."
138
+ ]
139
+ },
140
+ {
141
+ "cell_type": "code",
142
+ "execution_count": 4,
143
+ "metadata": {},
144
+ "outputs": [
145
+ {
146
+ "data": {
147
+ "text/html": [
148
+ "<div>\n",
149
+ "<style scoped>\n",
150
+ " .dataframe tbody tr th:only-of-type {\n",
151
+ " vertical-align: middle;\n",
152
+ " }\n",
153
+ "\n",
154
+ " .dataframe tbody tr th {\n",
155
+ " vertical-align: top;\n",
156
+ " }\n",
157
+ "\n",
158
+ " .dataframe thead th {\n",
159
+ " text-align: right;\n",
160
+ " }\n",
161
+ "</style>\n",
162
+ "<table border=\"1\" class=\"dataframe\">\n",
163
+ " <thead>\n",
164
+ " <tr style=\"text-align: right;\">\n",
165
+ " <th></th>\n",
166
+ " <th>Image</th>\n",
167
+ " <th>file_url</th>\n",
168
+ " <th>record_number</th>\n",
169
+ " <th>dataset</th>\n",
170
+ " <th>CAMID</th>\n",
171
+ " <th>Response_status</th>\n",
172
+ " </tr>\n",
173
+ " </thead>\n",
174
+ " <tbody>\n",
175
+ " <tr>\n",
176
+ " <th>0</th>\n",
177
+ " <td>Heliconius melpomene ssp. plesseni x malleti/5...</td>\n",
178
+ " <td>https://zenodo.org/record/3082688/files/CAM017...</td>\n",
179
+ " <td>3082688</td>\n",
180
+ " <td>Patricio Salazar</td>\n",
181
+ " <td>CAM017505</td>\n",
182
+ " <td>404</td>\n",
183
+ " </tr>\n",
184
+ " <tr>\n",
185
+ " <th>1</th>\n",
186
+ " <td>Heliconius erato ssp. notabilis x lativitta/54...</td>\n",
187
+ " <td>https://zenodo.org/record/3082688/files/CAM017...</td>\n",
188
+ " <td>3082688</td>\n",
189
+ " <td>Patricio Salazar</td>\n",
190
+ " <td>CAM017693</td>\n",
191
+ " <td>404</td>\n",
192
+ " </tr>\n",
193
+ " <tr>\n",
194
+ " <th>2</th>\n",
195
+ " <td>Heliconius erato ssp. notabilis x lativitta/55...</td>\n",
196
+ " <td>https://zenodo.org/record/3082688/files/CAM017...</td>\n",
197
+ " <td>3082688</td>\n",
198
+ " <td>Patricio Salazar</td>\n",
199
+ " <td>CAM017821</td>\n",
200
+ " <td>404</td>\n",
201
+ " </tr>\n",
202
+ " <tr>\n",
203
+ " <th>3</th>\n",
204
+ " <td>Heliconius melpomene ssp. plesseni x malleti/1...</td>\n",
205
+ " <td>https://zenodo.org/record/1748277/files/CAM017...</td>\n",
206
+ " <td>1748277</td>\n",
207
+ " <td>Patricio Salazar</td>\n",
208
+ " <td>CAM017932</td>\n",
209
+ " <td>404</td>\n",
210
+ " </tr>\n",
211
+ " <tr>\n",
212
+ " <th>4</th>\n",
213
+ " <td>Heliconius melpomene ssp. plesseni x malleti/1...</td>\n",
214
+ " <td>https://zenodo.org/record/1748277/files/CAM017...</td>\n",
215
+ " <td>1748277</td>\n",
216
+ " <td>Patricio Salazar</td>\n",
217
+ " <td>CAM017971</td>\n",
218
+ " <td>404</td>\n",
219
+ " </tr>\n",
220
+ " </tbody>\n",
221
+ "</table>\n",
222
+ "</div>"
223
+ ],
224
+ "text/plain": [
225
+ " Image \\\n",
226
+ "0 Heliconius melpomene ssp. plesseni x malleti/5... \n",
227
+ "1 Heliconius erato ssp. notabilis x lativitta/54... \n",
228
+ "2 Heliconius erato ssp. notabilis x lativitta/55... \n",
229
+ "3 Heliconius melpomene ssp. plesseni x malleti/1... \n",
230
+ "4 Heliconius melpomene ssp. plesseni x malleti/1... \n",
231
+ "\n",
232
+ " file_url record_number \\\n",
233
+ "0 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n",
234
+ "1 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n",
235
+ "2 https://zenodo.org/record/3082688/files/CAM017... 3082688 \n",
236
+ "3 https://zenodo.org/record/1748277/files/CAM017... 1748277 \n",
237
+ "4 https://zenodo.org/record/1748277/files/CAM017... 1748277 \n",
238
+ "\n",
239
+ " dataset CAMID Response_status \n",
240
+ "0 Patricio Salazar CAM017505 404 \n",
241
+ "1 Patricio Salazar CAM017693 404 \n",
242
+ "2 Patricio Salazar CAM017821 404 \n",
243
+ "3 Patricio Salazar CAM017932 404 \n",
244
+ "4 Patricio Salazar CAM017971 404 "
245
+ ]
246
+ },
247
+ "execution_count": 4,
248
+ "metadata": {},
249
+ "output_type": "execute_result"
250
+ }
251
+ ],
252
+ "source": [
253
+ "ERROR_PATH = \"../metadata/Jiggins_Zenodo_Img_Master_3477891Patch_error_log_(readable).json\"\n",
254
+ "with open(ERROR_PATH, \"r\") as error_file:\n",
255
+ " errors = json.loads(error_file.read())\n",
256
+ "\n",
257
+ "error_df = pd.DataFrame(data = errors)\n",
258
+ "error_df.head()"
259
+ ]
260
+ },
261
+ {
262
+ "cell_type": "code",
263
+ "execution_count": 5,
264
+ "metadata": {},
265
+ "outputs": [
266
+ {
267
+ "name": "stdout",
268
+ "output_type": "stream",
269
+ "text": [
270
+ "23\n",
271
+ "0\n"
272
+ ]
273
+ }
274
+ ],
275
+ "source": [
276
+ "rec_4289223_df = error_df.loc[error_df[\"record_number\"] == \"4289223\"]\n",
277
+ "\n",
278
+ "missing_camids = []\n",
279
+ "for camid in list(rec_4289223_df[\"CAMID\"].unique()):\n",
280
+ " if camid not in list(fof_df.ID):\n",
281
+ " missing_camids.append(camid)\n",
282
+ "\n",
283
+ "print(rec_4289223_df.CAMID.nunique())\n",
284
+ "print(len(missing_camids))"
285
+ ]
286
+ },
287
+ {
288
+ "cell_type": "markdown",
289
+ "metadata": {},
290
+ "source": [
291
+ "Looks like they're all captured in this CSV, so we can check their URLs?"
292
+ ]
293
+ },
294
+ {
295
+ "cell_type": "code",
296
+ "execution_count": 6,
297
+ "metadata": {},
298
+ "outputs": [
299
+ {
300
+ "data": {
301
+ "text/plain": [
302
+ "['https://zenodo.org/record/4289223/files/CAM028509v.JPG',\n",
303
+ " 'https://zenodo.org/record/4289223/files/CAM028504d.JPG',\n",
304
+ " 'https://zenodo.org/record/4289223/files/CAM028508v.JPG',\n",
305
+ " 'https://zenodo.org/record/4289223/files/CAM028509d.JPG',\n",
306
+ " 'https://zenodo.org/record/4289223/files/CAM028502v.JPG',\n",
307
+ " 'https://zenodo.org/record/4289223/files/CAM028513v.CR2',\n",
308
+ " 'https://zenodo.org/record/4289223/files/CAM028514d.JPG']"
309
+ ]
310
+ },
311
+ "execution_count": 6,
312
+ "metadata": {},
313
+ "output_type": "execute_result"
314
+ }
315
+ ],
316
+ "source": [
317
+ "list(rec_4289223_df.file_url.sample(7))"
318
+ ]
319
+ },
320
+ {
321
+ "cell_type": "markdown",
322
+ "metadata": {},
323
+ "source": [
324
+ "These are listed in the CSV, but do not show up on the [record page](https://zenodo.org/records/4289223)."
325
+ ]
326
+ },
327
+ {
328
+ "cell_type": "markdown",
329
+ "metadata": {},
330
+ "source": [
331
+ "We saw in `EDA-DL-0-1.ipynb` that none of the error images were in the multimedia file from record 3477891, so we don't have a clear patch. All error records were saved to a CSV through that notebook."
332
+ ]
333
+ },
334
+ {
335
+ "cell_type": "code",
336
+ "execution_count": 7,
337
+ "metadata": {},
338
+ "outputs": [
339
+ {
340
+ "name": "stdout",
341
+ "output_type": "stream",
342
+ "text": [
343
+ "Index(['Image', 'file_url', 'record_number', 'dataset', 'CAMID',\n",
344
+ " 'Response_status', 'filename', 'view'],\n",
345
+ " dtype='object')\n"
346
+ ]
347
+ }
348
+ ],
349
+ "source": [
350
+ "error_df = pd.read_csv(\"../metadata/Jiggins_Zenodo_Img_Master_3477891Patch_error_log.csv\", low_memory = False)\n",
351
+ "print(error_df.columns)\n",
352
+ "\n",
353
+ "master = pd.read_csv(\"../Jiggins_Zenodo_Img_Master_3477891Patch.csv\", low_memory = False)"
354
+ ]
355
+ },
356
+ {
357
+ "cell_type": "code",
358
+ "execution_count": 8,
359
+ "metadata": {},
360
+ "outputs": [
361
+ {
362
+ "data": {
363
+ "text/html": [
364
+ "<div>\n",
365
+ "<style scoped>\n",
366
+ " .dataframe tbody tr th:only-of-type {\n",
367
+ " vertical-align: middle;\n",
368
+ " }\n",
369
+ "\n",
370
+ " .dataframe tbody tr th {\n",
371
+ " vertical-align: top;\n",
372
+ " }\n",
373
+ "\n",
374
+ " .dataframe thead th {\n",
375
+ " text-align: right;\n",
376
+ " }\n",
377
+ "</style>\n",
378
+ "<table border=\"1\" class=\"dataframe\">\n",
379
+ " <thead>\n",
380
+ " <tr style=\"text-align: right;\">\n",
381
+ " <th></th>\n",
382
+ " <th>Image</th>\n",
383
+ " <th>file_url</th>\n",
384
+ " <th>record_number</th>\n",
385
+ " <th>dataset</th>\n",
386
+ " <th>CAMID</th>\n",
387
+ " <th>Response_status</th>\n",
388
+ " <th>filename</th>\n",
389
+ " <th>view</th>\n",
390
+ " </tr>\n",
391
+ " </thead>\n",
392
+ " <tbody>\n",
393
+ " <tr>\n",
394
+ " <th>5</th>\n",
395
+ " <td>Heliconius melpomene ssp. malleti/14972_CAM028...</td>\n",
396
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
397
+ " <td>4289223</td>\n",
398
+ " <td>Cambridge Collection</td>\n",
399
+ " <td>CAM028501</td>\n",
400
+ " <td>404</td>\n",
401
+ " <td>14972_CAM028501v.JPG</td>\n",
402
+ " <td>ventral</td>\n",
403
+ " </tr>\n",
404
+ " <tr>\n",
405
+ " <th>6</th>\n",
406
+ " <td>Heliconius melpomene ssp. malleti/14971_CAM028...</td>\n",
407
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
408
+ " <td>4289223</td>\n",
409
+ " <td>Cambridge Collection</td>\n",
410
+ " <td>CAM028501</td>\n",
411
+ " <td>404</td>\n",
412
+ " <td>14971_CAM028501d.JPG</td>\n",
413
+ " <td>dorsal</td>\n",
414
+ " </tr>\n",
415
+ " <tr>\n",
416
+ " <th>7</th>\n",
417
+ " <td>Heliconius melpomene ssp. malleti/14973_CAM028...</td>\n",
418
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
419
+ " <td>4289223</td>\n",
420
+ " <td>Cambridge Collection</td>\n",
421
+ " <td>CAM028502</td>\n",
422
+ " <td>404</td>\n",
423
+ " <td>14973_CAM028502d.JPG</td>\n",
424
+ " <td>dorsal</td>\n",
425
+ " </tr>\n",
426
+ " <tr>\n",
427
+ " <th>8</th>\n",
428
+ " <td>Heliconius melpomene ssp. malleti/14974_CAM028...</td>\n",
429
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
430
+ " <td>4289223</td>\n",
431
+ " <td>Cambridge Collection</td>\n",
432
+ " <td>CAM028502</td>\n",
433
+ " <td>404</td>\n",
434
+ " <td>14974_CAM028502v.JPG</td>\n",
435
+ " <td>ventral</td>\n",
436
+ " </tr>\n",
437
+ " <tr>\n",
438
+ " <th>9</th>\n",
439
+ " <td>Heliconius melpomene ssp. plesseni/14975_CAM02...</td>\n",
440
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
441
+ " <td>4289223</td>\n",
442
+ " <td>Cambridge Collection</td>\n",
443
+ " <td>CAM028503</td>\n",
444
+ " <td>404</td>\n",
445
+ " <td>14975_CAM028503d.JPG</td>\n",
446
+ " <td>dorsal</td>\n",
447
+ " </tr>\n",
448
+ " </tbody>\n",
449
+ "</table>\n",
450
+ "</div>"
451
+ ],
452
+ "text/plain": [
453
+ " Image \\\n",
454
+ "5 Heliconius melpomene ssp. malleti/14972_CAM028... \n",
455
+ "6 Heliconius melpomene ssp. malleti/14971_CAM028... \n",
456
+ "7 Heliconius melpomene ssp. malleti/14973_CAM028... \n",
457
+ "8 Heliconius melpomene ssp. malleti/14974_CAM028... \n",
458
+ "9 Heliconius melpomene ssp. plesseni/14975_CAM02... \n",
459
+ "\n",
460
+ " file_url record_number \\\n",
461
+ "5 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
462
+ "6 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
463
+ "7 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
464
+ "8 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
465
+ "9 https://zenodo.org/record/4289223/files/CAM028... 4289223 \n",
466
+ "\n",
467
+ " dataset CAMID Response_status filename \\\n",
468
+ "5 Cambridge Collection CAM028501 404 14972_CAM028501v.JPG \n",
469
+ "6 Cambridge Collection CAM028501 404 14971_CAM028501d.JPG \n",
470
+ "7 Cambridge Collection CAM028502 404 14973_CAM028502d.JPG \n",
471
+ "8 Cambridge Collection CAM028502 404 14974_CAM028502v.JPG \n",
472
+ "9 Cambridge Collection CAM028503 404 14975_CAM028503d.JPG \n",
473
+ "\n",
474
+ " view \n",
475
+ "5 ventral \n",
476
+ "6 dorsal \n",
477
+ "7 dorsal \n",
478
+ "8 ventral \n",
479
+ "9 dorsal "
480
+ ]
481
+ },
482
+ "execution_count": 8,
483
+ "metadata": {},
484
+ "output_type": "execute_result"
485
+ }
486
+ ],
487
+ "source": [
488
+ "error_42 = error_df.loc[error_df[\"record_number\"] == 4289223].copy()\n",
489
+ "error_42.head()"
490
+ ]
491
+ },
492
+ {
493
+ "cell_type": "code",
494
+ "execution_count": 9,
495
+ "metadata": {},
496
+ "outputs": [],
497
+ "source": [
498
+ "def get_x(filename):\n",
499
+ " return int(filename.split(\"_\")[0])"
500
+ ]
501
+ },
502
+ {
503
+ "cell_type": "code",
504
+ "execution_count": 10,
505
+ "metadata": {},
506
+ "outputs": [
507
+ {
508
+ "data": {
509
+ "text/html": [
510
+ "<div>\n",
511
+ "<style scoped>\n",
512
+ " .dataframe tbody tr th:only-of-type {\n",
513
+ " vertical-align: middle;\n",
514
+ " }\n",
515
+ "\n",
516
+ " .dataframe tbody tr th {\n",
517
+ " vertical-align: top;\n",
518
+ " }\n",
519
+ "\n",
520
+ " .dataframe thead th {\n",
521
+ " text-align: right;\n",
522
+ " }\n",
523
+ "</style>\n",
524
+ "<table border=\"1\" class=\"dataframe\">\n",
525
+ " <thead>\n",
526
+ " <tr style=\"text-align: right;\">\n",
527
+ " <th></th>\n",
528
+ " <th>CAMID</th>\n",
529
+ " <th>X</th>\n",
530
+ " <th>Image_name</th>\n",
531
+ " <th>View</th>\n",
532
+ " <th>zenodo_name</th>\n",
533
+ " <th>zenodo_link</th>\n",
534
+ " <th>Sequence</th>\n",
535
+ " <th>Taxonomic_Name</th>\n",
536
+ " <th>Locality</th>\n",
537
+ " <th>Sample_accession</th>\n",
538
+ " <th>...</th>\n",
539
+ " <th>Stage</th>\n",
540
+ " <th>Sex</th>\n",
541
+ " <th>Unit_Type</th>\n",
542
+ " <th>file_type</th>\n",
543
+ " <th>record_number</th>\n",
544
+ " <th>species</th>\n",
545
+ " <th>subspecies</th>\n",
546
+ " <th>genus</th>\n",
547
+ " <th>file_url</th>\n",
548
+ " <th>hybrid_stat</th>\n",
549
+ " </tr>\n",
550
+ " </thead>\n",
551
+ " <tbody>\n",
552
+ " <tr>\n",
553
+ " <th>24194</th>\n",
554
+ " <td>CAM028501</td>\n",
555
+ " <td>14972</td>\n",
556
+ " <td>CAM028501v.JPG</td>\n",
557
+ " <td>ventral</td>\n",
558
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
559
+ " <td>https://zenodo.org/record/4289223</td>\n",
560
+ " <td>28,501</td>\n",
561
+ " <td>Heliconius melpomene ssp. malleti</td>\n",
562
+ " <td>Río Pusuno</td>\n",
563
+ " <td>NaN</td>\n",
564
+ " <td>...</td>\n",
565
+ " <td>NaN</td>\n",
566
+ " <td>Male</td>\n",
567
+ " <td>Wild</td>\n",
568
+ " <td>jpg</td>\n",
569
+ " <td>4289223</td>\n",
570
+ " <td>Heliconius melpomene</td>\n",
571
+ " <td>malleti</td>\n",
572
+ " <td>Heliconius</td>\n",
573
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
574
+ " <td>non-hybrid</td>\n",
575
+ " </tr>\n",
576
+ " <tr>\n",
577
+ " <th>24195</th>\n",
578
+ " <td>CAM028501</td>\n",
579
+ " <td>14971</td>\n",
580
+ " <td>CAM028501d.JPG</td>\n",
581
+ " <td>dorsal</td>\n",
582
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
583
+ " <td>https://zenodo.org/record/4289223</td>\n",
584
+ " <td>28,501</td>\n",
585
+ " <td>Heliconius melpomene ssp. malleti</td>\n",
586
+ " <td>Río Pusuno</td>\n",
587
+ " <td>NaN</td>\n",
588
+ " <td>...</td>\n",
589
+ " <td>NaN</td>\n",
590
+ " <td>Male</td>\n",
591
+ " <td>Wild</td>\n",
592
+ " <td>jpg</td>\n",
593
+ " <td>4289223</td>\n",
594
+ " <td>Heliconius melpomene</td>\n",
595
+ " <td>malleti</td>\n",
596
+ " <td>Heliconius</td>\n",
597
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
598
+ " <td>non-hybrid</td>\n",
599
+ " </tr>\n",
600
+ " <tr>\n",
601
+ " <th>24196</th>\n",
602
+ " <td>CAM028502</td>\n",
603
+ " <td>14973</td>\n",
604
+ " <td>CAM028502d.JPG</td>\n",
605
+ " <td>dorsal</td>\n",
606
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
607
+ " <td>https://zenodo.org/record/4289223</td>\n",
608
+ " <td>28,502</td>\n",
609
+ " <td>Heliconius melpomene ssp. malleti</td>\n",
610
+ " <td>Río Pusuno</td>\n",
611
+ " <td>NaN</td>\n",
612
+ " <td>...</td>\n",
613
+ " <td>NaN</td>\n",
614
+ " <td>Male</td>\n",
615
+ " <td>Wild</td>\n",
616
+ " <td>jpg</td>\n",
617
+ " <td>4289223</td>\n",
618
+ " <td>Heliconius melpomene</td>\n",
619
+ " <td>malleti</td>\n",
620
+ " <td>Heliconius</td>\n",
621
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
622
+ " <td>non-hybrid</td>\n",
623
+ " </tr>\n",
624
+ " <tr>\n",
625
+ " <th>24197</th>\n",
626
+ " <td>CAM028502</td>\n",
627
+ " <td>14974</td>\n",
628
+ " <td>CAM028502v.JPG</td>\n",
629
+ " <td>ventral</td>\n",
630
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
631
+ " <td>https://zenodo.org/record/4289223</td>\n",
632
+ " <td>28,502</td>\n",
633
+ " <td>Heliconius melpomene ssp. malleti</td>\n",
634
+ " <td>Río Pusuno</td>\n",
635
+ " <td>NaN</td>\n",
636
+ " <td>...</td>\n",
637
+ " <td>NaN</td>\n",
638
+ " <td>Male</td>\n",
639
+ " <td>Wild</td>\n",
640
+ " <td>jpg</td>\n",
641
+ " <td>4289223</td>\n",
642
+ " <td>Heliconius melpomene</td>\n",
643
+ " <td>malleti</td>\n",
644
+ " <td>Heliconius</td>\n",
645
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
646
+ " <td>non-hybrid</td>\n",
647
+ " </tr>\n",
648
+ " <tr>\n",
649
+ " <th>24198</th>\n",
650
+ " <td>CAM028503</td>\n",
651
+ " <td>14975</td>\n",
652
+ " <td>CAM028503d.JPG</td>\n",
653
+ " <td>dorsal</td>\n",
654
+ " <td>0.2.rachel.blow.mel.tim.ikiam.csv</td>\n",
655
+ " <td>https://zenodo.org/record/4289223</td>\n",
656
+ " <td>28,503</td>\n",
657
+ " <td>Heliconius melpomene ssp. plesseni</td>\n",
658
+ " <td>Huaymayaco</td>\n",
659
+ " <td>NaN</td>\n",
660
+ " <td>...</td>\n",
661
+ " <td>NaN</td>\n",
662
+ " <td>Male</td>\n",
663
+ " <td>Wild</td>\n",
664
+ " <td>jpg</td>\n",
665
+ " <td>4289223</td>\n",
666
+ " <td>Heliconius melpomene</td>\n",
667
+ " <td>plesseni</td>\n",
668
+ " <td>Heliconius</td>\n",
669
+ " <td>https://zenodo.org/record/4289223/files/CAM028...</td>\n",
670
+ " <td>non-hybrid</td>\n",
671
+ " </tr>\n",
672
+ " </tbody>\n",
673
+ "</table>\n",
674
+ "<p>5 rows × 28 columns</p>\n",
675
+ "</div>"
676
+ ],
677
+ "text/plain": [
678
+ " CAMID X Image_name View \\\n",
679
+ "24194 CAM028501 14972 CAM028501v.JPG ventral \n",
680
+ "24195 CAM028501 14971 CAM028501d.JPG dorsal \n",
681
+ "24196 CAM028502 14973 CAM028502d.JPG dorsal \n",
682
+ "24197 CAM028502 14974 CAM028502v.JPG ventral \n",
683
+ "24198 CAM028503 14975 CAM028503d.JPG dorsal \n",
684
+ "\n",
685
+ " zenodo_name zenodo_link \\\n",
686
+ "24194 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
687
+ "24195 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
688
+ "24196 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
689
+ "24197 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
690
+ "24198 0.2.rachel.blow.mel.tim.ikiam.csv https://zenodo.org/record/4289223 \n",
691
+ "\n",
692
+ " Sequence Taxonomic_Name Locality \\\n",
693
+ "24194 28,501 Heliconius melpomene ssp. malleti Río Pusuno \n",
694
+ "24195 28,501 Heliconius melpomene ssp. malleti Río Pusuno \n",
695
+ "24196 28,502 Heliconius melpomene ssp. malleti Río Pusuno \n",
696
+ "24197 28,502 Heliconius melpomene ssp. malleti Río Pusuno \n",
697
+ "24198 28,503 Heliconius melpomene ssp. plesseni Huaymayaco \n",
698
+ "\n",
699
+ " Sample_accession ... Stage Sex Unit_Type file_type record_number \\\n",
700
+ "24194 NaN ... NaN Male Wild jpg 4289223 \n",
701
+ "24195 NaN ... NaN Male Wild jpg 4289223 \n",
702
+ "24196 NaN ... NaN Male Wild jpg 4289223 \n",
703
+ "24197 NaN ... NaN Male Wild jpg 4289223 \n",
704
+ "24198 NaN ... NaN Male Wild jpg 4289223 \n",
705
+ "\n",
706
+ " species subspecies genus \\\n",
707
+ "24194 Heliconius melpomene malleti Heliconius \n",
708
+ "24195 Heliconius melpomene malleti Heliconius \n",
709
+ "24196 Heliconius melpomene malleti Heliconius \n",
710
+ "24197 Heliconius melpomene malleti Heliconius \n",
711
+ "24198 Heliconius melpomene plesseni Heliconius \n",
712
+ "\n",
713
+ " file_url hybrid_stat \n",
714
+ "24194 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
715
+ "24195 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
716
+ "24196 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
717
+ "24197 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
718
+ "24198 https://zenodo.org/record/4289223/files/CAM028... non-hybrid \n",
719
+ "\n",
720
+ "[5 rows x 28 columns]"
721
+ ]
722
+ },
723
+ "execution_count": 10,
724
+ "metadata": {},
725
+ "output_type": "execute_result"
726
+ }
727
+ ],
728
+ "source": [
729
+ "error_42[\"X\"] = error_42[\"filename\"].apply(get_x)\n",
730
+ "\n",
731
+ "master_42 = master.loc[master[\"X\"].isin(list(error_42[\"X\"]))].copy()\n",
732
+ "master_42.head()"
733
+ ]
734
+ },
735
+ {
736
+ "cell_type": "code",
737
+ "execution_count": 11,
738
+ "metadata": {},
739
+ "outputs": [
740
+ {
741
+ "data": {
742
+ "text/html": [
743
+ "<div>\n",
744
+ "<style scoped>\n",
745
+ " .dataframe tbody tr th:only-of-type {\n",
746
+ " vertical-align: middle;\n",
747
+ " }\n",
748
+ "\n",
749
+ " .dataframe tbody tr th {\n",
750
+ " vertical-align: top;\n",
751
+ " }\n",
752
+ "\n",
753
+ " .dataframe thead th {\n",
754
+ " text-align: right;\n",
755
+ " }\n",
756
+ "</style>\n",
757
+ "<table border=\"1\" class=\"dataframe\">\n",
758
+ " <thead>\n",
759
+ " <tr style=\"text-align: right;\">\n",
760
+ " <th></th>\n",
761
+ " <th>CAMID</th>\n",
762
+ " <th>X</th>\n",
763
+ " <th>Image_name</th>\n",
764
+ " <th>View</th>\n",
765
+ " <th>zenodo_name</th>\n",
766
+ " <th>zenodo_link</th>\n",
767
+ " <th>Sequence</th>\n",
768
+ " <th>Taxonomic_Name</th>\n",
769
+ " <th>Locality</th>\n",
770
+ " <th>Sample_accession</th>\n",
771
+ " <th>...</th>\n",
772
+ " <th>Stage</th>\n",
773
+ " <th>Sex</th>\n",
774
+ " <th>Unit_Type</th>\n",
775
+ " <th>file_type</th>\n",
776
+ " <th>record_number</th>\n",
777
+ " <th>species</th>\n",
778
+ " <th>subspecies</th>\n",
779
+ " <th>genus</th>\n",
780
+ " <th>file_url</th>\n",
781
+ " <th>hybrid_stat</th>\n",
782
+ " </tr>\n",
783
+ " </thead>\n",
784
+ " <tbody>\n",
785
+ " </tbody>\n",
786
+ "</table>\n",
787
+ "<p>0 rows × 28 columns</p>\n",
788
+ "</div>"
789
+ ],
790
+ "text/plain": [
791
+ "Empty DataFrame\n",
792
+ "Columns: [CAMID, X, Image_name, View, zenodo_name, zenodo_link, Sequence, Taxonomic_Name, Locality, Sample_accession, Collected_by, Other_ID, Date, Dataset, Store, Brood, Death_Date, Cross_Type, Stage, Sex, Unit_Type, file_type, record_number, species, subspecies, genus, file_url, hybrid_stat]\n",
793
+ "Index: []\n",
794
+ "\n",
795
+ "[0 rows x 28 columns]"
796
+ ]
797
+ },
798
+ "execution_count": 11,
799
+ "metadata": {},
800
+ "output_type": "execute_result"
801
+ }
802
+ ],
803
+ "source": [
804
+ "master.loc[(master[\"Image_name\"].isin(list(master_42.Image_name.unique()))) & (~master[\"record_number\"] == 4289223)]"
805
+ ]
806
+ },
807
+ {
808
+ "cell_type": "markdown",
809
+ "metadata": {},
810
+ "source": [
811
+ "Can't align these elsewhere based on `Image_name` either."
812
+ ]
813
+ },
814
+ {
815
+ "cell_type": "code",
816
+ "execution_count": null,
817
+ "metadata": {},
818
+ "outputs": [],
819
+ "source": []
820
+ }
821
+ ],
822
+ "metadata": {
823
+ "kernelspec": {
824
+ "display_name": "std",
825
+ "language": "python",
826
+ "name": "python3"
827
+ },
828
+ "language_info": {
829
+ "codemirror_mode": {
830
+ "name": "ipython",
831
+ "version": 3
832
+ },
833
+ "file_extension": ".py",
834
+ "mimetype": "text/x-python",
835
+ "name": "python",
836
+ "nbconvert_exporter": "python",
837
+ "pygments_lexer": "ipython3",
838
+ "version": "3.11.3"
839
+ }
840
+ },
841
+ "nbformat": 4,
842
+ "nbformat_minor": 2
843
+ }
deduplication_process/notebooks/EDA-DL-0-3.ipynb ADDED
The diff for this file is too large to render. See raw diff