octree-nn / ocnn-pytorch

Octree-based 3D Convolutional Neural Networks
MIT License
152 stars 17 forks source link

AttributeError: 'NoneType' object has no attribute 'shape' #14

Closed zhongxiaj closed 1 year ago

zhongxiaj commented 1 year ago

Sorry for long message: I want to send my own data into the Lenet: def genOct(): pod = np.loadtxt('/mnt/zxj/datasets/20221030chuchai/Bianxie_stl2xyz_train/0015/Upper/0.txt') xyz, normal = pod[:, 0:3][0:4096], pod[:, 3:][0:4096] centroid = np.mean(xyz, axis=0)
xyz = xyz - centroid m = np.max(np.sqrt(np.sum(xyz ** 2, axis=1)))
xyz = xyz / m

xyz = xyz.clip(min=-1, max=1)

po = Points(torch.from_numpy(xyz), torch.from_numpy(normal)) # .permute(0,2,1)

octree = Octree(5, 2) octree.build_octree(po)

octree.construct_all_neigh() return octree

def main(): o1 =genOct() -->(for test) change the cloud point into <class 'ocnn.octree.octree.Octree'> o2 = genOct() o3 = genOct() octree = ocnn.octree.merge_octrees([o1,o2,o3]) data = self.get_input_feature(octree).cuda() logits = self.model(data, octree, octree.depth)

Traceback (most recent call last): File "classification.py", line 152, in ClsSolver.main() File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/thsolver/solver.py", line 411, in main cls.worker(0, FLAGS) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/thsolver/solver.py", line 400, in worker the_solver.run() File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/thsolver/solver.py", line 375, in run eval('self.%s()' % self.FLAGS.SOLVER.run) File "", line 1, in File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/thsolver/solver.py", line 298, in train self.train_epoch(epoch) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/thsolver/solver.py", line 156, in train_epoch output = self.train_step(batch) File "classification.py", line 142, in train_step loss, accu = self.forward(batch) File "classification__.py", line 89, in forward logits = self.model(data, octree, octree.depth) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, kwargs) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/ocnn-2.1.9-py3.7.egg/ocnn/models/lenet.py", line 42, in forward data = self.convs[i](data, octree, d) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(*input, *kwargs) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/ocnn-2.1.9-py3.7.egg/ocnn/modules/modules.py", line 72, in forward out = self.conv(data, octree, depth) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/torch/nn/modules/module.py", line 1130, in _call_impl return forward_call(input, kwargs) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/ocnn-2.1.9-py3.7.egg/ocnn/nn/octree_conv.py", line 351, in forward self.max_buffer) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/ocnn-2.1.9-py3.7.egg/ocnn/nn/octree_conv.py", line 223, in forward octree_conv.setup(octree, depth) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/ocnn-2.1.9-py3.7.egg/ocnn/nn/octree_conv.py", line 86, in setup self.buffer_h = self.neigh.shape[0] AttributeError: 'NoneType' object has no attribute 'shape' Exception in thread Thread-2: Traceback (most recent call last): File "/home/kexin/anaconda3/envs/py37/lib/python3.7/threading.py", line 917, in _bootstrap_inner self.run() File "/home/kexin/anaconda3/envs/py37/lib/python3.7/threading.py", line 865, in run self._target(*self._args, **self._kwargs) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/torch/utils/data/_utils/pin_memory.py", line 28, in _pin_memory_loop r = in_queue.get(timeout=MP_STATUS_CHECK_INTERVAL) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/multiprocessing/queues.py", line 113, in get return _ForkingPickler.loads(res) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/site-packages/torch/multiprocessing/reductions.py", line 297, in rebuild_storage_fd fd = df.detach() File "/home/kexin/anaconda3/envs/py37/lib/python3.7/multiprocessing/resource_sharer.py", line 57, in detach with _resource_sharer.get_connection(self._id) as conn: File "/home/kexin/anaconda3/envs/py37/lib/python3.7/multiprocessing/resource_sharer.py", line 87, in get_connection c = Client(address, authkey=process.current_process().authkey) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/multiprocessing/connection.py", line 498, in Client answer_challenge(c, authkey) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/multiprocessing/connection.py", line 746, in answer_challenge response = connection.recv_bytes(256) # reject large message File "/home/kexin/anaconda3/envs/py37/lib/python3.7/multiprocessing/connection.py", line 216, in recv_bytes buf = self._recv_bytes(maxlength) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/multiprocessing/connection.py", line 407, in _recv_bytes buf = self._recv(4) File "/home/kexin/anaconda3/envs/py37/lib/python3.7/multiprocessing/connection.py", line 379, in _recv chunk = read(handle, remaining) ConnectionResetError: [Errno 104] Connection reset by peer

I 'm sure the cloud point is not None. Is my operation procedure wrong? If so, what are the correct steps

wang-ps commented 1 year ago

I suggest first reading the provided examples in debug mode and debugging your own code with some IDEs like vscode.

zhongxiaj commented 1 year ago

I suggest first reading the provided examples in debug mode and debugging your own code with some IDEs like vscode.

Thanks for your master piece. I have solved the question. Thanks again