Skip to content

Commit

Permalink
fix: tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
arabian9ts committed Feb 4, 2018
1 parent 52e3d1f commit f89d088
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ class label loss is evaled by loss_conf
matches[near_index] = Box(gt_box, gt_label)
pos += 1

indicies = self.extract_highest_indicies(pred_confs, pos*3)
indicies = self.extract_highest_indicies(pred_confs, pos*5)

for i in indicies:
if matches[i] is None and classes-1 != np.argmax(pred_confs[i]):
Expand Down
9 changes: 5 additions & 4 deletions model/computation.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
author: arabian9ts
"""

import numpy as np

def intersection(rect1, rect2):
"""
Expand Down Expand Up @@ -49,7 +50,7 @@ def corner2center(rect):
center_x = (2 * rect[0] + rect[2]) * 0.5
center_y = (2 * rect[1] + rect[3]) * 0.5

return [center_x, center_y, abs(rect[2]), abs(rect[3])]
return np.array([center_x, center_y, abs(rect[2]), abs(rect[3])])


def center2corner(rect):
Expand All @@ -59,7 +60,7 @@ def center2corner(rect):
corner_x = rect[0] - rect[2] * 0.5
corner_y = rect[1] - rect[3] * 0.5

return [corner_x, corner_y, abs(rect[2]), abs(rect[3])]
return np.array([corner_x, corner_y, abs(rect[2]), abs(rect[3])])


def convert2diagonal_points(rect):
Expand All @@ -73,7 +74,7 @@ def convert2diagonal_points(rect):
output format is...
[ top_left_x, top_left_y, bottom_right_x, bottom_right_y ]
"""
return [rect[0], rect[1], rect[0]+rect[2], rect[1]+rect[3]]
return np.array([rect[0], rect[1], rect[0]+rect[2], rect[1]+rect[3]])


def convert2wh(rect):
Expand All @@ -87,4 +88,4 @@ def convert2wh(rect):
output format is...
[ top_left_x, top_left_y, width, height ]
"""
return [rect[0], rect[1], rect[2]-rect[0], rect[3]-rect[1]]
return np.array([rect[0], rect[1], rect[2]-rect[0], rect[3]-rect[1]])
2 changes: 1 addition & 1 deletion model/default_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def generate_boxes(fmap_shapes):
for i, ratio in enumerate(ratios):
s = s_k

if 0 == i:
if 1.0 == s:
s = np.sqrt(s_k*s_k1)

box_width = s * np.sqrt(ratio)
Expand Down
8 changes: 4 additions & 4 deletions model/policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
classes = 21

# the number of boxes per feature map
boxes = [6, 3, 6, 3, 6, 3,]
boxes = [4, 6, 6, 6, 6, 6,]

# default box ratios
# each length should be matches boxes[index]
box_ratios = [
[1.0, 1.0, 2.0, 1.0/2.0],
[1.0, 1.0, 2.0, 1.0/2.0, 3.0, 1.0/3.0],
[1.0, 1.0, 2.0, 1.0/2.0, 3.0, 1.0/3.0],
[1.0, 1.0, 2.0, 1.0/2.0, 3.0, 1.0/3.0],
[1.0, 2.0, 1.0/2.0],
[1.0, 1.0, 2.0, 1.0/2.0, 3.0, 1.0/3.0],
[1.0, 2.0, 1.0/2.0],
[1.0, 1.0, 2.0, 1.0/2.0, 3.0, 1.0/3.0],
[1.0, 2.0, 1.0/2.0],
]

0 comments on commit f89d088

Please sign in to comment.