주요 콘텐츠

releaseGPUMemory

R2026b

Release GPU memory allocated for model

Since R2026b

    Description

    Add-On Required: This feature requires the Point Cloud Toolbox Model for SNAP Segmentation Network add-on.

    releaseGPUMemory(segmenter) releases the GPU memory allocated to the Segment Anything in Any Point Cloud (SNAP) model object segmenter. To enable additional models to run on the GPU, use this function to free GPU resources after SNAP model inference completes.

    example

    Examples

    collapse all

    Create a SNAP segmentation model configured for outdoor point cloud data.

    segmenter = snap("Outdoor");

    Read the input point cloud representing outdoor urban driving scene.

    ptCloud = pcread("PandasetLidarData.pcd");

    Specify a point prompt that lies inside the object of interest. The prompt guides the model to segment the corresponding object.

    pointPrompt = [3 5 -0.5];

    Display the input point cloud and overlay the point prompt.

    figure(Position=[100 100 500 500])
    pcshow(ptCloud)
    hold on
    plot3(pointPrompt(1),pointPrompt(2),pointPrompt(3), ...
        ".r",MarkerSize=20)
    hold off
    zoom(5)

    Segment the object using the segmentObjects object function.

    [mask,label,score] = segmentObjects(segmenter,ptCloud,pointPrompt);

    Release GPU memory allocated to the SNAP model.

    releaseGPUMemory(segmenter)

    Visualize the segmented object overlaid on the point cloud.

    figure(Position=[100 100 500 500])
    pcshow(ptCloud.Location,single(mask))
    zoom(5)

    Display the predicted label.

    disp(label)
         Car 
    

    Input Arguments

    collapse all

    SNAP segmentation model, specified as a snap object.

    Note

    To use this functionality, your system must have a CUDA® enabled NVIDIA® GPU. For information on the supported compute capabilities, see GPU Computing Requirements (Parallel Computing Toolbox).

    Version History

    Introduced in R2026b