{"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"},"kaggle":{"accelerator":"nvidiaTeslaT4","dataSources":[{"sourceId":53666,"databundleVersionId":6589269,"sourceType":"competition"},{"sourceId":6879418,"sourceType":"datasetVersion","datasetId":3785250},{"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/tubo213/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-04T06:48:30.83819Z","iopub.execute_input":"2023-11-04T06:48:30.83855Z","iopub.status.idle":"2023-11-04T06:48:43.573162Z","shell.execute_reply.started":"2023-11-04T06:48:30.838518Z","shell.execute_reply":"2023-11-04T06:48:43.57194Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%cd /kaggle/input/cmi-code/kaggle-child-mind-institute-detect-sleep-states/","metadata":{"execution":{"iopub.status.busy":"2023-11-04T06:51:50.173344Z","iopub.execute_input":"2023-11-04T06:51:50.173751Z","iopub.status.idle":"2023-11-04T06:51:50.18312Z","shell.execute_reply.started":"2023-11-04T06:51:50.173718Z","shell.execute_reply":"2023-11-04T06:51:50.18216Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"# Config","metadata":{}},{"cell_type":"code","source":"DURATION = 5760\nDOWNSAMPLE_RATE = 2\nPHASE = 'test'\nEXP_NAME = 'exp001'","metadata":{"execution":{"iopub.status.busy":"2023-11-04T06:51:51.587356Z","iopub.execute_input":"2023-11-04T06:51:51.588405Z","iopub.status.idle":"2023-11-04T06:51:51.593322Z","shell.execute_reply.started":"2023-11-04T06:51:51.58836Z","shell.execute_reply":"2023-11-04T06:51:51.592381Z"},"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-04T06:51:52.624864Z","iopub.execute_input":"2023-11-04T06:51:52.625247Z","iopub.status.idle":"2023-11-04T06:51:55.06867Z","shell.execute_reply.started":"2023-11-04T06:51:52.625217Z","shell.execute_reply":"2023-11-04T06:51:55.067626Z"},"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-04T06:58:15.33764Z","iopub.execute_input":"2023-11-04T06:58:15.338066Z","iopub.status.idle":"2023-11-04T06:58:44.508434Z","shell.execute_reply.started":"2023-11-04T06:58:15.338028Z","shell.execute_reply":"2023-11-04T06:58:44.507278Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!rm -rf /kaggle/working/processed_data\n!rm -rf /kaggle/working/output","metadata":{"execution":{"iopub.status.busy":"2023-11-04T06:58:44.51035Z","iopub.execute_input":"2023-11-04T06:58:44.510677Z","iopub.status.idle":"2023-11-04T06:58:46.536147Z","shell.execute_reply.started":"2023-11-04T06:58:44.510646Z","shell.execute_reply":"2023-11-04T06:58:46.534771Z"},"trusted":true},"execution_count":null,"outputs":[]}]}