Skip to content

Commit

Permalink
Update semantic_localization_ctl.py
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaoyuan1996 authored Mar 30, 2022
1 parent 6357aa6 commit 4ae0ff0
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions code/api_controlers/semantic_localization_ctl.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,9 @@ def generate_heatmap(img_path, text, output_file_h, output_file_a):
heat_num = np.zeros([img_row, img_col], dtype=float)
for idx,file in enumerate(subimages):
r_start, r_end, c_start, c_end = file.replace(".jpg","").split("_")

for r in range(int(r_start), int(r_end)):
for c in range(int(c_start),int(c_end)):
heat_map[r,c] = sim_results[idx] + heat_map[r, c]
heat_num[r,c] += 1
heat_map[int(r_start):int(r_end), int(c_start):int(c_end)] += sim_results[idx]
heat_num[int(r_start):int(r_end), int(c_start):int(c_end)] += 1

for i in range(np.shape(heat_map)[0]):
for j in range(np.shape(heat_map)[1]):
heat_map[i,j] = heat_map[i,j] / heat_num[i,j]
Expand Down

0 comments on commit 4ae0ff0

Please sign in to comment.