実現したいこと
yolov5を使って物体検出の練習をしたく、qiitaを参考に勉強を進めているのですが、参考記事の7.2のGoogle Colabで作成したモデルをダウンロードし、Local PCのyolov5のディレクトリ直下にコピーする。ということがよくわからないため、皆様のお力をお貸し頂きたいです。
それまでに実行したプログラムにそれらしきものも見つからず、どの部分をダウンロードをすればいいかわかりません。またディレクトリ直下にコピーするというのもどこにコピーするのかわかりません。わからないことだらけで、無礼極まりないかもしれませんが、あと少しで物体検出が出来そうなので、よろしくお願いします。
該当のソースコード
python
1!git clone https://github.com/ultralytics/yolov5 2 3#結果 4Cloning into 'yolov5'... 5remote: Enumerating objects: 15997, done. 6remote: Counting objects: 100% (30/30), done. 7remote: Compressing objects: 100% (18/18), done. 8remote: Total 15997 (delta 19), reused 18 (delta 12), pack-reused 15967 9Receiving objects: 100% (15997/15997), 14.58 MiB | 17.05 MiB/s, done. 10Resolving deltas: 100% (10985/10985), done. 11 12!pip install -r yolov5/requirements.txt 13 14#結果 15Collecting gitpython>=3.1.30 (from -r yolov5/requirements.txt (line 5)) 16 Downloading GitPython-3.1.37-py3-none-any.whl (190 kB) 17 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 190.0/190.0 kB 5.2 MB/s eta 0:00:00 18 19 ~省略~ 20 21 22Installing collected packages: smmap, gitdb, gitpython, ultralytics, thop 23Successfully installed gitdb-4.0.10 gitpython-3.1.37 smmap-5.0.1 thop-0.1.1.post2209072238 ultralytics-8.0.188 24 25%cd /content/yolov5 26!python train.py --img 640 --batch 20 --epochs 300 --data '/content/drive/MyDrive/goochokipar/goochokipar.yml' --name goochokipar 27 28#結果 29/content/yolov5 30train: weights=yolov5s.pt, cfg=, data=/content/drive/MyDrive/goochokipar/goochokipar.yml, hyp=data/hyps/hyp.scratch-low.yaml, epochs=300, batch_size=20, imgsz=640, rect=False, resume=False, nosave=False, noval=False, noautoanchor=False, noplots=False, evolve=None, bucket=, cache=None, image_weights=False, device=, multi_scale=False, single_cls=False, optimizer=SGD, sync_bn=False, workers=8, project=runs/train, name=goochokipar, 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 31github: up to date with https://github.com/ultralytics/yolov5 ✅ 32YOLOv5 🚀 v7.0-224-g6262c7f Python-3.10.12 torch-2.0.1+cu118 CUDA:0 (Tesla T4, 15102MiB) 33 34hyperparameters: lr0=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 35Comet: run 'pip install comet_ml' to automatically track and visualize YOLOv5 🚀 runs in Comet 36TensorBoard: Start with 'tensorboard --logdir runs/train', view at http://localhost:6006/ 37Downloading https://ultralytics.com/assets/Arial.ttf to /root/.config/Ultralytics/Arial.ttf... 38100% 755k/755k [00:00<00:00, 21.5MB/s] 39Downloading https://github.com/ultralytics/yolov5/releases/download/v7.0/yolov5s.pt to yolov5s.pt... 40100% 14.1M/14.1M [00:00<00:00, 195MB/s] 41 42Overriding model.yaml nc=80 with nc=3 43 44 from n params module arguments 45 0 -1 1 3520 models.common.Conv [3, 32, 6, 2, 2] 46 1 -1 1 18560 models.common.Conv [32, 64, 3, 2] 47 2 -1 1 18816 models.common.C3 [64, 64, 1] 48 3 -1 1 73984 models.common.Conv [64, 128, 3, 2] 49 4 -1 2 115712 models.common.C3 [128, 128, 2] 50 5 -1 1 295424 models.common.Conv [128, 256, 3, 2] 51 6 -1 3 625152 models.common.C3 [256, 256, 3] 52 7 -1 1 1180672 models.common.Conv [256, 512, 3, 2] 53 8 -1 1 1182720 models.common.C3 [512, 512, 1] 54 9 -1 1 656896 models.common.SPPF [512, 512, 5] 55 10 -1 1 131584 models.common.Conv [512, 256, 1, 1] 56 11 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] 57 12 [-1, 6] 1 0 models.common.Concat [1] 58 13 -1 1 361984 models.common.C3 [512, 256, 1, False] 59 14 -1 1 33024 models.common.Conv [256, 128, 1, 1] 60 15 -1 1 0 torch.nn.modules.upsampling.Upsample [None, 2, 'nearest'] 61 16 [-1, 4] 1 0 models.common.Concat [1] 62 17 -1 1 90880 models.common.C3 [256, 128, 1, False] 63 18 -1 1 147712 models.common.Conv [128, 128, 3, 2] 64 19 [-1, 14] 1 0 models.common.Concat [1] 65 20 -1 1 296448 models.common.C3 [256, 256, 1, False] 66 21 -1 1 590336 models.common.Conv [256, 256, 3, 2] 67 22 [-1, 10] 1 0 models.common.Concat [1] 68 23 -1 1 1182720 models.common.C3 [512, 512, 1, False] 69 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]] 70Model summary: 214 layers, 7027720 parameters, 7027720 gradients, 16.0 GFLOPs 71 72Transferred 343/349 items from yolov5s.pt 73AMP: checks passed ✅ 74optimizer: SGD(lr=0.01) with parameter groups 57 weight(decay=0.0), 60 weight(decay=0.00046875), 60 bias 75albumentations: Blur(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)) 76train: Scanning /content/drive/My Drive/goochokipar... 150 images, 0 backgrounds, 0 corrupt: 100% 150/150 [00:03<00:00, 44.67it/s] 77train: New cache created: /content/drive/My Drive/goochokipar.cache 78val: Scanning /content/drive/My Drive/goochokipar.cache... 150 images, 0 backgrounds, 0 corrupt: 100% 150/150 [00:00<?, ?it/s] 79 80AutoAnchor: 3.27 anchors/target, 1.000 Best Possible Recall (BPR). Current anchors are a good fit to dataset ✅ 81Plotting labels to runs/train/goochokipar/labels.jpg... 82Image sizes 640 train, 640 val 83Using 2 dataloader workers 84Logging results to runs/train/goochokipar 85Starting training for 300 epochs... 86 87 Epoch GPU_mem box_loss obj_loss cls_loss Instances Size 88 0/299 4.29G 0.08276 0.03104 0.02876 19 640: 100% 8/8 [00:09<00:00, 1.16s/it] 89 Class Images Instances P R mAP50 mAP50-95: 100% 4/4 [00:06<00:00, 1.67s/it] 90 all 150 150 0.00304 0.867 0.0375 0.0114 91 92 Epoch GPU_mem box_loss obj_loss cls_loss Instances Size 93 1/299 4.84G 0.0828 0.03233 0.03369 30 640: 100% 8/8 [00:04<00:00, 1.97it/s] 94 Class Images Instances P R mAP50 mAP50-95: 100% 4/4 [00:03<00:00, 1.10it/s] 95 all 150 150 0.00341 0.973 0.0441 0.0101 96 97 Epoch GPU_mem box_loss obj_loss cls_loss Instances Size 98 2/299 4.84G 0.08341 0.02893 0.03732 21 640: 100% 8/8 [00:02<00:00, 3.28it/s] 99 Class Images Instances P R mAP50 mAP50-95: 100% 4/4 [00:03<00:00, 1.16it/s] 100 all 150 150 0.00336 0.98 0.0515 0.0114 101 102 103 104 ~省略~ 105 106 107 108 109 Epoch GPU_mem box_loss obj_loss cls_loss Instances Size 110 298/299 4.84G 0.01578 0.008609 0.00283 25 640: 100% 8/8 [00:02<00:00, 3.06it/s] 111 Class Images Instances P R mAP50 mAP50-95: 100% 4/4 [00:03<00:00, 1.05it/s] 112 all 150 150 0.998 1 0.995 0.901 113 114 Epoch GPU_mem box_loss obj_loss cls_loss Instances Size 115 299/299 4.84G 0.01695 0.008166 0.002426 27 640: 100% 8/8 [00:03<00:00, 2.38it/s] 116 Class Images Instances P R mAP50 mAP50-95: 100% 4/4 [00:02<00:00, 1.49it/s] 117 all 150 150 0.998 1 0.995 0.901 118 119300 epochs completed in 0.576 hours. 120Optimizer stripped from runs/train/goochokipar/weights/last.pt, 14.4MB 121Optimizer stripped from runs/train/goochokipar/weights/best.pt, 14.4MB 122 123Validating runs/train/goochokipar/weights/best.pt... 124Fusing layers... 125Model summary: 157 layers, 7018216 parameters, 0 gradients, 15.8 GFLOPs 126 Class Images Instances P R mAP50 mAP50-95: 100% 4/4 [00:03<00:00, 1.04it/s] 127 all 150 150 0.998 1 0.995 0.905 128 choki 150 50 0.999 1 0.995 0.884 129 goo 150 50 0.999 1 0.995 0.906 130 par 150 50 0.997 1 0.995 0.926 131Results saved to runs/train/goochokipar 132
試したこと
カメラ起動までいけたのですが、自分が作ったモデルがダウンロードできていないせいか、検出したいものは検出できませんでした。
参考にしたサイト
