question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing with a single example (point cloud)

See original GitHub issue

I’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:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
rusty1scommented, Aug 7, 2019

Just add a batch object to your test data: data.batch = torch.zeros(data.num_nodes, dtype=torch.long)

0reactions
rusty1scommented, Oct 27, 2022

Closing this issue due to inactivity. Please feel free to re-open if there are still concerns.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found