Calhacks 12.0 Submission
AdSmart is a comprehensive web application that leverages computer vision, audio analysis, and generative AI to provide actionable insights on advertisement performance. Upload your image or video ads and receive instant, data-driven feedback on key metrics that influence audience engagement.
Modern advertisers struggle to quantify what makes an ad effective. Traditional A/B testing is expensive and time-consuming. AdMetrics AI solves this by providing instant, objective analysis of ad creative elements before launch, helping marketers optimize their content for maximum impact.
| Metric | Range | Description |
|---|---|---|
| Color Contrast | 0.0 - 1.0 | Measures visual distinction and readability |
| Product Size Ratio | 0.0 - 1.0 | Product prominence (0=small, 1=large) |
| Text Number | Int | Answers the question: How many words appear on the ad? |
| Negative Space Ratio | 0.0 - 1.0 | White space for visual breathing room |
| Product Name | String | Answers the question: What product is being sold? |
| External Buttons | List | Detected CTA text elements |
| Human Features | List | Detected human characteristics |
| Appeal | String | Explains the appeal of product |
| Metric | Range | Description |
|---|---|---|
| Scene Count | Integer | Number of distinct scenes/cuts |
| Dimensions | Float | Ratio of width/length |
| Product Name | String | Answers the question: What is the name of the product? |
| Human Features | List | Detected human characteristics |
| Sound Peaks | dB/10s | Number of significant peaks |
| Speech Coverage | 0.0 - 100% | Voice-over percentage |
| Music Coverage | 0.0 - 100% | Music-over percentage |
| Time Until First Significant Peak | seconds | When the first significant sound change is created (whether music or speech) |
- Batch Upload Support - Analyze multiple ads simultaneously
- Persistent Media Library - View and re-analyze historical uploads
- Real-time Processing - Instant feedback with progress indicators
- Responsive Design - Works seamlessly on desktop and mobile
- Exportable Results - Download full analysis as JSON
- Streamlit - Rapid web app development with Python
- Custom CSS - Polished, professional UI/UX
- OpenCV (cv2) - Advanced image and video analysis
- PIL/Pillow - Image manipulation and format conversion
- NumPy - Efficient numerical computations
- Google Gemini 2.5 Flash - State-of-the-art multimodal AI for product detection and feature recognition
- Pydantic - Structured data validation and schema enforcement
- FFmpeg - Audio extraction and conversion
- Custom Audio Analysis Pipeline - Peak detection, voice analysis, and music classification
- Python 3.8+ - Core application logic
- python-dotenv - Secure environment variable management
- Tempfile - Safe file handling and cleanup
- Python 3.8 or higher
- FFmpeg (for video/audio processing)
- Google Gemini API Key- Clone the Repository
git clone https://github.com/PolnareffTurtle/ad-intelligence
cd ad-intelligence- Create Virtual Environment
python -m venv .venv
source .venv/bin/activate # On Windows: venv\Scripts\activate- Install Dependencies
pip install -r requirements.txt-
Install FFmpeg
- macOS:
brew install ffmpeg - Ubuntu/Debian:
sudo apt-get install ffmpeg - Windows: Download from ffmpeg.org
- macOS:
-
Configure Environment Variables
# Create .env file
touch .env
# Add your Gemini API key (add this to the .env file)
echo "GEMINI_API_KEY=your_gemini_api_key_here" >> .env- Run the Application
streamlit run calhacks.py- Alternatives to Website
python3 main.py # this runs the image/video processing, shows run time
python3 audio.py # this runs the audio processingThe app will open automatically in your browser at http://localhost:8501
streamlit>=1.28.0
opencv-python>=4.8.0
numpy>=1.24.0
Pillow>=10.0.0
google-generativeai>=0.3.0
pydantic>=2.0.0
python-dotenv>=1.0.0- Click "๐ท Upload Image Ad" on the homepage
- Select one or more image files (PNG, JPG, JPEG)
- Preview your upload and click "๐ Analyze Ad(s)"
- Review metrics in the analysis dashboard
- Download results as JSON for reporting
- Click "๐ฅ Upload Video Ad" on the homepage
- Select a video file (MP4, MOV, AVI)
- Preview your upload and click "๐ Analyze Ad(s)"
- Wait for video and audio processing (may take 30-60 seconds)
- Review comprehensive metrics across visual and audio dimensions
- Upload multiple images at once for comparative analysis
- View timing metrics for each file processed
- Access all results from the media library
- View all uploaded images via "๐ผ๏ธ All Images"
- View all uploaded videos via "๐ฌ All Videos"
- Clear specific media types or entire history via "๐๏ธ Clear History"
- Preprocessing - Resize and normalize images for consistent analysis
- Edge Detection - Canny algorithm for negative space calculation
- Local Contrast - Kernel-based intensity variance measurement
- AI Vision - Gemini 2.5 Flash for semantic understanding
- Metric Normalization - Scale all values to [0, 1] for comparability
- Frame Extraction - Sample key frames (start, end, and midpoints)
- Motion Analysis - Laplacian variance for blur detection
- Scene Detection - Frame differencing for transition identification
- Audio Extraction - FFmpeg conversion to WAV format
- Audio Analysis - Peak detection, voice isolation, music classification
- Temporal Metrics - First 3-second hook and loudness progression
- Gemini 2.5 Flash provides structured JSON responses with thinking budgets
- Pydantic Models ensure type safety and schema validation
- Fallback Handling for graceful degradation when AI is unavailable
- Engagement Prediction Model - ML model trained on historical ad performance
- Competitor Benchmarking - Compare your ads to industry standards
- Platform-Specific Optimization - Instagram vs. YouTube vs. TikTok recommendations
- A/B Test Suggestions - AI-generated variation recommendations
- Real-time Feedback - Live metrics during ad creation
- Team Collaboration - Shared workspaces and commenting
- API Access - Programmatic analysis for CI/CD pipelines
- Advanced Audio NLP - Sentiment and message clarity analysis
Calhacks 12.0 Team
- Kshitij Tomar - Team Member #1
- Yechan Park - Team Member #2
- Theo Dela Cruz - Team Member #3