WongKinYiu / yolor

implementation of paper - You Only Learn One Representation: Unified Network for Multiple Tasks (https://arxiv.org/abs/2105.04206)
GNU General Public License v3.0
1.99k stars 518 forks source link

Maximum number of classes that can be trained? #103

Closed hiteshhedwig closed 2 years ago

hiteshhedwig commented 3 years ago

What is the maximum number of classes that can be trained with YOLOR? if i have imagenet object localisation 1000 classes dataset. Would it be able to train those ?

WongKinYiu commented 3 years ago

i think you could use any number of classes, in my own case 6xx classes is ok.

hiteshhedwig commented 3 years ago

Thanks! and in that case, do i need to change yolo_p6.cfg file?

WongKinYiu commented 3 years ago

https://github.com/WongKinYiu/yolor/blob/main/cfg/yolor_p6.cfg#L1569 https://github.com/WongKinYiu/yolor/blob/main/cfg/yolor_p6.cfg#L1573 https://github.com/WongKinYiu/yolor/blob/main/cfg/yolor_p6.cfg#L1577 https://github.com/WongKinYiu/yolor/blob/main/cfg/yolor_p6.cfg#L1581 https://github.com/WongKinYiu/yolor/blob/main/cfg/yolor_p6.cfg#L1605 https://github.com/WongKinYiu/yolor/blob/main/cfg/yolor_p6.cfg#L1649 https://github.com/WongKinYiu/yolor/blob/main/cfg/yolor_p6.cfg#L1693 https://github.com/WongKinYiu/yolor/blob/main/cfg/yolor_p6.cfg#L1737

change these lines to anchor * (5 + classes), default is 3 * (5 + 80) = 255. and also check classes and anchor in all yolo layers.

hiteshhedwig commented 3 years ago

Thanks!

plaksivayatryapka commented 2 years ago

so for one class we should replace filters=255 with filters=18 in the lines mentioned above? 18 is because 3*(5+1)

st4rck19981 commented 2 years ago

And about the anchors that have to be modified for only one class? anchors = 19,27, 44,40, 38,94, 96,68, 86,152, 180,137, 140,301, 303,264, 238,542, 436,615, 739,380, 925,792

phelps-matthew commented 2 years ago

change these lines to anchor (5 + classes), default is 3 (5 + 80) = 255. and also check classes and anchor in all yolo layers.

Yes, you must also change to classes=1 found in three places in yolor_p6.cfg (assuming you have a single class). Do you have any guidance on the anchors ?