zzzxxxttt / pytorch_simple_CenterNet_45

A simple pytorch implementation of CenterNet (Objects as Points)
308 stars 63 forks source link

AttributeError: 'list' object has no attribute 'to' #20

Closed JiaLim98 closed 4 years ago

JiaLim98 commented 4 years ago

Hi @zzzxxxttt,

Thank you for your interesting work.

I followed everything about setting up this repo. However, when I start to train, it gives me this error. Do you know what's wrong? image Hope to hear from you soon.

Regards, JiaLim98

zzzxxxttt commented 4 years ago

I saw you were training on a custom dataset, what's the modification you made in the dataloader?

JiaLim98 commented 4 years ago

I changed: line#15 --> COCO_NAMES = 6 classes of my dataset line#29 --> COCO_IDS = [0, 1, 2, 3, 4, 5] line#49 --> self.num_classes = 6

That's all the changes I made to coco.py.

zzzxxxttt commented 4 years ago

I guess the data format of your dataset is not the same with COCO, you could train on COCO to see whether the error still occurs.

JiaLim98 commented 4 years ago

I noticed one thing is that the COCO_NAMES should have ['background'] infront. Mine doesn't. Let me try to modify my annotation files (7 classes total and IDS from 0 to 7) and see if the problem persists. Thank you.

JiaLim98 commented 4 years ago

The issue has been solved after adding 'background' and having Ids from 1 to 7. Now I am facing this issue image I am using the default image size of 512 so it shouldn't be an issue mentioned in #19, right? I suggest it's the number of classes? This is because COCO has 80 and I'm having 7. Please advice. Thank you.

zzzxxxttt commented 4 years ago

Oh, the hourglass model is created with default num_classes=80, you need to change the num_classes in hourglass.py line #106. def __init__(self, n, nstack, dims, modules, cnv_dim=256, num_classes=80):

JiaLim98 commented 4 years ago

@zzzxxxttt It is working fine now. Thank you so much!