rbg-research / Floor-Plan-Detection

Effects of Super-Resolution on Object Detection in Floor Plan Images
MIT License
61 stars 10 forks source link

I am getting ' IndexError: invalid index to scalar variable. ' this particular error in the Deep Neural Network part of the code. #4

Open ByteTrooper opened 6 months ago

ByteTrooper commented 6 months ago

" --------------------------------------------------------------------------- IndexError Traceback (most recent call last) Cell In[12], line 90 87 icons_pred = np.argmax(icons_pred, axis=0) 89 heatmaps, rooms, icons = split_prediction(prediction, img_size, split) ---> 90 polygons, types, room_polygons, room_types = get_polygons((heatmaps, rooms, icons), 0.2, [1, 2]) 92 wall_polygon_numbers=[i for i,j in enumerate(types) if j['type']=='wall'] 93 boxes=[]

File c:\Floor-Plan-Detection\utils\post_prosessing.py:367, in get_polygons(predictions, threshold, all_opening_types) 365 walls = np.empty([0, 4, 2], int) 366 wall_layers = [2, 8] --> 367 walls, wall_types, wall_points, wall_lines, wall_point_orientation_lines_map = get_wall_polygon(wall_heatmaps, room_seg, threshold, wall_layers, point_orientations, orientation_ranges) 369 icons = np.empty([0, 4, 2], int) 370 icons, icon_types = get_icon_polygon(heatmaps, icon_seg, threshold, point_orientations, orientation_ranges)

File c:\Floor-Plan-Detection\utils\post_prosessing.py:22, in get_wall_polygon(wall_heatmaps, room_segmentation, threshold, wall_classes, point_orientations, orientation_ranges) 19 wall_lines_new = [] 21 for indx, i in enumerate(wall_lines): ---> 22 res = extract_wall_polygon(i, wall_points, room_segmentation, wall_classes) 23 if res is not None: 24 wall_width, polygon = res

File c:\Floor-Plan-Detection\utils\post_prosessing.py:948, in extract_wall_polygon(wall, wall_points, segmentation, seg_class) 943 widths = np.append(widths, w_pos + w_neg + 1) 945 # widths = reject_outliers(widths) 946 # if len(widths) == 0: 947 # return None --> 948 wall_width = stats.mode(widths).mode[0] 949 if wall_width > y2 - y1: 950 wall_width = y2 - y1

IndexError: invalid index to scalar variable. " this is the error i am facing. Would be lovely to know how to solve it.