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

[pcl::PLYWriter::writeASCII] Input point cloud has no data! #87

Closed
AnjaKang opened this issue Sep 5, 2023 · 27 comments
Closed

[pcl::PLYWriter::writeASCII] Input point cloud has no data! #87

AnjaKang opened this issue Sep 5, 2023 · 27 comments

Comments

@AnjaKang
Copy link

AnjaKang commented Sep 5, 2023

Hi I'm new to the scripts. When I ran joint tracking and reconstruction with the example of milk data, I found the error :

[pcl::PLYWriter::writeASCII] Input point cloud has no data!
[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud!
[pcl::PLYWriter::writeASCII] Input point cloud has no data!
Segmentation fault (core dumped)

The same error also happened when I ran with HO3D dataset:
[bundlesdf.py] processNewFrame start 0000
[bundlesdf.py] process frame 0000
[pcl::PLYWriter::writeASCII] Input point cloud has no data!
[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud!
[pcl::PLYWriter::writeASCII] Input point cloud has no data!
Segmentation fault (core dumped)

It seems that I didn't successfully create the cloud_init.ply neither cloud_for_init_coord.ply. Does anyone know how to fix it?

Thanks in advance.

@wenbowen123
Copy link
Collaborator

Are you running this inside docker container?

@AnjaKang
Copy link
Author

AnjaKang commented Sep 8, 2023

Are you running this inside docker container?

Yes I am running inside the docker container.

I have downloaded XMem-s012.pth, outdoor_ds.ckpt, HO3D data , YCB-Video object models, the milk example, put them under the path you mentioned and update my root path of HO3D_ROOT.

Then I went into the docker and ran $bash build.sh.

After that I ran
python run_custom.py --mode run_video --video_dir ${my own path of bundlesdf}/2022-11-18-15-10-24_milk --out_folder ${my own path of bundlesdf}/bundlesdf_2022-11-18-15-10-24_milk --use_segmenter 1 --use_gui 1 --debug_level 2

And I got the error as mentioned on the title. Are there any steps I missed?

@wenbowen123
Copy link
Collaborator

from the error it looks like the depth loading has issue. I'd suggest increase debug_level to 4 and run. Then check the ply file saved in the output path.

@AnjaKang
Copy link
Author

I ran with debug_level 4, but I didn't find ply file, there were only config_bundletrack.yml, config_nerf.yml and an empty frame folder.

message output like this:
[2023-09-10 22:05:45.801] [warning] [Bundler.cpp:49] Connected to nerf_port 9999
[2023-09-10 22:05:45.801] [warning] [FeatureManager.cpp:2084] Connected to port 5555
default_cfg {'backbone_type': 'ResNetFPN', 'resolution': (8, 2), 'fine_window_size': 5, 'fine_concat_coarse_feat': True, 'resnetfpn': {'initial_dim': 128, 'block_dims': [128, 196, 256]}, 'coarse': {'d_model': 256, 'd_ffn': 256, 'nhead': 8, 'layer_names': ['self', 'cross', 'self', 'cross', 'self', 'cross', 'self', 'cross'], 'attention': 'linear', 'temp_bug_fix': False}, 'match_coarse': {'thr': 0.2, 'border_rm': 2, 'match_type': 'dual_softmax', 'dsmax_temperature': 0.1, 'skh_iters': 3, 'skh_init_bin_score': 1.0, 'skh_prefilter': True, 'train_coarse_percent': 0.4, 'train_pad_num_gt_min': 200}, 'fine': {'d_model': 128, 'd_ffn': 128, 'nhead': 8, 'layer_names': ['self', 'cross'], 'attention': 'linear'}}
[bundlesdf.py] Waiting for GUI
GUI started
[bundlesdf.py] Waiting for GUI
[bundlesdf.py] percentile denoise start
[bundlesdf.py] percentile denoise done
[bundlesdf.py] processNewFrame start 1668813025164826994
[bundlesdf.py] process frame 1668813025164826994
[pcl::PLYWriter::writeASCII] Input point cloud has no data!
[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud!
[pcl::PLYWriter::writeASCII] Input point cloud has no data!
Segmentation fault (core dumped)

@wenbowen123
Copy link
Collaborator

can you add some printings inside this function to locate where the abort occurs?

void Bundler::processNewFrame(std::shared_ptr<Frame> frame)

@wenbowen123
Copy link
Collaborator

And dont forget to recompile the cpp program after modification
cd ${ROOT}/BundleTrack && rm -rf build && mkdir build && cd build && cmake .. && make -j11

@AnjaKang
Copy link
Author

I turned gui off trying to make logs easier to read and I found problem may occur in my_cpp package.
After make_frame(...) function I got a my_cpp.Frame(...) object ?

Then process hanged in process_new_frame() -> frame.setNewInitCoordinate()

LOGS:
[bundlesdf.py] percentile denoise start
[bundlesdf.py] percentile denoise done
[bundlesdf.py] processNewFrame start 1668813025164826994
[bundlesdf.py] process frame 1668813025164826994
[pcl::PLYWriter::writeASCII] Input point cloud has no data!

Thanks for your help in advance :)

@wenbowen123
Copy link
Collaborator

Yes I have known it's happening from my_cpp package. That's why I suggested to add more printings there.
You said it hangs around frame.setNewInitCoordinate(). Can you add printings inside that function to locate where the hang is?

@AnjaKang
Copy link
Author

Hanging at Frame::setNewInitCoordinate()
{
...
Eigen::MatrixXf pts = mat.block(0,0,3,cloud->points.size());
Eigen::Vector3f max_xyz = pts.rowwise().maxCoeff();
}

where pts is None

@wenbowen123
Copy link
Collaborator

what is the value of cloud->points.size() and mat?
This is the first time I see this kind of issue.

@nixonhuang
Copy link

Thanks! it worked out in the end.
It turns out to be insufficient computing power(CPU or GPU), but the error is having no point cloud which makes no sense.
Next I'd to do the same thing with my own video(realsense camera), may I know how do you do that to get the required structure? especially for mask folder.

root
├──rgb/
├──depth/
├──masks/
└──cam_K.txt

Thanks

@taeyeopl
Copy link

taeyeopl commented Oct 4, 2023

In my case, it works for the 2022-11-18-15-10-24_milk demo, but when I try my own custom dataset (ex, NOCS dataset). I got the same error in frame.setNewInitCoordinate(). I still debug why it doesn't work.

Have you tried on the NOCS dataset? I made a small example for the NOCS275 dataset (https://drive.google.com/file/d/1mjg0QKGWDsbPVa4tNTseeN55OZmNaDZw/view?usp=sharing).

I also tested on the Wild6D dataset (https://drive.google.com/file/d/1d6E30n7o6NxAruu3Pq90Av77VUaNzFOE/view?usp=sharing), and it works for me.

@wenbowen123
Copy link
Collaborator

@taeyeopl was it also because of running out of memory? Can you try the same as #87 (comment) ?

@taeyeopl
Copy link

taeyeopl commented Oct 5, 2023

I'm unsure if my below code is the right position and way to check the results. I got these results.
If there is something let me know, and I will correct it and check again.

Eigen::MatrixXf mat = cloud->getMatrixXfMap(); // (D,N)
Eigen::MatrixXf pts = mat.block(0,0,3,cloud->points.size());

 Eigen::MatrixXf mat = cloud->getMatrixXfMap();  // (D,N) 
 Eigen::MatrixXf pts = mat.block(0,0,3,cloud->points.size()); 
 SPDLOG("debug cloud: {}",cloud->points.size()); # get 0
 SPDLOG("debug _cloud: {}",_cloud->points.size()); # get 307200
 SPDLOG("{}",mat); 
[pcl::PLYWriter::writeASCII] Input point cloud has no data!
[pcl::KdTreeFLANN::setInputCloud] Cannot create a KDTree with an empty input cloud!
[pcl::PLYWriter::writeASCII] Input point cloud has no data!
[2023-10-04 22:53:19.347] [warning] [Frame.cpp:168] debug cloud: 0
[2023-10-04 22:53:19.347] [warning] [Frame.cpp:169] debug _cloud: 307200
[2023-10-04 22:53:19.347] [warning] [Frame.cpp:170] 
Segmentation fault (core dumped)

@wenbowen123
Copy link
Collaborator

looks like none of the point satisfy the condition at

if (pt.z>0.1 && _fg_mask.at<uchar>(h,w)>0)

Can you confirm the mask and depth files are correctly loaded? @taeyeopl

@nixonhuang for mask folder, you can obtain the masks from tools such as SAM, XMem

@taeyeopl
Copy link

taeyeopl commented Oct 6, 2023

Thanks for your help, @wenbowen123.
As you mentioned, when I print each value((pt.z,_fg_mask.at<uchar>(h,w)), all the values are zero.
It looks like errors in my data part (depth or mask).

@tomole444
Copy link

I am currently investigating the same issue. I get it, when I try to run BundleSDF on my own dataset: https://cloud.thws.de/s/4LBfL58PTZwKRYE

@cnalty
Copy link

cnalty commented Oct 30, 2023

I'm also having the same issue. I've printed out statements on the python side inside data_reader.py and bundlesdf.py that confirm the depth image and mask values are not all 0. However, when adding cout statements to the C++ side to check the value I get every pt.z is 0, and every _fg_mask is empty.

@wenbowen123
Copy link
Collaborator

@taeyeopl @tomole444 @cnalty
did you run inside docker? Were you able to run on the example data?

@tomole444
Copy link

can you add some printings inside this function to locate where the abort occurs?

Yes. I discovered the issue in the mean time. My objects z-Coordinate was greater than 1 meter and I didn't change the default config, so all object points were farther away than the z-far config-parameter.

@cnalty
Copy link

cnalty commented Oct 31, 2023

Confirmed changing z-far fixes the issue

@monajalal
Copy link

monajalal commented Nov 7, 2023

@cnalty @tomole444 could you please tell how you changed the "z-far" for custom data?
#116

@tomole444
Copy link

You can change it at the top of the run_custom.py file

@monajalal
Copy link

monajalal commented Nov 7, 2023

@tomole444 thanks a lot I found it
cfg_bundletrack['depth_processing']["zfar"] = 1

could you please let me know to what value you change it based on your custom data and how?

my min and max values across all depth images are:
Minimum depth: 0
Maximum depth: 58392

@tomole444
Copy link

The table is approximately 1.2 m away from the camera and I know that my object is always above the table. So I set zfar to 1.3.

@monajalal
Copy link

It's interesting my object was about 10-20 cm away from camera, I set it to 0.1 and 0.2 but still keep getting the same error.

@vsevolod-misiul
Copy link

@wenbowen123 Hi, I’ve encountered the same error and created a detailed issue here: #182. If you have a moment, I’d greatly appreciate your help or any guidance you can provide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants