Facebook Ad Preview Validator

Facebook Ad Preview Validator

A recurring issue with the Facebook API was causing broken ad previews in client-facing reports, creating confusion and disabling a feature our clients had come to rely on. To address this, I developed the Facebook Ad Preview Validator, creating a classification engine, powered by Machine Learning, to validate ad creatives and protect the client experience.

Technologies Used

Computer VisionDeep LearningDockerFlaskPandasPythonPyTorchReactScikit-Learn

The Challenge

At Click Here Digital, the company's flagship platform, ClickIQ, provides clients with transparent reporting on their social media ad performance. However, an issue arose from intermittent API failures, which resulted in broken or incorrect ad previews being displayed in client-facing reports. These silent failures created confusion among our teams and clients. The challenge was to develop a system capable of differentiating between a valid ad creative and a platform-generated error image. This was a task that required a more sophisticated approach than traditional error handling.

The Solution

As my capstone project for my AI/ML certification, I developed a proof-of-concept to solve this significant business challenge: a custom-trained image classification model. The system ingests a generated ad preview and uses a deep learning model to instantly determine its validity. This allows the reporting pipeline to flag potential issues in real-time, preventing invalid images from ever reaching the client and ensuring the data they see is accurate.

I independently led the project from concept to completion, guiding the architectural decisions, including a key transition from Tensorflow to PyTorch, and managed the model's training and deployment to ensure it met the project's objectives. One of the most significant factors in the success of the project was the collection of adequate data samples, which required me to download, review, and organize over 150,000 image files.

Technical Architecture

To bring this vision to life, I engineered a modern, scalable, and efficient technology stack designed for performance and agility.

  • Libraries Used: PyTorch, Scikit-Learn, Pandas, Numpy, Seaborn, Matplotlib
  • Backend API: Flask

One of my most significant decisions was the move from Tensorflow to PyTorch. This was driven by PyTorch's flexibility and more intuitive development experience. This allowed additional control over the training processes and, ultimately, outperformed my initial implementation.

A lightweight Flask API serves as the bridge between the deep learning model and the end-user, providing a robust inference endpoint. For the user interface, React delivers a modern and responsive experience for seamless interaction.

Data and Training

A model's performance is largely dependent on the quality of its training data. I composed a dataset of over 150,000 images, which involved integrating data from multiple sources:

  • Internal Systems: Captured over 40,000 real-world examples of valid and invalid ad previews from the company's reporting pipeline.
  • Public Datasets: Incorporated 60,000 automotive images from Kaggle to teach the model to recognize valid, but out-of-context, images. This was important due to the company's clientele being primarily automotive dealerships.
  • Royalty-Free Sources: Used several hundred images from platforms like Unsplash to diversify the "unknown" class.

This meticulous process of data collection and labeling was a strategic investment that allowed me to create a highly nuanced dataset, giving the model a distinct performance advantage.

A key hurdle was a severe class imbalance in the initial dataset. To solve this, I developed custom Python scripts to automate data acquisition, allowing me to programmatically trigger and capture specific ad preview states. This approach rapidly enriched the 'valid' and 'invalid' classes and balanced the dataset.

Impact

The Facebook Ad Preview Validator serves as a blueprint for applying targeted AI to solve real-world business problems and drive significant value.

  • Enhanced Data Integrity: By proactively identifying invalid ad previews, the system strengthens client trust and satisfaction.
  • Demonstrated Strategic Capability: This project served as a proof-of-concept, demonstrating the potential for developing high-performing, custom deep learning solutions in-house.
  • Operational Scalability: It provides an automated quality assurance layer that can validate thousands of ad creatives without human intervention.
  • High-Performance Outcome: The final model achieved high accuracy of over 99%, successfully solving the core business problem and providing a reliable foundation for integration into the company's live production environment.
// work with me

Want a build like this for your own business? I take on a limited number of engagements spanning technology consulting, AI engineering services, and website development & hosting.

// more from the record

Related Projects

ClickIQ: An AI-Powered Marketing Intelligence & Automation Platform
project · related

ClickIQ: An AI-Powered Marketing Intelligence & Automation Platform

As the lead architect and engineer, I spearheaded the development of ClickIQ, an AI-driven advertising intelligence platform that transformed Click Here Digital's operations by automating campaign management, unifying data analytics, and providing a single source of truth for measuring ROI across a vast digital landscape.

Amazon Web ServicesGoKubernetes
view project →

tell me what you're building.

Free 30-minute consult. If I'm not the right fit, I'll say so and point you to who is.

Book a consultation