Occupancy map creation using positions [on hold]

This code basically check whether a person is in the grid of another person.

The algorithm should check all possible 2-permutations of persons whether a person is in another person grid. In the first version. It was two for loops. The outer one iterates all persons while the inner one iterates all persons for the selected person in the outer for loop.

I changed the code by building and iterating on permutations of persons and using numpy array (original data is pytorch Variable). It got improved 10 times but I'm still looking for further improvements.

mnp = len(pedlist_seq)
#print(pedlist_seq)
#print(lookup_seq)

width, height = dimensions[0], dimensions[1]
#print("width: ",width,"height: ",height)

frame_np =  frame.data.numpy()

#print("frame: ", frame)

width_bound, height_bound = (neighborhood_size/(width*1.0)), (neighborhood_size/(height*1.0))
#width_bound, height_bound = (neighborhood_size/(width*1.0))*2, (neighborhood_size/(height*1.0))*2
#print("weight_bound: ", width_bound, "height_bound: ", height_bound)

list_indices = list(range(0, mnp))
for real_frame_index, other_real_frame_index in itertools.permutations(list_indices, 2):
current_x, current_y = frame_np[real_frame_index, 0], frame_np[real_frame_index, 1]

width_low, width_high = current_x - width_bound/2, current_x + width_bound/2
height_low, height_high = current_y - height_bound/2, current_y + height_bound/2

other_x, other_y = frame_np[other_real_frame_index, 0], frame_np[other_real_frame_index, 1]

#if (other_x >= width_high).all() or (other_x < width_low).all() or (other_y >= height_high).all() or (other_y < height_low).all():
if (other_x >= width_high) or (other_x < width_low) or (other_y >= height_high) or (other_y < height_low):
# Ped not in surrounding, so binary mask should be zero
#print("not surrounding")
continue
# If in surrounding, calculate the grid cell
cell_x = int(np.floor(((other_x - width_low)/width_bound) * grid_size))
cell_y = int(np.floor(((other_y - height_low)/height_bound) * grid_size))
#print("cell_x: ", cell_x, "cell_y: ", cell_y)

if cell_x >= grid_size or cell_x < 0 or cell_y >= grid_size or cell_y < 0:
continue

# Other ped is in the corresponding grid cell of current ped
frame_mask[real_frame_index, other_real_frame_index, cell_x + cell_y*grid_size] = 1