Primary competition visual

Amini Cocoa Contamination Challenge

Helping Ghana
$7 000 USD
Completed (11 months ago)
Computer Vision
Object Detection
928 joined
255 active
Starti
Feb 14, 25
Closei
May 11, 25
Reveali
May 12, 25
User avatar
skaak
Ferra Solutions
Classes not unique
Data · 6 Mar 2025, 06:58 · 7

It seems classes and class ids are not matched consistently, see below e.g.

Discussion 7 answers

I believe the correct IDs are in the labels folder

6 Mar 2025, 08:05
Upvotes 0
User avatar
skaak
Ferra Solutions

Yeah, I guess so, but ... those are all numeric.

So is a label of 2 or 1 healthy? Is cssvd 0 or 1?

User avatar
AJoel
Zindi

Thank you for pointing this error out. Here is a quick fix that you can include in your notebook:

6 Mar 2025, 09:23
Upvotes 0
User avatar
AJoel
Zindi

# strip any spacing from the class item and make sure it is a string

train['class'] = train['class'].str.strip()

6 Mar 2025, 09:24
Upvotes 0
User avatar
AJoel
Zindi

# The correct mapping from class to class_id

class_map = {cls: i for i, cls in enumerate(sorted(train['class'].unique().tolist()))}

# This will give you

{'anthracnose': 0, 'cssvd': 1, 'healthy': 2}

# Map it

train['class_id'] = train['class'].map(class_map)

# Check

train[['class', 'class_id']].value_counts()

class class_id count

healthy 2 4280

cssvd 1 3241

anthracnose 0 2271

6 Mar 2025, 09:28
Upvotes 2
User avatar
skaak
Ferra Solutions

Great, thanks for clarifying

Thank you! Some images in the Train / csv sometimes no longer have annotations in the associated label file. We can clearly see in the train that an image is associated with cssvd and healthy but in the associated label file we no longer see cssvd. Is this an anomaly or a misunderstanding on my part?