question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Text Report Misses Last Class

See original GitHub issue

This is a minor issue, but the text report that DetVisGUI.py produces during initialization misses the last class in the list. For example when I run DetVisGUI.py on my custom dataset that has 3 object classes (as shown by “Total Category”) I get:

==============[ COCO json info ]==============
Total Annotations: 216
Total Image      : 172
Annotated Image  : 172
Total Category   : 3
----------------------------
       class        | count
----------------------------
       human        | 86
      vehicle       | 130

That result is missing the animal class in my case. The source of the error is within the parse_jason function, line 112 of DetVisGUI.py in the mmDetection branch: 112 category_count = [0 for _ in range(max_category_id)] Corrected to: 112 category_count = [0 for _ in range(max_category_id + 1)] Shows all the classes and their counts:

==============[ COCO json info ]==============
Total Annotations: 216
Total Image      : 172
Annotated Image  : 172
Total Category   : 3
----------------------------
       class        | count
----------------------------
       human        | 86
      vehicle       | 59
       animal       | 71

Thanks for the cool tool!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Chien-Hungcommented, Feb 5, 2021

Hello, this error is caused by line 142 ~ 144 :

for c, cnt in zip(category, category_count):
    if cnt != 0:
        print('{:^20}| {}'.format(c, cnt))

I fixed this error by change these lines to

for idx, cat_idx in enumerate(cat2idx): 
    c = category[idx]
    cnt = category_count[cat_idx-1]
    if cnt != 0:
        print('{:^20}| {}'.format(c, cnt))   

You can test it on your dataset and if this issue is solved, please close this issue. If there are any errors, please let me know. Thank you.

0reactions
Chien-Hungcommented, Feb 19, 2021

Sorry for late reply. I guess that they use 0 for the background class by default, but depending on the object detection code you use, you could also use -1 for the background class.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using Timely Text Messages To Curb Missed Assignments ...
In a study, automated text messages to parents reduced absences and the number of F's earned by high school students.
Read more >
Parent Alert! Your Child Just Skipped Class - NPR
In a study, automated text messages to parents reduced absences and the number of F's earned by high school students.
Read more >
WHAT! Missing Assignments & Progress Reports for Google ...
Alice will go over some features of Google Classroom on how you can get information about your students progress. While Google Classroom is ......
Read more >
15 Good Excuses to Miss Class without Being Caught Lying
Good excuses to miss class are like strong armor; they guarantee your protection even when the stakes are high.
Read more >
When I open a Powerpoint File in Classroom, text shows but ...
We had no issues with this last year and it worked fine. Workaround is to save as a PDF and the pictures show...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found