PKU-YuanGroup / LanguageBind

【ICLR 2024🔥】 Extending Video-Language Pretraining to N-modality by Language-based Semantic Alignment
https://arxiv.org/abs/2310.01852
MIT License
723 stars 52 forks source link

AttributeError: 'NoneType' object has no attribute 'astype' in Depth processor #68

Closed SoyeonHH closed 3 days ago

SoyeonHH commented 3 days ago

Thanks for sharing your well organized code.

I would like to try to run the training with depth data as mentioned in TRAIN_AND_VALIDATE.md. However, while processing the depth data, I encountered the following error, which is usually caused by the image resize process.

Original Traceback (most recent call last):
  File "/workspace/BIND/LanguageBind/data/base_datasets.py", line 82, in __getitem__
    matched_modality = self.get_depth(id, folder, ofa_number)
  File "/workspace/BIND/LanguageBind/data/base_datasets.py", line 181, in get_depth
    depth = load_and_transform_depth(depth_path, self.depth_transform)
  File "/workspace/BIND/LanguageBind/data/process_depth.py", line 53, in load_and_transform_depth
    depth = opencv_loader(depth_path)
  File "/workspace/BIND/LanguageBind/data/process_depth.py", line 12, in opencv_loader
    return cv2.imread(path, cv2.IMREAD_UNCHANGED).astype('float32')
AttributeError: 'NoneType' object has no attribute 'astype'

I can't identify exactly which data is causing the error, but a visual inspection shows that the depth data usually has a .png extension and the images have different sizes.

I was wondering if other researchers have encountered the same error and how they solved it.

SoyeonHH commented 3 days ago

It turned out that it was just because the file path was set incorrectly. If we organize the files according to the structure defined in TRAIN_AND_VALIDATE.md, it should work fine.