Menu
Skip to main content

Automatic Image Segmentation With SAM (Segment Anything Model)

Developed by Meta, SAM (Segment Anything Model) is an AI model that automatically separates the contents of any image into objects.

SAM (Segment Anything Model) ile Otomatik Görsel Segmentasyonu

Developed by Meta, SAM (Segment Anything Model) is an AI model that automatically separates the contents of any image into objects. SAM doing this automatically is a revolutionary development in the field. At Digibus, we constantly update and develop our skill set, not just on the creative side but on the technical side too. In this article, we explain how we, as an advertising agency, used SAM in our own projects, which tools we set up, which steps we went through and how we got it working technically.

Open at the source ↗

What Is SAM?

SAM stands for Segment Anything Model. Developed by Meta AI, it is a versatile segmentation engine that can automatically detect and mask objects in an image. It’s called “Anything” because the model can recognize a wide variety of objects, such as people, animals, things and text.

Segment Anything Model örneği: penguen sürüsünün fotoğrafında her pengueni ayrı renkte işaretleyen otomatik segmentasyon

Where Is the SAM Model Used?

  • Background removal: With the model, objects in an image (products, people, things) can be easily separated and given a transparent background. Automatic segmentation is possible without Photoshop.
  • Collages and composite content: It saves a lot of time, especially in multilayer posters, banners and social media designs.
  • Post-processing for product photography: It speeds up cataloging by automatically separating objects after studio shoots.
  • Automatic product separation: If an image contains several products, each can be extracted as a separate image. In short, no more separate cut-outs in Photoshop. :)
  • Automatic PNG Conversion: With SAM, each product in an image containing several products can automatically be converted into a separate PNG.
  • Elements such as infographics, icons and characters in educational content are separated one by one and made ready for animation or annotated use.

In short, with the SAM model you can easily do many time-consuming tasks you’d otherwise do in Photoshop.

META SAM Modeli

How Did We Use SAM?

For one client, we needed to separate the objects in more than a hundred .psd and .png files. Doing this the classic way, manually checking every layer in Photoshop and exporting the objects, would have been both time-consuming and error-prone. Instead, we wanted a more scalable, automated solution. First, we converted all the .psd files to high-quality .png files.

Technologies Used:

  • Segment Anything Model (SAM): Object separation with SAM, developed by Meta AI
  • OpenCV: To turn each object into a mask after segmentation and export each as a separate PNG
  • Streamlit: To build a web interface for our internal team to test and make edits
  • PyTorch: A GPU/CPU-compatible framework for running the SAM model

Process:

  • These PNGs were segmented with the SAM model.
  • Each segment was separated with its own mask and saved as a PNG with a transparent background.
  • An RGB workflow was used instead of BGR to prevent color distortion.
  • All outputs were named meaningfully, archived in a folder structure and backed up.

Results:

  • More than 4,000 objects were extracted from 100+ PNG files in total.
  • Project time was cut by 80% compared with the manual method.
  • The client received a ready-to-use, well-organized output folder structure.
  • The objects in the project were cataloged for digital asset management.

At Digibus, in projects like this we bring our software development skills into play alongside our digital agency identity and automate the process from start to finish. We bring design and technology to the same table so creative teams can move forward without losing time or rhythm. This way, we produce outputs that are organized and usable not just visually but structurally too.

Blog categoriesExplore 9 topics
WhatsApp