{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.12","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":53666,"databundleVersionId":6589269,"sourceType":"competition"},{"sourceId":6879418,"sourceType":"datasetVersion","datasetId":3785250},{"sourceId":6975427,"sourceType":"datasetVersion","datasetId":4008173},{"sourceId":144358840,"sourceType":"kernelVersion"},{"sourceId":149254949,"sourceType":"kernelVersion"}],"dockerImageVersionId":30559,"isInternetEnabled":false,"language":"python","sourceType":"notebook","isGpuEnabled":true}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"See the following repositories for details  \nhttps://github.com/TomuToyoshima/kaggle-child-mind-institute-detect-sleep-states","metadata":{}},{"cell_type":"markdown","source":"# Install additional libraries","metadata":{}},{"cell_type":"code","source":"!pip install hydra-core segmentation_models_pytorch==0.3.3 --no-index --find-links=/kaggle/input/ex-library","metadata":{"execution":{"iopub.status.busy":"2023-11-07T01:06:11.148459Z","iopub.execute_input":"2023-11-07T01:06:11.149011Z","iopub.status.idle":"2023-11-07T01:06:33.030475Z","shell.execute_reply.started":"2023-11-07T01:06:11.148982Z","shell.execute_reply":"2023-11-07T01:06:33.029337Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd /kaggle/input/TomuToyoshima/kaggle-child-mind-institute-detect-sleep-states","metadata":{"execution":{"iopub.status.busy":"2023-11-07T01:06:33.033048Z","iopub.execute_input":"2023-11-07T01:06:33.033425Z","iopub.status.idle":"2023-11-07T01:06:33.043021Z","shell.execute_reply.started":"2023-11-07T01:06:33.033386Z","shell.execute_reply":"2023-11-07T01:06:33.042085Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Config","metadata":{}},{"cell_type":"code","source":"# Config\nDURATION = 5760\nDOWNSAMPLE_RATE = 2\nPHASE = 'test'\nEXP_NAME = 'exp001'","metadata":{"execution":{"iopub.status.busy":"2023-11-07T01:06:39.149141Z","iopub.execute_input":"2023-11-07T01:06:39.149490Z","iopub.status.idle":"2023-11-07T01:06:39.154193Z","shell.execute_reply.started":"2023-11-07T01:06:39.149462Z","shell.execute_reply":"2023-11-07T01:06:39.153258Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Preprocess","metadata":{}},{"cell_type":"code","source":"!python -m run.prepare_data dir=kaggle phase=$PHASE","metadata":{"execution":{"iopub.status.busy":"2023-11-07T01:06:41.168803Z","iopub.execute_input":"2023-11-07T01:06:41.169201Z","iopub.status.idle":"2023-11-07T01:06:43.965141Z","shell.execute_reply.started":"2023-11-07T01:06:41.169168Z","shell.execute_reply":"2023-11-07T01:06:43.964153Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Inference","metadata":{}},{"cell_type":"code","source":"!python -m run.inference\\\n    dir=kaggle\\\n    model.encoder_name=resnet34\\\n    model.encoder_weights=null\\\n    num_workers=2\\\n    exp_name=$EXP_NAME\\\n    weight.run_name=single\\\n    batch_size=64\\\n    duration=$DURATION\\\n    downsample_rate=$DOWNSAMPLE_RATE\\\n    post_process.score_th=0.005\\\n    post_process.distance=40\\\n    phase=$PHASE","metadata":{"execution":{"iopub.status.busy":"2023-11-07T01:06:43.967104Z","iopub.execute_input":"2023-11-07T01:06:43.967409Z","iopub.status.idle":"2023-11-07T01:07:25.224046Z","shell.execute_reply.started":"2023-11-07T01:06:43.967380Z","shell.execute_reply":"2023-11-07T01:07:25.222801Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"# いらないファイル、フォルダ削除\n!rm -rf /kaggle/working/processed_data\n!rm -rf /kaggle/working/output","metadata":{"execution":{"iopub.status.busy":"2023-11-07T01:07:25.225664Z","iopub.execute_input":"2023-11-07T01:07:25.226001Z","iopub.status.idle":"2023-11-07T01:07:27.145089Z","shell.execute_reply.started":"2023-11-07T01:07:25.225971Z","shell.execute_reply":"2023-11-07T01:07:27.143779Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{},"execution_count":null,"outputs":[]}]}