overlap - みる会図書館


検索対象: TensorFlowはじめました 3
2件見つかりました。

1. TensorFlowはじめました 3

→ 0 / 0 顔領域と box の対応 第 2 章では [ 21 , 21 ] のグリッドしかなかったので、顔領域の中心座標が含まれる b 。 x を選択 すれば問題ありませんでした。しかし今回は、異なるサイズの b 。 x で構成される複数のグリッ ドが存在するため、中心座標が基準では最適な b 。 x を選択できません。 そこで「 Jaccard Overlap3 」を使って最適な box を選択します。 Jaccard OverIap は、図 3 ユ 1 のように、 2 つの領域の重なっている面積 (overlap) を、 2 つ の領域を結合した面積 (union) で割って算出します ( リスト 3.3 ) 。 2 つの領域が完全に一致している場合は 1 . @、まったく重なっていない場合は @. @ となります。 図 3.11 : Jaccard OverIap リスト 3.3 : box_util py def _tand(rect) : left, top, right, bottom left width right height bottom ー top rect i f wi dth く @ 0 r hei ght く 0 : return @ return width 大 height def jaccard—overlap(rectl, rect2) : rectl_left, rectl_top, rectl_right, rectl_bottom rect2_1eft, rect2_top, rect2_right, rect2_bottom overtap—right, overlap—bottom] ) land( [overlap-left, overlap—top, overtap—bottom = min(rectl—bottom, rect2—bottom) overlap—top = max(rectl—top, rect2—top) overlap—right = min(rectl—right, rect2—right) overlap—teft = max(rectl_left, rect2—1eft) overtap rectl rect2 第 3 章物体認識奮闘記 63

2. TensorFlowはじめました 3

Overlap を算出して最適な b 。 x を選択します。 リスト 3.4 : create dataset. py DEFAULT_OVERLAP_THRESHOLD def _assign—region—to boxes( boxes, labets, regions, OverIaP—threshOId=DEFAULT_OVERLAP_THRESHOLD) : for rect -in enumerate(regions) : sorted_boxes sorted( boxes , key=lambda box: box—util. jaccard—overlap(box. rect() , reverse=True) for box box box box in sorted—boxes[l:] : . regnon box . offset(rect) labels[index] box ユ abel . positive = True sorted—boxes[@] unnon 作成したデータセットを元に、モデルを学習・訓練します。 land(rectl) + tand(rect2) overlap return overlap / union リスト 3.4 の関数 _assign_region_to-boxes は、顔領域に対してそれぞれの box の Jaccard rect) , rect) jaccard—overlap box—util. jaccard—overlap(box. rect() , if jaccard—overtap く overlap—threshold: break box . positive ニ True box.labet labels[index] bOX . region box . offset(rect) 番目以降の box についても、 Jaccard Overlap の値が DEFAULT_OVERLAP_THRESHOLD を超えて boxes を Jaccard Overlap の降順に並び替え、もっとも値の大きい box を選択します。また、 2 いれば選択します。 3.5 学習・訓練 64 第 3 章物体認識奮闘記