princeton-vl / CornerNet

BSD 3-Clause "New" or "Revised" License
2.36k stars 475 forks source link

when i train my data, the category count is not 80 as coco, which code should i modify? #45

Open xiaoxiongli opened 6 years ago

xiaoxiongli commented 6 years ago

Dear all:

when i train my data, the category count is not 80 as coco, which code should i modify?

i find three part of code using "80" : 1) models/CornerNet.py: line 72 class model(kp): def init(self, db): n = 5 dims = [256, 256, 384, 384, 384, 512] modules = [2, 2, 2, 2, 2, 4] out_dim = 80 <---------------------- here need change to my category count???

2) db/detection.py: line 8
self._configs["categories"] = 80 <---------------------- here need change to my category count???

3) config/CornerNet.json: line 45
"categories": 80 <---------------------- here need change to my category count???

@heilaw Does all of these 3 place need to be change? and any other place need change?

zhaowujie commented 5 years ago

Did you change db/coco.py line 48
self._cat_ids = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90 ] self._classes = { ind + 1: cat_id for ind, cat_id in enumerate(self._cat_ids) } to your number of categories @xiaoxiongli

zhaowujie commented 5 years ago

why there are 90 classes?

xiaoxiongli commented 5 years ago

@zhaowujie 重新数一下

jason-su commented 5 years ago

why don't you use continuous interval, e.g. 1-80?

nassarofficial commented 5 years ago

Did you change db/coco.py line 48 self._cat_ids = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 27, 28, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 67, 70, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 89, 90 ] self._classes = { ind + 1: cat_id for ind, cat_id in enumerate(self._cat_ids) } to your number of categories @xiaoxiongli

Did you have any luck? I am having trouble during evaluation with this line:

            category       = self._coco_to_class_map[cat_id]

in the db/coco.py I have only 1 class, and its giving me a "key error 0"

cainiaojy commented 5 years ago

@xiaoxiongli @tianzhi0549 when the category count is not 80 as coco,the loss Fall quickly. At last, the loss is very very low , like this training loss at iteration 27230: 7.612511581100989e-07
training loss at iteration 27235: 1.9973826965724584e-06
training loss at iteration 27240: 6.293149453995284e-06
training loss at iteration 27245: 9.290890261581808e-07
training loss at iteration 27250: 7.603926519550441e-07
training loss at iteration 27255: 8.633248853584519e-07
training loss at iteration 27260: 7.514188951063261e-07
training loss at iteration 27265: 8.675733624841087e-07
training loss at iteration 27270: 1.0097636504724505e-06
training loss at iteration 27275: 8.036624308260798e-07
training loss at iteration 27280: 8.953446695159073e-07
training loss at iteration 27285: 7.899022875790251e-07
training loss at iteration 27290: 4.14156420447398e-06
training loss at iteration 27295: 1.6851539612616762e-06
training loss at iteration 27300: 7.977693030625232e-07
validation loss at iteration 27300: 1.594285890860192e-06
training loss at iteration 27305: 2.5046172140719136e-06
training loss at iteration 27310: 7.887338142609224e-07
training loss at iteration 27315: 9.830607723415596e-07
training loss at iteration 27320: 7.96585936768679e-07
training loss at iteration 27325: 7.648009727745375e-07
training loss at iteration 27330: 1.6255791024377686e-06
training loss at iteration 27335: 7.160156201280188e-07
training loss at iteration 27340: 1.0358436384194647e-06
training loss at iteration 27345: 7.546686333625985e-07
training loss at iteration 27350: 9.059414196599391e-07
training loss at iteration 27355: 7.671519597352017e-07
5%|#5 | 27357/500000 [17:14:46<348:08:50, 2.65s/it]shuffling indices... training loss at iteration 27360: 2.279482941958122e-06
5%|#5 | 27363/500000 [17:14:59<296:37:52, 2.26s/it]shuffling indices... training loss at iteration 27365: 2.0431405118870316e-06
training loss at iteration 27370: 1.0739236131485086e-06
training loss at iteration 27375: 9.094511597140809e-07
training loss at iteration 27380: 8.221845178013609e-07
training loss at iteration 27385: 8.983377028926043e-07
training loss at iteration 27390: 2.3142054033087334e-06
training loss at iteration 27395: 2.802274821078754e-06
training loss at iteration 27400: 9.592042715667048e-07
validation loss at iteration 27400: 7.173352400968724e-07
5%|#5 | 27403/500000 [17:16:38<306:36:56, 2.34s/it]shuffling indices... training loss at iteration 27405: 1.3337682958081132e-06
training loss at iteration 27410: 1.046495299306116e-06
training loss at iteration 27415: 9.256709745386615e-07
training loss at iteration 27420: 9.490519232713268e-07
training loss at iteration 27425: 8.912809335015481e-07
training loss at iteration 27430: 1.081516074918909e-06
training loss at iteration 27435: 7.116623237379827e-07
5%|#5 | 27437/500000 [17:18:04<349:13:25, 2.66s/it]shuffling indices... training loss at iteration 27440: 7.564152042505157e-07
training loss at iteration 27445: 9.4166585995481e-07
training loss at iteration 27450: 4.15429667555145e-06
training loss at iteration 27455: 1.51546009874437e-06
training loss at iteration 27460: 8.638742201583227e-07
training loss at iteration 27465: 1.4471661415882409e-06

do you Encounter this problem?

nassarofficial commented 5 years ago

yes, this happens to me, also the accuracy is less than 1 percent. I don't know what is the problem yet.

NightNightNight commented 5 years ago

@nassarofficial how to solve KeyError: 0?

nassarofficial commented 5 years ago

Make sure your labels for your dataset is appropriately labeled. This error basically means you dont have any labeled instances with "0" in your dataset!

cainiaojy commented 5 years ago

@nassarofficial Did you solve this problem?

nassarofficial commented 5 years ago

@cainiaojy no, unfortunately, I am still trying..

dl19940602 commented 5 years ago

Could you tell me which codes need to be changed when I have only one class? Thank you.