CoolFace
Apppublic

iBrokeTheCode/Multimodal_Product_Classification

sourceHugging Facemitupdated 1y agoView on Hugging Face
0likes
App README

πŸ›οΈMultimodal Product Classification with Gradio

Table of Contents

  1. 1.Project Description
  2. 2.Methodology & Key Features
  3. 3.Technology Stack
  4. 4.Model Details

1. Project Description

This project implements a multimodal product classification system for Best Buy products. The core objective is to categorize products using both their text descriptions and images. The system was trained on a dataset of almost 50,000 items.

The entire system is deployed as a lightweight, web application using Gradio. The app allows users to:

  • β€”Use both text and an image for the most accurate prediction.
  • β€”Run predictions using only text or only an image to understand the contribution of each data modality.

This project showcases the power of combining different data types to build a more robust and intelligent classification system.

[!IMPORTANT] - Check out the deployed app here: πŸ‘‰οΈ Multimodal Product Classification App πŸ‘ˆοΈ - Check out the Jupyter Notebook for a detailed walkthrough of the project here: πŸ‘‰οΈ Jupyter Notebook πŸ‘ˆοΈ

[image]

2. Methodology & Key Features

  • β€”Core Task: Multimodal Product Classification on a Best Buy dataset.
  • β€”Pipeline:
  • β€”Data: A dataset of \~50,000 products, each with a text description and an image.
  • β€”Feature Extraction: Pre-trained models are used to convert raw text and image data into high-dimensional embedding vectors.
  • β€”Classification: A custom-trained Multilayer Perceptron (MLP) model performs the final classification based on the embeddings.
  • β€”Key Features:
  • β€”Multimodal: Combines text and image data for a more accurate prediction.
  • β€”Single-Service Deployment: The entire application runs as a single, deployable Gradio app.
  • β€”Flexible Inputs: The app supports multimodal, text-only, and image-only prediction modes.

3. Technology Stack

This project was built using the following technologies:

Deployment & Hosting:

Modeling & Training:

Development Tools:

  • β€”Ruff – Python linter and formatter.
  • β€”uv – fast Python package installer and resolver.

4. Model Details

The final classification is performed by a custom-trained Multilayer Perceptron (MLP) model that takes the extracted embeddings as input.

  • β€”Text Embedding Model: SentenceTransformer (all-MiniLM-L6-v2)
  • β€”Image Embedding Model: TFConvNextV2Model (convnextv2-tiny-22k-224)
  • β€”Classifier: A custom MLP model trained on top of the embeddings.
  • β€”Classes: The model classifies products into a set of specific Best Buy product categories.
ModelModalityAccuracyMacro Avg F1-ScoreWeighted Avg F1-Score
Random ForestText0.900.830.90
Logistic RegressionText0.900.840.90
Random ForestImage0.800.700.79
Random ForestCombined0.890.790.89
Logistic RegressionCombined0.890.830.89
MLPImage0.840.770.84
MLPText0.920.870.92
MLPCombined0.920.850.92
[!TIP] Based on the evaluation on the test set, the Multimodal MLP model achieved an excellent 92% accuracy and a 92% weighted F1-score, confirming its superior performance by leveraging both text and image data.