I’m using code from this tutorial. I have my own data. It is a very small set of images, just seven with seven masks. The masks have a black background and four AOIs each with their own shade.
When I get to these lines:
dataset = sensor_image(root = '/home/nightjar/Documents/images', transforms = get_transform(train=True))
>>> data_loader = torch.utils.data.DataLoader(
... dataset)#, batch_size=1, num_workers=2,
>>> images,targets = next(iter(data_loader))
… I get the following error
:30: DeprecationWarning: elementwise comparison failed; this will raise an error in the future.
Traceback (most recent call last):
File “”, line 1, in
File “/home/nightjar/.local/share/virtualenvs/instance_seg_training-pW2YCmb4/lib64/python3.9/site-packages/torch/utils/data/dataloader.py”, line 530, in next
data = self._next_data()
File “/home/nightjar/.local/share/virtualenvs/instance_seg_training-pW2YCmb4/lib64/python3.9/site-packages/torch/utils/data/dataloader.py”, line 570, in _next_data
data = self._dataset_fetcher.fetch(index) # may raise StopIteration
File “/home/nightjar/.local/share/virtualenvs/instance_seg_training-pW2YCmb4/lib64/python3.9/site-packages/torch/utils/data/_utils/fetch.py”, line 49, in fetch
data = [self.dataset[idx] for idx in possibly_batched_index]
File “/home/nightjar/.local/share/virtualenvs/instance_seg_training-pW2YCmb4/lib64/python3.9/site-packages/torch/utils/data/_utils/fetch.py”, line 49, in
data = [self.dataset[idx] for idx in possibly_batched_index]
File “”, line 36, in getitem
TypeError: ‘bool’ object is not subscriptable
I think the error is caused by the something to do with the masks, but I’m not sure of that, because I don’t understand everything the traceback says. But since it says “bool”, I’m guessing that is with the masks due to this comment in the code:
# split the color-encoded mask into a set
# of binary masks
That comment occurs early in the code where the class for the dataset is declared.
What can I do to resolve this error?