Class counts don’t match my actual annotations across all projects

Hi everyone,

In every project in my workspace, the class counts Roboflow shows don’t match the counts from my own database. Some classes show more than I have and some show fewer. Clicking the refresh icon next to “Count” doesn’t change the numbers.

Questions:

  1. Does this count include images in Unassigned / Annotating batches, or only images already added to the dataset?
  2. Does it count annotations or images?
  3. Are deleted, null or duplicate images still counted?
  4. Could the counts be stale or cached at the workspace level? Is there a way to force a full recount?
  5. Is there a recommended way to get per-class counts (API or export) so I can reconcile them with my data?

Hi Greg,

For your first question, I found this on a post from July 2025 "At the moment, you can go to the Classes & Tags section and see the number of instances in each class for all annotated images, including those not already added to the dataset." So it sounds like it includes images in Unassigned/Annotated batches.

For your second question, class counts refer to annotations not images. Specifically the netboxes added seen in this link. So you will see a higher class count than number of images if your image has multiple instances of that class. Ie one picture of a highway could have 5 images of a car. When you look at your dashboard and see car — 450 it means 450 bounding boxes of cars, not 450 images of cars.

Deleted images are not counted, null images contain no annotations and so would not count towards class count.

For duplication, Roboflow looks at underlying image data to identify if the image is a duplicate when the image is added to a project. However: if you change the image in any way through resizing, cropping or other alterations Robofolow will identify it as a new image.

Uploading an image the project already has returns the existing image ID with duplicate set to true.

For a current and correct way to get per class counts you can use the API here is an untested example script you could run:

import json
from collections import defaultdict

def reconcile_roboflow_coco_detailed(json_file_path):
    """
    Parses a Roboflow COCO JSON export and calculates both total annotation instances 
    AND unique image counts per class category to reconcile against an external database.
    """
    with open(json_file_path, 'r') as f:
        data = json.load(f)
    
    # Map category id to category name
    categories = {cat['id']: cat['name'] for cat in data.get('categories', [])}
    
    # Track total instances and set of unique image IDs per category
    instance_counts = defaultdict(int)
    unique_images_per_cat = defaultdict(set)
    
    for ann in data.get('annotations', []):
        cat_id = ann['category_id']
        image_id = ann['image_id']
        
        instance_counts[cat_id] += 1
        unique_images_per_cat[cat_id].add(image_id)
        
    print(f"{'Class Name':<18} | {'Total Annotations':<18} | {'Unique Images':<15} | {'Avg / Image':<10}")
    print("-" * 70)
    
    for cat_id, cat_name in categories.items():
        total_anns = instance_counts[cat_id]
        unique_imgs = len(unique_images_per_cat[cat_id])
        avg_per_img = round(total_anns / unique_imgs, 2) if unique_imgs > 0 else 0.0
        print(f"{cat_name:<18} | {total_anns:<18} | {unique_imgs:<15} | {avg_per_img:<10}")

# Run the reconciliation on your exported COCO json file
# reconcile_roboflow_coco_detailed("path/to/_annotations.coco.json")