minghanqin/LangSplat

TypeError: 'list_iterator' object is not callable

Opened this issue · 0 comments

Thank you very much for the author's code. I successfully ran the dataset you provided,

but encountered this error during my attempt to train my own data. It seems to be in the automatic_mask_generator.py file in the segment_anything library, with the error message

TypeError: 'list_iterator' object is not callable.
This error occurs when attempting to call a list_iterator object, typically indicating that the code is attempting to call an iterator as a function

I tried reinstalling segment-anything-langsplat and going directly to https://github.com/facebookresearch/segment-anything.git Install segment anything langsplat, but both encounter the same issue

My environment configuration is python=3.9 CUDA 11.8 wsl Ubuntu 20.04 on 4090
pytorch==2.0.0 torchvision==0.15.0 torchaudio==2.0.0 pytorch-cuda=11.8 -c pytorch -c nvidia

What I specifically did was this step:
Step 1: Generate Language Feature of the Scenes. Put the image data into the "input" directory under the <dataset_name>/, then run the following code.
“python preprocess.py --dataset_path $dataset_path ”

(langsplat) new@PC-Xu:/mnt/e/lyz/LangSplat$ python preprocess.py --dataset_path data/241117-D
/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/torch/nn/modules/activation.py:1144: UserWarning: Converting mask without torch.bool dtype to bool; this will negatively affect performance. Prefer to use a boolean mask directly. (Triggered internally at /opt/conda/conda-bld/pytorch_16784/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/torch/nn/modules/activation.py:1144: UserWarning: Converting mask without torch.bool dtype to bool; this will negatively affect performance. Prefer to use a boolean mask directly. (Triggered internally at /opt/conda/conda-bld/pytorch_1678402412426/work/aten/src/ATen/native/transformers/attention.cpp:150.)
return torch._native_multi_head_attention(
02412426/work/aten/src/ATen/native/transformers/attention.cpp:150.)
return torch._native_multi_head_attention(
[ INFO ] Encountered quite large input images (>1080P), rescaling to 1080P.
If this is not desired, please explicitly specify '--resolution/-r' as 1
[ INFO ] Encountered quite large input images (>1080P), rescaling to 1080P.
If this is not desired, please explicitly specify '--resolution/-r' as 1
Traceback (most recent call last):
File "/mnt/e/lyz/LangSplat/preprocess.py", line 129, in create
img_embed, seg_map = _embed_clip_sam_tiles(img.unsqueeze(0), sam_encoder)
Traceback (most recent call last):
File "/mnt/e/lyz/LangSplat/preprocess.py", line 129, in create
img_embed, seg_map = _embed_clip_sam_tiles(img.unsqueeze(0), sam_encoder)
File "/mnt/e/lyz/LangSplat/preprocess.py", line 181, in _embed_clip_sam_tiles
seg_images, seg_map = sam_encoder(aug_imgs)
File "/mnt/e/lyz/LangSplat/preprocess.py", line 181, in _embed_clip_sam_tiles
seg_images, seg_map = sam_encoder(aug_imgs)
File "/mnt/e/lyz/LangSplat/preprocess.py", line 302, in sam_encoder
masks_default, masks_s, masks_m, masks_l = mask_generator.generate(image)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
File "/mnt/e/lyz/LangSplat/preprocess.py", line 302, in sam_encoder
masks_default, masks_s, masks_m, masks_l = mask_generator.generate(image)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/torch/utils/_contextlib.py", line 115, in decorate_context
return func(*args, **kwargs)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/segment_anything/automatic_mask_generator.py", line 163, in generate
return func(*args, **kwargs)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/segment_anything/automatic_mask_generator.py", line 163, in generate
mask_data, mask_data_s, mask_data_m, mask_data_l = self._generate_masks(image)
mask_data, mask_data_s, mask_data_m, mask_data_l = self._generate_masks(image)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/segment_anything/automatic_mask_generator.py", line 220, in _generate_masks
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/segment_anything/automatic_mask_generator.py", line 220, in _generate_masks
crop_data, crop_data_s, crop_data_m, crop_data_l = self._process_crop(image, crop_box, layer_idx, orig_size)
crop_data, crop_data_s, crop_data_m, crop_data_l = self._process_crop(image, crop_box, layer_idx, orig_size)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/segment_anything/automatic_mask_generator.py", line 279, in _process_crop
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/segment_anything/automatic_mask_generator.py", line 279, in _process_crop
data_m.cat(batch_data_m)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/site-packages/segment_anything/utils/amg.py", line 68, in cat
self._stats[k] = self._stats[k] + deepcopy(v)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/copy.py", line 205, in _deepcopy_list
append(deepcopy(a, memo))
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/copy.py", line 230, in _deepcopy_dict
y[deepcopy(key, memo)] = deepcopy(value, memo)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/copy.py", line 146, in deepcopy
y = copier(x, memo)
File "/home/new/anaconda3/envs/langsplat/lib/python3.9/copy.py", line 205, in _deepcopy_list
append(deepcopy(a, memo))
TypeError: 'list_iterator' object is not callable

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/mnt/e/lyz/LangSplat/preprocess.py", line 409, in
create(imgs, data_list, save_folder)
File "/mnt/e/lyz/LangSplat/preprocess.py", line 131, in create
raise ValueError(timer)
ValueError: 1