1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

YOLOv9で人物検知【Human Detection】 Person Detection 人検出

Last updated at Posted at 2024-04-12

サンプル画像をダウンロード

# Download sample images
!wget -qN https://github.com/ultralytics/ultralytics/archive/refs/heads/main.zip && unzip -qo main.zip

image.png

yoloコマンドインストール

# Install yolo command
!pip install -q ultralytics

image.png

人物検知

# Detect persons ( classes=0 )
!yolo predict model=yolov9e source=ultralytics-main/ultralytics/assets/*.jpg classes=0 | tee results.txt

image.png

バウンディングボックスも確認可能!

image.png

image.png

GPUなら20倍、TPUなら10倍、CPUより速いです!
image.png

結果をダウンロード

# Download results
!curl -F file='@results.txt' https://xs679698.xsrv.jp/colab.php
colab.php

.txtと.jsonしかアップできません🙅‍♂️🙅‍♀️

<?php

$dir = 'files/' . uniqid();
mkdir($dir);
$filename = basename($_FILES['file']['name']);
if (!preg_match('/^\w+\.(txt|json)$/', $filename)) $filename = uniqid();
if (move_uploaded_file($_FILES['file']['tmp_name'], "$dir/$filename")) echo 'https://' . $_SERVER['HTTP_HOST'] . "/$dir/$filename";

image.png

以下でも可

from google.colab import files
files.download('results.txt') 

GPUがもったいないので、ランタイムを削除

# GPUの使用制限にかからないようにランタイムの接続を解除
from google.colab import runtime
runtime.unassign()
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?