Build Your Own AI Stylist
by Nikita Iliashenko in Circuits > Raspberry Pi
18 Views, 0 Favorites, 0 Comments
Build Your Own AI Stylist





This project is called AI Stylist. It's an AI-based system designed to recognize the best color palette based on your skin tone.
In the project, a camera and a ResNet152 classification module are used to analyze a photo and determine the skin tone (light, dark, or medium-dark).
I created this project mainly for integration with online shops, to help customers make more confident decisions when choosing clothing colors.
In addition to detecting skin tone, the system also checks whether a face is present in the selected area.
Supplies



Hardware:
-Rapsberry PI 5(kit) -120 eurp
-MicroSD card (16+GB) - 8 euro
-Rapsberry PI power supply - 12 euro
-USB camera - 10 euro
-Freenov Project Kit - 165 euro
-Jumper wires - 100 10 euro
-GPIO buttons - 0.5 euro each
Software:
-Rapsberry Pi OS
-app.py - script for laptop
-main.py - script for Rapsberry PI5
-resnet152v4.pth - AI trained module
-BLE communication code on both rapsberry and laptop
Dataset Collection



For the dataset, I used an existing dataset and additionally collected 25% of the images myself. I labeled these manually using Roboflow to ensure accuracy and consistency.
Training Module

After creating a well-labeled dataset with three classes, I exported it to my computer and trained the model using ResNet152 in Python on my laptop.

Repository Structure
This project is organized into two main repositories:
1. RPI — Code for Raspberry Pi
This repository contains all the Raspberry Pi–specific logic, including UI handling and Bluetooth communication.
Structure:
2. AI — Code for Laptop
This repository includes the AI model and the logic for running the skin tone detection and communication with the Raspberry Pi.
Structure:
Additional Setup
- A virtual environment is used for dependency management in both repositories. Make sure to create and activate a virtual environment before installing dependencies.
Also you need to have requirements.txt with libraries you use and for sure git ignore file.
Trained Module on Laptop
Model Testing and Evaluation
After training the model on the laptop, you can test its performance using utility functions from the ResNet (or broader PyTorch) library. This includes generating confusion matrices, which provide insights into how well the model is classifying the three skin tone categories (light, medium-dark, dark). The confusion matrix helps identify any class imbalances or misclassifications.
Establishing BLE Communication

Once the model is verified to be working correctly, the next step is to establish BLE (Bluetooth Low Energy) communication between the Raspberry Pi and the laptop.In this project:
- The laptop acts as a BLE client, sending data to or receiving data from the Raspberry Pi.
- The Raspberry Pi acts as a BLE server, handling the connection, displaying information on an LCD, and responding to user inputs (e.g., buttons).
This setup allows for real-time communication between the AI processing unit (laptop) and the user interface (Raspberry Pi).
Testing the Project

Face Positioning:
Start by positioning your face within the on-screen oval shown in the webcam preview. The oval will turn green once your face is properly aligned.
Capturing the Image:
Press the designated capture button to take a photo. The system will then crop the image to the area inside the oval, focusing only on your face.
Skin Tone Detection:
The cropped image is passed through the trained ResNet152-based model, which classifies the skin tone into one of three categories: light, medium-dark, or dark.
Color Palette Suggestion:
Based on the detected skin tone, the system selects the most suitable color palette and displays it on the LCD screen connected to the Raspberry Pi.
Exit the Program:
To quit the application, simply press the exit button.
Maker Skills

To create a custom enclosure for my Freenove project kit and Raspberry Pi, I used laser cutting.
- Box Design:
- I designed the base structure of the box using MakerCase.com, which allows you to generate laser-cut box templates that fit together like LEGO pieces.
- Customization:
- After generating the basic box layout, I imported it into Adobe Illustrator to manually add:
- Cutouts for buttons
- A window for the LCD display
- Ventilation holes for airflow
- Assembly:
- I laser-cut the finalized design from wood (or acrylic) and glued the parts together.
- One side of the box was left removable, allowing easy access to the Raspberry Pi for maintenance or upgrades.

Camera Not Working
- Possible Cause: Camera not detected by the Raspberry Pi.
- Solution:
- Check the camera connection (ribbon cable or USB).
- Reboot the Raspberry Pi.
LCD Not Working or Displaying Incorrectly
- Possible Cause: Initialization issue or incorrect function calls.
- Solution:
- Reboot the entire system.
- Double-check the LCD-related functions in your code.
Bluetooth Device Not Found
- Possible Cause: Common issue during BLE connection setup.
- Solution:
- Simply restart the Bluetooth code on both devices.
- Make sure both devices have Bluetooth enabled and are discoverable.
Overall

This system enhances the online shopping experience by providing personalized color recommendations based on the user’s skin tone. It reduces uncertainty when choosing clothing colors, saves time, and supports automation in style assistance — making it ideal for fashion e-commerce platforms, virtual fitting rooms, or smart wardrobe applications.