microsoft / O-CNN

O-CNN: Octree-based Convolutional Neural Networks for 3D Shape Analysis
MIT License
732 stars 173 forks source link

How should I use OCNN to deal with general 3D tensor? #116

Closed NoOneUST closed 3 years ago

NoOneUST commented 3 years ago

Now I have a 3D tensor(it is not some shape, just a general tensor).

torch.Size([2, 32, 48, 128, 160]) ((N,Cin,D,H,W))
mean: 5e-4
max: 6.6e-3
min: -1.1e-8
mid: 2.7940e-8

Percent:
abs<1e-20: 0.0378
abs<1e-10: 0.0398
abs<1e-9: 0.0937
abs<1e-8: 0.3470
abs<1e-7: 0.6488
abs<1e-6: 0.7463
abs<1e-5: 0.7702
abs<1e-4: 0.7728
abs<1e-3: 0.8302
abs<1e-2: 1

Can I use OCNN to speed it up? In my understanding, OCNN requires the input to be sparse. Can I adopt OCNN by forcing some values<threshold to be 0? What kind of threshold might be good? And I am not clear how the data is stored in the numpy array read from the points files. I notice that the array is a len=171976 vector. What does each element in it mean? Is the inside data stored in the form [[x1,y1,z1,nx1,ny1,nz1,r1,g1,b1,label1], [x2,y2,z2,nx2,ny2,nz2,r2,g2,b2,label2],...] or [[x1,y1,z1,x2,y2,z2...], [nx1,ny1,nz1,nx2,ny2,nz2,...], [r1,g1,b1,r2,g2,b2,...], [label1, label2,...]]? It seems that the channel number can vary and some arributes can be empty, so how to make sure that the input array can be accurately decoded? Another thing is that how should I set the hyper-parameters like tree depth in the code to construct a 3D U-Net. Thank you so much!

NoOneUST commented 3 years ago

Hello. Do you have any suggestions?

wang-ps commented 3 years ago

Can I adopt OCNN by forcing some values<threshold to be 0?

Yes. Probably, You can choose the threshold via cross-validation.

I am not clear how the data is stored in the NumPy array

Please refer to the tutorial here to prepare your data. You should write several lines of C++ code. We also provide a Tensorflow wrapper here which can be directly used in python.

If the normal is empty, you can simply leave it as empty or set it as [1, 1, 1] when constructing the points.

About the tree depth

You can regard the tree depth as the resolution of a voxel. For example, if tree-depth is 6, the corresponding resolution of voxel grids is 64. This parameter indicates on which resolution the convolution operation applies.

NoOneUST commented 3 years ago

The following problem comes from the version of the compiler, it can work well with GCC 7.2. But I still have a doubt, how should I use the tensorflow wrapper?


I try to use the Tensorflow wrapper, thus I first follow your installation guidance and run

cd tensorflow/libs
python build.py`

Then I get the following error:

(base) -bash-4.2$ python build.py
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:516: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:517: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:518: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:519: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:520: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/python/framework/dtypes.py:525: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:541: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint8 = np.dtype([("qint8", np.int8, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:542: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint8 = np.dtype([("quint8", np.uint8, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:543: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint16 = np.dtype([("qint16", np.int16, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:544: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_quint16 = np.dtype([("quint16", np.uint16, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:545: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  _np_qint32 = np.dtype([("qint32", np.int32, 1)])
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorboard/compat/tensorflow_stub/dtypes.py:550: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.
  np_resource = np.dtype([("resource", np.ubyte, 1)])
g++ -std=c++11 -O2 -c transform_points_op.cc -I/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include -D_GLIBCXX_USE_CXX11_ABI=1 -I../../octree/octree -I /usr/local/cuda-10.1/include   -L /usr/local/cuda-10.1/lib64 -D GOOGLE_CUDA=1 -L/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow -l:libtensorflow_framework.so.1 -L../../octree/build -loctree_lib -fPIC -lcudart  -o object/transform_points_op.cc.o
/usr/local/cuda-10.1/bin/nvcc -std=c++11 -O2 -c tensorflow_gpu_gemm.cu.cc -I/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include -D_GLIBCXX_USE_CXX11_ABI=1 -I../../octree/octree -I /usr/local/cuda-10.1/include -x cu -Xcompiler -fPIC -D GOOGLE_CUDA=1 -I /usr/local   -expt-relaxed-constexpr -DNDEBUG  -o object/tensorflow_gpu_gemm.cu.cc.o
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/absl/strings/string_view.h(495): warning: expression has no effect

/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/absl/strings/string_view.h(495): warning: expression has no effect

/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h: In instantiation of ‘void google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::SearchFrom(google::protobuf::Map<Key, T>::size_type) [with KeyValueType = google::protobuf::Map<std::__cxx11::basic_string<char>, tensorflow::AttrValue>::KeyValuePair; Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::Map<Key, T>::size_type = long unsigned int]’:
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:400:11:   required from ‘google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::iterator_base(const google::protobuf::Map<Key, T>::InnerMap*) [with KeyValueType = google::protobuf::Map<std::__cxx11::basic_string<char>, tensorflow::AttrValue>::KeyValuePair; Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:516:28:   required from ‘google::protobuf::Map<Key, T>::InnerMap::iterator google::protobuf::Map<Key, T>::InnerMap::begin() [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::Map<Key, T>::InnerMap::iterator = google::protobuf::Map<std::__cxx11::basic_string<char>, tensorflow::AttrValue>::InnerMap::iterator_base<google::protobuf::Map<std::__cxx11::basic_string<char>, tensorflow::AttrValue>::KeyValuePair>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1040:25:   required from ‘google::protobuf::Map<Key, T>::const_iterator google::protobuf::Map<Key, T>::begin() const [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/tensorflow/core/framework/node_def_util.h:173:177:   required from here
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:428:29: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsNonEmptyList(google::protobuf::Map<Key, T>::size_type) const [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
           if (m_->TableEntryIsNonEmptyList(bucket_index_)) {
           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:431:30: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsTree(google::protobuf::Map<Key, T>::size_type) const [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
           } else if (m_->TableEntryIsTree(bucket_index_)) {
              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h: In instantiation of ‘bool google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::revalidate_if_necessary(google::protobuf::Map<Key, T>::InnerMap::TreeIterator*) [with KeyValueType = google::protobuf::Map<std::__cxx11::basic_string<char>, tensorflow::AttrValue>::KeyValuePair; Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::Map<Key, T>::InnerMap::TreeIterator = std::_Rb_tree_const_iterator<std::__cxx11::basic_string<char>*>]’:
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:610:12:   required from ‘void google::protobuf::Map<Key, T>::InnerMap::erase(google::protobuf::Map<Key, T>::InnerMap::iterator) [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::Map<Key, T>::InnerMap::iterator = google::protobuf::Map<std::__cxx11::basic_string<char>, tensorflow::AttrValue>::InnerMap::iterator_base<google::protobuf::Map<std::__cxx11::basic_string<char>, tensorflow::AttrValue>::KeyValuePair>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1139:1:   required from ‘google::protobuf::Map<Key, T>::iterator google::protobuf::Map<Key, T>::erase(google::protobuf::Map<Key, T>::iterator) [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1144:14:   required from ‘void google::protobuf::Map<Key, T>::erase(google::protobuf::Map<Key, T>::iterator, google::protobuf::Map<Key, T>::iterator) [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1147:21:   required from ‘void google::protobuf::Map<Key, T>::clear() [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map_field_inl.h:188:1:   required from ‘void google::protobuf::internal::MapField<Derived, Key, T, key_wire_type, value_wire_type, default_enum_value>::Clear() [with Derived = tensorflow::NameAttrList_AttrEntry_DoNotUse; Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::internal::WireFormatLite::FieldType kKeyFieldType = (google::protobuf::internal::WireFormatLite::FieldType)9; google::protobuf::internal::WireFormatLite::FieldType kValueFieldType = (google::protobuf::internal::WireFormatLite::FieldType)11; int default_enum_value = 0]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/tensorflow/core/framework/attr_value.pb.h:1790:15:   required from here
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:490:29: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsNonEmptyList(google::protobuf::Map<Key, T>::size_type) const [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
         if (m_->TableEntryIsNonEmptyList(bucket_index_)) {
         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:504:24: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsList(google::protobuf::Map<Key, T>::size_type) const [with Key = std::__cxx11::basic_string<char>; T = tensorflow::AttrValue; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
         return m_->TableEntryIsList(bucket_index_);
         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h: In instantiation of ‘void google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::SearchFrom(google::protobuf::Map<Key, T>::size_type) [with KeyValueType = google::protobuf::Map<unsigned int, tensorflow::FunctionDef_ArgAttrs>::KeyValuePair; Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::Map<Key, T>::size_type = long unsigned int]’:
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:400:11:   required from ‘google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::iterator_base(const google::protobuf::Map<Key, T>::InnerMap*) [with KeyValueType = google::protobuf::Map<unsigned int, tensorflow::FunctionDef_ArgAttrs>::KeyValuePair; Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:516:28:   required from ‘google::protobuf::Map<Key, T>::InnerMap::iterator google::protobuf::Map<Key, T>::InnerMap::begin() [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::Map<Key, T>::InnerMap::iterator = google::protobuf::Map<unsigned int, tensorflow::FunctionDef_ArgAttrs>::InnerMap::iterator_base<google::protobuf::Map<unsigned int, tensorflow::FunctionDef_ArgAttrs>::KeyValuePair>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1037:27:   required from ‘google::protobuf::Map<Key, T>::iterator google::protobuf::Map<Key, T>::begin() [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1147:27:   required from ‘void google::protobuf::Map<Key, T>::clear() [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map_field_inl.h:188:1:   required from ‘void google::protobuf::internal::MapField<Derived, Key, T, key_wire_type, value_wire_type, default_enum_value>::Clear() [with Derived = tensorflow::FunctionDef_ArgAttrEntry_DoNotUse; Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::internal::WireFormatLite::FieldType kKeyFieldType = (google::protobuf::internal::WireFormatLite::FieldType)13; google::protobuf::internal::WireFormatLite::FieldType kValueFieldType = (google::protobuf::internal::WireFormatLite::FieldType)11; int default_enum_value = 0]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/tensorflow/core/framework/function.pb.h:1059:19:   required from here
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:428:29: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsNonEmptyList(google::protobuf::Map<Key, T>::size_type) const [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
           if (m_->TableEntryIsNonEmptyList(bucket_index_)) {
           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:431:30: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsTree(google::protobuf::Map<Key, T>::size_type) const [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
           } else if (m_->TableEntryIsTree(bucket_index_)) {
              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h: In instantiation of ‘bool google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::revalidate_if_necessary(google::protobuf::Map<Key, T>::InnerMap::TreeIterator*) [with KeyValueType = google::protobuf::Map<unsigned int, tensorflow::FunctionDef_ArgAttrs>::KeyValuePair; Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::Map<Key, T>::InnerMap::TreeIterator = std::_Rb_tree_const_iterator<unsigned int*>]’:
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:610:12:   required from ‘void google::protobuf::Map<Key, T>::InnerMap::erase(google::protobuf::Map<Key, T>::InnerMap::iterator) [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::Map<Key, T>::InnerMap::iterator = google::protobuf::Map<unsigned int, tensorflow::FunctionDef_ArgAttrs>::InnerMap::iterator_base<google::protobuf::Map<unsigned int, tensorflow::FunctionDef_ArgAttrs>::KeyValuePair>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1139:1:   required from ‘google::protobuf::Map<Key, T>::iterator google::protobuf::Map<Key, T>::erase(google::protobuf::Map<Key, T>::iterator) [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1144:14:   required from ‘void google::protobuf::Map<Key, T>::erase(google::protobuf::Map<Key, T>::iterator, google::protobuf::Map<Key, T>::iterator) [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1147:21:   required from ‘void google::protobuf::Map<Key, T>::clear() [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map_field_inl.h:188:1:   required from ‘void google::protobuf::internal::MapField<Derived, Key, T, key_wire_type, value_wire_type, default_enum_value>::Clear() [with Derived = tensorflow::FunctionDef_ArgAttrEntry_DoNotUse; Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::internal::WireFormatLite::FieldType kKeyFieldType = (google::protobuf::internal::WireFormatLite::FieldType)13; google::protobuf::internal::WireFormatLite::FieldType kValueFieldType = (google::protobuf::internal::WireFormatLite::FieldType)11; int default_enum_value = 0]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/tensorflow/core/framework/function.pb.h:1059:19:   required from here
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:490:29: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsNonEmptyList(google::protobuf::Map<Key, T>::size_type) const [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
         if (m_->TableEntryIsNonEmptyList(bucket_index_)) {
         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:504:24: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsList(google::protobuf::Map<Key, T>::size_type) const [with Key = unsigned int; T = tensorflow::FunctionDef_ArgAttrs; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
         return m_->TableEntryIsList(bucket_index_);
         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h: In instantiation of ‘void google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::SearchFrom(google::protobuf::Map<Key, T>::size_type) [with KeyValueType = google::protobuf::Map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::KeyValuePair; Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::Map<Key, T>::size_type = long unsigned int]’:
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:400:11:   required from ‘google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::iterator_base(const google::protobuf::Map<Key, T>::InnerMap*) [with KeyValueType = google::protobuf::Map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::KeyValuePair; Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:516:28:   required from ‘google::protobuf::Map<Key, T>::InnerMap::iterator google::protobuf::Map<Key, T>::InnerMap::begin() [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::Map<Key, T>::InnerMap::iterator = google::protobuf::Map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::InnerMap::iterator_base<google::protobuf::Map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::KeyValuePair>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1037:27:   required from ‘google::protobuf::Map<Key, T>::iterator google::protobuf::Map<Key, T>::begin() [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1147:27:   required from ‘void google::protobuf::Map<Key, T>::clear() [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map_field_inl.h:188:1:   required from ‘void google::protobuf::internal::MapField<Derived, Key, T, key_wire_type, value_wire_type, default_enum_value>::Clear() [with Derived = tensorflow::FunctionDef_RetEntry_DoNotUse; Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::internal::WireFormatLite::FieldType kKeyFieldType = (google::protobuf::internal::WireFormatLite::FieldType)9; google::protobuf::internal::WireFormatLite::FieldType kValueFieldType = (google::protobuf::internal::WireFormatLite::FieldType)9; int default_enum_value = 0]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/tensorflow/core/framework/function.pb.h:1104:14:   required from here
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:428:29: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsNonEmptyList(google::protobuf::Map<Key, T>::size_type) const [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
           if (m_->TableEntryIsNonEmptyList(bucket_index_)) {
           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:431:30: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsTree(google::protobuf::Map<Key, T>::size_type) const [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
           } else if (m_->TableEntryIsTree(bucket_index_)) {
              ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h: In instantiation of ‘bool google::protobuf::Map<Key, T>::InnerMap::iterator_base<KeyValueType>::revalidate_if_necessary(google::protobuf::Map<Key, T>::InnerMap::TreeIterator*) [with KeyValueType = google::protobuf::Map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::KeyValuePair; Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::Map<Key, T>::InnerMap::TreeIterator = std::_Rb_tree_const_iterator<std::__cxx11::basic_string<char>*>]’:
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:610:12:   required from ‘void google::protobuf::Map<Key, T>::InnerMap::erase(google::protobuf::Map<Key, T>::InnerMap::iterator) [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::Map<Key, T>::InnerMap::iterator = google::protobuf::Map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::InnerMap::iterator_base<google::protobuf::Map<std::__cxx11::basic_string<char>, std::__cxx11::basic_string<char> >::KeyValuePair>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1139:1:   required from ‘google::protobuf::Map<Key, T>::iterator google::protobuf::Map<Key, T>::erase(google::protobuf::Map<Key, T>::iterator) [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1144:14:   required from ‘void google::protobuf::Map<Key, T>::erase(google::protobuf::Map<Key, T>::iterator, google::protobuf::Map<Key, T>::iterator) [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:1147:21:   required from ‘void google::protobuf::Map<Key, T>::clear() [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map_field_inl.h:188:1:   required from ‘void google::protobuf::internal::MapField<Derived, Key, T, key_wire_type, value_wire_type, default_enum_value>::Clear() [with Derived = tensorflow::FunctionDef_RetEntry_DoNotUse; Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::internal::WireFormatLite::FieldType kKeyFieldType = (google::protobuf::internal::WireFormatLite::FieldType)9; google::protobuf::internal::WireFormatLite::FieldType kValueFieldType = (google::protobuf::internal::WireFormatLite::FieldType)9; int default_enum_value = 0]’
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/tensorflow/core/framework/function.pb.h:1104:14:   required from here
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:490:29: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsNonEmptyList(google::protobuf::Map<Key, T>::size_type) const [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
         if (m_->TableEntryIsNonEmptyList(bucket_index_)) {
         ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/export/data/lwangcg/anaconda3/lib/python3.7/site-packages/tensorflow/include/google/protobuf/map.h:504:24: error: cannot call member function ‘bool google::protobuf::Map<Key, T>::InnerMap::TableEntryIsList(google::protobuf::Map<Key, T>::size_type) const [with Key = std::__cxx11::basic_string<char>; T = std::__cxx11::basic_string<char>; google::protobuf::Map<Key, T>::size_type = long unsigned int]’ without object
         return m_->TableEntryIsList(bucket_index_);
         ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
make: *** [object/tensorflow_gpu_gemm.cu.cc.o] Error 1

When I try to directly compile O-CNN/octree/octree/custom_data.cpp, I use command gcc -lstdc++ custom_data.cpp and get error:

(base) -bash-4.2$ gcc -lstdc++ custom_data.cpp
/tmp/cczFHJ5a.o: In function `main':
custom_data.cpp:(.text+0x9c2): undefined reference to `Points::set_points(std::vector<float, std::allocator<float> > const&, std::vector<float, std::allocator<float> > const&, std::vector<float, std::allocator<float> > const&, std::vector<float, std::allocator<float> > const&)'
custom_data.cpp:(.text+0x9f3): undefined reference to `Points::write_points(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/tmp/cczFHJ5a.o: In function `PointsInfo::PointsInfo()':
custom_data.cpp:(.text._ZN10PointsInfoC2Ev[_ZN10PointsInfoC5Ev]+0x14): undefined reference to `PointsInfo::reset()'
collect2: error: ld returned 1 exit status

How should I use the code? Thank you so much!!

NoOneUST commented 3 years ago

Now the things I am still confused are:

  1. In the pytorch implementation, the point (e.g. dataset/ModelNet40.points/airplane/train/airplane_0001.upgrade.smp.points) read from points file is a len=204616 np array instead of an object with attributes like points, normals, features, labels. Although with the help of test_points_property.py, now I know how to generate new points in tensorflow. However, I still do not know how to do this in pytorch. It seems that you did not provide the points_new function. It seems that there are many functions not implemented in your pytorch version, e.g. octree_property. How should I do?
  2. In the pytorch implementation, three transforms are needs: NormalizePoints,TransformPoints,Points2Octree. If I just want to convert a pytorch tensor to an octree, what transforms do I need to do?
  3. How should I set the following parameters? Especially full depth, what is its difference to depth? When we say the depth, suppose I need the convolution's input resolution to be 6464, and the output resolution to be 3232, then the depth now should be set to 6 (resolution=64*64)?
    adaptive: False
    angle: (0, 0, 5)
    depth: 5
    distort: True
    full_depth: 2
    interval: (1, 1, 1)
    jitter: 0.125
    name: 
    node_dis: False
    node_feat: False
    offset: 0.016
    scale: 0.25
    split_label: False
    uniform: False
  4. How should I deal with a tensor with height not equal to width, e.g. torch.size(2,3,48,60) (batch,channel,height,width)? To my understanding, such tensor is not supported in the current OCNN? Need I resize the original tensor first?
  5. I do not find out how to new points and how to do TransConv in pytroch