LoginSignup
3
1

More than 5 years have passed since last update.

Object detection実装:post-processing(主にNMS)実装

Posted at

前回は、学習時用にencodeしたanchorのdecoderを実装した。

今回のコミットでは、予測結果の後処理としてNon-max suppression(NMS)を使ったboxの間引き処理を実装した。加えて結果確認のためのvisualizationも実装している。

NMSは与えられたboxの予測結果に対して、ある程度のオーバーラップがあるbox間において、objectness scoreが低い方を除去する処理である。
この処理は各クラスのboxに対して順次行われる。
TensorFlowにはtf.image.non_max_suppressionという関数としてすでに実装されているため、これをベースに実装を行う。

実装のポイントとしては:
・予測結果のバッチをtf.unstackにてunrollしてfor loopでiterateし、tf.boolean_maskを用いて
クラス毎の結果を抽出する。
・non_max_suppressionは除去後に残ったboxのindexを返すので、tf.gatherと組み合わせてboxを取得する。
などである。

動作確認の一環として簡単なtensorboard上で表示するvisualizationも実装。
ただし。TensorFlowは質の良い描画関数がないため。tf.py_funcと組み合わせてopencvを用いて描画する。

3
1
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
3
1