TechJuly 24, 202610 min read

Filtering worn-garment images with pose estimation

At Bantoa we work every day with thousands of product images: they are the lifeblood of our platform and the first visual point of contact for users. Because we import catalogs from dozens of different retailers, however, we face a non-trivial classification problem.

The images we receive fall into two main categories:

  • Still life: the garment is photographed on its own, laid flat on a surface or supported by an invisible mannequin.

  • Worn: the product comes to life on a female or male model who shows off its fit.

We often have no metadata at all to help us tell what type of shot we are looking at. This is a significant obstacle, because images with a model are not suitable for certain use cases, such as creating clean visual outfits or virtual try-on features.

The quick fix would be to send a prompt to any modern VLM (Vision Language Model). However, given the high volume of images we work with, this route would mean substantial costs and response times that would drastically slow down product import.

This is where we can turn to computer vision, the branch of artificial intelligence that involves algorithms and models for extracting information from images. Various solutions have been developed to detect the presence of specific objects within images, such as the Haar Cascades machine learning model, or the YOLO (You Only Look Once) family of models, a well-known standard in object detection and deep learning.

In this specific case, we settled on a particular solution: a pose estimation model. These detectors are normally used to track movement in real-time video, but they work perfectly well on static images too, with the advantage of identifying not only the presence of a human body but also its features, such as the face (by detecting keypoints like nose, mouth, eyes, and ears). Another advantage of these models is their ability to recognize anatomical details even when they are only partially visible. They can pick out limbs in close-up framings, as in photos focused solely on shoes or accessories.

Specifically, the deep learning model we chose is RTMPose, which is Apache-2.0 licensed, available in ONNX format, and fast enough on CPU: running it on the full image, we measured ~10 ms per image, equivalent to about 81 images per second on a laptop CPU.

How RTMPose works

When you feed the model an image of a garment in still life, such as a t-shirt laid flat on a surface, it is easy to see a skeleton overlaid on the fabric. This is not a malfunction, but the normal behavior of this detector, which is designed to find anatomical keypoints even in shapes that only vaguely resemble the human silhouette. RTMPose has a top-down architecture. This approach typically involves a first stage handled by an Object Detector, whose job is to isolate the bounding boxes of people, and a second stage in which the Pose Estimator analyzes only the regions of interest it has identified. To save time and resources, we deliberately bypassed the initial detector and passed the full image directly to the pose model.

Because the Pose Estimator assumes that a first detector has already isolated a person, it takes for granted that there is always one in the image. A t-shirt, after all, mirrors the anatomical shape of the body it was cut for (sleeves, waist, neckline): the model therefore tries to “force” a plausible skeleton by following the lines of the fabric. As a result, simply counting the 17 keypoints of the map derived from the COCO dataset (Common Objects in Context) is not enough to answer the question “is there a person?”, precisely because the model assumes one is present regardless.

The primary and most reliable signal for confirming the presence of a real person therefore remains the face. A piece of clothing has no head, so it can be classified as an object. For full-length and half-length photos, we take the highest score among the five facial keypoints (nose, eyes, ears) and require that it exceed 0.70 as a confidence threshold. On a set of 139 verified images, which we treat as ground truth, this single rule reaches 97.1% accuracy with zero false positives on still-life images.

The method also proves effective on shots taken from behind: even without facial features, the model infers the position of the ears from the shape of the skull, achieving very high reliability (up to 0.91) even with long hair.

To keep the rule stable even for subjects seen from behind, it is essential to use the maximum confidence value across the five facial points rather than their average.

Detecting the parts: torso, legs, details

Recognizing the presence of a person, however, is only half the job. For our needs it is just as important to identify which specific body parts appear in the frame.

To do this, we group the model’s 17 keypoints into six main anatomical regions (head, shoulders, arms, hips, legs, and feet) and check which ones exceed our confidence threshold. This lets us classify the different use cases precisely:

  • full-length – head, torso, and legs or feet all present;

  • half-length – torso without the lower body;

  • low framing – hips and legs, with or without feet: this is the case for pants and skirts shot from the waist down;

  • feet only – ankles without the rest: typically a shoe detail shot.

In building this reading we learned two things worth knowing:

  1. a high score does not guarantee that the keypoint is in the image. In a photo cropped at mid-thigh, RTMPose placed both knees below the bottom edge, at over 1,100 pixels on an image 1,138 pixels tall, with a score of 0.8. The model infers the trajectory of the visible limbs and mathematically “guesses” where the missing joints should be, regardless of the physical limits of the photo. To tell a full-length shot from a half-length one, therefore, you have to look at the spatial coordinates to make sure the points fall inside the image, not just at their confidence.

  2. In close-up details (e.g., shoes), where the head is cut off and the face > 0.70 rule would inevitably fail. On a very tight crop, all scores drop together, and a fixed threshold stops seeing anything. The relative order survives, though: in a photo of shoes, the ankles clearly beat the face. In these specific cases, where the coordinates confirm that the upper body is outside the borders, we compare the two halves of the skeleton against each other instead of relying on an absolute constant. This allows us to validate low framings while working around the missing face, and at the same time prevents a simple isolated bag from being mistaken for a worn photo (since the bag would trigger random keypoints without respecting the strict spatial and relative consistency we require).

Although a top-down pose estimation model is built to track joints on the assumption that a person is present, we have shown that, when queried with the right logic, it can become an excellent body detection system.

By making judicious use of the confidence scores (using the face as the main anchor) and checking the consistency of spatial coordinates for close-up details, we managed to adapt the model’s output to our needs. The result is a detector that doesn’t just confirm the presence of a person but describes precisely which body parts are in frame, allowing us to discard mannequins and categorize crops. All of it runs directly on CPU, in just about ten milliseconds per image and, above all, solves a real e-commerce problem without having to train any custom model.

Sources
RTMPose (MMLab): https://github.com/open-mmlab/mmpose/tree/main/projects/rtmposeRTMPose: Real-Time Multi-Person Pose Estimation based on MMPose (paper):
https://arxiv.org/abs/2303.07399COCO Dataset: https://www.cocodataset.org/
Microsoft COCO Common Objects in Context (paper): https://arxiv.org/abs/1405.0312

Enrico Antonini, Deep learning engineer @Bantoa

AIComputer visionTech
Keep reading

More articles dal panorama fashion-tech

All articles

Want to become the next case study?

Discover how Bantoa solutions can grow your brand.

Request a demo