Detector/FaceDetector.py
def _overlap(self, pos1, pos2):
		"""
		Calculate IoU region given two boxes
		"""
		x1, y1, w1, h1 = pos1
		x2, y2, w2, h2 = pos2
		# calculate the intersection
		top = max(x1, x2), min(y1 + h1, y2 + h2)
		bottom = min(x1 + w1, x2 + w2), max(y1 + h1, y2 + h2)
		interset = max(0, min(y1 + w1, y2 + w2) - max(y1, y2)) * \
				   max(0, min(x1 + w1, x2 + w2) - max(x1, x2))
		# calculate the union + intersection
		union1 = w1 * h1
		union2 = w2 * h2
	
		return interset / float(union1 + union2 - interset)

		Calculate IoU region given two boxes
		
Calculate IoU region given two boxes
Calculate IoU region given two boxes
def _overlap(self, pos1, pos2):
		x1, y1, w1, h1 = pos1
		x2, y2, w2, h2 = pos2
		top = max(x1, x2), min(y1 + h1, y2 + h2)
		bottom = min(x1 + w1, x2 + w2), max(y1 + h1, y2 + h2)
		interset = max(0, min(y1 + w1, y2 + w2) - max(y1, y2)) * \
				   max(0, min(x1 + w1, x2 + w2) - max(x1, x2))
		union1 = w1 * h1
		union2 = w2 * h2
		return interset / float(union1 + union2 - interset)
def _overlap ( self , pos1 , pos2 ) : x1 , y1 , w1 , h1 = pos1 x2 , y2 , w2 , h2 = pos2 top = max ( x1 , x2 ) , min ( y1 + h1 , y2 + h2 ) bottom = min ( x1 + w1 , x2 + w2 ) , max ( y1 + h1 , y2 + h2 ) interset = max ( 0 , min ( y1 + w1 , y2 + w2 ) - max ( y1 , y2 ) ) * max ( 0 , min ( x1 + w1 , x2 + w2 ) - max ( x1 , x2 ) ) union1 = w1 * h1 union2 = w2 * h2 return interset / float ( union1 + union2 - interset )
Calculate IoU region given two boxes
Calculate IoU region given two boxes
"""
		Calculate IoU region given two boxes
		""" # calculate the intersection # calculate the union + intersection
self
pos1
pos2