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
crossentropy
Federal university of Technology, Akure
Quick Overview and Analysis
Platform · 17 Apr 2025, 13:21 · 1

Per @stefan027 discussion here: https://zindi.africa/competitions/amini-cocoa-contamination-challenge/discussions/26327

Take a quick look at this:

Please i am human as well and might have some misconceptions or ideas from my analysis so do well to correct me if any of my calculations or computations are wrong:

Firstly: Modifying the path and computing image resolution

📷

Secondly: Checking some cases of misappropriation for example xmin>image width just does not make sense!

At the same time, we can see that there is not a single case where xmin>xmax, same for ymin and ymax

📷

Thirdly: I have a brief assumption(theory?), nothing serious, i have only just reasoned it :)

* Now, except if i am wrong, mathematically:

* If xmax > image_width and we proceed to make it such that for every scenario where this is a thing, we clip the excess values to the width, say:

* if xmax>image_width:

* xmax == image_width

* else:

* xmax remains

The above is not expected to make it such that after computation, some values of xmin automatically become greater than xmax because we checked initially and for all cases, xmin is not greater than xmax

📷

Lastly: After computing the base stats as i did earlier in the second state, we can see a change. Why? I have no actual facts, just assumptions:

📷

My first assumption would be that the coordinates were swapped i.e xmin for ymin and similarly xmax for ymax

Secondly, similarly to the first assumption, only in a few cases was this an issue(swapping coordinates)

I also plotted some of these boxes, carefully comparing the box width and height with respect to the image resolution, it is quite evident that perhaps they are swapped or i am mistaken and these are just wrong case of boxes looking quite decieving!

I'd very much love to hear your opinions on this and if potentially there is anything wrong in my calculations and assumptions, I'd love to hear them too!

Thanks!

Discussion 1 answer
User avatar
crossentropy
Federal university of Technology, Akure

If you're reading this, per the original discussion(https://zindi.africa/competitions/amini-cocoa-contamination-challenge/discussions/26327), as explained by @Muhamed_Tuo

This can be fixed by loading images with this instead:

from PIL import Image, ExifTags

def load_image(filepath):
    image = Image.open(filepath)
    
    for flag in ExifTags.TAGS.keys():
        if ExifTags.TAGS[flag]=='Orientation':         
            break
    orientation = flag
    exif = image._getexif()
    orientation_value = exif.get(orientation, None)
    
    if orientation_value == 3:
        image=image.rotate(180, expand=True)
    elif orientation_value == 6:
        image=image.rotate(270, expand=True)
    elif orientation_value == 8:
        image=image.rotate(90, expand=True)
    return image
    

18 Apr 2025, 23:22
Upvotes 0