concept-graphs / concept-graphs

Official code release for ConceptGraphs
MIT License
367 stars 60 forks source link

Building a map on outdoor scene #57

Closed vinci-xiao closed 5 days ago

vinci-xiao commented 1 month ago

Screenshot from 2024-07-25 00-09-17 Hi, I was trying to collect a .r3d of my front door, and I followed the instructions from the YouTube tutorial. I know it was originally used for indoor scenarios, but I still want to try.

I got the map preprocessed successfully but got the following error while I was running "rerun_realtime_mapping.py"

Error executing job with overrides: []
Traceback (most recent call last):
  File "/home/vinc/cg_ws/concept-graphs/conceptgraph/slam/rerun_realtime_mapping.py", line 278, in main
    labels, edges, edge_image = make_vlm_edges(image, curr_det, obj_classes, detection_class_labels, det_exp_vis_path, color_path, False, None)
  File "/home/vinc/cg_ws/concept-graphs/conceptgraph/utils/general_utils.py", line 430, in make_vlm_edges
    filtered_detections, labels = filter_detections(
  File "/home/vinc/cg_ws/concept-graphs/conceptgraph/utils/general_utils.py", line 385, in filter_detections
    confidences, class_ids, xyxy, masks, indices = zip(*filtered_detections)
ValueError: not enough values to unpack (expected 5, got 0)

Set the environment variable HYDRA_FULL_ERROR=1 for a complete stack trace.

Is there any chance to adjust some parameters to get thing works? or I simply shouldn't use it for outdoor scenarios.

alik-git commented 1 month ago

I think you need to check the settings that are being passed into filtered detections. it seems that all your detections are being filtered out so its returning none. can you check how many detections there are before the filtering?

hntkien commented 1 week ago

Hi all, hope you are doing well so far. Regarding this issue, it will happen with indoor scene as well if there is no object detected in a frame. In this case, filtered_detection will be an empty list. Below is my solution

# Accounting for the case when there is no detection in the image
    if len(filtered_detections) != 0:
        # Unzip the filtered results
        confidences, class_ids, xyxy, masks, indices = zip(*filtered_detections)
        filtered_labels = [given_labels[i] for i in indices]

        # Create new detections object
        filtered_detections = sv.Detections(
            class_id=np.array(class_ids, dtype=np.int64),
            confidence=np.array(confidences, dtype=np.float32),
            xyxy=np.array(xyxy, dtype=np.float32),
            mask=np.array(masks, dtype=np.bool_)
        )
    else:
        # No filter 
        filtered_detections = detections 
        filtered_labels = given_labels

At the end of filter_detections function in general_utils.py, I added a condition to check if the filtered_detection is empty. If it is, then we will assign it to the input detections.

georgegu1997 commented 5 days ago

I found this issue and the proposed change have already been included in PR #68. So I'm closing this issue for now.