Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Latest commit

 

History

History
11 lines (9 loc) · 676 Bytes

README.md

File metadata and controls

11 lines (9 loc) · 676 Bytes

yolov5 を用いた Object detection のサンプルコード

データの流れ

  1. HTMLImageElement (img タグ ) をレンダリングする .
  2. レンダリングした画像がロードされたら (<img >タグのonLoad), HTMLImageElement オブジェクトを取得して以下の内容を関数で実行する.
  3. HTMLImageElement を tf.browser.fromPixelsで Tensor に変換.
  4. model を読み込む. /public/web_model/model.json からモデルを取得して読み込む.
  5. Tensor をモデルに渡して, 推論結果 (Tensor)を得る.
  6. 推論結果を JavaScript Array に整形する.
  7. 画像上に推論結果を描画する.