luxonis / depthai-ros

Official ROS Driver for DepthAI Sensors.
MIT License
259 stars 189 forks source link

[BUG] std:bad_aloc after running spatial_bb.launch.py using Yolov4 tiny even though it seems I do have enough memory #618

Open kodaigit opened 1 week ago

kodaigit commented 1 week ago

Describe the bug With ROS2 humble and OAK-D PRO PoE camera, I ran spatial_bb.launch.py using YOLOv4 tiny coco. But a few seconds after the camera became ready, I got std:bad_aloc. My OS is Ubuntu 22.04 and the laptop has 16GB of RAM. When I ran the launch file, I could not observe that the RAM ran out. So, I am not sure what went wrong. Without the visualization, I could successfully publish the bboxes.

[component_container-1] terminate called after throwing an instance of 'std::bad_alloc' [component_container-1] what(): std::bad_alloc [ERROR] [component_container-1]: process has died [pid 21089, exit code -6, cmd '/opt/ros/humble/lib/rclcpp_components/component_container --ros-args --log-level info --ros-args -r __node:=oak_container -r __ns:=/'].

Minimal Reproducible Example with Yolov4 model, not mobilenet, run

ros2 launch depthai_filters spatial_bb.launch.py

Expected behavior If it runs out of memory, I expect that RAM is full.

Attach system log

Serafadam commented 5 days ago

Hi, did you update the label map in spatial_bb_node? If not, that might be cause of the issue as the default label map is set for mobilenet, right now we don't have the mechanism to also get the labels from the message. For yolo you would need to update the config file as follows:


/spatial_bb_node:
  ros__parameters:
    desqueeze: true
    label_map: [
            "person",
            "bicycle",
            "car",
            "motorbike",
            "aeroplane",
            "bus",
            "train",
            "truck",
            "boat",
            "traffic light",
            "fire hydrant",
            "stop sign",
            "parking meter",
            "bench",
            "bird",
            "cat",
            "dog",
            "horse",
            "sheep",
            "cow",
            "elephant",
            "bear",
            "zebra",
            "giraffe",
            "backpack",
            "umbrella",
            "handbag",
            "tie",
            "suitcase",
            "frisbee",
            "skis",
            "snowboard",
            "sports ball",
            "kite",
            "baseball bat",
            "baseball glove",
            "skateboard",
            "surfboard",
            "tennis racket",
            "bottle",
            "wine glass",
            "cup",
            "fork",
            "knife",
            "spoon",
            "bowl",
            "banana",
            "apple",
            "sandwich",
            "orange",
            "broccoli",
            "carrot",
            "hot dog",
            "pizza",
            "donut",
            "cake",
            "chair",
            "sofa",
            "pottedplant",
            "bed",
            "diningtable",
            "toilet",
            "tvmonitor",
            "laptop",
            "mouse",
            "remote",
            "keyboard",
            "cell phone",
            "microwave",
            "oven",
            "toaster",
            "sink",
            "refrigerator",
            "book",
            "clock",
            "vase",
            "scissors",
            "teddy bear",
            "hair drier",
            "toothbrush"
        ]