{"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":"!git clone https://github.com/chjinny/RSNA2019_Intracranial-Hemorrhage-Detection.git","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:23:49.946168Z","iopub.execute_input":"2021-06-23T13:23:49.94655Z","iopub.status.idle":"2021-06-23T13:23:58.85254Z","shell.execute_reply.started":"2021-06-23T13:23:49.946473Z","shell.execute_reply":"2021-06-23T13:23:58.851575Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd RSNA2019_Intracranial-Hemorrhage-Detection","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:23:58.854383Z","iopub.execute_input":"2021-06-23T13:23:58.854742Z","iopub.status.idle":"2021-06-23T13:23:58.861074Z","shell.execute_reply.started":"2021-06-23T13:23:58.854702Z","shell.execute_reply":"2021-06-23T13:23:58.860285Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!pip install -r requirements.txt","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:23:58.862921Z","iopub.execute_input":"2021-06-23T13:23:58.863716Z","iopub.status.idle":"2021-06-23T13:24:22.7159Z","shell.execute_reply.started":"2021-06-23T13:23:58.863681Z","shell.execute_reply":"2021-06-23T13:24:22.714815Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd 2DNet","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:22.719651Z","iopub.execute_input":"2021-06-23T13:24:22.719909Z","iopub.status.idle":"2021-06-23T13:24:22.725026Z","shell.execute_reply.started":"2021-06-23T13:24:22.719879Z","shell.execute_reply":"2021-06-23T13:24:22.724126Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!sudo apt install unzip\n!unzip data.zip","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:22.72609Z","iopub.execute_input":"2021-06-23T13:24:22.726408Z","iopub.status.idle":"2021-06-23T13:24:25.958526Z","shell.execute_reply.started":"2021-06-23T13:24:22.726371Z","shell.execute_reply":"2021-06-23T13:24:25.95762Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd data\n!ls","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:25.959942Z","iopub.execute_input":"2021-06-23T13:24:25.960225Z","iopub.status.idle":"2021-06-23T13:24:26.611693Z","shell.execute_reply.started":"2021-06-23T13:24:25.960198Z","shell.execute_reply":"2021-06-23T13:24:26.610755Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd ../src","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:26.613482Z","iopub.execute_input":"2021-06-23T13:24:26.614206Z","iopub.status.idle":"2021-06-23T13:24:26.620563Z","shell.execute_reply.started":"2021-06-23T13:24:26.614166Z","shell.execute_reply":"2021-06-23T13:24:26.619498Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# Prepapre Data for training\n#!python prepare_data.py -dcm_path ../../../../input/rsna-intracranial-hemorrhage-detection/rsna-intracranial-hemorrhage-detection/stage_2_train -png_path train_png\n#!python prepare_data.py -dcm_path ../../../../input/rsna-intracranial-hemorrhage-detection/rsna-intracranial-hemorrhage-detection/stage_2_train -png_path test_png","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:26.623545Z","iopub.execute_input":"2021-06-23T13:24:26.623923Z","iopub.status.idle":"2021-06-23T13:24:26.630235Z","shell.execute_reply.started":"2021-06-23T13:24:26.623889Z","shell.execute_reply":"2021-06-23T13:24:26.629243Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#!cd test_png && ls","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:26.632093Z","iopub.execute_input":"2021-06-23T13:24:26.632489Z","iopub.status.idle":"2021-06-23T13:24:26.640532Z","shell.execute_reply.started":"2021-06-23T13:24:26.63245Z","shell.execute_reply":"2021-06-23T13:24:26.639697Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"'''\nimport cv2\nimport matplotlib.pyplot as plt\nimg = cv2.imread(\"./test_png/ID_0161aacd7.png\")\nplt.imshow(img)\nplt.show()\nprint(img.shape)\n\nimg = cv2.imread(\"./test_png/ID_4102a0aa2.png\")\nplt.imshow(img)\nplt.show()\nprint(img.shape)\n'''","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:26.641896Z","iopub.execute_input":"2021-06-23T13:24:26.642614Z","iopub.status.idle":"2021-06-23T13:24:26.663715Z","shell.execute_reply.started":"2021-06-23T13:24:26.642577Z","shell.execute_reply":"2021-06-23T13:24:26.662394Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!cd ../../../../input/rsna-intracranial-hemorrhage-detection-weight-file && ls","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:26.665573Z","iopub.execute_input":"2021-06-23T13:24:26.666528Z","iopub.status.idle":"2021-06-23T13:24:27.604192Z","shell.execute_reply.started":"2021-06-23T13:24:26.666488Z","shell.execute_reply":"2021-06-23T13:24:27.603063Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"#!python train.py -backbone se_resnext101_32x4d -img_size 256 -tbs 80 -vbs 40 -save_path ../../../../input/rsna-intracranial-hemorrhage-detection-weight-file/se_resnext101_256by256","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:27.607468Z","iopub.execute_input":"2021-06-23T13:24:27.60782Z","iopub.status.idle":"2021-06-23T13:24:27.619587Z","shell.execute_reply.started":"2021-06-23T13:24:27.607781Z","shell.execute_reply":"2021-06-23T13:24:27.618477Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cp -r ../../../../input/rsna-intracranial-hemorrhage-detection-weight-file/prediction ./","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:27.623945Z","iopub.execute_input":"2021-06-23T13:24:27.630533Z","iopub.status.idle":"2021-06-23T13:24:39.957393Z","shell.execute_reply.started":"2021-06-23T13:24:27.630494Z","shell.execute_reply":"2021-06-23T13:24:39.956338Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!cd prediction && ls","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:39.959016Z","iopub.execute_input":"2021-06-23T13:24:39.959341Z","iopub.status.idle":"2021-06-23T13:24:40.609241Z","shell.execute_reply.started":"2021-06-23T13:24:39.959302Z","shell.execute_reply":"2021-06-23T13:24:40.608331Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!python predict.py -backbone DenseNet121_change_avg -img_size 256 -tbs 4 -vbs 4 -spth ./prediction/DenseNet121_change_avg_512 ","metadata":{"execution":{"iopub.status.busy":"2021-06-23T13:24:40.610756Z","iopub.execute_input":"2021-06-23T13:24:40.611081Z"},"trusted":true},"execution_count":null,"outputs":[]}]}