{"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":"! pip install -q ultralytics pycocotools timeout-timer","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2023-07-10T19:08:36.282458Z","iopub.execute_input":"2023-07-10T19:08:36.283473Z","iopub.status.idle":"2023-07-10T19:08:47.791677Z","shell.execute_reply.started":"2023-07-10T19:08:36.283434Z","shell.execute_reply":"2023-07-10T19:08:47.79054Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import wandb\n\nwandb.init(mode=\"disabled\")","metadata":{"execution":{"iopub.status.busy":"2023-07-10T19:08:47.794708Z","iopub.execute_input":"2023-07-10T19:08:47.795733Z","iopub.status.idle":"2023-07-10T19:08:49.280205Z","shell.execute_reply.started":"2023-07-10T19:08:47.795692Z","shell.execute_reply":"2023-07-10T19:08:49.279294Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from timeout_timer import timeout, TimeoutInterrupt","metadata":{"execution":{"iopub.status.busy":"2023-07-10T19:08:49.281479Z","iopub.execute_input":"2023-07-10T19:08:49.282716Z","iopub.status.idle":"2023-07-10T19:08:49.287047Z","shell.execute_reply.started":"2023-07-10T19:08:49.282681Z","shell.execute_reply":"2023-07-10T19:08:49.286176Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"%%writefile badlad.yaml\npath: /kaggle/input\ntrain:\n  - badlad-fold-0\n  - badlad-fold-1\n  - badlad-fold-2\n  - badlad-fold-3\nval:\n  - badlad-fold-0\n  - badlad-fold-1\n  - badlad-fold-2\n  - badlad-fold-3\n\nnames:\n  0: paragraph\n  1: text_box\n  2: image\n  3: table","metadata":{"execution":{"iopub.status.busy":"2023-07-10T19:08:49.288762Z","iopub.execute_input":"2023-07-10T19:08:49.289499Z","iopub.status.idle":"2023-07-10T19:08:49.301903Z","shell.execute_reply.started":"2023-07-10T19:08:49.289468Z","shell.execute_reply":"2023-07-10T19:08:49.30086Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"from ultralytics import YOLO\n\nHOURS = 8.6\n\n@timeout(3600*HOURS)\ndef train():\n    model = YOLO(\"yolov8m-seg.pt\")\n    model.train(\n        data=\"badlad.yaml\",\n        epochs=15,\n        imgsz=960,\n        batch=4,\n        seed=3000,\n        overlap_mask=False,\n        fliplr=0.0,\n        close_mosaic=20,\n        show_labels=False,\n        conf=0.25,\n        iou=0.45,\n        max_det=1000,\n        val=False,\n        half=True,\n    )","metadata":{"execution":{"iopub.status.busy":"2023-07-10T19:08:49.305278Z","iopub.execute_input":"2023-07-10T19:08:49.306268Z","iopub.status.idle":"2023-07-10T19:08:49.312408Z","shell.execute_reply.started":"2023-07-10T19:08:49.306217Z","shell.execute_reply":"2023-07-10T19:08:49.311387Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"try:\n    train()\nexcept TimeoutInterrupt:\n    print(\"Training Paused...\")","metadata":{"execution":{"iopub.status.busy":"2023-07-10T19:08:49.314678Z","iopub.execute_input":"2023-07-10T19:08:49.314982Z","iopub.status.idle":"2023-07-10T19:08:59.328424Z","shell.execute_reply.started":"2023-07-10T19:08:49.314958Z","shell.execute_reply":"2023-07-10T19:08:59.327367Z"},"trusted":true},"execution_count":null,"outputs":[]}]}