Let's say I'm looking for any item that has a certain shape (outline) in a photo. but I can further classify it only according to particular features, that most of them are expected to be shown only in a smaller area of the the object itself.

How may I give more weight, in the model, to that particular area, in order to avoid wrong classification issues?

What is the flow, and are there specific tools that should be used for that purpose?


I want to detect all triangles in the image, and try to classify them like this: If triangle has 3 lines in its corner, it's A type. if only two lines, it's B type.

So the triangles outline composes 100% of the object, but we can see that the area where the red lines are present, is only about 10% of the object area. How may I give more weight and tell the model to carefully look for the details in that area, so it doesn't confuse A with B or vice versa, just because the other 90% of the shape is similar.

And Of course, I want the certainty level to be as close as possible to 100%, for both A and B, and to be distinguished from the other option.

So my goal is the get this output:

Purple Triangle ==> Type A, certainty, 99%. Type B: certainty: 50%

Green Triangle ==> Type B, certainty, 99%. Type A: certainty: 50%

enter image description here

  • $\begingroup$ Well I am new in the computer vision,depending, you could try to train a convolutional neural network: you should train classifier for lines and triangles. get the values in the before the las layer, kind of "the probability that with will be triangle and probablity this could be a two lines" $\endgroup$ Oct 31, 2020 at 19:20
  • $\begingroup$ So I don't know this for sure, but I think you could trains classifier that attempts to increase the classification gradients around these edges. $\endgroup$ Oct 31, 2020 at 19:44
  • $\begingroup$ @jaljalvarezalvarez in my real use case there won't be actual lines, the idea is that I want to give more weight to particular elements that are supposed to be found at the base of the triangle, but those elements do not have a particular shape that I can pre-train. $\endgroup$
    – Stackaloo
    Oct 31, 2020 at 21:56
  • $\begingroup$ Its very interesting question.. $\endgroup$ Oct 31, 2020 at 22:07
  • $\begingroup$ One of the main strengths of deep neural networks is that they can learn representation of the data. It should be able to figure out on it's own what are the relevant features without you telling it what is relevant. Alternatively, you can try hierarchical approach - First, detect your main object (e.g triangle), extract relevant part of that object and then do classification on that extracted part only. $\endgroup$
    – Brale
    Oct 31, 2020 at 22:42


You must log in to answer this question.