Testing with a single example (point cloud)
See original GitHub issueI’ve trained PointNet++ for classification on ModelNet40. Unfortunately I am unable to test the trained net on a single input point cloud.
Sample test script:
import torch
import torch_geometric.read as R
import torch_geometric.transforms as T
from model import PointNet2
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
# load model weights
model = PointNet2()
model.load_state_dict(torch.load('./weights.pt'))
model.to(device)
# load input and pre-process
off_input = R.read_off('./bench_0174.off')
sampler = T.SamplePoints(1024)
normalise = T.NormalizeScale()
off_preprocessed = normalise(sampler(off_input))
# inference
print(model(off_preprocessed.to(device)))
This script results in AttributeError: 'Data' object has no attribute 'batch'
. It seems unlikely to be able to set batch size without going through a dataloader. Any idea on how to proceed?
Full stack trace error in interested:
Traceback (most recent call last):
File "/home/reddwarf/3d-feature-extraction/pointnet2/test.py", line 18, in <module>
print(model(off_preprocessed.to(device)))
File "/home/reddwarf/anaconda3/envs/3df/lib/python3.6/site-packages/torch/nn/modules/module.py", line 493, in __call__
result = self.forward(*input, **kwargs)
File "/home/reddwarf/3d-feature-extraction/pointnet2/model.py", line 58, in forward
sa0_out = (data.x, data.pos, data.batch)
AttributeError: 'Data' object has no attribute 'batch'
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Point Clouds for Beginners: Your Questions Answered
A point cloud is essentially a huge collection of tiny individual points plotted in 3D space. It's made up of a multitude of...
Read more >Creating unit tests - libpointmatcher - Read the Docs
In the following test, we create a 2D point cloud point cloud where each voxel contains a grid of unformly spaced points. We...
Read more >Testing the experimental MSI installer and point cloud support ...
In this video I test the experimental MSI installer for QGIS 3.18 on Windows. I also show how to process and visualise point...
Read more >Displaying a Point Cloud Using Scene Depth - Apple Developer
Present a visualization of the physical environment by placing points based a scene's depth data.
Read more >Point cloud classification with PointNet - Keras
Classification, detection and segmentation of unordered 3D point sets i.e. point clouds is a core problem in computer vision. This example ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Just add a
batch
object to your test data: data.batch = torch.zeros(data.num_nodes, dtype=torch.long)Closing this issue due to inactivity. Please feel free to re-open if there are still concerns.