{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":71885,"databundleVersionId":8143495,"sourceType":"competition"}],"dockerImageVersionId":30698,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"- This notebook is just look around the data for begginer","metadata":{}},{"cell_type":"markdown","source":"## import lib","metadata":{}},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd\nimport os\nimport cv2\nimport matplotlib.pyplot as plt","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-05-17T13:25:00.926646Z","iopub.execute_input":"2024-05-17T13:25:00.927457Z","iopub.status.idle":"2024-05-17T13:25:01.261058Z","shell.execute_reply.started":"2024-05-17T13:25:00.927428Z","shell.execute_reply":"2024-05-17T13:25:01.259978Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# all files","metadata":{}},{"cell_type":"code","source":"# all file path\nfp_all = []\nfor dirname, _, filenames in os.walk('/kaggle/input'):\n    for filename in sorted(filenames):\n        fp_all.append(dirname+ \"/\" + filename)\n#         print(os.path.join(dirname, filename))","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2024-05-17T13:25:01.262754Z","iopub.execute_input":"2024-05-17T13:25:01.263201Z","iopub.status.idle":"2024-05-17T13:25:01.313115Z","shell.execute_reply.started":"2024-05-17T13:25:01.263172Z","shell.execute_reply":"2024-05-17T13:25:01.311787Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# meta data","metadata":{}},{"cell_type":"markdown","source":"## sample_submission.csv","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/image-matching-challenge-2024/sample_submission.csv\")\ndisplay(df.shape)\ndisplay(df)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:25:01.314834Z","iopub.execute_input":"2024-05-17T13:25:01.315557Z","iopub.status.idle":"2024-05-17T13:25:01.341675Z","shell.execute_reply.started":"2024-05-17T13:25:01.315520Z","shell.execute_reply":"2024-05-17T13:25:01.340081Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# train\n## categories.csv\n- 7 scenes\n- 6 categories","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/image-matching-challenge-2024/train/categories.csv\")\ndisplay(df.shape)\ndisplay(df)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:25:01.343004Z","iopub.execute_input":"2024-05-17T13:25:01.343277Z","iopub.status.idle":"2024-05-17T13:25:01.359525Z","shell.execute_reply.started":"2024-05-17T13:25:01.343253Z","shell.execute_reply":"2024-05-17T13:25:01.358213Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## train_labels.csv\n- 2148 images","metadata":{}},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/image-matching-challenge-2024/train/train_labels.csv\")\ndisplay(df.shape)\ndisplay(df)\nprint(\"nunique\")\ndisplay(pd.DataFrame(df.nunique()))\nprint(\"dataset\")\ndisplay(pd.DataFrame(df[\"dataset\"].value_counts()))\ndisplay(pd.DataFrame(df[\"dataset\"].value_counts()).plot(kind=\"bar\"))","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:25:01.362621Z","iopub.execute_input":"2024-05-17T13:25:01.362949Z","iopub.status.idle":"2024-05-17T13:25:01.633649Z","shell.execute_reply.started":"2024-05-17T13:25:01.362922Z","shell.execute_reply":"2024-05-17T13:25:01.632348Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# test\n## categories.csv","metadata":{"execution":{"iopub.status.busy":"2024-04-21T10:08:36.886838Z","iopub.execute_input":"2024-04-21T10:08:36.887233Z","iopub.status.idle":"2024-04-21T10:08:36.892185Z","shell.execute_reply.started":"2024-04-21T10:08:36.887204Z","shell.execute_reply":"2024-04-21T10:08:36.890924Z"}}},{"cell_type":"code","source":"df = pd.read_csv(\"/kaggle/input/image-matching-challenge-2024/test/categories.csv\")\ndisplay(df.shape)\ndisplay(df)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:25:01.634752Z","iopub.execute_input":"2024-05-17T13:25:01.635018Z","iopub.status.idle":"2024-05-17T13:25:01.648954Z","shell.execute_reply.started":"2024-05-17T13:25:01.634995Z","shell.execute_reply":"2024-05-17T13:25:01.648000Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# check image","metadata":{}},{"cell_type":"code","source":"# please set all_show category \n# !!!! if you set True more than 2 types, maybe your notebook would be overflow on Kaggle notebook !!!!\nchurch = True\ndioscuri = False\nlizard = False\nmulti_temporal_temple_baalshamin = False\npond = False\ntransp_obj_glass_cup = False\ntransp_obj_glass_cylinder = False","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:29:40.276443Z","iopub.execute_input":"2024-05-17T13:29:40.276841Z","iopub.status.idle":"2024-05-17T13:29:40.284867Z","shell.execute_reply.started":"2024-05-17T13:29:40.276810Z","shell.execute_reply":"2024-05-17T13:29:40.283002Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"def show_img(image_path, rot=0):    \n    # color\n    image = cv2.imread(image_path)\n    if rot == 90:\n        image = np.rot90(image)\n    image_rgb = cv2.cvtColor(image, cv2.COLOR_BGR2RGB)\n\n    # show\n    plt.imshow(image_rgb)\n    plt.axis('off')  # axis none\n    plt.show()","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:29:42.619429Z","iopub.execute_input":"2024-05-17T13:29:42.619769Z","iopub.status.idle":"2024-05-17T13:29:42.627309Z","shell.execute_reply.started":"2024-05-17T13:29:42.619743Z","shell.execute_reply":"2024-05-17T13:29:42.625265Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## train church","metadata":{}},{"cell_type":"code","source":"if church:  \n    # all\n    for fp in fp_all:\n        if fp.startswith(f\"/kaggle/input/image-matching-challenge-2024/train/church\")&(fp.endswith(\".png\")):\n            show_img(fp)\n            print(fp)\n\nelse:\n    # single\n    image_path = \"/kaggle/input/image-matching-challenge-2024/train/church/images/00001.png\"\n    show_img(image_path)","metadata":{"_kg_hide-output":true,"execution":{"iopub.status.busy":"2024-05-17T13:29:42.995568Z","iopub.execute_input":"2024-05-17T13:29:42.995943Z","iopub.status.idle":"2024-05-17T13:29:43.263750Z","shell.execute_reply.started":"2024-05-17T13:29:42.995913Z","shell.execute_reply":"2024-05-17T13:29:43.261378Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## dioscuri","metadata":{}},{"cell_type":"code","source":"if dioscuri:  \n    # all\n    for fp in fp_all:\n        if fp.startswith(f\"/kaggle/input/image-matching-challenge-2024/train/dioscuri\")&(fp.endswith(\".png\")):\n            show_img(fp)\n            print(fp)\n\nelse:\n    # single\n    image_path = \"/kaggle/input/image-matching-challenge-2024/train/dioscuri/images/3dom_fbk_img_1512.png\"\n    show_img(image_path, 90)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:29:43.437956Z","iopub.execute_input":"2024-05-17T13:29:43.438316Z","iopub.status.idle":"2024-05-17T13:29:43.650534Z","shell.execute_reply.started":"2024-05-17T13:29:43.438271Z","shell.execute_reply":"2024-05-17T13:29:43.649699Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## lizard","metadata":{}},{"cell_type":"code","source":"if lizard:  \n    # all\n    for fp in fp_all:\n        if fp.startswith(f\"/kaggle/input/image-matching-challenge-2024/train/lizard\")&(fp.endswith(\".png\")):\n            show_img(fp)\n            print(fp)\n\nelse:\n    # single\n    image_path = \"/kaggle/input/image-matching-challenge-2024/train/lizard/images/00001.png\"\n    show_img(image_path)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:29:43.795856Z","iopub.execute_input":"2024-05-17T13:29:43.797095Z","iopub.status.idle":"2024-05-17T13:29:44.020612Z","shell.execute_reply.started":"2024-05-17T13:29:43.797063Z","shell.execute_reply":"2024-05-17T13:29:44.019675Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## multi-temporal-temple-baalshamin","metadata":{}},{"cell_type":"code","source":"if multi_temporal_temple_baalshamin:  \n    # all\n    for fp in fp_all:\n        if fp.startswith(f\"/kaggle/input/image-matching-challenge-2024/train/multi-temporal-temple-baalshamin\")&(fp.endswith(\".png\")):\n            show_img(fp)\n            print(fp)\n\nelse:\n    # single\n    image_path = \"/kaggle/input/image-matching-challenge-2024/train/multi-temporal-temple-baalshamin/images/070313_img_6187_syria_palmyra_roman_ruins_999x.png\"\n    show_img(image_path)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:29:44.152252Z","iopub.execute_input":"2024-05-17T13:29:44.152770Z","iopub.status.idle":"2024-05-17T13:29:44.400128Z","shell.execute_reply.started":"2024-05-17T13:29:44.152740Z","shell.execute_reply":"2024-05-17T13:29:44.399054Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## pond","metadata":{}},{"cell_type":"code","source":"if pond:  \n    # all\n    for fp in fp_all:\n        if fp.startswith(f\"/kaggle/input/image-matching-challenge-2024/train/pond\")&(fp.endswith(\".png\")):\n            show_img(fp)\n            print(fp)\n\nelse:\n    # single\n    image_path = \"/kaggle/input/image-matching-challenge-2024/train/pond/images/00001.png\"\n    show_img(image_path)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:29:44.534935Z","iopub.execute_input":"2024-05-17T13:29:44.535274Z","iopub.status.idle":"2024-05-17T13:29:44.712181Z","shell.execute_reply.started":"2024-05-17T13:29:44.535247Z","shell.execute_reply":"2024-05-17T13:29:44.711385Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## transp_obj_glass_cup","metadata":{}},{"cell_type":"code","source":"if transp_obj_glass_cup:  \n    # all\n    for fp in fp_all:\n        if fp.startswith(f\"/kaggle/input/image-matching-challenge-2024/train/transp_obj_glass_cup\")&(fp.endswith(\".png\")):\n            show_img(fp)\n            print(fp)\n\nelse:\n    # single\n    image_path = \"/kaggle/input/image-matching-challenge-2024/train/transp_obj_glass_cup/images/00.png\"\n    show_img(image_path, 90)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:29:44.855724Z","iopub.execute_input":"2024-05-17T13:29:44.856057Z","iopub.status.idle":"2024-05-17T13:29:47.070067Z","shell.execute_reply.started":"2024-05-17T13:29:44.856031Z","shell.execute_reply":"2024-05-17T13:29:47.068880Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"## transp_obj_glass_cylinder","metadata":{}},{"cell_type":"code","source":"if transp_obj_glass_cylinder:  \n    # all\n    for fp in fp_all:\n        if fp.startswith(f\"/kaggle/input/image-matching-challenge-2024/train/transp_obj_glass_cylinder\")&(fp.endswith(\".png\")):\n            show_img(fp)\n            print(fp)\n\nelse:\n    # single\n    image_path = \"/kaggle/input/image-matching-challenge-2024/train/transp_obj_glass_cylinder/images/dsc_8232.png\"\n    show_img(image_path)","metadata":{"execution":{"iopub.status.busy":"2024-05-17T13:29:47.072161Z","iopub.execute_input":"2024-05-17T13:29:47.072542Z","iopub.status.idle":"2024-05-17T13:31:40.554954Z","shell.execute_reply.started":"2024-05-17T13:29:47.072503Z","shell.execute_reply":"2024-05-17T13:31:40.552360Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}