AI-Powered Artist Recognition With Raspberry Pi

by Hamzzah kattan in Circuits > Raspberry Pi

17 Views, 0 Favorites, 0 Comments

AI-Powered Artist Recognition With Raspberry Pi

Posterwithlogo.png

Hi, I’m Hamzzah, My project uses AI to identify the artist of a painting in real-time, recognizing iconic styles like Van Gogh’s swirling brushstrokes or Picasso’s cubist shapes. Imagine pointing a webcam at a painting and instantly seeing “Monet” on a small LCD screen—cool, right? This project solves the problem of time-consuming manual artist identification, making it easy for students, educators, and art lovers to explore art history. Long-term, it could expand to lesser-known artists, help museum curators, or even authenticate art!

I’m building this with a Raspberry Pi, USB webcam, and 16x2 LCD, using a custom AI models trained on Google Colab. So far, I’ve collected data, trained a model, and tested it with promising results. This Instructable covers my journey from scratch, with tips and challenges, and I’ll update it in ~2 weeks when the project is complete. Follow along to build your own AI art recognizer!

Why AI? AI excels at spotting patterns in brushstrokes, colors, and compositions that humans might miss, automating what usually needs expert eyes. Let’s dive in!

Supplies

WhatsApp Image 2025-06-15 at 7.54.51 PM (2).jpeg

Materials and Tools

  1. Electronics:
  2. Raspberry Pi (e.g., Pi 4 or 5) – Raspberry Pi Official
  3. Webcam (USB-compatible) – Generic USB Webcam
  4. I2C 16x2 LCD Display (0x27 address) – Adafruit LCD
  5. USB Cables and Power Supply
  6. Maker Part:
  7. Wood sheets (for 17x27x11 cm box)
  8. Wood glue
  9. Sandpaper (medium and fine grit)
  10. Wood paint (any color)
  11. Laser cutter (e.g., Glowforge) – Glowforge
  12. Drill with hole saw attachment
  13. Software/Tools:
  14. Python 3
  15. OpenCV – OpenCV Python
  16. Ultralytics YOLOv8 – YOLOv8
  17. ONNX Runtime – ONNX
  18. smbus for I2C – Python smbus
  19. Google Colab (for training)
  20. References:
  21. PyTorch Tutorials – PyTorch
  22. Raspberry Pi Documentation – RPi Docs
  23. Estimated Cost: Building The Project from scratch would cost approximately €220-€300, depending on sourced materials. This includes the Raspberry Pi (€100-€200), webcam (€20-€30), and wood/tools (€20-€40). Refer to the updated Bill of Materials (BOM) PDF for a detailed breakdown

Setting Up the Raspberry Pi

WhatsApp Image 2025-06-15 at 7.54.50 PM.jpeg

Step 1: Setting Up the Raspberry Pi

Kick off your adventure by preparing the brain of the project! Start by flashing the latest Raspberry Pi OS onto a microSD card using the Raspberry Pi Imager. Once booted, connect to your Pi via SSH or VNC. Install essential Python libraries with:

  1. pip install opencv-python ultralytics onnxruntime smbus2 Connect the USB webcam and I2C LCD (ensure the address is 0x27—check with i2cdetect -y 1 if needed). Power up and test the camera with python -c "import cv2; print(cv2.VideoCapture(0).read())" to confirm it works. This step sets the foundation for a seamless build—let’s move to housing it next!

Building the Custom Box

WhatsApp Image 2025-06-07 at 3.01.23 PM (1).jpeg
WhatsApp Image 2025-06-07 at 3.01.23 PM (2).jpeg
WhatsApp Image 2025-06-07 at 3.01.23 PM.jpeg
WhatsApp Image 2025-06-07 at 3.01.24 PM (1).jpeg
WhatsApp Image 2025-06-07 at 3.01.24 PM.jpeg

Get ready to craft a sleek home for your project with a custom-designed box that’s both functional and stylish! The box measures 17x27x11 cm, perfectly sized to snugly house the Raspberry Pi, webcam, and LCD while keeping cables organized. One side features a precisely cut space for the LCD screen, allowing you to view artist names on the go. Two holes, drilled on the sides, let USB and power cables pass through to connect to a laptop, ensuring minimal interference and easy access.

Techniques Used:

  1. Laser Cutting: I used a laser cutter to slice wooden pieces for the side panels, base, and top with pinpoint accuracy, ensuring clean edges and perfect fits.
  2. Laser Engraving: Adding a personal touch, I engraved a decorative design on the top panel, blending art with function.
  3. Custom Cut for LCD Screen: With the laser cutter, I carved a custom cutout matching the LCD’s exact dimensions for a flawless integration.
  4. Gluing: Wood glue bonded all pieces together, creating a sturdy structure that withstands handling.
  5. Sanding: Sandpaper smoothed rough edges, prepping the surface for a polished look.
  6. Painting: A coat of wood paint gave the box a professional finish while protecting the wood.
  7. Drilling for Cable Management: A hole saw drilled two side holes for cables, keeping the setup tidy.
  8. Drilling a Hole for Webcam: A top hole was added to mount the webcam inside, maintaining a clean aesthetic.

This simple yet effective design not only protects the components but also makes it portable—perfect for showing off your creation!

Preparing the Training Set

Photo-90.jpeg
Photo-40.jpeg
Photo-295.jpeg
IMG_4752.jpg
IMG_4745.jpg

Turn your project into a smart art detective by building a robust training set! I printed artworks by Claude Monet, Da Vinci, Picasso, and Van Gogh on paper, then captured photos using both the webcam and my phone to simulate real-life conditions. To mimic the detection process, I gathered additional pictures with frames and manually cropped them, adding variety to the dataset. This real-world approach ensured the model could handle the bounding box outputs and diverse lighting, setting the stage for accurate predictions—keep reading to see how I trained it!

Training the Model

confusion_matrix.png
confusion_matrix_normalized.png
Screenshot 2025-06-16 142152.png
Screenshot 2025-06-16 142320.png

Now, let’s train the brains behind the model with not one, but two powerful models! I developed a detection model using YOLOv8n, a lightweight version ideal for the Raspberry Pi’s limited resources, to improve prediction accuracy by identifying paintings first. For classification, I expanded the dataset with more webcam-captured and manually cropped images to simulate bounding box outputs. After numerous training runs, I experimented with augmentations (e.g., rotation, blur) and model versions. ResNet-34 proved too heavy for the Pi, so I switched to ResNet-18, striking the perfect balance of performance and efficiency. This dual-model setup is the heart of the project—stay tuned to see it in action!

Coding the Detection and Classification

Screenshot 2025-06-16 142811.png
WhatsApp Image 2025-06-16 at 2.55.00 PM.jpeg

Bring your project to life with code that ties it all together! Using Python, I loaded the YOLOv8n detection model and ResNet-18 classification model in ONNX format, setting up the webcam at 320x240 or any other resolution. The system detects paintings frame by frame, then classifies them, displaying results on the LCD and video feed. There’s a small delay or lag—reasonable given the dual-model processing—but I tried skipping 2-3 frames with little difference. This step showcases the magic of real-time art recognition—let’s optimize it next!

Visualization and Dashboard

Make your results pop with stunning visualization! OpenCV overlays bounding boxes and artist names with confidence percentages on the live video feed, creating an engaging display. I used a VNC connection to set up a basic dashboard on my laptop, letting me monitor detections remotely. This visual feedback turns the project into an interactive tool—perfect for presentations or personal use!

Testing and Optimization

Test your creation and dream big for the future! I ran it with various paintings, tweaking confidence thresholds (e.g., 0.5) to balance accuracy and detections. The lag is manageable, but we’ll explore skipping more frames or higher resolutions later. Looking ahead, the system could expand to include less popular artists, assist museum curators in organizing exhibits, support art event planners, and even aid in art authentication—imagine the possibilities! This project is just the beginning of a transformative tool.

Conclusion

It is more than a project—it’s a gateway to exploring art through technology! By detecting and identifying masterpieces in real-time, it enhances education and appreciation, all housed in a custom wooden box. The impact reaches students, enthusiasts, and potentially museums, with room to grow. For improvements, consider higher resolution, a graphical interface, or more artist data. Thank you for joining this journey—build your own and share your story!