{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyMsr6zQ2XcUQEqV8i87Sh9v"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"},"accelerator":"GPU","gpuClass":"premium"},"cells":[{"cell_type":"code","execution_count":null,"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"OEySyEO08SU3","executionInfo":{"status":"ok","timestamp":1675254185686,"user_tz":-60,"elapsed":1124,"user":{"displayName":"marti Xooo","userId":"17000102553335328898"}},"outputId":"8263f62d-cc5c-4fd8-c363-afe4594da5a8"},"outputs":[{"output_type":"stream","name":"stdout","text":["Wed Feb 1 12:23:04 2023 \n","+-----------------------------------------------------------------------------+\n","| NVIDIA-SMI 510.47.03 Driver Version: 510.47.03 CUDA Version: 11.6 |\n","|-------------------------------+----------------------+----------------------+\n","| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |\n","| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |\n","| | | MIG M. |\n","|===============================+======================+======================|\n","| 0 NVIDIA A100-SXM... Off | 00000000:00:04.0 Off | 0 |\n","| N/A 30C P0 50W / 400W | 0MiB / 40960MiB | 0% Default |\n","| | | Disabled |\n","+-------------------------------+----------------------+----------------------+\n"," \n","+-----------------------------------------------------------------------------+\n","| Processes: |\n","| GPU GI CI PID Type Process name GPU Memory |\n","| ID ID Usage |\n","|=============================================================================|\n","| No running processes found |\n","+-----------------------------------------------------------------------------+\n"]}],"source":["!nvidia-smi"]},{"cell_type":"code","source":["from google.colab import drive\n","drive.mount('/content/gdrive', force_remount=True)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"9PsGmo0h8vBe","executionInfo":{"status":"ok","timestamp":1675254208492,"user_tz":-60,"elapsed":18056,"user":{"displayName":"marti Xooo","userId":"17000102553335328898"}},"outputId":"81adc7fb-0b26-4541-ef82-d1b0008b30b3"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Mounted at /content/gdrive\n"]}]},{"cell_type":"code","source":["cd gdrive/MyDrive/WKO_PROJECT_NEW"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"61nw5yn9_rId","executionInfo":{"status":"ok","timestamp":1675254211441,"user_tz":-60,"elapsed":206,"user":{"displayName":"marti Xooo","userId":"17000102553335328898"}},"outputId":"e594178c-4088-4881-b830-745741baf884"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["/content/gdrive/MyDrive/WKO_PROJECT_NEW\n"]}]},{"cell_type":"code","source":["!git clone https://github.com/ultralytics/yolov5"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"PCV1rHaY8gLr","executionInfo":{"status":"ok","timestamp":1675071106760,"user_tz":-60,"elapsed":4182,"user":{"displayName":"marti Xooo","userId":"17000102553335328898"}},"outputId":"8c7f5bed-04c5-4fff-8fba-ae6e7bc5bc6a"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["Cloning into 'yolov5'...\n","remote: Enumerating objects: 15002, done.\u001b[K\n","remote: Total 15002 (delta 0), reused 0 (delta 0), pack-reused 15002\u001b[K\n","Receiving objects: 100% (15002/15002), 14.02 MiB | 11.68 MiB/s, done.\n","Resolving deltas: 100% (10291/10291), done.\n"]}]},{"cell_type":"code","source":["%cd yolov5\n","!pip install -U -r requirements.txt\n","import torch\n","from IPython.display import Image"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"adYlb7-18lBJ","executionInfo":{"status":"ok","timestamp":1675071133115,"user_tz":-60,"elapsed":13098,"user":{"displayName":"marti Xooo","userId":"17000102553335328898"}},"outputId":"a7080eb9-c7a9-429f-8955-223a5a3f13f5"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["/content/gdrive/MyDrive/WKO_PROJECT_NEW/yolov5\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: gitpython in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 5)) (3.1.30)\n","Requirement already satisfied: ipython in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 6)) (8.9.0)\n","Requirement already satisfied: matplotlib>=3.2.2 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 7)) (3.6.3)\n","Requirement already satisfied: numpy>=1.18.5 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 8)) (1.24.1)\n","Requirement already satisfied: opencv-python>=4.1.1 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 9)) (4.7.0.68)\n","Requirement already satisfied: Pillow>=7.1.2 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 10)) (9.4.0)\n","Requirement already satisfied: psutil in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 11)) (5.9.4)\n","Requirement already satisfied: PyYAML>=5.3.1 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 12)) (6.0)\n","Requirement already satisfied: requests>=2.23.0 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 13)) (2.28.2)\n","Requirement already satisfied: scipy>=1.4.1 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 14)) (1.10.0)\n","Requirement already satisfied: thop>=0.1.1 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 15)) (0.1.1.post2209072238)\n","Requirement already satisfied: torch>=1.7.0 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 16)) (1.13.1+cu116)\n","Requirement already satisfied: torchvision>=0.8.1 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 17)) (0.14.1+cu116)\n","Requirement already satisfied: tqdm>=4.64.0 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 18)) (4.64.1)\n","Requirement already satisfied: tensorboard>=2.4.1 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 22)) (2.11.2)\n","Requirement already satisfied: pandas>=1.1.4 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 27)) (1.5.3)\n","Requirement already satisfied: seaborn>=0.11.0 in /usr/local/lib/python3.8/dist-packages (from -r requirements.txt (line 28)) (0.12.2)\n","Requirement already satisfied: gitdb<5,>=4.0.1 in /usr/local/lib/python3.8/dist-packages (from gitpython->-r requirements.txt (line 5)) (4.0.10)\n","Requirement already satisfied: jedi>=0.16 in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (0.18.2)\n","Requirement already satisfied: decorator in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (4.4.2)\n","Requirement already satisfied: prompt-toolkit<3.1.0,>=3.0.30 in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (3.0.36)\n","Requirement already satisfied: stack-data in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (0.6.2)\n","Requirement already satisfied: backcall in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (0.2.0)\n","Requirement already satisfied: pexpect>4.3 in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (4.8.0)\n","Requirement already satisfied: pickleshare in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (0.7.5)\n","Requirement already satisfied: pygments>=2.4.0 in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (2.6.1)\n","Requirement already satisfied: traitlets>=5 in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (5.7.1)\n","Requirement already satisfied: matplotlib-inline in /usr/local/lib/python3.8/dist-packages (from ipython->-r requirements.txt (line 6)) (0.1.6)\n","Requirement already satisfied: contourpy>=1.0.1 in /usr/local/lib/python3.8/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 7)) (1.0.7)\n","Requirement already satisfied: cycler>=0.10 in /usr/local/lib/python3.8/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 7)) (0.11.0)\n","Requirement already satisfied: fonttools>=4.22.0 in /usr/local/lib/python3.8/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 7)) (4.38.0)\n","Requirement already satisfied: kiwisolver>=1.0.1 in /usr/local/lib/python3.8/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 7)) (1.4.4)\n","Requirement already satisfied: python-dateutil>=2.7 in /usr/local/lib/python3.8/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 7)) (2.8.2)\n","Requirement already satisfied: pyparsing>=2.2.1 in /usr/local/lib/python3.8/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 7)) (3.0.9)\n","Requirement already satisfied: packaging>=20.0 in /usr/local/lib/python3.8/dist-packages (from matplotlib>=3.2.2->-r requirements.txt (line 7)) (21.3)\n","Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/dist-packages (from requests>=2.23.0->-r requirements.txt (line 13)) (2022.12.7)\n","Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.8/dist-packages (from requests>=2.23.0->-r requirements.txt (line 13)) (2.10)\n","Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/dist-packages (from requests>=2.23.0->-r requirements.txt (line 13)) (1.24.3)\n","Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.8/dist-packages (from requests>=2.23.0->-r requirements.txt (line 13)) (2.1.1)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.8/dist-packages (from torch>=1.7.0->-r requirements.txt (line 16)) (4.4.0)\n","Requirement already satisfied: google-auth<3,>=1.6.3 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (2.16.0)\n","Requirement already satisfied: tensorboard-data-server<0.7.0,>=0.6.0 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (0.6.1)\n","Requirement already satisfied: absl-py>=0.4 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (1.3.0)\n","Requirement already satisfied: tensorboard-plugin-wit>=1.6.0 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (1.8.1)\n","Requirement already satisfied: google-auth-oauthlib<0.5,>=0.4.1 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (0.4.6)\n","Requirement already satisfied: markdown>=2.6.8 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (3.4.1)\n","Requirement already satisfied: grpcio>=1.24.3 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (1.51.1)\n","Requirement already satisfied: werkzeug>=1.0.1 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (1.0.1)\n","Requirement already satisfied: wheel>=0.26 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (0.38.4)\n","Requirement already satisfied: protobuf<4,>=3.9.2 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (3.19.6)\n","Requirement already satisfied: setuptools>=41.0.0 in /usr/local/lib/python3.8/dist-packages (from tensorboard>=2.4.1->-r requirements.txt (line 22)) (57.4.0)\n","Requirement already satisfied: pytz>=2020.1 in /usr/local/lib/python3.8/dist-packages (from pandas>=1.1.4->-r requirements.txt (line 27)) (2022.7)\n","Requirement already satisfied: smmap<6,>=3.0.1 in /usr/local/lib/python3.8/dist-packages (from gitdb<5,>=4.0.1->gitpython->-r requirements.txt (line 5)) (5.0.0)\n","Requirement already satisfied: cachetools<6.0,>=2.0.0 in /usr/local/lib/python3.8/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 22)) (5.2.1)\n","Requirement already satisfied: rsa<5,>=3.1.4 in /usr/local/lib/python3.8/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 22)) (4.9)\n","Requirement already satisfied: pyasn1-modules>=0.2.1 in /usr/local/lib/python3.8/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 22)) (0.2.8)\n","Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python3.8/dist-packages (from google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 22)) (1.15.0)\n","Requirement already satisfied: requests-oauthlib>=0.7.0 in /usr/local/lib/python3.8/dist-packages (from google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.4.1->-r requirements.txt (line 22)) (1.3.1)\n","Requirement already satisfied: parso<0.9.0,>=0.8.0 in /usr/local/lib/python3.8/dist-packages (from jedi>=0.16->ipython->-r requirements.txt (line 6)) (0.8.3)\n","Requirement already satisfied: importlib-metadata>=4.4 in /usr/local/lib/python3.8/dist-packages (from markdown>=2.6.8->tensorboard>=2.4.1->-r requirements.txt (line 22)) (6.0.0)\n","Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.8/dist-packages (from pexpect>4.3->ipython->-r requirements.txt (line 6)) (0.7.0)\n","Requirement already satisfied: wcwidth in /usr/local/lib/python3.8/dist-packages (from prompt-toolkit<3.1.0,>=3.0.30->ipython->-r requirements.txt (line 6)) (0.2.5)\n","Requirement already satisfied: executing>=1.2.0 in /usr/local/lib/python3.8/dist-packages (from stack-data->ipython->-r requirements.txt (line 6)) (1.2.0)\n","Requirement already satisfied: asttokens>=2.1.0 in /usr/local/lib/python3.8/dist-packages (from stack-data->ipython->-r requirements.txt (line 6)) (2.2.1)\n","Requirement already satisfied: pure-eval in /usr/local/lib/python3.8/dist-packages (from stack-data->ipython->-r requirements.txt (line 6)) (0.2.2)\n","Requirement already satisfied: zipp>=0.5 in /usr/local/lib/python3.8/dist-packages (from importlib-metadata>=4.4->markdown>=2.6.8->tensorboard>=2.4.1->-r requirements.txt (line 22)) (3.11.0)\n","Requirement already satisfied: pyasn1<0.5.0,>=0.4.6 in /usr/local/lib/python3.8/dist-packages (from pyasn1-modules>=0.2.1->google-auth<3,>=1.6.3->tensorboard>=2.4.1->-r requirements.txt (line 22)) (0.4.8)\n","Requirement already satisfied: oauthlib>=3.0.0 in /usr/local/lib/python3.8/dist-packages (from requests-oauthlib>=0.7.0->google-auth-oauthlib<0.5,>=0.4.1->tensorboard>=2.4.1->-r requirements.txt (line 22)) (3.2.2)\n"]}]},{"cell_type":"code","source":["!python3 yolov5/train.py --batch 1 --epochs 100 --data mask_dataset/data.yaml --cfg yolov5/models/yolov5s.yaml --weights '' --device 0"],"metadata":{"id":"RXR731Z39NsD","colab":{"base_uri":"https://localhost:8080/"},"outputId":"a23d8c49-39c0-4e1a-8312-24bb5d3bab87","executionInfo":{"status":"ok","timestamp":1675249360254,"user_tz":-60,"elapsed":748014,"user":{"displayName":"marti Xooo","userId":"17000102553335328898"}}},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["\u001b[34m\u001b[1mtrain: \u001b[0mweights=, cfg=yolov5/models/yolov5s.yaml, data=mask_dataset/data.yaml, hyp=yolov5/data/hyps/hyp.scratch-low.yaml, epochs=100, batch_size=1, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, bucket=, cache=None, image_weights=False, device=0, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=yolov5/runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest\n","\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov5 ✅\n","YOLOv5 🚀 v7.0-72-g064365d Python-3.8.10 torch-1.13.1+cu116 CUDA:0 (Tesla T4, 15110MiB)\n","\n","\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0\n","\u001b[34m\u001b[1mClearML: \u001b[0mrun 'pip install clearml' to automatically track, visualize and remotely train YOLOv5 🚀 in ClearML\n","\u001b[34m\u001b[1mComet: \u001b[0mrun 'pip install comet_ml' to automatically track and visualize YOLOv5 🚀 runs in Comet\n","\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir yolov5/runs/train', view at http://localhost:6006/\n","\n"," from n params module arguments \n"," 0 -1 1 3520 models.common.Conv [3, 32, 6, 2, 2] \n"," 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n"," 2 -1 1 18816 models.common.C3 [64, 64, 1] \n"," 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n"," 4 -1 2 115712 models.common.C3 [128, 128, 2] \n"," 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n"," 6 -1 3 625152 models.common.C3 [256, 256, 3] \n"," 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n"," 8 -1 1 1182720 models.common.C3 [512, 512, 1] \n"," 9 -1 1 656896 models.common.SPPF [512, 512, 5] \n"," 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] \n"," 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n"," 12 [-1, 6] 1 0 models.common.Concat [1] \n"," 13 -1 1 361984 models.common.C3 [512, 256, 1, False] \n"," 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] \n"," 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n"," 16 [-1, 4] 1 0 models.common.Concat [1] \n"," 17 -1 1 90880 models.common.C3 [256, 128, 1, False] \n"," 18 -1 1 147712 models.common.Conv [128, 128, 3, 2] \n"," 19 [-1, 14] 1 0 models.common.Concat [1] \n"," 20 -1 1 296448 models.common.C3 [256, 256, 1, False] \n"," 21 -1 1 590336 models.common.Conv [256, 256, 3, 2] \n"," 22 [-1, 10] 1 0 models.common.Concat [1] \n"," 23 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n"," 24 [17, 20, 23] 1 21576 models.yolo.Detect [3, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n","YOLOv5s summary: 214 layers, 7027720 parameters, 7027720 gradients, 16.0 GFLOPs\n","\n","\u001b[34m\u001b[1mAMP: \u001b[0mchecks passed ✅\n","\u001b[34m\u001b[1moptimizer:\u001b[0m SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 60 weight(decay=0.0005), 60 bias\n","\u001b[34m\u001b[1malbumentations: \u001b[0mBlur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01), CLAHE(p=0.01, clip_limit=(1, 4.0), tile_grid_size=(8, 8))\n","\u001b[34m\u001b[1mtrain: \u001b[0mScanning /content/gdrive/MyDrive/WKO_PROJECT_NEW/mask_dataset/train.cache... 682 images, 0 backgrounds, 0 corrupt: 100% 682/682 [00:00\n"," main(opt)\n"," File \"yolov5/train.py\", line 528, in main\n"," train(opt.hyp, opt, device, callbacks)\n"," File \"yolov5/train.py\", line 283, in train\n"," for i, (imgs, targets, paths, _) in pbar: # batch -------------------------------------------------------------\n"," File \"/usr/local/lib/python3.8/dist-packages/tqdm/std.py\", line 1195, in __iter__\n"," for obj in iterable:\n"," File \"/content/gdrive/MyDrive/WKO_PROJECT_NEW/yolov5/utils/dataloaders.py\", line 172, in __iter__\n"," yield next(self.iterator)\n"," File \"/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py\", line 628, in __next__\n"," data = self._next_data()\n"," File \"/usr/local/lib/python3.8/dist-packages/torch/utils/data/dataloader.py\", line 671, in _next_data\n"," data = self._dataset_fetcher.fetch(index) # may raise StopIteration\n"," File \"/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py\", line 58, in fetch\n"," data = [self.dataset[idx] for idx in possibly_batched_index]\n"," File \"/usr/local/lib/python3.8/dist-packages/torch/utils/data/_utils/fetch.py\", line 58, in \n"," data = [self.dataset[idx] for idx in possibly_batched_index]\n"," File \"/content/gdrive/MyDrive/WKO_PROJECT_NEW/yolov5/utils/dataloaders.py\", line 660, in __getitem__\n"," img, labels = self.load_mosaic(index)\n"," File \"/content/gdrive/MyDrive/WKO_PROJECT_NEW/yolov5/utils/dataloaders.py\", line 763, in load_mosaic\n"," img4 = np.full((s * 2, s * 2, img.shape[2]), 114, dtype=np.uint8) # base image with 4 tiles\n"," File \"/usr/local/lib/python3.8/dist-packages/numpy/core/numeric.py\", line 344, in full\n"," multiarray.copyto(a, fill_value, casting='unsafe')\n"," File \"<__array_function__ internals>\", line 5, in copyto\n","KeyboardInterrupt\n","^C\n"]}]},{"cell_type":"code","source":["!python3 yolov5/train.py --batch 1 --epochs 100 --data mask_dataset/mask_an.yaml --cfg yolov5/models/yolov5s.yaml --weights '' --device 0"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"MqlvNLa5oTro","outputId":"87dd0c9a-32fa-4d78-e77a-a5d88c3d70a6"},"execution_count":null,"outputs":[{"output_type":"stream","name":"stdout","text":["\u001b[34m\u001b[1mtrain: \u001b[0mweights=, cfg=yolov5/models/yolov5s.yaml, data=mask_dataset/mask_an.yaml, hyp=yolov5/data/hyps/hyp.scratch-low.yaml, epochs=100, batch_size=1, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, bucket=, cache=None, image_weights=False, device=0, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=yolov5/runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest\n","\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov5 ✅\n","YOLOv5 🚀 v7.0-72-g064365d Python-3.8.10 torch-1.13.1+cu116 CUDA:0 (Tesla T4, 15110MiB)\n","\n","\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0\n","\u001b[34m\u001b[1mClearML: \u001b[0mrun 'pip install clearml' to automatically track, visualize and remotely train YOLOv5 🚀 in ClearML\n","\u001b[34m\u001b[1mComet: \u001b[0mrun 'pip install comet_ml' to automatically track and visualize YOLOv5 🚀 runs in Comet\n","\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir yolov5/runs/train', view at http://localhost:6006/\n","\n"," from n params module arguments \n"," 0 -1 1 3520 models.common.Conv [3, 32, 6, 2, 2] \n"," 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n"," 2 -1 1 18816 models.common.C3 [64, 64, 1] \n"," 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n"," 4 -1 2 115712 models.common.C3 [128, 128, 2] \n"," 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n"," 6 -1 3 625152 models.common.C3 [256, 256, 3] \n"," 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n"," 8 -1 1 1182720 models.common.C3 [512, 512, 1] \n"," 9 -1 1 656896 models.common.SPPF [512, 512, 5] \n"," 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] \n"," 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n"," 12 [-1, 6] 1 0 models.common.Concat [1] \n"," 13 -1 1 361984 models.common.C3 [512, 256, 1, False] \n"," 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] \n"," 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n"," 16 [-1, 4] 1 0 models.common.Concat [1] \n"," 17 -1 1 90880 models.common.C3 [256, 128, 1, False] \n"," 18 -1 1 147712 models.common.Conv [128, 128, 3, 2] \n"," 19 [-1, 14] 1 0 models.common.Concat [1] \n"," 20 -1 1 296448 models.common.C3 [256, 256, 1, False] \n"," 21 -1 1 590336 models.common.Conv [256, 256, 3, 2] \n"," 22 [-1, 10] 1 0 models.common.Concat [1] \n"," 23 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n"," 24 [17, 20, 23] 1 21576 models.yolo.Detect [3, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n","YOLOv5s summary: 214 layers, 7027720 parameters, 7027720 gradients, 16.0 GFLOPs\n","\n","\u001b[34m\u001b[1mAMP: \u001b[0mchecks passed ✅\n","\u001b[34m\u001b[1moptimizer:\u001b[0m SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 60 weight(decay=0.0005), 60 bias\n","\u001b[34m\u001b[1malbumentations: \u001b[0mBlur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01), CLAHE(p=0.01, clip_limit=(1, 4.0), tile_grid_size=(8, 8))\n","\u001b[34m\u001b[1mtrain: \u001b[0mScanning /content/gdrive/MyDrive/WKO_PROJECT_NEW/mask_dataset/train.cache... 682 images, 0 backgrounds, 0 corrupt: 100% 682/682 [00:00=4.0.1\n"," Downloading gitdb-4.0.10-py3-none-any.whl (62 kB)\n"," ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 62.7/62.7 KB 9.3 MB/s eta 0:00:00\n","Collecting smmap<6,>=3.0.1\n"," Downloading smmap-5.0.0-py3-none-any.whl (24 kB)\n","Installing collected packages: smmap, gitdb, gitpython\n","Successfully installed gitdb-4.0.10 gitpython-3.1.30 smmap-5.0.0\n","\n","\u001b[31m\u001b[1mrequirements:\u001b[0m 1 package updated per ['gitpython']\n","\u001b[31m\u001b[1mrequirements:\u001b[0m ⚠️ \u001b[1mRestart runtime or rerun command for updates to take effect\u001b[0m\n","\n","\u001b[34m\u001b[1mtrain: \u001b[0mweights=, cfg=yolov5/models/yolov5s.yaml, data=mask_dataset/mask_an.yaml, hyp=yolov5/data/hyps/hyp.scratch-low.yaml, epochs=100, batch_size=1, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, bucket=, cache=None, image_weights=False, device=0, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=yolov5/runs/train, name=exp, exist_ok=False, quad=False, cos_lr=False, label_smoothing=0.0, patience=100, freeze=[0], save_period=-1, seed=0, local_rank=-1, entity=None, upload_dataset=False, bbox_interval=-1, artifact_alias=latest\n","\u001b[34m\u001b[1mgithub: \u001b[0mup to date with https://github.com/ultralytics/yolov5 ✅\n","\u001b[31m\u001b[1mrequirements:\u001b[0m YOLOv5 requirements \"ipython\" \"thop>=0.1.1\" not found, attempting AutoUpdate...\n","Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/\n","Requirement already satisfied: ipython in /usr/local/lib/python3.8/dist-packages (7.9.0)\n","Collecting thop>=0.1.1\n"," Downloading thop-0.1.1.post2209072238-py3-none-any.whl (15 kB)\n","Requirement already satisfied: setuptools>=18.5 in /usr/local/lib/python3.8/dist-packages (from ipython) (57.4.0)\n","Requirement already satisfied: pexpect in /usr/local/lib/python3.8/dist-packages (from ipython) (4.8.0)\n","Requirement already satisfied: traitlets>=4.2 in /usr/local/lib/python3.8/dist-packages (from ipython) (5.7.1)\n","Requirement already satisfied: backcall in /usr/local/lib/python3.8/dist-packages (from ipython) (0.2.0)\n","Collecting jedi>=0.10\n"," Downloading jedi-0.18.2-py2.py3-none-any.whl (1.6 MB)\n"," ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.6/1.6 MB 22.4 MB/s eta 0:00:00\n","Requirement already satisfied: decorator in /usr/local/lib/python3.8/dist-packages (from ipython) (4.4.2)\n","Requirement already satisfied: pygments in /usr/local/lib/python3.8/dist-packages (from ipython) (2.6.1)\n","Requirement already satisfied: prompt-toolkit<2.1.0,>=2.0.0 in /usr/local/lib/python3.8/dist-packages (from ipython) (2.0.10)\n","Requirement already satisfied: pickleshare in /usr/local/lib/python3.8/dist-packages (from ipython) (0.7.5)\n","Requirement already satisfied: torch in /usr/local/lib/python3.8/dist-packages (from thop>=0.1.1) (1.13.1+cu116)\n","Requirement already satisfied: parso<0.9.0,>=0.8.0 in /usr/local/lib/python3.8/dist-packages (from jedi>=0.10->ipython) (0.8.3)\n","Requirement already satisfied: six>=1.9.0 in /usr/local/lib/python3.8/dist-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython) (1.15.0)\n","Requirement already satisfied: wcwidth in /usr/local/lib/python3.8/dist-packages (from prompt-toolkit<2.1.0,>=2.0.0->ipython) (0.2.5)\n","Requirement already satisfied: ptyprocess>=0.5 in /usr/local/lib/python3.8/dist-packages (from pexpect->ipython) (0.7.0)\n","Requirement already satisfied: typing-extensions in /usr/local/lib/python3.8/dist-packages (from torch->thop>=0.1.1) (4.4.0)\n","Installing collected packages: jedi, thop\n","Successfully installed jedi-0.18.2 thop-0.1.1.post2209072238\n","\n","\u001b[31m\u001b[1mrequirements:\u001b[0m 2 packages updated per /content/gdrive/MyDrive/WKO_PROJECT_NEW/yolov5/requirements.txt\n","\u001b[31m\u001b[1mrequirements:\u001b[0m ⚠️ \u001b[1mRestart runtime or rerun command for updates to take effect\u001b[0m\n","\n","YOLOv5 🚀 v7.0-72-g064365d Python-3.8.10 torch-1.13.1+cu116 CUDA:0 (NVIDIA A100-SXM4-40GB, 40536MiB)\n","\n","\u001b[34m\u001b[1mhyperparameters: \u001b[0mlr0=0.01, lrf=0.01, momentum=0.937, weight_decay=0.0005, warmup_epochs=3.0, warmup_momentum=0.8, warmup_bias_lr=0.1, box=0.05, cls=0.5, cls_pw=1.0, obj=1.0, obj_pw=1.0, iou_t=0.2, anchor_t=4.0, fl_gamma=0.0, hsv_h=0.015, hsv_s=0.7, hsv_v=0.4, degrees=0.0, translate=0.1, scale=0.5, shear=0.0, perspective=0.0, flipud=0.0, fliplr=0.5, mosaic=1.0, mixup=0.0, copy_paste=0.0\n","\u001b[34m\u001b[1mClearML: \u001b[0mrun 'pip install clearml' to automatically track, visualize and remotely train YOLOv5 🚀 in ClearML\n","\u001b[34m\u001b[1mComet: \u001b[0mrun 'pip install comet_ml' to automatically track and visualize YOLOv5 🚀 runs in Comet\n","\u001b[34m\u001b[1mTensorBoard: \u001b[0mStart with 'tensorboard --logdir yolov5/runs/train', view at http://localhost:6006/\n","2023-02-01 12:24:09.162063: I tensorflow/core/util/util.cc:169] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.\n","Downloading https://ultralytics.com/assets/Arial.ttf to /root/.config/Ultralytics/Arial.ttf...\n","100% 755k/755k [00:00<00:00, 15.7MB/s]\n","\n"," from n params module arguments \n"," 0 -1 1 3520 models.common.Conv [3, 32, 6, 2, 2] \n"," 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] \n"," 2 -1 1 18816 models.common.C3 [64, 64, 1] \n"," 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] \n"," 4 -1 2 115712 models.common.C3 [128, 128, 2] \n"," 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] \n"," 6 -1 3 625152 models.common.C3 [256, 256, 3] \n"," 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] \n"," 8 -1 1 1182720 models.common.C3 [512, 512, 1] \n"," 9 -1 1 656896 models.common.SPPF [512, 512, 5] \n"," 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] \n"," 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n"," 12 [-1, 6] 1 0 models.common.Concat [1] \n"," 13 -1 1 361984 models.common.C3 [512, 256, 1, False] \n"," 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] \n"," 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] \n"," 16 [-1, 4] 1 0 models.common.Concat [1] \n"," 17 -1 1 90880 models.common.C3 [256, 128, 1, False] \n"," 18 -1 1 147712 models.common.Conv [128, 128, 3, 2] \n"," 19 [-1, 14] 1 0 models.common.Concat [1] \n"," 20 -1 1 296448 models.common.C3 [256, 256, 1, False] \n"," 21 -1 1 590336 models.common.Conv [256, 256, 3, 2] \n"," 22 [-1, 10] 1 0 models.common.Concat [1] \n"," 23 -1 1 1182720 models.common.C3 [512, 512, 1, False] \n"," 24 [17, 20, 23] 1 21576 models.yolo.Detect [3, [[10, 13, 16, 30, 33, 23], [30, 61, 62, 45, 59, 119], [116, 90, 156, 198, 373, 326]], [128, 256, 512]]\n","YOLOv5s summary: 214 layers, 7027720 parameters, 7027720 gradients\n","\n","\u001b[34m\u001b[1mAMP: \u001b[0mchecks passed ✅\n","\u001b[34m\u001b[1moptimizer:\u001b[0m SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 60 weight(decay=0.0005), 60 bias\n","\u001b[34m\u001b[1malbumentations: \u001b[0mBlur(p=0.01, blur_limit=(3, 7)), MedianBlur(p=0.01, blur_limit=(3, 7)), ToGray(p=0.01), CLAHE(p=0.01, clip_limit=(1, 4.0), tile_grid_size=(8, 8))\n","\u001b[34m\u001b[1mtrain: \u001b[0mScanning /content/gdrive/MyDrive/WKO_PROJECT_NEW/mask_dataset/train.cache... 682 images, 0 backgrounds, 0 corrupt: 100% 682/682 [00:00