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

Problems executing Inference (a minimum of 1 is required by DBSCAN.) #15

Open
mrcabellom opened this issue Aug 2, 2023 · 2 comments
Open

Comments

@mrcabellom
Copy link

Hello! I'm using the following command to obtain inference results:

 python start_inference.py --model_name tgnet --input_dir_path ./data_obj_parent_directory --split_txt_path base_name_test_fold.txt --checkpoint_path ckpts/tgnet_fps --checkpoint_path_bdl ckpts/tgnet_bdl

but I'm getting the following error:

Processing: 0 : ./data_obj_parent_directory\013FHA7K\013FHA7K_lower.obj
Found array with 0 sample(s) (shape=(0, 3)) while a minimum of 1 is required by DBSCAN.
Traceback (most recent call last):
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\predict_utils.py", line 97, in predict
pred_result = self.chl_pipeline(scan_path)
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\inference_pipelines\inference_pipeline_tgn.py", line 46, in call
first_results = self.get_first_module_results(input_cuda_feats, self.first_module)
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\inference_pipelines\inference_pipeline_tgn.py", line 170, in get_first_module_results
output = base_model([points])
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\models\modules\grouping_network_module.py", line 65, in forward
fg_points_labels_ls = ou.get_clustering_labels(b_moved_points, whole_cls_1)
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\ops_utils.py", line 98, in get_clustering_labels
clustering = DBSCAN(eps=0.03, min_samples=30).fit(moved_points[super_point_cond, :], 3)
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\sklearn\base.py", line 1151, in wrapper
return fit_method(estimator, *args, **kwargs)
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\sklearn\cluster_dbscan.py", line 370, in fit
X = self._validate_data(X, accept_sparse="csr")
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\sklearn\base.py", line 604, in _validate_data
out = check_array(X, input_name="X", **check_params)
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\sklearn\utils\validation.py", line 969, in check_array
raise ValueError(
ValueError: Found array with 0 sample(s) (shape=(0, 3)) while a minimum of 1 is required by DBSCAN.

Traceback (most recent call last):
File "start_inference.py", line 39, in
pred_obj.process(stl_path_ls[i], os.path.join(args.save_path, os.path.basename(stl_path_ls[i]).replace(".obj", ".json")))
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\predict_utils.py", line 136, in process
labels, instances, jaw = self.predict([input_path])
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\predict_utils.py", line 97, in predict
pred_result = self.chl_pipeline(scan_path)
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\inference_pipelines\inference_pipeline_tgn.py", line 46, in call
first_results = self.get_first_module_results(input_cuda_feats, self.first_module)
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\inference_pipelines\inference_pipeline_tgn.py", line 170, in get_first_module_results
output = base_model([points])
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\torch\nn\modules\module.py", line 1194, in _call_impl
return forward_call(*input, **kwargs)
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\models\modules\grouping_network_module.py", line 65, in forward
fg_points_labels_ls = ou.get_clustering_labels(b_moved_points, whole_cls_1)
File "C:\Users\mrcabello\Documents\Research\code\ToothGroupNetwork\ops_utils.py", line 98, in get_clustering_labels
clustering = DBSCAN(eps=0.03, min_samples=30).fit(moved_points[super_point_cond, :], 3)
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\sklearn\base.py", line 1151, in wrapper
return fit_method(estimator, *args, **kwargs)
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\sklearn\cluster_dbscan.py", line 370, in fit
X = self._validate_data(X, accept_sparse="csr")
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\sklearn\base.py", line 604, in _validate_data
out = check_array(X, input_name="X", **check_params)
File "C:\Users\mrcabello\Miniconda3\envs\tooth_seg\lib\site-packages\sklearn\utils\validation.py", line 969, in check_array
raise ValueError(
ValueError: Found array with 0 sample(s) (shape=(0, 3)) while a minimum of 1 is required by DBSCAN

I have followed all the steps but may be I'm missing something. Anyone could help me?

@limhoyeon
Copy link
Owner

limhoyeon commented Aug 11, 2023

Can you visualize the sampled points(preprocessed .npy files)?

@Frq-F
Copy link

Frq-F commented Apr 28, 2024

Hello ,I meet this problem too. when I try to run preprocess_data.py to check the sampled points

(torch1.10) E:\ToothGroupNetwork-main>python E:\ToothGroupNetwork-main\ToothGroupNetwork-main\preprocess_data.py
0 E:\ToothGroupNetwork-main\test_results\data\116429353_shell_teethup_l.stl
Traceback (most recent call last):
File "E:\ToothGroupNetwork-main\ToothGroupNetwork-main\preprocess_data.py", line 46, in
vertices, org_mesh = gu.read_txt_obj_ls(stl_path_ls[i], ret_mesh=True, use_tri_mesh=False)
File "E:\ToothGroupNetwork-main\ToothGroupNetwork-main\gen_utils.py", line 213, in read_txt_obj_ls
line = f.readline().split()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xff in position 80: illegal multibyte sequence
And I modify the code
vertices, org_mesh = gu.read_txt_obj_ls(stl_path_ls[i], ret_mesh=True, use_tri_mesh=True)
.......
if vertices.shape[0]>24000:
vertices = gu.resample_pcd([vertices], 24000, "fps")[0]

    pcd = o3d.geometry.PointCloud()
    pcd.points = o3d.utility.Vector3dVector(vertices[:,:3])
    
    pcd.paint_uniform_color([0, 0, 1.0])
    o3d.visualization.draw_geometries([pcd])

But there is no pointcloud has been shown. How can I solve this problem

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

3 participants