HRNet / HRNet-Semantic-Segmentation

The OCR approach is rephrased as Segmentation Transformer: https://arxiv.org/abs/1909.11065. This is an official implementation of semantic segmentation for HRNet. https://arxiv.org/abs/1908.07919
Other
3.13k stars 686 forks source link

AttributeError: 'PASCALContext' object has no attribute '_key' #196

Open hw2hwei opened 3 years ago

hw2hwei commented 3 years ago

AttributeError: 'PASCALContext' object has no attribute '_key' Traceback (most recent call last): File "tools/train.py", line 286, in main() File "tools/train.py", line 115, in main scale_factor=config.TRAIN.SCALE_FACTOR) File "/home/huangwei/Codes/HRNet-Semantic-Segmentation-pytorch-v1.1/tools/../lib/datasets/pascal_ctx.py", line 76, in init self.masks = self._preprocess(mask_file) File "/home/huangwei/Codes/HRNet-Semantic-Segmentation-pytorch-v1.1/tools/../lib/datasets/pascal_ctx.py", line 93, in _preprocess self.detail.getMask(img_id))) File "/home/huangwei/Codes/HRNet-Semantic-Segmentation-pytorch-v1.1/tools/../lib/datasets/pascal_ctx.py", line 84, in _class_to_index return self._key[index].reshape(mask.shape)

what's the "_key"?

ZHU-Zhiyu commented 3 years ago

Hello, do you solve the problem? I meet the same issue now.

ZHU-Zhiyu commented 3 years ago

Hello, do you solve the problem? I meet the same issue now. self._key = np.array(range(len(self._mapping))).astype('uint8') add this line after the definition of self._mapping in pascal_ctx.py https://github.com/HRNet/HRNet-Semantic-Segmentation/blob/8037a7fb867b58d885b26b1ceb8283a7ee252851/lib/datasets/pascal_ctx.py#L71

hw2hwei commented 3 years ago

I solved this problem by updating the Pytorch version.

Margrate commented 3 years ago

I solved this problem by updating the Pytorch version.

Can you get the results mIoU(59 classes)=54.0% and mIoU(60 classes)=48.3%? I got a big performance gap.