We may have a content/page ID mismatch.
Browse files- data/eol_files/eol_cp_not_media.csv +3 -0
- notebooks/ToL_license_check.ipynb +357 -160
- notebooks/ToL_license_check.py +56 -5
data/eol_files/eol_cp_not_media.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:25fb2f25447f09ac53ea1a180c653eb60b31dcddc304ab2c54efc0e5914b2c7b
|
| 3 |
+
size 6009977
|
notebooks/ToL_license_check.ipynb
CHANGED
|
@@ -24,18 +24,9 @@
|
|
| 24 |
"cell_type": "code",
|
| 25 |
"execution_count": 2,
|
| 26 |
"metadata": {},
|
| 27 |
-
"outputs": [
|
| 28 |
-
{
|
| 29 |
-
"name": "stderr",
|
| 30 |
-
"output_type": "stream",
|
| 31 |
-
"text": [
|
| 32 |
-
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_23442/4112647395.py:1: DtypeWarning: Columns (5,6,7,14,15) have mixed types. Specify dtype option on import or set low_memory=False.\n",
|
| 33 |
-
" df = pd.read_csv(\"../data/predicted-catalog.csv\")\n"
|
| 34 |
-
]
|
| 35 |
-
}
|
| 36 |
-
],
|
| 37 |
"source": [
|
| 38 |
-
"df = pd.read_csv(\"../data/predicted-catalog.csv\",
|
| 39 |
]
|
| 40 |
},
|
| 41 |
{
|
|
@@ -290,7 +281,7 @@
|
|
| 290 |
},
|
| 291 |
{
|
| 292 |
"cell_type": "code",
|
| 293 |
-
"execution_count":
|
| 294 |
"metadata": {},
|
| 295 |
"outputs": [],
|
| 296 |
"source": [
|
|
@@ -309,7 +300,7 @@
|
|
| 309 |
},
|
| 310 |
{
|
| 311 |
"cell_type": "code",
|
| 312 |
-
"execution_count":
|
| 313 |
"metadata": {},
|
| 314 |
"outputs": [],
|
| 315 |
"source": [
|
|
@@ -473,29 +464,29 @@
|
|
| 473 |
"</div>"
|
| 474 |
],
|
| 475 |
"text/plain": [
|
| 476 |
-
" split treeoflife_id eol_content_id eol_page_id
|
| 477 |
-
"0 train f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926.0 269504.0
|
| 478 |
"1 train 5faa4f55-32e9-4872-953d-567e5d232e52 22291283.0 6101931.0 \n",
|
| 479 |
"2 train 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775.0 45513632.0 \n",
|
| 480 |
"3 train 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812.0 51655800.0 \n",
|
| 481 |
"4 train f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643.0 45515896.0 \n",
|
| 482 |
"\n",
|
| 483 |
-
" bioscan_part bioscan_filename inat21_filename inat21_cls_name
|
| 484 |
-
"0 NaN NaN NaN NaN
|
| 485 |
"1 NaN NaN NaN NaN \n",
|
| 486 |
"2 NaN NaN NaN NaN \n",
|
| 487 |
"3 NaN NaN NaN NaN \n",
|
| 488 |
"4 NaN NaN NaN NaN \n",
|
| 489 |
"\n",
|
| 490 |
-
" inat21_cls_num kingdom phylum class order
|
| 491 |
-
"0 NaN Animalia Arthropoda Insecta Lepidoptera
|
| 492 |
"1 NaN Plantae Tracheophyta Polypodiopsida Polypodiales \n",
|
| 493 |
"2 NaN Animalia Chordata Aves Passeriformes \n",
|
| 494 |
"3 NaN NaN NaN NaN NaN \n",
|
| 495 |
"4 NaN Animalia Chordata Aves Casuariiformes \n",
|
| 496 |
"\n",
|
| 497 |
-
" family genus species common
|
| 498 |
-
"0 Lycaenidae Orthomiella rantaizana Chinese Straight-wing Blue
|
| 499 |
"1 Woodsiaceae Woodsia subcordata Woodsia subcordata \n",
|
| 500 |
"2 Laniidae Lanius minor Lesser Grey Shrike \n",
|
| 501 |
"3 NaN NaN tenuis Tenuis \n",
|
|
@@ -527,7 +518,7 @@
|
|
| 527 |
},
|
| 528 |
{
|
| 529 |
"cell_type": "code",
|
| 530 |
-
"execution_count":
|
| 531 |
"metadata": {},
|
| 532 |
"outputs": [
|
| 533 |
{
|
|
@@ -536,7 +527,7 @@
|
|
| 536 |
"Index(['treeoflife_id', 'eol_content_id', 'eol_page_id'], dtype='object')"
|
| 537 |
]
|
| 538 |
},
|
| 539 |
-
"execution_count":
|
| 540 |
"metadata": {},
|
| 541 |
"output_type": "execute_result"
|
| 542 |
}
|
|
@@ -548,7 +539,7 @@
|
|
| 548 |
},
|
| 549 |
{
|
| 550 |
"cell_type": "code",
|
| 551 |
-
"execution_count":
|
| 552 |
"metadata": {},
|
| 553 |
"outputs": [],
|
| 554 |
"source": [
|
|
@@ -558,84 +549,9 @@
|
|
| 558 |
},
|
| 559 |
{
|
| 560 |
"cell_type": "code",
|
| 561 |
-
"execution_count":
|
| 562 |
"metadata": {},
|
| 563 |
-
"outputs": [
|
| 564 |
-
{
|
| 565 |
-
"data": {
|
| 566 |
-
"text/html": [
|
| 567 |
-
"<div>\n",
|
| 568 |
-
"<style scoped>\n",
|
| 569 |
-
" .dataframe tbody tr th:only-of-type {\n",
|
| 570 |
-
" vertical-align: middle;\n",
|
| 571 |
-
" }\n",
|
| 572 |
-
"\n",
|
| 573 |
-
" .dataframe tbody tr th {\n",
|
| 574 |
-
" vertical-align: top;\n",
|
| 575 |
-
" }\n",
|
| 576 |
-
"\n",
|
| 577 |
-
" .dataframe thead th {\n",
|
| 578 |
-
" text-align: right;\n",
|
| 579 |
-
" }\n",
|
| 580 |
-
"</style>\n",
|
| 581 |
-
"<table border=\"1\" class=\"dataframe\">\n",
|
| 582 |
-
" <thead>\n",
|
| 583 |
-
" <tr style=\"text-align: right;\">\n",
|
| 584 |
-
" <th></th>\n",
|
| 585 |
-
" <th>treeoflife_id</th>\n",
|
| 586 |
-
" <th>eol_content_id</th>\n",
|
| 587 |
-
" <th>eol_page_id</th>\n",
|
| 588 |
-
" </tr>\n",
|
| 589 |
-
" </thead>\n",
|
| 590 |
-
" <tbody>\n",
|
| 591 |
-
" <tr>\n",
|
| 592 |
-
" <th>0</th>\n",
|
| 593 |
-
" <td>f2f0aa29-e87b-469c-bf5b-51a3611ab001</td>\n",
|
| 594 |
-
" <td>22131926.0</td>\n",
|
| 595 |
-
" <td>269504.0</td>\n",
|
| 596 |
-
" </tr>\n",
|
| 597 |
-
" <tr>\n",
|
| 598 |
-
" <th>1</th>\n",
|
| 599 |
-
" <td>5faa4f55-32e9-4872-953d-567e5d232e52</td>\n",
|
| 600 |
-
" <td>22291283.0</td>\n",
|
| 601 |
-
" <td>6101931.0</td>\n",
|
| 602 |
-
" </tr>\n",
|
| 603 |
-
" <tr>\n",
|
| 604 |
-
" <th>2</th>\n",
|
| 605 |
-
" <td>2282f2bf-2b52-4522-b588-dd6f356d5fd6</td>\n",
|
| 606 |
-
" <td>21802775.0</td>\n",
|
| 607 |
-
" <td>45513632.0</td>\n",
|
| 608 |
-
" </tr>\n",
|
| 609 |
-
" <tr>\n",
|
| 610 |
-
" <th>3</th>\n",
|
| 611 |
-
" <td>76b57c36-2181-4e6d-a5c4-b40e22a09449</td>\n",
|
| 612 |
-
" <td>12784812.0</td>\n",
|
| 613 |
-
" <td>51655800.0</td>\n",
|
| 614 |
-
" </tr>\n",
|
| 615 |
-
" <tr>\n",
|
| 616 |
-
" <th>4</th>\n",
|
| 617 |
-
" <td>f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2</td>\n",
|
| 618 |
-
" <td>29713643.0</td>\n",
|
| 619 |
-
" <td>45515896.0</td>\n",
|
| 620 |
-
" </tr>\n",
|
| 621 |
-
" </tbody>\n",
|
| 622 |
-
"</table>\n",
|
| 623 |
-
"</div>"
|
| 624 |
-
],
|
| 625 |
-
"text/plain": [
|
| 626 |
-
" treeoflife_id eol_content_id eol_page_id\n",
|
| 627 |
-
"0 f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926.0 269504.0\n",
|
| 628 |
-
"1 5faa4f55-32e9-4872-953d-567e5d232e52 22291283.0 6101931.0\n",
|
| 629 |
-
"2 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775.0 45513632.0\n",
|
| 630 |
-
"3 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812.0 51655800.0\n",
|
| 631 |
-
"4 f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643.0 45515896.0"
|
| 632 |
-
]
|
| 633 |
-
},
|
| 634 |
-
"execution_count": 11,
|
| 635 |
-
"metadata": {},
|
| 636 |
-
"output_type": "execute_result"
|
| 637 |
-
}
|
| 638 |
-
],
|
| 639 |
"source": [
|
| 640 |
"eol_license_df.head()"
|
| 641 |
]
|
|
@@ -659,17 +575,9 @@
|
|
| 659 |
},
|
| 660 |
{
|
| 661 |
"cell_type": "code",
|
| 662 |
-
"execution_count":
|
| 663 |
"metadata": {},
|
| 664 |
"outputs": [
|
| 665 |
-
{
|
| 666 |
-
"name": "stderr",
|
| 667 |
-
"output_type": "stream",
|
| 668 |
-
"text": [
|
| 669 |
-
"/var/folders/nv/f0fq1p1n1_3b11x579py_0q80000gq/T/ipykernel_23442/2809897267.py:1: DtypeWarning: Columns (5) have mixed types. Specify dtype option on import or set low_memory=False.\n",
|
| 670 |
-
" media = pd.read_csv(\"../data/media_manifest (july 26).csv\")\n"
|
| 671 |
-
]
|
| 672 |
-
},
|
| 673 |
{
|
| 674 |
"name": "stdout",
|
| 675 |
"output_type": "stream",
|
|
@@ -697,16 +605,28 @@
|
|
| 697 |
},
|
| 698 |
{
|
| 699 |
"cell_type": "code",
|
| 700 |
-
"execution_count":
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 701 |
"metadata": {},
|
| 702 |
"outputs": [
|
| 703 |
{
|
| 704 |
"data": {
|
| 705 |
"text/plain": [
|
| 706 |
-
"(
|
| 707 |
]
|
| 708 |
},
|
| 709 |
-
"execution_count":
|
| 710 |
"metadata": {},
|
| 711 |
"output_type": "execute_result"
|
| 712 |
}
|
|
@@ -715,6 +635,57 @@
|
|
| 715 |
"eol_license_df.shape"
|
| 716 |
]
|
| 717 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 718 |
{
|
| 719 |
"cell_type": "markdown",
|
| 720 |
"metadata": {},
|
|
@@ -724,7 +695,7 @@
|
|
| 724 |
},
|
| 725 |
{
|
| 726 |
"cell_type": "code",
|
| 727 |
-
"execution_count":
|
| 728 |
"metadata": {},
|
| 729 |
"outputs": [],
|
| 730 |
"source": [
|
|
@@ -733,7 +704,7 @@
|
|
| 733 |
},
|
| 734 |
{
|
| 735 |
"cell_type": "code",
|
| 736 |
-
"execution_count":
|
| 737 |
"metadata": {},
|
| 738 |
"outputs": [],
|
| 739 |
"source": [
|
|
@@ -742,7 +713,7 @@
|
|
| 742 |
},
|
| 743 |
{
|
| 744 |
"cell_type": "code",
|
| 745 |
-
"execution_count":
|
| 746 |
"metadata": {},
|
| 747 |
"outputs": [
|
| 748 |
{
|
|
@@ -755,14 +726,14 @@
|
|
| 755 |
" # Column Non-Null Count Dtype \n",
|
| 756 |
"--- ------ -------------- ----- \n",
|
| 757 |
" 0 treeoflife_id 6277374 non-null object \n",
|
| 758 |
-
" 1 eol_content_id 6277374 non-null
|
| 759 |
-
" 2
|
| 760 |
-
" 3
|
| 761 |
" 4 Medium Source URL 6163903 non-null object \n",
|
| 762 |
" 5 EOL Full-Size Copy URL 6163903 non-null object \n",
|
| 763 |
" 6 License Name 6163903 non-null object \n",
|
| 764 |
" 7 Copyright Owner 5549428 non-null object \n",
|
| 765 |
-
"dtypes: float64(
|
| 766 |
"memory usage: 383.1+ MB\n"
|
| 767 |
]
|
| 768 |
}
|
|
@@ -775,12 +746,12 @@
|
|
| 775 |
"cell_type": "markdown",
|
| 776 |
"metadata": {},
|
| 777 |
"source": [
|
| 778 |
-
"
|
| 779 |
]
|
| 780 |
},
|
| 781 |
{
|
| 782 |
"cell_type": "code",
|
| 783 |
-
"execution_count":
|
| 784 |
"metadata": {},
|
| 785 |
"outputs": [
|
| 786 |
{
|
|
@@ -806,8 +777,8 @@
|
|
| 806 |
" <th></th>\n",
|
| 807 |
" <th>treeoflife_id</th>\n",
|
| 808 |
" <th>eol_content_id</th>\n",
|
| 809 |
-
" <th>
|
| 810 |
-
" <th>
|
| 811 |
" <th>Medium Source URL</th>\n",
|
| 812 |
" <th>EOL Full-Size Copy URL</th>\n",
|
| 813 |
" <th>License Name</th>\n",
|
|
@@ -818,8 +789,8 @@
|
|
| 818 |
" <tr>\n",
|
| 819 |
" <th>0</th>\n",
|
| 820 |
" <td>f2f0aa29-e87b-469c-bf5b-51a3611ab001</td>\n",
|
| 821 |
-
" <td>22131926
|
| 822 |
-
" <td>269504
|
| 823 |
" <td>269504.0</td>\n",
|
| 824 |
" <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
|
| 825 |
" <td>https://content.eol.org/data/media/6a/ed/7a/18...</td>\n",
|
|
@@ -829,8 +800,8 @@
|
|
| 829 |
" <tr>\n",
|
| 830 |
" <th>1</th>\n",
|
| 831 |
" <td>5faa4f55-32e9-4872-953d-567e5d232e52</td>\n",
|
| 832 |
-
" <td>22291283
|
| 833 |
-
" <td>6101931
|
| 834 |
" <td>6101931.0</td>\n",
|
| 835 |
" <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
|
| 836 |
" <td>https://content.eol.org/data/media/7b/bc/92/18...</td>\n",
|
|
@@ -840,8 +811,8 @@
|
|
| 840 |
" <tr>\n",
|
| 841 |
" <th>2</th>\n",
|
| 842 |
" <td>2282f2bf-2b52-4522-b588-dd6f356d5fd6</td>\n",
|
| 843 |
-
" <td>21802775
|
| 844 |
-
" <td>45513632
|
| 845 |
" <td>45513632.0</td>\n",
|
| 846 |
" <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
|
| 847 |
" <td>https://content.eol.org/data/media/66/be/16/18...</td>\n",
|
|
@@ -851,8 +822,8 @@
|
|
| 851 |
" <tr>\n",
|
| 852 |
" <th>3</th>\n",
|
| 853 |
" <td>76b57c36-2181-4e6d-a5c4-b40e22a09449</td>\n",
|
| 854 |
-
" <td>12784812
|
| 855 |
-
" <td>51655800
|
| 856 |
" <td>51655800.0</td>\n",
|
| 857 |
" <td>http://www.femorale.com/shellphotos/photos15/3...</td>\n",
|
| 858 |
" <td>https://content.eol.org/data/media/c4/79/dc/14...</td>\n",
|
|
@@ -862,8 +833,8 @@
|
|
| 862 |
" <tr>\n",
|
| 863 |
" <th>4</th>\n",
|
| 864 |
" <td>f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2</td>\n",
|
| 865 |
-
" <td>29713643
|
| 866 |
-
" <td>45515896
|
| 867 |
" <td>45515896.0</td>\n",
|
| 868 |
" <td>https://upload.wikimedia.org/wikipedia/commons...</td>\n",
|
| 869 |
" <td>https://content.eol.org/data/media/5f/ef/95/50...</td>\n",
|
|
@@ -875,22 +846,22 @@
|
|
| 875 |
"</div>"
|
| 876 |
],
|
| 877 |
"text/plain": [
|
| 878 |
-
" treeoflife_id eol_content_id
|
| 879 |
-
"0 f2f0aa29-e87b-469c-bf5b-51a3611ab001
|
| 880 |
-
"1 5faa4f55-32e9-4872-953d-567e5d232e52
|
| 881 |
-
"2 2282f2bf-2b52-4522-b588-dd6f356d5fd6
|
| 882 |
-
"3 76b57c36-2181-4e6d-a5c4-b40e22a09449
|
| 883 |
-
"4 f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2
|
| 884 |
"\n",
|
| 885 |
-
"
|
| 886 |
-
"0
|
| 887 |
-
"1
|
| 888 |
-
"2
|
| 889 |
-
"3
|
| 890 |
-
"4
|
| 891 |
"\n",
|
| 892 |
-
" EOL Full-Size Copy URL License Name
|
| 893 |
-
"0 https://content.eol.org/data/media/6a/ed/7a/18... cc-by-nc-4.0
|
| 894 |
"1 https://content.eol.org/data/media/7b/bc/92/18... cc-by-nc-4.0 \n",
|
| 895 |
"2 https://content.eol.org/data/media/66/be/16/18... cc-by-nc-4.0 \n",
|
| 896 |
"3 https://content.eol.org/data/media/c4/79/dc/14... cc-by-nc \n",
|
|
@@ -904,7 +875,7 @@
|
|
| 904 |
"4 NaN "
|
| 905 |
]
|
| 906 |
},
|
| 907 |
-
"execution_count":
|
| 908 |
"metadata": {},
|
| 909 |
"output_type": "execute_result"
|
| 910 |
}
|
|
@@ -915,37 +886,263 @@
|
|
| 915 |
},
|
| 916 |
{
|
| 917 |
"cell_type": "code",
|
| 918 |
-
"execution_count":
|
| 919 |
"metadata": {},
|
| 920 |
"outputs": [
|
| 921 |
{
|
| 922 |
"data": {
|
| 923 |
"text/plain": [
|
| 924 |
-
"treeoflife_id
|
| 925 |
-
"eol_content_id
|
| 926 |
-
"
|
| 927 |
-
"
|
| 928 |
-
"Medium Source URL
|
| 929 |
-
"EOL Full-Size Copy URL
|
| 930 |
-
"License Name
|
| 931 |
"Copyright Owner 0\n",
|
| 932 |
"dtype: int64"
|
| 933 |
]
|
| 934 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 935 |
"execution_count": 34,
|
| 936 |
"metadata": {},
|
| 937 |
"output_type": "execute_result"
|
| 938 |
}
|
| 939 |
],
|
| 940 |
"source": [
|
| 941 |
-
"
|
| 942 |
]
|
| 943 |
},
|
| 944 |
{
|
| 945 |
"cell_type": "markdown",
|
| 946 |
"metadata": {},
|
| 947 |
"source": [
|
| 948 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 949 |
]
|
| 950 |
},
|
| 951 |
{
|
|
@@ -1209,7 +1406,7 @@
|
|
| 1209 |
"metadata": {},
|
| 1210 |
"outputs": [],
|
| 1211 |
"source": [
|
| 1212 |
-
"cat_df = pd.read_csv(\"../data/catalog.csv\",
|
| 1213 |
"# Remove duplicates in train_small\n",
|
| 1214 |
"cat_df = cat_df.loc[cat_df.split != 'train_small']"
|
| 1215 |
]
|
|
|
|
| 24 |
"cell_type": "code",
|
| 25 |
"execution_count": 2,
|
| 26 |
"metadata": {},
|
| 27 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
"source": [
|
| 29 |
+
"df = pd.read_csv(\"../data/predicted-catalog.csv\", low_memory = False)"
|
| 30 |
]
|
| 31 |
},
|
| 32 |
{
|
|
|
|
| 281 |
},
|
| 282 |
{
|
| 283 |
"cell_type": "code",
|
| 284 |
+
"execution_count": 5,
|
| 285 |
"metadata": {},
|
| 286 |
"outputs": [],
|
| 287 |
"source": [
|
|
|
|
| 300 |
},
|
| 301 |
{
|
| 302 |
"cell_type": "code",
|
| 303 |
+
"execution_count": 6,
|
| 304 |
"metadata": {},
|
| 305 |
"outputs": [],
|
| 306 |
"source": [
|
|
|
|
| 464 |
"</div>"
|
| 465 |
],
|
| 466 |
"text/plain": [
|
| 467 |
+
" split treeoflife_id eol_content_id eol_page_id \\\n",
|
| 468 |
+
"0 train f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926.0 269504.0 \n",
|
| 469 |
"1 train 5faa4f55-32e9-4872-953d-567e5d232e52 22291283.0 6101931.0 \n",
|
| 470 |
"2 train 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775.0 45513632.0 \n",
|
| 471 |
"3 train 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812.0 51655800.0 \n",
|
| 472 |
"4 train f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643.0 45515896.0 \n",
|
| 473 |
"\n",
|
| 474 |
+
" bioscan_part bioscan_filename inat21_filename inat21_cls_name \\\n",
|
| 475 |
+
"0 NaN NaN NaN NaN \n",
|
| 476 |
"1 NaN NaN NaN NaN \n",
|
| 477 |
"2 NaN NaN NaN NaN \n",
|
| 478 |
"3 NaN NaN NaN NaN \n",
|
| 479 |
"4 NaN NaN NaN NaN \n",
|
| 480 |
"\n",
|
| 481 |
+
" inat21_cls_num kingdom phylum class order \\\n",
|
| 482 |
+
"0 NaN Animalia Arthropoda Insecta Lepidoptera \n",
|
| 483 |
"1 NaN Plantae Tracheophyta Polypodiopsida Polypodiales \n",
|
| 484 |
"2 NaN Animalia Chordata Aves Passeriformes \n",
|
| 485 |
"3 NaN NaN NaN NaN NaN \n",
|
| 486 |
"4 NaN Animalia Chordata Aves Casuariiformes \n",
|
| 487 |
"\n",
|
| 488 |
+
" family genus species common \\\n",
|
| 489 |
+
"0 Lycaenidae Orthomiella rantaizana Chinese Straight-wing Blue \n",
|
| 490 |
"1 Woodsiaceae Woodsia subcordata Woodsia subcordata \n",
|
| 491 |
"2 Laniidae Lanius minor Lesser Grey Shrike \n",
|
| 492 |
"3 NaN NaN tenuis Tenuis \n",
|
|
|
|
| 518 |
},
|
| 519 |
{
|
| 520 |
"cell_type": "code",
|
| 521 |
+
"execution_count": 8,
|
| 522 |
"metadata": {},
|
| 523 |
"outputs": [
|
| 524 |
{
|
|
|
|
| 527 |
"Index(['treeoflife_id', 'eol_content_id', 'eol_page_id'], dtype='object')"
|
| 528 |
]
|
| 529 |
},
|
| 530 |
+
"execution_count": 8,
|
| 531 |
"metadata": {},
|
| 532 |
"output_type": "execute_result"
|
| 533 |
}
|
|
|
|
| 539 |
},
|
| 540 |
{
|
| 541 |
"cell_type": "code",
|
| 542 |
+
"execution_count": 9,
|
| 543 |
"metadata": {},
|
| 544 |
"outputs": [],
|
| 545 |
"source": [
|
|
|
|
| 549 |
},
|
| 550 |
{
|
| 551 |
"cell_type": "code",
|
| 552 |
+
"execution_count": null,
|
| 553 |
"metadata": {},
|
| 554 |
+
"outputs": [],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 555 |
"source": [
|
| 556 |
"eol_license_df.head()"
|
| 557 |
]
|
|
|
|
| 575 |
},
|
| 576 |
{
|
| 577 |
"cell_type": "code",
|
| 578 |
+
"execution_count": 11,
|
| 579 |
"metadata": {},
|
| 580 |
"outputs": [
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 581 |
{
|
| 582 |
"name": "stdout",
|
| 583 |
"output_type": "stream",
|
|
|
|
| 605 |
},
|
| 606 |
{
|
| 607 |
"cell_type": "code",
|
| 608 |
+
"execution_count": 12,
|
| 609 |
+
"metadata": {},
|
| 610 |
+
"outputs": [],
|
| 611 |
+
"source": [
|
| 612 |
+
"# Read eol license df back in with type int64 for ID columns\n",
|
| 613 |
+
"eol_license_df = pd.read_csv(\"../data/eol_files/eol_licenses.csv\", \n",
|
| 614 |
+
" dtype = {\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"}, \n",
|
| 615 |
+
" low_memory = False)"
|
| 616 |
+
]
|
| 617 |
+
},
|
| 618 |
+
{
|
| 619 |
+
"cell_type": "code",
|
| 620 |
+
"execution_count": 13,
|
| 621 |
"metadata": {},
|
| 622 |
"outputs": [
|
| 623 |
{
|
| 624 |
"data": {
|
| 625 |
"text/plain": [
|
| 626 |
+
"(6020135, 5)"
|
| 627 |
]
|
| 628 |
},
|
| 629 |
+
"execution_count": 13,
|
| 630 |
"metadata": {},
|
| 631 |
"output_type": "execute_result"
|
| 632 |
}
|
|
|
|
| 635 |
"eol_license_df.shape"
|
| 636 |
]
|
| 637 |
},
|
| 638 |
+
{
|
| 639 |
+
"cell_type": "code",
|
| 640 |
+
"execution_count": 24,
|
| 641 |
+
"metadata": {},
|
| 642 |
+
"outputs": [
|
| 643 |
+
{
|
| 644 |
+
"name": "stdout",
|
| 645 |
+
"output_type": "stream",
|
| 646 |
+
"text": [
|
| 647 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 648 |
+
"Index: 6277374 entries, 0 to 6277373\n",
|
| 649 |
+
"Data columns (total 18 columns):\n",
|
| 650 |
+
" # Column Dtype \n",
|
| 651 |
+
"--- ------ ----- \n",
|
| 652 |
+
" 0 split object \n",
|
| 653 |
+
" 1 treeoflife_id object \n",
|
| 654 |
+
" 2 eol_content_id int64 \n",
|
| 655 |
+
" 3 eol_page_id int64 \n",
|
| 656 |
+
" 4 bioscan_part float64\n",
|
| 657 |
+
" 5 bioscan_filename object \n",
|
| 658 |
+
" 6 inat21_filename object \n",
|
| 659 |
+
" 7 inat21_cls_name object \n",
|
| 660 |
+
" 8 inat21_cls_num float64\n",
|
| 661 |
+
" 9 kingdom object \n",
|
| 662 |
+
" 10 phylum object \n",
|
| 663 |
+
" 11 class object \n",
|
| 664 |
+
" 12 order object \n",
|
| 665 |
+
" 13 family object \n",
|
| 666 |
+
" 14 genus object \n",
|
| 667 |
+
" 15 species object \n",
|
| 668 |
+
" 16 common object \n",
|
| 669 |
+
" 17 data_source object \n",
|
| 670 |
+
"dtypes: float64(2), int64(2), object(14)\n",
|
| 671 |
+
"memory usage: 910.0+ MB\n"
|
| 672 |
+
]
|
| 673 |
+
}
|
| 674 |
+
],
|
| 675 |
+
"source": [
|
| 676 |
+
"eol_df = eol_df.astype({\"eol_content_id\": \"int64\", \"eol_page_id\": \"int64\"})\n",
|
| 677 |
+
"eol_df.info()"
|
| 678 |
+
]
|
| 679 |
+
},
|
| 680 |
+
{
|
| 681 |
+
"cell_type": "code",
|
| 682 |
+
"execution_count": 25,
|
| 683 |
+
"metadata": {},
|
| 684 |
+
"outputs": [],
|
| 685 |
+
"source": [
|
| 686 |
+
"eol_license_df = eol_df[eol_license_cols]"
|
| 687 |
+
]
|
| 688 |
+
},
|
| 689 |
{
|
| 690 |
"cell_type": "markdown",
|
| 691 |
"metadata": {},
|
|
|
|
| 695 |
},
|
| 696 |
{
|
| 697 |
"cell_type": "code",
|
| 698 |
+
"execution_count": 14,
|
| 699 |
"metadata": {},
|
| 700 |
"outputs": [],
|
| 701 |
"source": [
|
|
|
|
| 704 |
},
|
| 705 |
{
|
| 706 |
"cell_type": "code",
|
| 707 |
+
"execution_count": 26,
|
| 708 |
"metadata": {},
|
| 709 |
"outputs": [],
|
| 710 |
"source": [
|
|
|
|
| 713 |
},
|
| 714 |
{
|
| 715 |
"cell_type": "code",
|
| 716 |
+
"execution_count": 27,
|
| 717 |
"metadata": {},
|
| 718 |
"outputs": [
|
| 719 |
{
|
|
|
|
| 726 |
" # Column Non-Null Count Dtype \n",
|
| 727 |
"--- ------ -------------- ----- \n",
|
| 728 |
" 0 treeoflife_id 6277374 non-null object \n",
|
| 729 |
+
" 1 eol_content_id 6277374 non-null int64 \n",
|
| 730 |
+
" 2 eol_page_id_x 6277374 non-null int64 \n",
|
| 731 |
+
" 3 eol_page_id_y 6163903 non-null float64\n",
|
| 732 |
" 4 Medium Source URL 6163903 non-null object \n",
|
| 733 |
" 5 EOL Full-Size Copy URL 6163903 non-null object \n",
|
| 734 |
" 6 License Name 6163903 non-null object \n",
|
| 735 |
" 7 Copyright Owner 5549428 non-null object \n",
|
| 736 |
+
"dtypes: float64(1), int64(2), object(5)\n",
|
| 737 |
"memory usage: 383.1+ MB\n"
|
| 738 |
]
|
| 739 |
}
|
|
|
|
| 746 |
"cell_type": "markdown",
|
| 747 |
"metadata": {},
|
| 748 |
"source": [
|
| 749 |
+
"We have about 620K images missing copyright owner."
|
| 750 |
]
|
| 751 |
},
|
| 752 |
{
|
| 753 |
"cell_type": "code",
|
| 754 |
+
"execution_count": 28,
|
| 755 |
"metadata": {},
|
| 756 |
"outputs": [
|
| 757 |
{
|
|
|
|
| 777 |
" <th></th>\n",
|
| 778 |
" <th>treeoflife_id</th>\n",
|
| 779 |
" <th>eol_content_id</th>\n",
|
| 780 |
+
" <th>eol_page_id_x</th>\n",
|
| 781 |
+
" <th>eol_page_id_y</th>\n",
|
| 782 |
" <th>Medium Source URL</th>\n",
|
| 783 |
" <th>EOL Full-Size Copy URL</th>\n",
|
| 784 |
" <th>License Name</th>\n",
|
|
|
|
| 789 |
" <tr>\n",
|
| 790 |
" <th>0</th>\n",
|
| 791 |
" <td>f2f0aa29-e87b-469c-bf5b-51a3611ab001</td>\n",
|
| 792 |
+
" <td>22131926</td>\n",
|
| 793 |
+
" <td>269504</td>\n",
|
| 794 |
" <td>269504.0</td>\n",
|
| 795 |
" <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
|
| 796 |
" <td>https://content.eol.org/data/media/6a/ed/7a/18...</td>\n",
|
|
|
|
| 800 |
" <tr>\n",
|
| 801 |
" <th>1</th>\n",
|
| 802 |
" <td>5faa4f55-32e9-4872-953d-567e5d232e52</td>\n",
|
| 803 |
+
" <td>22291283</td>\n",
|
| 804 |
+
" <td>6101931</td>\n",
|
| 805 |
" <td>6101931.0</td>\n",
|
| 806 |
" <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
|
| 807 |
" <td>https://content.eol.org/data/media/7b/bc/92/18...</td>\n",
|
|
|
|
| 811 |
" <tr>\n",
|
| 812 |
" <th>2</th>\n",
|
| 813 |
" <td>2282f2bf-2b52-4522-b588-dd6f356d5fd6</td>\n",
|
| 814 |
+
" <td>21802775</td>\n",
|
| 815 |
+
" <td>45513632</td>\n",
|
| 816 |
" <td>45513632.0</td>\n",
|
| 817 |
" <td>https://inaturalist-open-data.s3.amazonaws.com...</td>\n",
|
| 818 |
" <td>https://content.eol.org/data/media/66/be/16/18...</td>\n",
|
|
|
|
| 822 |
" <tr>\n",
|
| 823 |
" <th>3</th>\n",
|
| 824 |
" <td>76b57c36-2181-4e6d-a5c4-b40e22a09449</td>\n",
|
| 825 |
+
" <td>12784812</td>\n",
|
| 826 |
+
" <td>51655800</td>\n",
|
| 827 |
" <td>51655800.0</td>\n",
|
| 828 |
" <td>http://www.femorale.com/shellphotos/photos15/3...</td>\n",
|
| 829 |
" <td>https://content.eol.org/data/media/c4/79/dc/14...</td>\n",
|
|
|
|
| 833 |
" <tr>\n",
|
| 834 |
" <th>4</th>\n",
|
| 835 |
" <td>f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2</td>\n",
|
| 836 |
+
" <td>29713643</td>\n",
|
| 837 |
+
" <td>45515896</td>\n",
|
| 838 |
" <td>45515896.0</td>\n",
|
| 839 |
" <td>https://upload.wikimedia.org/wikipedia/commons...</td>\n",
|
| 840 |
" <td>https://content.eol.org/data/media/5f/ef/95/50...</td>\n",
|
|
|
|
| 846 |
"</div>"
|
| 847 |
],
|
| 848 |
"text/plain": [
|
| 849 |
+
" treeoflife_id eol_content_id eol_page_id_x \\\n",
|
| 850 |
+
"0 f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926 269504 \n",
|
| 851 |
+
"1 5faa4f55-32e9-4872-953d-567e5d232e52 22291283 6101931 \n",
|
| 852 |
+
"2 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775 45513632 \n",
|
| 853 |
+
"3 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812 51655800 \n",
|
| 854 |
+
"4 f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643 45515896 \n",
|
| 855 |
"\n",
|
| 856 |
+
" eol_page_id_y Medium Source URL \\\n",
|
| 857 |
+
"0 269504.0 https://inaturalist-open-data.s3.amazonaws.com... \n",
|
| 858 |
+
"1 6101931.0 https://inaturalist-open-data.s3.amazonaws.com... \n",
|
| 859 |
+
"2 45513632.0 https://inaturalist-open-data.s3.amazonaws.com... \n",
|
| 860 |
+
"3 51655800.0 http://www.femorale.com/shellphotos/photos15/3... \n",
|
| 861 |
+
"4 45515896.0 https://upload.wikimedia.org/wikipedia/commons... \n",
|
| 862 |
"\n",
|
| 863 |
+
" EOL Full-Size Copy URL License Name \\\n",
|
| 864 |
+
"0 https://content.eol.org/data/media/6a/ed/7a/18... cc-by-nc-4.0 \n",
|
| 865 |
"1 https://content.eol.org/data/media/7b/bc/92/18... cc-by-nc-4.0 \n",
|
| 866 |
"2 https://content.eol.org/data/media/66/be/16/18... cc-by-nc-4.0 \n",
|
| 867 |
"3 https://content.eol.org/data/media/c4/79/dc/14... cc-by-nc \n",
|
|
|
|
| 875 |
"4 NaN "
|
| 876 |
]
|
| 877 |
},
|
| 878 |
+
"execution_count": 28,
|
| 879 |
"metadata": {},
|
| 880 |
"output_type": "execute_result"
|
| 881 |
}
|
|
|
|
| 886 |
},
|
| 887 |
{
|
| 888 |
"cell_type": "code",
|
| 889 |
+
"execution_count": 29,
|
| 890 |
"metadata": {},
|
| 891 |
"outputs": [
|
| 892 |
{
|
| 893 |
"data": {
|
| 894 |
"text/plain": [
|
| 895 |
+
"treeoflife_id 727946\n",
|
| 896 |
+
"eol_content_id 727946\n",
|
| 897 |
+
"eol_page_id_x 119376\n",
|
| 898 |
+
"eol_page_id_y 115564\n",
|
| 899 |
+
"Medium Source URL 614089\n",
|
| 900 |
+
"EOL Full-Size Copy URL 614475\n",
|
| 901 |
+
"License Name 10\n",
|
| 902 |
"Copyright Owner 0\n",
|
| 903 |
"dtype: int64"
|
| 904 |
]
|
| 905 |
},
|
| 906 |
+
"execution_count": 29,
|
| 907 |
+
"metadata": {},
|
| 908 |
+
"output_type": "execute_result"
|
| 909 |
+
}
|
| 910 |
+
],
|
| 911 |
+
"source": [
|
| 912 |
+
"eol_df_media.loc[eol_df_media[\"Copyright Owner\"].isna()].nunique()"
|
| 913 |
+
]
|
| 914 |
+
},
|
| 915 |
+
{
|
| 916 |
+
"cell_type": "markdown",
|
| 917 |
+
"metadata": {},
|
| 918 |
+
"source": [
|
| 919 |
+
"The missing info is distributed across 116,609 pages.\n",
|
| 920 |
+
"\n",
|
| 921 |
+
"There also seems to be a discrepancy in the number of page IDs between these. This lead to duplicated records...definitely something's off."
|
| 922 |
+
]
|
| 923 |
+
},
|
| 924 |
+
{
|
| 925 |
+
"cell_type": "markdown",
|
| 926 |
+
"metadata": {},
|
| 927 |
+
"source": [
|
| 928 |
+
"Check consistency of merge when matching both `eol_content_id` and `eol_page_id`."
|
| 929 |
+
]
|
| 930 |
+
},
|
| 931 |
+
{
|
| 932 |
+
"cell_type": "code",
|
| 933 |
+
"execution_count": 19,
|
| 934 |
+
"metadata": {},
|
| 935 |
+
"outputs": [],
|
| 936 |
+
"source": [
|
| 937 |
+
"media.rename(columns = {\"EOL page ID\": \"eol_page_id\"}, inplace = True)"
|
| 938 |
+
]
|
| 939 |
+
},
|
| 940 |
+
{
|
| 941 |
+
"cell_type": "code",
|
| 942 |
+
"execution_count": 20,
|
| 943 |
+
"metadata": {},
|
| 944 |
+
"outputs": [],
|
| 945 |
+
"source": [
|
| 946 |
+
"merge_cols = [\"eol_content_id\", \"eol_page_id\"]"
|
| 947 |
+
]
|
| 948 |
+
},
|
| 949 |
+
{
|
| 950 |
+
"cell_type": "code",
|
| 951 |
+
"execution_count": 31,
|
| 952 |
+
"metadata": {},
|
| 953 |
+
"outputs": [
|
| 954 |
+
{
|
| 955 |
+
"name": "stdout",
|
| 956 |
+
"output_type": "stream",
|
| 957 |
+
"text": [
|
| 958 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 959 |
+
"RangeIndex: 6163903 entries, 0 to 6163902\n",
|
| 960 |
+
"Data columns (total 7 columns):\n",
|
| 961 |
+
" # Column Non-Null Count Dtype \n",
|
| 962 |
+
"--- ------ -------------- ----- \n",
|
| 963 |
+
" 0 treeoflife_id 6163903 non-null object\n",
|
| 964 |
+
" 1 eol_content_id 6163903 non-null int64 \n",
|
| 965 |
+
" 2 eol_page_id 6163903 non-null int64 \n",
|
| 966 |
+
" 3 Medium Source URL 6163903 non-null object\n",
|
| 967 |
+
" 4 EOL Full-Size Copy URL 6163903 non-null object\n",
|
| 968 |
+
" 5 License Name 6163903 non-null object\n",
|
| 969 |
+
" 6 Copyright Owner 5549428 non-null object\n",
|
| 970 |
+
"dtypes: int64(2), object(5)\n",
|
| 971 |
+
"memory usage: 329.2+ MB\n"
|
| 972 |
+
]
|
| 973 |
+
}
|
| 974 |
+
],
|
| 975 |
+
"source": [
|
| 976 |
+
"eol_df_media_cp = pd.merge(eol_license_df, media, how = \"inner\", left_on = merge_cols, right_on = merge_cols)\n",
|
| 977 |
+
"eol_df_media_cp.info(show_counts = True)"
|
| 978 |
+
]
|
| 979 |
+
},
|
| 980 |
+
{
|
| 981 |
+
"cell_type": "markdown",
|
| 982 |
+
"metadata": {},
|
| 983 |
+
"source": [
|
| 984 |
+
"Okay, so we do have a mis-match of about 113K images where the content IDs and page IDs don't both match."
|
| 985 |
+
]
|
| 986 |
+
},
|
| 987 |
+
{
|
| 988 |
+
"cell_type": "code",
|
| 989 |
+
"execution_count": 32,
|
| 990 |
+
"metadata": {},
|
| 991 |
+
"outputs": [],
|
| 992 |
+
"source": [
|
| 993 |
+
"eol_df_media_cp.to_csv(\"../data/eol_files/eol_cp_match_media.csv\", index = False)"
|
| 994 |
+
]
|
| 995 |
+
},
|
| 996 |
+
{
|
| 997 |
+
"cell_type": "code",
|
| 998 |
+
"execution_count": 33,
|
| 999 |
+
"metadata": {},
|
| 1000 |
+
"outputs": [
|
| 1001 |
+
{
|
| 1002 |
+
"data": {
|
| 1003 |
+
"text/plain": [
|
| 1004 |
+
"['f2f0aa29-e87b-469c-bf5b-51a3611ab001',\n",
|
| 1005 |
+
" '5faa4f55-32e9-4872-953d-567e5d232e52',\n",
|
| 1006 |
+
" '2282f2bf-2b52-4522-b588-dd6f356d5fd6',\n",
|
| 1007 |
+
" '76b57c36-2181-4e6d-a5c4-b40e22a09449',\n",
|
| 1008 |
+
" 'f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2']"
|
| 1009 |
+
]
|
| 1010 |
+
},
|
| 1011 |
+
"execution_count": 33,
|
| 1012 |
+
"metadata": {},
|
| 1013 |
+
"output_type": "execute_result"
|
| 1014 |
+
}
|
| 1015 |
+
],
|
| 1016 |
+
"source": [
|
| 1017 |
+
"tol_ids_in_media = list(eol_df_media_cp.treeoflife_id)\n",
|
| 1018 |
+
"tol_ids_in_media[:5]"
|
| 1019 |
+
]
|
| 1020 |
+
},
|
| 1021 |
+
{
|
| 1022 |
+
"cell_type": "code",
|
| 1023 |
+
"execution_count": 34,
|
| 1024 |
+
"metadata": {},
|
| 1025 |
+
"outputs": [
|
| 1026 |
+
{
|
| 1027 |
+
"data": {
|
| 1028 |
+
"text/html": [
|
| 1029 |
+
"<div>\n",
|
| 1030 |
+
"<style scoped>\n",
|
| 1031 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
| 1032 |
+
" vertical-align: middle;\n",
|
| 1033 |
+
" }\n",
|
| 1034 |
+
"\n",
|
| 1035 |
+
" .dataframe tbody tr th {\n",
|
| 1036 |
+
" vertical-align: top;\n",
|
| 1037 |
+
" }\n",
|
| 1038 |
+
"\n",
|
| 1039 |
+
" .dataframe thead th {\n",
|
| 1040 |
+
" text-align: right;\n",
|
| 1041 |
+
" }\n",
|
| 1042 |
+
"</style>\n",
|
| 1043 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
| 1044 |
+
" <thead>\n",
|
| 1045 |
+
" <tr style=\"text-align: right;\">\n",
|
| 1046 |
+
" <th></th>\n",
|
| 1047 |
+
" <th>treeoflife_id</th>\n",
|
| 1048 |
+
" <th>eol_content_id</th>\n",
|
| 1049 |
+
" <th>eol_page_id</th>\n",
|
| 1050 |
+
" </tr>\n",
|
| 1051 |
+
" </thead>\n",
|
| 1052 |
+
" <tbody>\n",
|
| 1053 |
+
" <tr>\n",
|
| 1054 |
+
" <th>0</th>\n",
|
| 1055 |
+
" <td>f2f0aa29-e87b-469c-bf5b-51a3611ab001</td>\n",
|
| 1056 |
+
" <td>22131926</td>\n",
|
| 1057 |
+
" <td>269504</td>\n",
|
| 1058 |
+
" </tr>\n",
|
| 1059 |
+
" <tr>\n",
|
| 1060 |
+
" <th>1</th>\n",
|
| 1061 |
+
" <td>5faa4f55-32e9-4872-953d-567e5d232e52</td>\n",
|
| 1062 |
+
" <td>22291283</td>\n",
|
| 1063 |
+
" <td>6101931</td>\n",
|
| 1064 |
+
" </tr>\n",
|
| 1065 |
+
" <tr>\n",
|
| 1066 |
+
" <th>2</th>\n",
|
| 1067 |
+
" <td>2282f2bf-2b52-4522-b588-dd6f356d5fd6</td>\n",
|
| 1068 |
+
" <td>21802775</td>\n",
|
| 1069 |
+
" <td>45513632</td>\n",
|
| 1070 |
+
" </tr>\n",
|
| 1071 |
+
" <tr>\n",
|
| 1072 |
+
" <th>3</th>\n",
|
| 1073 |
+
" <td>76b57c36-2181-4e6d-a5c4-b40e22a09449</td>\n",
|
| 1074 |
+
" <td>12784812</td>\n",
|
| 1075 |
+
" <td>51655800</td>\n",
|
| 1076 |
+
" </tr>\n",
|
| 1077 |
+
" <tr>\n",
|
| 1078 |
+
" <th>4</th>\n",
|
| 1079 |
+
" <td>f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2</td>\n",
|
| 1080 |
+
" <td>29713643</td>\n",
|
| 1081 |
+
" <td>45515896</td>\n",
|
| 1082 |
+
" </tr>\n",
|
| 1083 |
+
" </tbody>\n",
|
| 1084 |
+
"</table>\n",
|
| 1085 |
+
"</div>"
|
| 1086 |
+
],
|
| 1087 |
+
"text/plain": [
|
| 1088 |
+
" treeoflife_id eol_content_id eol_page_id\n",
|
| 1089 |
+
"0 f2f0aa29-e87b-469c-bf5b-51a3611ab001 22131926 269504\n",
|
| 1090 |
+
"1 5faa4f55-32e9-4872-953d-567e5d232e52 22291283 6101931\n",
|
| 1091 |
+
"2 2282f2bf-2b52-4522-b588-dd6f356d5fd6 21802775 45513632\n",
|
| 1092 |
+
"3 76b57c36-2181-4e6d-a5c4-b40e22a09449 12784812 51655800\n",
|
| 1093 |
+
"4 f57d3ab6-2cf5-484b-a590-e2a3d49a3ca2 29713643 45515896"
|
| 1094 |
+
]
|
| 1095 |
+
},
|
| 1096 |
"execution_count": 34,
|
| 1097 |
"metadata": {},
|
| 1098 |
"output_type": "execute_result"
|
| 1099 |
}
|
| 1100 |
],
|
| 1101 |
"source": [
|
| 1102 |
+
"eol_license_df.head()"
|
| 1103 |
]
|
| 1104 |
},
|
| 1105 |
{
|
| 1106 |
"cell_type": "markdown",
|
| 1107 |
"metadata": {},
|
| 1108 |
"source": [
|
| 1109 |
+
"Let's save a copy of the EOL section with content and page IDs that are mismatched."
|
| 1110 |
+
]
|
| 1111 |
+
},
|
| 1112 |
+
{
|
| 1113 |
+
"cell_type": "code",
|
| 1114 |
+
"execution_count": 35,
|
| 1115 |
+
"metadata": {},
|
| 1116 |
+
"outputs": [
|
| 1117 |
+
{
|
| 1118 |
+
"name": "stdout",
|
| 1119 |
+
"output_type": "stream",
|
| 1120 |
+
"text": [
|
| 1121 |
+
"<class 'pandas.core.frame.DataFrame'>\n",
|
| 1122 |
+
"Index: 113471 entries, 126 to 6277290\n",
|
| 1123 |
+
"Data columns (total 3 columns):\n",
|
| 1124 |
+
" # Column Non-Null Count Dtype \n",
|
| 1125 |
+
"--- ------ -------------- ----- \n",
|
| 1126 |
+
" 0 treeoflife_id 113471 non-null object\n",
|
| 1127 |
+
" 1 eol_content_id 113471 non-null int64 \n",
|
| 1128 |
+
" 2 eol_page_id 113471 non-null int64 \n",
|
| 1129 |
+
"dtypes: int64(2), object(1)\n",
|
| 1130 |
+
"memory usage: 3.5+ MB\n"
|
| 1131 |
+
]
|
| 1132 |
+
}
|
| 1133 |
+
],
|
| 1134 |
+
"source": [
|
| 1135 |
+
"eol_df_missing_media = eol_license_df.loc[~eol_license_df.treeoflife_id.isin(tol_ids_in_media)]\n",
|
| 1136 |
+
"eol_df_missing_media.info(show_counts = True)"
|
| 1137 |
+
]
|
| 1138 |
+
},
|
| 1139 |
+
{
|
| 1140 |
+
"cell_type": "code",
|
| 1141 |
+
"execution_count": 36,
|
| 1142 |
+
"metadata": {},
|
| 1143 |
+
"outputs": [],
|
| 1144 |
+
"source": [
|
| 1145 |
+
"eol_df_missing_media.to_csv(\"../data/eol_files/eol_cp_not_media.csv\", index = False)"
|
| 1146 |
]
|
| 1147 |
},
|
| 1148 |
{
|
|
|
|
| 1406 |
"metadata": {},
|
| 1407 |
"outputs": [],
|
| 1408 |
"source": [
|
| 1409 |
+
"cat_df = pd.read_csv(\"../data/catalog.csv\", low_memory = False)\n",
|
| 1410 |
"# Remove duplicates in train_small\n",
|
| 1411 |
"cat_df = cat_df.loc[cat_df.split != 'train_small']"
|
| 1412 |
]
|
notebooks/ToL_license_check.py
CHANGED
|
@@ -24,7 +24,7 @@ sns.set(rc = {'figure.figsize': (10,10)})
|
|
| 24 |
# Load in full images to ease process.
|
| 25 |
|
| 26 |
# %%
|
| 27 |
-
df = pd.read_csv("../data/predicted-catalog.csv",
|
| 28 |
|
| 29 |
# %%
|
| 30 |
df.head()
|
|
@@ -81,9 +81,22 @@ eol_license_df.head()
|
|
| 81 |
media = pd.read_csv("../data/media_manifest (july 26).csv", dtype = {"EOL content ID": "int64", "EOL page ID": "int64"}, low_memory = False)
|
| 82 |
media.info(show_counts = True)
|
| 83 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 84 |
# %%
|
| 85 |
eol_license_df.shape
|
| 86 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 87 |
# %% [markdown]
|
| 88 |
# Notice that we have about 300K more entries in the media manifest, which is about expected from the [comparison of predicted-catalog to the original full list](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/main/notebooks/ToL_predicted-catalog_EDA.ipynb).
|
| 89 |
|
|
@@ -97,16 +110,54 @@ eol_df_media = pd.merge(eol_license_df, media, how = "left", on = "eol_content_i
|
|
| 97 |
eol_df_media.info(show_counts = True)
|
| 98 |
|
| 99 |
# %% [markdown]
|
| 100 |
-
#
|
| 101 |
|
| 102 |
# %%
|
| 103 |
eol_df_media.head()
|
| 104 |
|
| 105 |
# %%
|
| 106 |
-
eol_df_media.loc[eol_df_media["
|
| 107 |
|
| 108 |
# %% [markdown]
|
| 109 |
-
# The missing info is distributed across
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 110 |
|
| 111 |
# %% [markdown]
|
| 112 |
# ### Save Record of Missing Content IDs & Compare to Older Media Manifest
|
|
@@ -143,7 +194,7 @@ eol_df_media_old.info(show_counts = True)
|
|
| 143 |
# Let's see if these are all images in TreeOfLife-10M, or a mix between it and Rare Species.
|
| 144 |
|
| 145 |
# %%
|
| 146 |
-
cat_df = pd.read_csv("../data/catalog.csv",
|
| 147 |
# Remove duplicates in train_small
|
| 148 |
cat_df = cat_df.loc[cat_df.split != 'train_small']
|
| 149 |
|
|
|
|
| 24 |
# Load in full images to ease process.
|
| 25 |
|
| 26 |
# %%
|
| 27 |
+
df = pd.read_csv("../data/predicted-catalog.csv", low_memory = False)
|
| 28 |
|
| 29 |
# %%
|
| 30 |
df.head()
|
|
|
|
| 81 |
media = pd.read_csv("../data/media_manifest (july 26).csv", dtype = {"EOL content ID": "int64", "EOL page ID": "int64"}, low_memory = False)
|
| 82 |
media.info(show_counts = True)
|
| 83 |
|
| 84 |
+
# %%
|
| 85 |
+
# Read eol license df back in with type int64 for ID columns
|
| 86 |
+
eol_license_df = pd.read_csv("../data/eol_files/eol_licenses.csv",
|
| 87 |
+
dtype = {"eol_content_id": "int64", "eol_page_id": "int64"},
|
| 88 |
+
low_memory = False)
|
| 89 |
+
|
| 90 |
# %%
|
| 91 |
eol_license_df.shape
|
| 92 |
|
| 93 |
+
# %%
|
| 94 |
+
eol_df = eol_df.astype({"eol_content_id": "int64", "eol_page_id": "int64"})
|
| 95 |
+
eol_df.info()
|
| 96 |
+
|
| 97 |
+
# %%
|
| 98 |
+
eol_license_df = eol_df[eol_license_cols]
|
| 99 |
+
|
| 100 |
# %% [markdown]
|
| 101 |
# Notice that we have about 300K more entries in the media manifest, which is about expected from the [comparison of predicted-catalog to the original full list](https://huggingface.co/datasets/imageomics/ToL-EDA/blob/main/notebooks/ToL_predicted-catalog_EDA.ipynb).
|
| 102 |
|
|
|
|
| 110 |
eol_df_media.info(show_counts = True)
|
| 111 |
|
| 112 |
# %% [markdown]
|
| 113 |
+
# We have about 620K images missing copyright owner.
|
| 114 |
|
| 115 |
# %%
|
| 116 |
eol_df_media.head()
|
| 117 |
|
| 118 |
# %%
|
| 119 |
+
eol_df_media.loc[eol_df_media["Copyright Owner"].isna()].nunique()
|
| 120 |
|
| 121 |
# %% [markdown]
|
| 122 |
+
# The missing info is distributed across 116,609 pages.
|
| 123 |
+
#
|
| 124 |
+
# There also seems to be a discrepancy in the number of page IDs between these. This lead to duplicated records...definitely something's off.
|
| 125 |
+
|
| 126 |
+
# %% [markdown]
|
| 127 |
+
# Check consistency of merge when matching both `eol_content_id` and `eol_page_id`.
|
| 128 |
+
|
| 129 |
+
# %%
|
| 130 |
+
media.rename(columns = {"EOL page ID": "eol_page_id"}, inplace = True)
|
| 131 |
+
|
| 132 |
+
# %%
|
| 133 |
+
merge_cols = ["eol_content_id", "eol_page_id"]
|
| 134 |
+
|
| 135 |
+
# %%
|
| 136 |
+
eol_df_media_cp = pd.merge(eol_license_df, media, how = "inner", left_on = merge_cols, right_on = merge_cols)
|
| 137 |
+
eol_df_media_cp.info(show_counts = True)
|
| 138 |
+
|
| 139 |
+
# %% [markdown]
|
| 140 |
+
# Okay, so we do have a mis-match of about 113K images where the content IDs and page IDs don't both match.
|
| 141 |
+
|
| 142 |
+
# %%
|
| 143 |
+
eol_df_media_cp.to_csv("../data/eol_files/eol_cp_match_media.csv", index = False)
|
| 144 |
+
|
| 145 |
+
# %%
|
| 146 |
+
tol_ids_in_media = list(eol_df_media_cp.treeoflife_id)
|
| 147 |
+
tol_ids_in_media[:5]
|
| 148 |
+
|
| 149 |
+
# %%
|
| 150 |
+
eol_license_df.head()
|
| 151 |
+
|
| 152 |
+
# %% [markdown]
|
| 153 |
+
# Let's save a copy of the EOL section with content and page IDs that are mismatched.
|
| 154 |
+
|
| 155 |
+
# %%
|
| 156 |
+
eol_df_missing_media = eol_license_df.loc[~eol_license_df.treeoflife_id.isin(tol_ids_in_media)]
|
| 157 |
+
eol_df_missing_media.info(show_counts = True)
|
| 158 |
+
|
| 159 |
+
# %%
|
| 160 |
+
eol_df_missing_media.to_csv("../data/eol_files/eol_cp_not_media.csv", index = False)
|
| 161 |
|
| 162 |
# %% [markdown]
|
| 163 |
# ### Save Record of Missing Content IDs & Compare to Older Media Manifest
|
|
|
|
| 194 |
# Let's see if these are all images in TreeOfLife-10M, or a mix between it and Rare Species.
|
| 195 |
|
| 196 |
# %%
|
| 197 |
+
cat_df = pd.read_csv("../data/catalog.csv", low_memory = False)
|
| 198 |
# Remove duplicates in train_small
|
| 199 |
cat_df = cat_df.loc[cat_df.split != 'train_small']
|
| 200 |
|