Main Content

classify

Classify point cloud using PointNet++ classifier

Since R2025a

    Description

    classes = classify(classifier,ptCloud) classifies an object in the input point cloud PtCloud using a PointNet++ classifier, classifier. The input point cloud must contain only one object. The function returns a predicted class for the input 3-D object.

    example

    [classes,scores] = classify(classifier,ptCloud) additionally returns a confidence score within the range [0, 1] for the classified object.

    [___] = classify(classifier,ds) classifies objects within a set of point clouds, ds, using any combination of output arguments from previous syntaxes.. Each point cloud within the set must contain only one object.

    [___] = classify(___,Name=Value) specifies options using one or more name-value arguments in addition to any combination of arguments from previous syntaxes. For example, ExecutionEnvironment="cpu" specifies to use the CPU to classify objects in the input point clouds.

    Note

    This functionality requires Deep Learning Toolbox™, Lidar Toolbox™, and the Lidar Toolbox Model for PointNet++ Classification support package. You can download and install the Lidar Toolbox Model for PointNet++ Classification from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

    Examples

    collapse all

    Create a PointNet++ Classifier.

    classifier = pointNetPlusClassifier;

    Read the input point cloud.

    filename = "bus.pcd";
    ptCloud = pcread(filename);

    Apply the pretrained PointNet++ classifier to the input point cloud.

    class = classify(classifier,ptCloud);

    Display the input point cloud and its predicted class.

    pcshow(ptCloud.Location,[0 1 0], ...
        MarkerSize=40, ...
        VerticalAxisDir="down")
    title(class)

    Figure contains an axes object. The axes object with title bus contains an object of type scatter.

    Input Arguments

    collapse all

    PointNet++ classifier, specified as a pointNetPlusClassifier object.

    Input point cloud, specified as a pointCloud object, an array of pointCloud objects, or a cell array of pointCloud objects. The point clouds can be unorganized or organized. Each input point cloud must contain only one object. To get a single-object point cloud from a large point cloud, use the pcsegsam or pcsegdist function.

    Collection of point clouds, specified as a valid datastore object. The datastore must be set up such that using the read function on the datastore object returns a point cloud. For more information on creating datastore objects, see the datastore function.

    Name-Value Arguments

    collapse all

    Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

    Example: classify(classifier,PtCloud,ExecutionEnvironment="cpu") specifies to use the CPU to classify objects in the input point clouds.

    Hardware resource on which to run the classifier, specified as "auto", "gpu", or "cpu".

    • "auto" — Use a GPU, if available. Otherwise, use the CPU.

    • "gpu" — Use the GPU. To use a GPU, you must have Parallel Computing Toolbox™ and a CUDA® enabled NVIDIA® GPU. If a suitable GPU is not available, the function returns an error. For information about the supported compute capabilities, see GPU Computing Requirements (Parallel Computing Toolbox).

    • "cpu" — Use the CPU.

    Performance optimization, specified as "auto" or "none".

    • "auto" — Automatically select the optimizations suitable for the input network and environment.

    • "none" — Turn off all acceleration.

    Data Types: char | string

    Minimum batch size, specified as a positive integer. Use the MiniBatchSize argument when processing a large collection of point clouds. Using this argument, the function groups point clouds into mini-batches and processes them as a batch to improve computational efficiency. Increase the minimum batch size to decrease processing time. Decrease the size to use less memory.

    Output Arguments

    collapse all

    Predicted class, returned as an M-by-1 categorical vector. M is the number of input point clouds.

    Classification confidence score, returned as an M-by-1 numeric vector. M is the number of input point clouds. The value of each confidence score is in the range of [0, 1]. A higher score indicates greater confidence in the classification.

    Version History

    Introduced in R2025a