Alessio Grancini
commited on
Update app.py
Browse files
app.py
CHANGED
@@ -251,6 +251,7 @@ def get_detection_data(image_data):
|
|
251 |
|
252 |
#image = utils.resize(img)
|
253 |
image = img
|
|
|
254 |
image_segmentation, objects_data = img_seg.predict(image)
|
255 |
depthmap, depth_colormap = depth_estimator.make_prediction(image)
|
256 |
|
@@ -260,6 +261,9 @@ def get_detection_data(image_data):
|
|
260 |
cls_id, cls_name, center, mask, color_bgr, confidence = obj
|
261 |
x1, y1, x2, y2 = get_bbox_from_mask(mask)
|
262 |
depth_value = depth_at_center(depthmap, [x1, y1, x2, y2])
|
|
|
|
|
|
|
263 |
|
264 |
# Convert BGR to RGB
|
265 |
color_rgb = (int(color_bgr[2]), int(color_bgr[1]), int(color_bgr[0]))
|
@@ -297,6 +301,7 @@ def get_detection_data(image_data):
|
|
297 |
#"camera_matrix": get_camera_matrix(depth_estimator),
|
298 |
#"camera_position": [0, 0, 0] # Assumed at origin based on camera intrinsics
|
299 |
}
|
|
|
300 |
return response
|
301 |
|
302 |
except Exception as e:
|
|
|
251 |
|
252 |
#image = utils.resize(img)
|
253 |
image = img
|
254 |
+
print(f"Debug - Original image shape: {image.shape}")
|
255 |
image_segmentation, objects_data = img_seg.predict(image)
|
256 |
depthmap, depth_colormap = depth_estimator.make_prediction(image)
|
257 |
|
|
|
261 |
cls_id, cls_name, center, mask, color_bgr, confidence = obj
|
262 |
x1, y1, x2, y2 = get_bbox_from_mask(mask)
|
263 |
depth_value = depth_at_center(depthmap, [x1, y1, x2, y2])
|
264 |
+
|
265 |
+
# Debug: Log center and vertices to verify resolution
|
266 |
+
print(f"Debug - Object {idx}: Center = {center}, Vertices = {get_box_vertices([x1, y1, x2, y2])}")
|
267 |
|
268 |
# Convert BGR to RGB
|
269 |
color_rgb = (int(color_bgr[2]), int(color_bgr[1]), int(color_bgr[0]))
|
|
|
301 |
#"camera_matrix": get_camera_matrix(depth_estimator),
|
302 |
#"camera_position": [0, 0, 0] # Assumed at origin based on camera intrinsics
|
303 |
}
|
304 |
+
print(f"Debug - Response: {response}")
|
305 |
return response
|
306 |
|
307 |
except Exception as e:
|