Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use np.methods instead of for circulation in run_image #33

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 8 additions & 19 deletions halfsqueezenet/training/halfsqueezenet_objdetect.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,15 +477,9 @@ def run_image(model, sess_init, image_dir):
objdetect = outputs[0]
bndboxes = outputs[1]

max_pred = -100
max_h = -1
max_w = -1
for h in range(0, objdetect.shape[1]):
for w in range(0, objdetect.shape[2]):
if objdetect[0, h, w] > max_pred:
max_pred = objdetect[0, h, w]
max_h = h
max_w = w
max_pred = objdetect[0].max()
argmaxs = np.where(objdetect[0] == max_pred)
max_h, max_w, _ = argmaxs
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here can make fps 11>>23 in my RTX2060


sum_labels= 0;
bndbox = {}
Expand Down Expand Up @@ -581,15 +575,10 @@ def run_single_image(model, sess_init, image):
objdetect = outputs[0]
bndboxes = outputs[1]

max_pred = -100
max_h = -1
max_w = -1
for h in range(0, objdetect.shape[1]):
for w in range(0, objdetect.shape[2]):
if objdetect[0, h, w] > max_pred:
max_pred = objdetect[0, h, w]
max_h = h
max_w = w
max_pred = objdetect[0].max()
argmaxs = np.where(objdetect[0] == max_pred)
max_h, max_w, _ = argmaxs

bndbox2 = {}
bndbox2['xmin'] = int( bndboxes[0,max_h,max_w,0] + max_w*grid_size)
bndbox2['ymin'] = int( bndboxes[0,max_h,max_w,1] + max_h*grid_size)
Expand Down Expand Up @@ -751,4 +740,4 @@ def dump_weights(meta, model, output):
sys.exit()

assert args.weights.endswith('.npy')
run_single_image(Model(), DictRestore(np.load(args.weights, encoding='latin1').item()), args.run)
run_single_image(Model(), DictRestore(np.load(args.weights, encoding='latin1').item()), args.run)