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

python test.py CenterNet-104 --testiter 20000 --split testing --debug #44

Closed
wudi00 opened this issue May 29, 2019 · 11 comments
Closed

Comments

@wudi00
Copy link

wudi00 commented May 29, 2019

When I use test.py, there is such error Traceback (most recent call last): File "test.py", line 100, in <module> test(testing_db, args.split, args.testiter, args.debug, args.suffix) File "test.py", line 62, in test testing(db, nnet, result_dir, debug=debug) File "/media/disk/wudi/CenterNet/test/coco.py", line 321, in testing return globals()[system_configs.sampling_function](db, nnet, result_dir, deb File "/media/disk/wudi/CenterNet/test/coco.py", line 290, in kp_detection cat_name = db.class_name(j) File "/media/disk/wudi/CenterNet/db/coco.py", line 106, in class_name cat = self._coco.loadCats([cat_id])[0] File "data/coco/PythonAPI/pycocotools/coco.py", line 218, in loadCats return [self.cats[id] for id in ids] File "data/coco/PythonAPI/pycocotools/coco.py", line 218, in <listcomp> return [self.cats[id] for id in ids] KeyError: 34
I have modified the class id, why occur this error? How to solve it? Thanks.

@Duankaiwen
Copy link
Owner

@wudi00 You need to modify the self._cat_ids in line 48 in db/coco.py

@wudi00
Copy link
Author

wudi00 commented May 30, 2019

@wudi00 I have modefied it, detection.py and sample/coco.py also be changed.But the question still remains. It can train the model, but can't test and validte.

@Duankaiwen
Copy link
Owner

@wudi00 How do you make your own json file? Does the written dict contain the key "categories"?

@wudi00
Copy link
Author

wudi00 commented May 30, 2019

@Duankaiwen I modified the CenterNet-104.json to apply it to my data."categories": 49, is my classes number. Is it right?

@Duankaiwen
Copy link
Owner

categories should be like this:
"categories": [{"supercategory": "person", "id": 1, "name": "person"}, {"supercategory": "vehicle", "id": 2, "name": "bicycle"}, {"supercategory": "vehicle", "id": 3, "name": "car"}, {"supercategory": "vehicle", "id": 4, "name": "motorcycle"}, {"supercategory": "vehicle", "id": 5, "name": "airplane"}, {"supercategory": "vehicle", "id": 6, "name": "bus"}, {"supercategory": "vehicle", "id": 7, "name": "train"}, {"supercategory": "vehicle", "id": 8, "name": "truck"}, {"supercategory": "vehicle", "id": 9, "name": "boat"}, {"supercategory": "outdoor", "id": 10, "name": "traffic light"}, {"supercategory": "outdoor", "id": 11, "name": "fire hydrant"}, {"supercategory": "outdoor", "id": 13, "name": "stop sign"}, {"supercategory": "outdoor", "id": 14, "name": "parking meter"}, {"supercategory": "outdoor", "id": 15, "name": "bench"}, {"supercategory": "animal", "id": 16, "name": "bird"}, {"supercategory": "animal", "id": 17, "name": "cat"}, {"supercategory": "animal", "id": 18, "name": "dog"}, {"supercategory": "animal", "id": 19, "name": "horse"}, {"supercategory": "animal", "id": 20, "name": "sheep"}, {"supercategory": "animal", "id": 21, "name": "cow"}, {"supercategory": "animal", "id": 22, "name": "elephant"}, {"supercategory": "animal", "id": 23, "name": "bear"}, {"supercategory": "animal", "id": 24, "name": "zebra"}, {"supercategory": "animal", "id": 25, "name": "giraffe"}, {"supercategory": "accessory", "id": 27, "name": "backpack"}, {"supercategory": "accessory", "id": 28, "name": "umbrella"}, {"supercategory": "accessory", "id": 31, "name": "handbag"}, {"supercategory": "accessory", "id": 32, "name": "tie"}, {"supercategory": "accessory", "id": 33, "name": "suitcase"}, {"supercategory": "sports", "id": 34, "name": "frisbee"}, {"supercategory": "sports", "id": 35, "name": "skis"}, {"supercategory": "sports", "id": 36, "name": "snowboard"}, {"supercategory": "sports", "id": 37, "name": "sports ball"}, {"supercategory": "sports", "id": 38, "name": "kite"}, {"supercategory": "sports", "id": 39, "name": "baseball bat"}, {"supercategory": "sports", "id": 40, "name": "baseball glove"}, {"supercategory": "sports", "id": 41, "name": "skateboard"}, {"supercategory": "sports", "id": 42, "name": "surfboard"}, {"supercategory": "sports", "id": 43, "name": "tennis racket"}, {"supercategory": "kitchen", "id": 44, "name": "bottle"}, {"supercategory": "kitchen", "id": 46, "name": "wine glass"}, {"supercategory": "kitchen", "id": 47, "name": "cup"}, {"supercategory": "kitchen", "id": 48, "name": "fork"}, {"supercategory": "kitchen", "id": 49, "name": "knife"}, {"supercategory": "kitchen", "id": 50, "name": "spoon"}, {"supercategory": "kitchen", "id": 51, "name": "bowl"}, {"supercategory": "food", "id": 52, "name": "banana"}, {"supercategory": "food", "id": 53, "name": "apple"}, {"supercategory": "food", "id": 54, "name": "sandwich"}, {"supercategory": "food", "id": 55, "name": "orange"}, {"supercategory": "food", "id": 56, "name": "broccoli"}, {"supercategory": "food", "id": 57, "name": "carrot"}, {"supercategory": "food", "id": 58, "name": "hot dog"}, {"supercategory": "food", "id": 59, "name": "pizza"}, {"supercategory": "food", "id": 60, "name": "donut"}, {"supercategory": "food", "id": 61, "name": "cake"}, {"supercategory": "furniture", "id": 62, "name": "chair"}, {"supercategory": "furniture", "id": 63, "name": "couch"}, {"supercategory": "furniture", "id": 64, "name": "potted plant"}, {"supercategory": "furniture", "id": 65, "name": "bed"}, {"supercategory": "furniture", "id": 67, "name": "dining table"}, {"supercategory": "furniture", "id": 70, "name": "toilet"}, {"supercategory": "electronic", "id": 72, "name": "tv"}, {"supercategory": "electronic", "id": 73, "name": "laptop"}, {"supercategory": "electronic", "id": 74, "name": "mouse"}, {"supercategory": "electronic", "id": 75, "name": "remote"}, {"supercategory": "electronic", "id": 76, "name": "keyboard"}, {"supercategory": "electronic", "id": 77, "name": "cell phone"}, {"supercategory": "appliance", "id": 78, "name": "microwave"}, {"supercategory": "appliance", "id": 79, "name": "oven"}, {"supercategory": "appliance", "id": 80, "name": "toaster"}, {"supercategory": "appliance", "id": 81, "name": "sink"}, {"supercategory": "appliance", "id": 82, "name": "refrigerator"}, {"supercategory": "indoor", "id": 84, "name": "book"}, {"supercategory": "indoor", "id": 85, "name": "clock"}, {"supercategory": "indoor", "id": 86, "name": "vase"}, {"supercategory": "indoor", "id": 87, "name": "scissors"}, {"supercategory": "indoor", "id": 88, "name": "teddy bear"}, {"supercategory": "indoor", "id": 89, "name": "hair drier"}, {"supercategory": "indoor", "id": 90, "name": "toothbrush"}]}

@wudi00
Copy link
Author

wudi00 commented May 30, 2019

Yes, I generate the json file according to my dataset.

@Duankaiwen
Copy link
Owner

can I see your josn file? just for "categories" part

@wudi00
Copy link
Author

wudi00 commented May 30, 2019

"categories": [{"supercategory": "none", "id": 0, "name": "android.widget.ImageView"}, {"supercategory": "none", "id": 1, "name": "android.widget.TextView"}, {"supercategory": "none", "id": 2, "name": "android.widget.ImageButton"}, {"supercategory": "none", "id": 3, "name": "android.view.View"}, {"supercategory": "none", "id": 4, "name": "android.widget.RelativeLayout"}, {"supercategory": "none", "id": 5, "name": "android.widget.LinearLayout"}, {"supercategory": "none", "id": 6, "name": "android.widget.FrameLayout"}, {"supercategory": "none", "id": 7, "name": "android.widget.EditText"}, {"supercategory": "none", "id": 8, "name": "android.widget.Button"}, {"supercategory": "none", "id": 9, "name": "android.widget.Image"}, {"supercategory": "none", "id": 10, "name": "android.widget.SeekBar"}, {"supercategory": "none", "id": 11, "name": "android.widget.Spinner"}, {"supercategory": "none", "id": 12, "name": "android.widget.ToggleButton"}, {"supercategory": "none", "id": 13, "name": "android.widget.ProgressBar"}, {"supercategory": "none", "id": 14, "name": "android.webkit.WebView"}, {"supercategory": "none", "id": 15, "name": "android.widget.ListView"}, {"supercategory": "none", "id": 16, "name": "android.widget.CheckedTextView"}, {"supercategory": "none", "id": 17, "name": "android.widget.Switch"}, {"supercategory": "none", "id": 18, "name": "android.widget.CheckBox"}, {"supercategory": "none", "id": 19, "name": "android.support.v7.app.ActionBar$Tab"}, {"supercategory": "none", "id": 20, "name": "android.support.v7.widget.RecyclerView"}, {"supercategory": "none", "id": 21, "name": "android.widget.RadioButton"}, {"supercategory": "none", "id": 22, "name": "com.fitness22.usermanager.model.Views.MutedVideoView"}, {"supercategory": "none", "id": 23, "name": "android.widget.MultiAutoCompleteTextView"}, {"supercategory": "none", "id": 24, "name": "android.widget.GridView"}, {"supercategory": "none", "id": 25, "name": "android.widget.RatingBar"}, {"supercategory": "none", "id": 26, "name": "android.widget.ScrollView"}, {"supercategory": "none", "id": 27, "name": "android.widget.VideoView"}, {"supercategory": "none", "id": 28, "name": "com.jotterpad.widget.jbmr2_kk.EditText"}, {"supercategory": "none", "id": 29, "name": "android.support.v4.view.ViewPager"}, {"supercategory": "none", "id": 30, "name": "android.widget.ViewSwitcher"}, {"supercategory": "none", "id": 31, "name": "android.widget.HorizontalScrollView"}, {"supercategory": "none", "id": 32, "name": "io.apptik.widget.MultiSlider$Thumb"}, {"supercategory": "none", "id": 33, "name": "com.zhiliaoapp.musically.activity.util.TextureVideoView"}]}
The total number of categories is 49, But there are only 33 categories in the generated text.json file so that's where the error comes in?

@Duankaiwen
Copy link
Owner

There are 33 categories, why the "categories": 49 is your classes number?

@wudi00
Copy link
Author

wudi00 commented May 30, 2019

I know what's wrong.There are only 33 json file categories generated with the test set, but 49 for all categories.Thanks.

@wudi00 wudi00 closed this as completed May 30, 2019
@NightNightNight
Copy link

@wudi00 the categories start with 0? And you have 34 categories. I have a problem in test.
WX20190530-144919

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

3 participants