Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IndexError: index out of range in self #13

Closed
MalekSamet opened this issue Jun 23, 2024 · 1 comment
Closed

IndexError: index out of range in self #13

MalekSamet opened this issue Jun 23, 2024 · 1 comment

Comments

@MalekSamet
Copy link

/ALDM/cldm_seg/util.py", line 41, in forward
seg_emb = torch.index_select(self.class_embeddings, 0, seg_map_.cpu())
IndexError: index out of range in self

I am using the structure of cityscapes.py for my new dataset, where I am using self.lb_map = {el['id']: el['trainId'] for el in labels_info}
I created a json file "newdataset_info.json" where I packed :
{
"name": "terrain",
"ignoreInEval": false,
"id": 30,
"color": [
112,
9,
255
],
"trainId": 30
}
for each class. Note that I put all my classes and I am not ignoring any of them (No trainId = 255).
When I run the code, I receive this error (See above).
However, I tried to add 3 fictive classes to the json file, named them randomly but put their trainId as 255, it worked. I dont understand what is the problem here? And I don't know if the way it made the program compile is true and does not affect the training?

@YumengLi007
Copy link
Member

you probably need to check the __get_item__ function in the dataloader. For instance, you maybe don't need

def label_encode_id(self,label):
if there is no trainID=255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants