{"id":8052,"date":"2024-08-28T15:07:07","date_gmt":"2024-08-28T06:07:07","guid":{"rendered":"https:\/\/www.nkozawa.com\/blog\/?p=8052"},"modified":"2024-10-28T11:12:43","modified_gmt":"2024-10-28T02:12:43","slug":"google-colab%e3%82%92%e4%bd%bf%e3%81%8a%e3%81%86%e3%80%81%e6%a9%9f%e6%a2%b0%e5%ad%a6%e7%bf%92%e5%85%a5%e9%96%80%e3%81%9d%e3%81%ae2","status":"publish","type":"post","link":"https:\/\/www.nkozawa.com\/blog\/archives\/8052","title":{"rendered":"Google Colab\u3092\u4f7f\u304a\u3046\u3001\u6a5f\u68b0\u5b66\u7fd2\u5165\u9580\u305d\u306e2"},"content":{"rendered":"<p><a href=\"https:\/\/www.nkozawa.com\/blog\/archives\/8022\">\u524d\u56de<\/a>\u3001\u624b\u9806\u306f\u78ba\u8a8d\u51fa\u6765\u307e\u3057\u305f\u3002\u6b21\u306b\u63a2\u6c42\u3059\u3079\u304d\u306f\u3069\u306e\u30e2\u30c7\u30eb\u3092\u4f7f\u3044epochs\u306b\u4f55\u56de\u6307\u5b9a\u3059\u308c\u3070\u826f\u3044\u306e\u304b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u307e\u305a\u306fepcohs=200\u3067\u5404\u7a2e\u30e2\u30c7\u30eb\u306e\u30c6\u30b9\u30c8\u3092\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u7acb\u3061\u307e\u3057\u305f\u304c\u3001M2 MacBook Air\u3067\u306f\u3044\u304f\u3089GPU\u4f7f\u3063\u3066\u3082\u30e2\u30c7\u30eb\u306b\u3088\u3063\u3066\u306f\u4e00\u6669\u3067\u306f\u5b66\u7fd2\u304c\u5b8c\u4e86\u3057\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u304c\u5206\u304b\u308a\u307e\u3057\u305f\u3002\u30e1\u30e2\u30ea\u30fc\u30b5\u30a4\u30ba\u306e\u95a2\u4fc2\u3067\u751f\u6210\u51fa\u6765\u306a\u3044\u30e2\u30c7\u30eb\u3082\u3042\u308a\u307e\u3059\u3002\u305d\u308c\u306f\u8ae6\u3081\u308b\u3068\u3057\u3066\u3082\u6642\u9593\u304c\u304b\u304b\u3063\u3066\u3057\u3087\u3046\u304c\u306a\u3044\u3002\u76ee\u6a19\u304c\u5b9a\u307e\u308c\u3070\u6642\u9593\u3092\u304b\u3051\u3066\u751f\u6210\u3059\u308b\u306e\u3082\u60aa\u304f\u306f\u306a\u3044\u3067\u3059\u304c\u3001\u8a66\u884c\u932f\u8aa4\u306e\u305f\u3081\u306b\u306f\u7d20\u65e9\u304f\u7d42\u308f\u3089\u305b\u305f\u3044\u3002<\/p>\n<p>\u9ad8\u4fa1\u306aGPU\u3092\u8cb7\u3044\u306b\u8d70\u308b\u308f\u3051\u306b\u3082\u884c\u304b\u306a\u3044\u306e\u3067Google Colab\u3092\u8a66\u3057\u3066\u307f\u308b\u3053\u3068\u306b\u3057\u307e\u3057\u305f\u3002\u6700\u521d\u3001\u7121\u6599\u7248\u3067\u8a66\u3057\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u8272\u3005\u3068\u8a66\u3057\u3066\u3044\u308b\u3068\u3059\u3050\u306b\u4f7f\u7528\u5236\u9650\u304c\u304b\u304b\u3063\u3066\u6b62\u307e\u3063\u3066\u3057\u307e\u3044\u307e\u3059\u3002\u591a\u5206\u3001\u4f55\u3092\u3059\u308b\u304b\u304c\u6c7a\u307e\u3063\u3066\u3044\u308c\u3070\u7121\u6599\u7248\u3060\u3051\u3067\u3082\u5927\u4e08\u592b\u304b\u3082\u77e5\u308c\u307e\u305b\u3093\u304c\u3001\u30b9\u30c8\u30ec\u30b9\u7121\u304f\u30c6\u30b9\u30c8\u3092\u884c\u3046\u305f\u3081\u306b\u4e00\u756a\u5b89\u3044Pay As You Go\u306e1179\u5186\u3092\u652f\u6255\u3063\u3066100\u30b3\u30f3\u30d4\u30e5\u30fc\u30c6\u30a3\u30f3\u30b0\u5358\u4f4d\u3092\u8cb7\u3044\u307e\u3057\u305f\u3002\u3053\u306e\u5358\u4f4d\u304c\u3069\u308c\u304f\u3089\u3044\u306e\u3082\u306e\u304b\u306f\u5206\u304b\u308a\u307e\u305b\u3093\u304c\u3001\u4e00\u9023\u306e\u30c6\u30b9\u30c8\u3067\u6d88\u8cbb\u3057\u305f\u306e\u306f17\u5358\u4f4d\u307b\u3069\u3067\u3057\u305f\u306e\u3067\u3001\u5c0f\u898f\u6a21\u306a\u30c6\u30b9\u30c8\u306b\u306f\u5341\u5206\u3067\u3057\u3087\u3046\u3002\u901f\u5ea6\u306b\u3064\u3044\u3066\u306f\u7533\u3057\u5206\u306a\u3044\u3067\u3059\u3002M2 MacBook Air\u3067\u4e00\u6669\u3067\u7d42\u308f\u3089\u306a\u3044\u5b66\u7fd2\u304c\u7121\u6599\u3067\u4f7f\u3048\u308bGPU\u3067\u308210\u5206\u307b\u3069\u3067\u5b8c\u4e86\u3057\u307e\u3059\u3002<\/p>\n<p>\u4ee5\u4e0b\u3001Colab\u3067\u306e\u5b9f\u884c\u4f8b\u3067\u3059\u3002<\/p>\n<p>\u524d\u56de\u3001Label Studio\u304b\u3089Export\u3057\u305f\u30c7\u30fc\u30bf\u306f\uff27\uff4f\uff4f\uff47\uff4c\uff45\u3000\uff24\uff52\uff49\uff56\uff45\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3057\u307e\u3057\u305f\u3002\uff23\uff4f\uff4c\uff41\uff42\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u5185\u306b\u30a2\u30c3\u30d7\u30ed\u30fc\u30c9\u3059\u308b\u65b9\u6cd5\u3082\u3042\u308a\u307e\u3059\u304c\u3001\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u63a5\u7d9a\u89e3\u9664\uff08\u983b\u7e41\u306b\u884c\u3046\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\uff09\u3059\u308b\u305f\u3073\u306b\u6d88\u3048\u3066\u3057\u307e\u3046\u306e\u3067\u4f7f\u3044\u52dd\u624b\u304c\u826f\u304f\u3042\u308a\u307e\u305b\u3093\u3002<\/p>\n<p>yaml\u30d5\u30a1\u30a4\u30eb\u3082Googel Drive\u306b\u4f5c\u6210\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-plain\" data-lang=\"Plain Text\"><code># fpvgoals dataset\r\n\r\n# train and val data as 1) directory: path\/images\/, 2) file: path\/images.txt, or 3) list: [path1\/images\/, path2\/images\/]\r\ntrain: \/content\/drive\/My Drive\/fpvgates\r\nval: \/content\/drive\/My Drive\/fpvgates\r\n\r\n# number of classes\r\nnc: 2\r\n\r\n# class names\r\nnames: ['gate', 'goalgate']<\/code><\/pre>\n<\/div>\n<p><a href=\"https:\/\/colab.research.google.com\/?hl=ja\">Google Colab<\/a>\u3067\u65b0\u898f\u30ce\u30fc\u30c8\u30d6\u30c3\u30af\u3092\u4f5c\u308a\u307e\u3059\u3002<\/p>\n<p>\u300c\u30e9\u30f3\u30bf\u30a4\u30e0\/\u30e9\u30f3\u30bf\u30a4\u30e0\u306e\u5909\u66f4\u300d\u3067T4 GPU\u3092\u9078\u629e\u3057\u307e\u3059\u3002\u4e0b\u306e\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u306f\u8ab2\u91d1\u3057\u305f\u5f8c\u306a\u306e\u3067\u9078\u629e\u80a2\u304c\u591a\u304f\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n<a href=\"http:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/ColabRuntime.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/ColabRuntime-300x195.png\" alt=\"\" width=\"300\" height=\"195\" class=\"alignnone size-medium wp-image-8058\" srcset=\"https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/ColabRuntime-300x195.png 300w, https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/ColabRuntime-1024x665.png 1024w, https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/ColabRuntime-768x499.png 768w, https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/ColabRuntime.png 1404w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><code>!pip install ultralytics<\/code>\u3092\u5b9f\u884c\u3057Ultralytics\u3092\u5c0e\u5165\u3057\u307e\u3059\u3002<\/p>\n<p>\u305d\u3057\u3066\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u3066\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-python\" data-lang=\"Python\"><code>import time\r\nstart = time.time()\r\nprint(f'start time: {start}')\r\nfrom ultralytics import YOLO\r\nmodel = YOLO('yolov9m.pt')\r\nmodel.info()\r\nmodel.train(data='\/content\/drive\/My Drive\/fpvgoals.yaml', epochs=200, imgsz=640)\r\ntrained = time.time()\r\nprint(f'elpased time: {trained-start}')\r\nmodel.val()\r\nend = time.time()\r\nprint(f'end time: {end - start}')<\/code><\/pre>\n<\/div>\n<p>Colab\u306e\u753b\u9762\u3060\u3068\u3053\u3093\u306a\u611f\u3058\u3067\u3059\u3002<br \/>\n<a href=\"http:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/colabyolo.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/colabyolo-300x178.png\" alt=\"\" width=\"300\" height=\"178\" class=\"alignnone size-medium wp-image-8064\" srcset=\"https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/colabyolo-300x178.png 300w, https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/colabyolo-1024x607.png 1024w, https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/colabyolo-768x456.png 768w, https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/colabyolo-1536x911.png 1536w, https:\/\/www.nkozawa.com\/blog\/wp-content\/uploads\/colabyolo-2048x1215.png 2048w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p>\u3053\u308c\u3067\u30e2\u30c7\u30eb\u3092\u5909\u3048\u305f\u308aepochs\u306b\u6307\u5b9a\u3059\u308b\u6570\u5024\u3092\u5909\u66f4\u3057\u3066\u8a66\u3057\u3066\u307f\u307e\u3057\u305f\u3002\u5143\u306b\u306a\u308b\u30c7\u30fc\u30bf\u306f\u6700\u521d\u306b\u7528\u610f\u3057\u305f56\u679a\u306e\u753b\u50cf\u3067\u3059\u3002<\/p>\n<p>\u3056\u3063\u304f\u308a\u3068\u76ee\u8996\u3067\u30c8\u30e9\u30c3\u30ad\u30f3\u30b0\u753b\u50cf\u3067\u5224\u65ad\u3057\u3066\u3001\u91cd\u3044\u30e2\u30c7\u30eb\u3092\u4f7f\u7528\u3059\u308b\u307b\u3069\u7cbe\u5ea6\u306f\u826f\u304f\u306a\u308a\u305d\u3046\u3002\u307e\u305fepochs\u306f20\u56de\u3088\u308a200\u56de\u304c\u306f\u308b\u304b\u306b\u826f\u3044\u3068\u3044\u3046\u5f53\u305f\u308a\u524d\u306e\u3053\u3068\u304c\u78ba\u8a8d\u3067\u304d\u307e\u3057\u305f\u3002\u7cbe\u5ea6(\u8aa4\u8a8d\u8b58\u306e\u7a0b\u5ea6)\u304c\u76ee\u7684\u306b\u9069\u3063\u3066\u3044\u308b\u304b\u3069\u3046\u304b\u306f\u7c21\u5358\u306a\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u66f8\u3044\u3066\u78ba\u8a8d\u3057\u307e\u3057\u305f(\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3064\u3044\u3066\u306f\u3044\u305a\u308c\u7d39\u4ecb\u3057\u307e\u3059)\u3002\u305d\u306e\u7d50\u679c\u3001\u8efd\u3081\u306e\u30e2\u30c7\u30eb\u3067\u3082\u5341\u5206\u306a\u7d50\u679c\u304c\u51fa\u305b\u305d\u3046\u3060\u3068\u3044\u3046\u3053\u3068\u3082\u5206\u304b\u308a\u307e\u3057\u305f\u3002<\/p>\n<p>\u8efd\u3044\u30e2\u30c7\u30eb\u306e\u5229\u70b9\u306f\u5b66\u7fd2\u6642\u9593\u304c\u77ed\u3044\u3001\u5927\u304d\u306a\u30e1\u30e2\u30ea\u30fc\u3092\u5fc5\u8981\u3068\u3057\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u306f\u65e2\u306b\u5206\u304b\u3063\u3066\u3044\u307e\u3057\u305f\u304c\u3001\u305d\u308c\u306b\u52a0\u3048\u3066\u753b\u50cf\u8a8d\u8b58\u306b\u8981\u3059\u308b\u6642\u9593\u304c\u77ed\u3044\u3068\u3044\u3046\u7279\u6027\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u308c\u306f\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u51e6\u7406\u80fd\u529b\u3092\u8003\u3048\u308b\u3046\u3048\u3067\u91cd\u8981\u306a\u30dd\u30a4\u30f3\u30c8\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n<table border='2'>\n<tr>\n<th>\u30d9\u30fc\u30b9\u30fb\u30e2\u30c7\u30eb<\/th>\n<th>1\u30d5\u30ec\u30fc\u30e0\u306e\u51e6\u7406\u6642\u9593<\/th>\n<th>fps<\/th>\n<\/tr>\n<tr>\n<td>yolov9t.pt<\/td>\n<td>45ms<\/td>\n<td>22.2<\/td>\n<\/tr>\n<tr>\n<td>yolov9s.pt<\/td>\n<td>45ms<\/td>\n<td>22.2<\/td>\n<\/tr>\n<tr>\n<td>yolov9m.pt<\/td>\n<td>75ms<\/td>\n<td>13.3<\/td>\n<\/tr>\n<tr>\n<td>yolov9c.pt<\/td>\n<td>86ms<\/td>\n<td>11.6<\/td>\n<\/tr>\n<tr>\n<td>yolov9e.pt<\/td>\n<td>152ms<\/td>\n<td>6.6<\/td>\n<\/tr>\n<tr>\n<td>yolo10n.pt<\/td>\n<td>42ms<\/td>\n<td>23.8<\/td>\n<\/tr>\n<tr>\n<td>yolo10s.pt<\/td>\n<td>64ms<\/td>\n<td>15.6<\/td>\n<\/tr>\n<tr>\n<td>yolo10m.pt<\/td>\n<td>57ms<\/td>\n<td>17.5<\/td>\n<\/tr>\n<tr>\n<td>yolo10b.pt<\/td>\n<td>79ms<\/td>\n<td>12.7<\/td>\n<\/tr>\n<tr>\n<td>yolo10l.pt<\/td>\n<td>90ms<\/td>\n<td>11.1<\/td>\n<\/tr>\n<tr>\n<td>yolo10x.pt<\/td>\n<td>115ms<\/td>\n<td>8.7<\/td>\n<\/tr>\n<\/table>\n<p>\u3053\u308c\u306fM2 MacBook Air\u3067\u306e\u5b9f\u884c\u4f8b\u3067\u3059\u300222FPS\u51fa\u3066\u3044\u308b\u3068\u307e\u305a\u307e\u305a\u76ee\u7684\u306b\u9069\u3063\u3066\u3044\u308b\u6c17\u304c\u3057\u307e\u3059\u3002\u3068\u3044\u3046\u3053\u3068\u3067yolov9s.pt\u3092\u4f7f\u7528\u3059\u308b\u4e8b\u306b\u3057\u307e\u3057\u305f\u3002yolov10n\u306e\u65b9\u304c\u901f\u5ea6\u304c\u51fa\u3066\u3044\u308b\u306e\u3067\u3059\u304c\u3001\u307e\u3042\u4f55\u3068\u306a\u304f\u611f\u3067\u6c7a\u3081\u307e\u3057\u305f\u3002<\/p>\n<p>epochs\u306b\u3064\u3044\u3066\u306f200,300\u3068400\u3067\u6bd4\u8f03\u3057\u3066\u307f\u307e\u3057\u305f\u304c\u3001\u898b\u305f\u76ee\u3067\u306e\u5dee\u306f\u307b\u3068\u3093\u3069\u5206\u304b\u308a\u307e\u305b\u3093\u3067\u3057\u305f\u3002result.png\u3067\u8868\u793a\u3055\u308c\u308b\u30b0\u30e9\u30d5\u306b\u3064\u3044\u3066\u3082\u5fae\u5999\u306a\u5dee\u3067\u3057\u305f\u3002\u52d8\u3067\u3057\u304b\u3042\u308a\u307e\u305b\u3093\u304c\u5f53\u9762\u306fepoch=300\u3067\u9032\u3081\u3066\u307f\u307e\u3059\u3002<\/p>\n<p>\u3042\u3068\u306f\u5143\u3068\u306a\u308b\u753b\u50cf\u3092\u5897\u3084\u3057\u3066\u3044\u3063\u3066\u4f55\u304b\u3057\u3089\u554f\u984c\u70b9\u304c\u3042\u308b\u304b\u3069\u3046\u304b\u3092\u8a66\u3057\u3066\u3044\u304d\u305f\u3044\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u56de\u3001\u624b\u9806\u306f\u78ba\u8a8d\u51fa\u6765\u307e\u3057\u305f\u3002\u6b21\u306b\u63a2\u6c42\u3059\u3079\u304d\u306f\u3069\u306e\u30e2\u30c7\u30eb\u3092\u4f7f\u3044epochs\u306b\u4f55\u56de\u6307\u5b9a\u3059\u308c\u3070\u826f\u3044\u306e\u304b\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u307e\u305a\u306fepcohs=200\u3067\u5404\u7a2e\u30e2\u30c7\u30eb\u306e\u30c6\u30b9\u30c8\u3092\u3057\u3066\u307f\u3088\u3046\u3068\u601d\u3044\u7acb\u3061\u307e\u3057\u305f\u304c\u3001M2 MacBook Air\u3067 [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[52,38,27,53],"tags":[],"class_list":["post-8052","post","type-post","status-publish","format-standard","hentry","category-ai","category-quadcopter","category-programing","category-image-recognition"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/8052","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/comments?post=8052"}],"version-history":[{"count":27,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/8052\/revisions"}],"predecessor-version":[{"id":8088,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/posts\/8052\/revisions\/8088"}],"wp:attachment":[{"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/media?parent=8052"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/categories?post=8052"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nkozawa.com\/blog\/wp-json\/wp\/v2\/tags?post=8052"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}