{"cells":[{"metadata":{"_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","trusted":true},"cell_type":"code","source":"import os\nimport sys","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"os.listdir(\"/kaggle/input/workspace/workspace\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"! cp -r /kaggle/input/workspace/workspace .","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"os.listdir(\"./\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"os.listdir(\"/kaggle/input/bengaliai-cv19/\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"os.listdir(\"/kaggle/input/monk-kaggle-bengali-ai/monk_kaggle_bengali_ai/\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!cd /kaggle/input/monk-kaggle-bengali-ai/monk_kaggle_bengali_ai/installs/ && pip install PyLg-1.3.3-py3-none-any.whl","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!cd /kaggle/input/monk-kaggle-bengali-ai/monk_kaggle_bengali_ai/installs/ && pip install blessings-1.7-py3-none-any.whl","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!cd /kaggle/input/monk-kaggle-bengali-ai/monk_kaggle_bengali_ai/installs/ && pip install netron-3.7.3-py2.py3-none-any.whl","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"!cd /kaggle/input/monk-kaggle-bengali-ai/monk_kaggle_bengali_ai/installs/ && pip install gpustat-0.6.0-py3-none-any.whl","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"import sys\nsys.path.append(\"/kaggle/input/monk-kaggle-bengali-ai/monk_kaggle_bengali_ai/monk/\")\nsys.path.append(\"/kaggle/input/monk-kaggle-bengali-ai/monk_kaggle_bengali_ai/installs/\")","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from gluon_prototype import prototype","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"from tqdm.notebook import tqdm\nimport pandas as pd\n\nimport numpy as np\nimport mxnet as mx","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"gtf_list = []\n\ngtf1 = prototype(verbose=1);\ngtf1.Prototype(\"sample-project\", \"sample-experiment-1\", eval_infer=True);\ngtf_list.append(gtf1);\n\n\ngtf2 = prototype(verbose=1);\ngtf2.Prototype(\"sample-project\", \"sample-experiment-2\", eval_infer=True);\ngtf_list.append(gtf2);\n\ngtf3 = prototype(verbose=1);\ngtf3.Prototype(\"sample-project\", \"sample-experiment-3\", eval_infer=True);\ngtf_list.append(gtf3);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"target = [\"consonant_diacritic\", \"grapheme_root\", \"vowel_diacritic\"];\ncombined = [];\n\n\nfor i in range(4):\n    fname = \"/kaggle/input/bengaliai-cv19/test_image_data_{}.parquet\".format(i);\n    print(\"reading - \", fname);\n    df = pd.read_parquet(fname);\n    \n    for j in range(len(df)):\n        image_id = df.iloc[j][0];\n        #print(image_id);\n        data = df.iloc[j][1:];\n\n        for k in range(3):\n            id_ = image_id + \"_\" +  target[k]\n            predictions = gtf_list[k].Infer_Kaggle(data)\n            pred = int(predictions[\"predicted_class\"]);\n            #print(id_, pred)\n            combined.append([id_, pred]);","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df = pd.DataFrame(combined, columns = ['row_id', 'target']);  ","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df.to_csv(\"submission.csv\", index=False)","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"df[:5]","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"! rm -r workspace","execution_count":null,"outputs":[]},{"metadata":{"trusted":true},"cell_type":"code","source":"","execution_count":null,"outputs":[]}],"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat":4,"nbformat_minor":1}