Question

I am trying to create an algorithm that, given a set of elements that are in a site, would return the one that is more likely to be the "one" describing a product.

This is not a 100% accurate algorithm of course, and will need of people-based selection afterwards, but I am trying to get at least a list of the 3 most probable images. Here is what I do so far:

1 - Get rid of which square size is smaller than 50x50px
2 - Calculate average square size of all in the page
3 - Give a score to each , depending on the difference with the average square size (the bigger square size, the more score)
4 - If width of is > than (height * 5), score = score * 0.5 (I do this because this is likely to be a banner in the page).

Here is what I would like to change, but I fail to see what would be a good way to do so. In step 3, what I am doing right now is giving the following score:

score_of_image = average_square_size - square_size_image

I would like to have a particular amount of points that would be shared out to all the depending on their size. The share out should reflect the size of one picture related to the others. What would be a good algorithm in order to share out these points?

Was it helpful?

Solution

I think you need to decide how important some aspects are with regards to others, but you could simply calculate the size of the image (width x height) and use that as the first part of the score. How I'd score this would be to record the area of largest image on the page and work out the others as a percentage of this. I don't think the average image size really adds anything here as I would imagine the largest image is most likely the product image.

Then calculate a separate score for the squareness, doing something like this:-

if (height > width) {
    result = (width/height) * max_points_for_squareness;
} else {
    result = (height/width) * max_points_for_squareness;
}

So between those two aspects you get two percentages that can be used to distribute a total score however you wish (you could assign more points to squareness if you so wish, or more to image size.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top