My goal is to identify the horse in a photo. I'm dealing with about 500 unique horses.

My feeling is that the best way to distinguish one horse from another is by its face. So I trained Yolov5 successfully to find faces at reasonable angles.

I'd like to take this a step further, and teach it to identify which horse's face it sees.

I'm new to this sort of thing (though not programming in general), so the way I assume I should approach this is to add an additional label like face_horsename, with the unique name for the horse (or really, a unique reference to a database of horses).

Is that the right approach? It seems like the Yolo file format doesn't allow for multiple labels for the same box, so my guess is I should just make 2 rectboxes that are identical, but both point to different labels.

Frankly, I'd like to take it even further and label the same thing with the type of "blaze" of the horse's face, and its proper name for the horse's color. So now I'm talking about 4 labels.

Is that the right approach (duplicate boxes with unique labels)?


1 Answer 1


Duplicate boxes with unique labels make the problem too complex for the model. What I suggest is you use the horse face detection model to get a bounding box of the horse's face, crop the face image and use that image as a training sample for a separate classification model.

I have seen this method used often in human identification, and dividing the tasks/models seems much more reasonable than trying to solve it in one model.

P.S. Just out of curiosity, you said that

the best way to distinguish one horse from another is by its face

Is this really true? Aren't there better features to use from the body?

  • $\begingroup$ Do you have any recommendations for generating the classification model? As far as whether or not the face is the best way to identify them, I think it's practically the easiest. The legs sometimes are unique, but those aren't always well captured in a photo (especially a portrait). $\endgroup$ Nov 17, 2021 at 4:22
  • $\begingroup$ @GoldenNewby A simple cnn classifier would suffice for a baseline. $\endgroup$
    – DKDK
    Nov 17, 2021 at 4:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .