Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example: Add an example of Pointnet inference implementation #2845

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from
23 changes: 13 additions & 10 deletions examples/network/README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# PointNet Convolutional Neural Network Sample for 3D Pointcloud Classification

[PointNet][pointnet-paper] is a convolutional neural network architecture for applications concerning 3D recognition such as object classification and part segmentation. These sample codes implement a variant of PointNet for 3D object classification, for inference only with ModelNet10, showing a larger example of using oneDNN. Some rough instructions for how it might be used are provided.
[PointNet][pointnet-paper] is a convolutional neural network architecture for applications concerning 3D recognition such as object classification and part segmentation. These sample codes implement a variant of PointNet for 3D object classification, for inference only with ModelNet10, providing a comprehensive example of using oneDNN. You can see the following initial instructions on using the samples.

## Obtaining the model weights and classes and preparing an input pointcloud
## Obtain the Model Weights and Classes and Preparing an Input pointcloud
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Obtain the Model Weights and Classes and Prepare an Input pointcloud


A preprocessing script is provided which unpacks the weights from a pretrained pytorch model. The script also prepares an input pointcloud for testing inference. The pointcloud is made from 3D scans taken from the [ModelNet10][modelnet] dataset. The script requires an installation of [PyTorch][pytorch]. First download the pretrained PointNet weights and move the pth file into the same directory of the model.
A preprocessing script is provided which unpacks the weights from a pre-trained pytorch model. The script also prepares an input pointcloud for testing inference. The pointcloud is made from 3D scans taken from the [ModelNet10][modelnet] dataset. The script requires an installation of [PyTorch][pytorch].
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A preprocessing script is provided which unpacks the weights from a pre-trained PyTorch model.


First, download the pre-trained PointNet weights and then move the pth file into the same directory containing the model.

```bash
wget http://3dvision.princeton.edu/projects/2014/3DShapeNets/ModelNet10.zip
Expand All @@ -13,16 +15,17 @@ rm ModelNet10.zip
python3 prepareData.py ModelNet10/ pointnet_model.pth
```

The weights will be saved to `data/` and the input pointcloud will be saved as `itemName_cloud.bin`
The weights will be saved to `data/` and the input pointcloud will be saved as `itemName_cloud.bin`.

## Testing on a pointcloud
## Test on a pointcloud

The oneDNN samples are built in the default CMake configuration. The sample
is built by the target `network-pointnet-cpp`. The samples must first
be passed the directory where the binary weights files are stored and the second
argument should be the preprocessed pointcloud that should be classified. The expected
output is of a classification index and a series of times in nanoseconds that corresond
to the total time to run the network on an input, not including data transfer time.
is built by the target `network-pointnet-cpp`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this example will be moved to oneAPI Samples and will not be built with the oneDNN source code, could you please add the bash command line to build this example and link libdnnl.so?

The oneDNN samples are built using the default CMake configuration.
To run the sample, provide as first argument the path to the directory containing the binary weight files and as second argument the path to the preprocessed point cloud file to be classified.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To run the sample, provide the path to the directory containing the binary weight files as the first argument and the path to the preprocessed point cloud file to be classified as the second argument.


The expected output includes a classification index and (if enabled) timing measurements in nanoseconds, representing the total time taken to run the network on the input, excluding data transfer time.


```bash
network-pointnet-cpp ModelNet10/directory/extracted_data ModelNet10/directory/input_cloud/itemName_cloud.bin
Expand Down
Loading