{"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_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!pip3 install timm","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-02-24T15:19:56.223303Z","iopub.execute_input":"2022-02-24T15:19:56.223599Z","iopub.status.idle":"2022-02-24T15:20:05.753724Z","shell.execute_reply.started":"2022-02-24T15:19:56.223566Z","shell.execute_reply":"2022-02-24T15:20:05.752596Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!nvidia-smi","metadata":{"execution":{"iopub.status.busy":"2022-02-24T15:20:09.738843Z","iopub.execute_input":"2022-02-24T15:20:09.739162Z","iopub.status.idle":"2022-02-24T15:20:10.550601Z","shell.execute_reply.started":"2022-02-24T15:20:09.739124Z","shell.execute_reply":"2022-02-24T15:20:10.549321Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!git clone https://github.com/rwightman/pytorch-image-models\n%cd pytorch-image-models","metadata":{"execution":{"iopub.status.busy":"2022-02-24T15:20:55.852053Z","iopub.execute_input":"2022-02-24T15:20:55.852395Z","iopub.status.idle":"2022-02-24T15:20:55.863303Z","shell.execute_reply.started":"2022-02-24T15:20:55.852355Z","shell.execute_reply":"2022-02-24T15:20:55.859166Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Training","metadata":{}},{"cell_type":"code","source":"!CUDA_VISIBLE_DEVICES=0 python train.py ../../input/dog-vs-cat-classification --model tf_efficientnet_b4_ns --batch-size 16 --epochs 1 --train-split train --pretrained ","metadata":{"execution":{"iopub.status.busy":"2022-02-24T10:53:36.393605Z","iopub.execute_input":"2022-02-24T10:53:36.39392Z","iopub.status.idle":"2022-02-24T15:14:26.284247Z","shell.execute_reply.started":"2022-02-24T10:53:36.393882Z","shell.execute_reply":"2022-02-24T15:14:26.281954Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Inference","metadata":{}},{"cell_type":"code","source":"!CUDA_VISIBLE_DEVICES=0 python inference.py ../../input/dog-vs-cat-classification/test/test --model tf_efficientnet_b4_ns --topk 1 --checkpoint \"output/train/20220224-105349-tf_efficientnet_b4_ns-380/checkpoint-5.pth.tar\" --batch-size 16","metadata":{"execution":{"iopub.status.busy":"2022-02-24T15:46:18.977579Z","iopub.execute_input":"2022-02-24T15:46:18.977879Z","iopub.status.idle":"2022-02-24T15:48:01.116136Z","shell.execute_reply.started":"2022-02-24T15:46:18.977846Z","shell.execute_reply":"2022-02-24T15:48:01.114976Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pandas as pd\n\ndf_test = pd.read_csv('topk_ids.csv', index_col=False, header=None)\ndf_test.columns = ['id', 'labels']\ndf_test.to_csv(\"../submission.csv\", index=False)","metadata":{"execution":{"iopub.status.busy":"2022-02-24T15:49:06.865504Z","iopub.execute_input":"2022-02-24T15:49:06.865807Z","iopub.status.idle":"2022-02-24T15:49:06.898756Z","shell.execute_reply.started":"2022-02-24T15:49:06.865774Z","shell.execute_reply":"2022-02-24T15:49:06.897707Z"},"trusted":true},"execution_count":null,"outputs":[]}]}