Trace3D icon indicating copy to clipboard operation
Trace3D copied to clipboard

TypeError: can't convert np.ndarray of type numpy.object_.

Open llbll opened this issue 1 year ago • 8 comments

Has anyone successfully verified the eval script? I was able to execute everything correctly up until the training, but eval always shows the label variable as None. I'm using the official dataset.

Image

llbll avatar Sep 22 '25 10:09 llbll

I'm also encountering the same issue.

OldParr0t avatar Sep 25 '25 10:09 OldParr0t

是数据集读取路径问题,如果你也是replica数据集。去read_semantic_replica把gt_seg_path= os.path.join(input_folder , "semantic_instance",f"semantic_instance_{idx}.png") 改的和data/replica_900/room_0/semantic_****一致,按照给的链接下下来是以class结尾。

OldParr0t avatar Sep 29 '25 09:09 OldParr0t

Thanks for pointing this out!

The dataset link I provided actually includes the semantic_instance masks, but they are packaged in a separate zip file.
The file is named:

Replica_Instance_Segmentation.zip

Inside this zip, you will find the semantic_instance folder. Please extract this folder and place it into each corresponding scene directory (e.g., office_0/semantic_instance, room_0/semantic_instance, etc.).

Without this step, the code will fall back to loading semantic_class masks, which are semantic-level masks (all objects of the same class share a single mask), leading to incorrect GT masks and lower evaluation metrics.

I will update the README to clarify this and avoid future confusion.
Thanks again for raising the issue!

shy2000 avatar Nov 19 '25 08:11 shy2000

However, the semantic_instance_i.png files in the extracted office_0/semantic_instance folder do not contain valid information, as all pixel values are 0. The vis_sem_class_i.png files appear to be correct, but they cannot be directly used as ground truth masks.

shysensai avatar Nov 25 '25 13:11 shysensai

However, the semantic_instance_i.png files in the extracted office_0/semantic_instance folder do not contain valid information, as all pixel values are 0. The vis_sem_class_i.png files appear to be correct, but they cannot be directly used as ground truth masks.

The semantic_instance_i.png files actually do contain valid instance IDs, but you must load them without OpenCV’s default color conversion. Please read the mask using:

mask = cv2.imread("semantic_instance_i.png", cv2.IMREAD_UNCHANGED)

Using IMREAD_COLOR (default) will convert the mask to 3-channel BGR and destroy the original instance IDs, causing all values to appear as 0.

shy2000 avatar Nov 27 '25 04:11 shy2000

After applying the changes suggested earlier regarding the Replica semantic mask paths, I’ve run into the following error during evaluation:

pred = get_pred(sams[i].cuda(), querys, ths) File "...", line 68, in get_pred similar_pos = torch.cdist(features_flat, querys) File "...", line 1336, in cdist return _VF.cdist(x1, x2, p, None) TypeError: cdist(): argument 'x2' (position 2) must be Tensor, not NoneType

Can you please explain why querys are coming as None in this codebase?

sohcahtoae avatar Dec 02 '25 06:12 sohcahtoae

After applying the changes suggested earlier regarding the Replica semantic mask paths, I’ve run into the following error during evaluation:

pred = get_pred(sams[i].cuda(), querys, ths) File "...", line 68, in get_pred similar_pos = torch.cdist(features_flat, querys) File "...", line 1336, in cdist return _VF.cdist(x1, x2, p, None) TypeError: cdist(): argument 'x2' (position 2) must be Tensor, not NoneType

Can you please explain why querys are coming as None in this codebase?

I meet this issue too

leviome avatar Jan 24 '26 17:01 leviome

After applying the changes suggested earlier regarding the Replica semantic mask paths, I’ve run into the following error during evaluation: pred = get_pred(sams[i].cuda(), querys, ths) File "...", line 68, in get_pred similar_pos = torch.cdist(features_flat, querys) File "...", line 1336, in cdist return _VF.cdist(x1, x2, p, None) TypeError: cdist(): argument 'x2' (position 2) must be Tensor, not NoneType Can you please explain why querys are coming as None in this codebase?

I meet this issue too

Could you provide more details? Which object in which scene, or all of them? If possible, please check reference mask: overlay the ground truth mask gt[ref_view] onto the image to confirm that the reference mask is correct.

shy2000 avatar Jan 26 '26 11:01 shy2000