BioRTC's 2025 AI Workshop

Complete Resource Guide

Activity 2: Name Tag Image Analyzer

Duration: 60 minutes
What This Application Does

Imagine you’re organizing a large conference with hundreds of attendees wearing name tags. Instead of manually typing each person’s information into a database, this AI application can “read” name tag images and automatically extract:

Input: Multiple images of name tags from an event

Process:

  1. Computer Vision: AI “looks at” each image and identifies text
  2. Information Extraction: Pulls out specific details like names, organizations, and locations
  3. Data Organization: Structures the information into a searchable database
  4. Analysis Tools: Provides summaries and search capabilities

Output:

  • Searchable database of all attendees
  • Summary statistics by town and organization
  • CSV file for further analysis
The AI Models Working Behind the Scenes

Vision Language Models (VLMs) – Qwen2.5-VL Series These are cutting-edge AI models that can both “see” images and understand text. Unlike simple OCR (Optical Character Recognition), these models actually understand context:

  • Qwen2.5-VL-7B: Most capable, best accuracy, requires more memory
  • Qwen2.5-VL-3B: Balanced performance and speed (recommended)
  • Qwen2-VL-2B: Fastest processing, good for large batches

What Makes VLMs Special:

  • They don’t just read text – they understand what they’re looking at
  • Can handle different fonts, orientations, and image qualities
  • Understand context (knows “Dr. Jane Smith, Harvard University, Boston” means Jane is from Harvard in Boston)
  • Can follow complex instructions about what information to extract
Real-World Applications
  • Event Management: Automatic attendee registration, networking facilitation
  • Document Processing: Extract information from forms, IDs, business cards
  • Inventory Management: Read product labels and specifications
  • Healthcare: Process patient wristbands, medical forms
  • Education: Grade written exams, process student information
  • Retail: Analyze product tags, shelf labels
  • Research: Digitize handwritten notes, extract data from photographs
Step-by-Step Implementation
Step 1: Download the Application Code

In your Jupyter notebook, create a new cell and run:

%cd /home
!git clone https://github.com/ictBioRtc/image_analyzer.git

What this does: Downloads the complete name tag analyzer application to your cloud computer.

Step 2: Navigate to the Project

Create another cell and run:

%cd image_analyzer

What this does: Changes your working directory to the image analyzer folder.

Step 3: Install Required Software

Create a new cell and run:

!pip install -r requirements.txt

What this installs:

  • Gradio: Creates the web interface
  • Transformers: Provides access to Qwen vision models
  • Pillow: Handles image processing
  • Pandas: Manages data analysis
  • Tabulate: Formats data tables nicely

This installation takes 2-3 minutes.

Step 4: Prepare Your Image Data

The repository includes sample name tag images in a zip file:

!unzip NameTags.zip

What this does: Extracts sample name tag images you can use for testing. You’ll see various name tags from a conference with different people, organizations, and locations.

Step 5: Launch the Application

Create a new cell and run:

!python app.py

What happens:

  • The application initializes the AI models
  • Creates a web interface with two main tabs
  • Provides a public URL (like: https://abcd1234.gradio.live)
  • Click the URL to open your name tag analyzer
Step 6: Processing Images

In the “Process Images” tab:

Step 6a: Upload Images

  1. Click “Upload Name Tag Images”
  2. Select multiple image files:
    • Use the sample images from NameTags folder, or
    • Upload your own name tag photos
  3. You can upload many images at once

Step 6b: Configure the AI Model

  • Vision Model: Choose your processing power
    • qwen2.5-vl-3b (Recommended): Best balance of speed and accuracy
    • qwen2.5-vl-7b: Highest accuracy but slower
    • qwen2-vl-2b: Fastest but less detailed extraction
  • Device: Leave as “auto” (uses GPU if available)
  • Use Half Precision: Keep checked (saves memory)
  • Max Image Size: Set to 768 or higher for clear text reading
  • Max Output Tokens: Set to 256 (enough for name, organization, location)

Step 6c: Set the AI Instructions The prompt tells the AI exactly what to look for. The default prompt is:

“Extract ‘name of the person’, ‘affiliation of the attendee’ and also extract the town name you have to get it from the affiliation, then return the results in the format ‘Name: Affiliation: Town:'”

You can modify this if you need different information extracted.

Step 6d: Process the Images

  1. Click “Process Images”
  2. Watch the progress bar as each image is analyzed
  3. Processing time depends on:
    • Number of images
    • Model size chosen
    • Image resolution
    • GPU availability

What’s happening behind the scenes:

  • Each image is loaded and resized for optimal processing
  • The vision model “looks at” the image
  • AI reads text and understands the layout
  • Information is extracted according to your prompt
  • Results are saved to a CSV file
Step 7: Analyzing Your Data

Switch to the “Analyze Data” tab:

Step 7a: Load Your Data

  1. Click “Use Processed CSV” to load data from the previous step, or
  2. Upload your own CSV file with name, affiliation, and town columns

Step 7b: Generate Summaries

  1. Select summary type:
    • By Town: See how many people came from each city
    • By Affiliation: See which organizations sent the most attendees
  2. Click “Generate Summary”

Example output:

=== SUMMARY BY TOWN ===
town             total_people    affiliations
boston           15              8
new york         12              6
chicago          8               4

Step 7c: Search the Database

  1. Enter a search term (person’s name, organization, or city)
  2. Choose search field or leave as “All Fields”
  3. Click “Search”

Example searches:

  • Search “harvard” to find all Harvard attendees
  • Search “john” to find anyone named John
  • Search “boston” to find all Boston participants
Understanding What Happened

The Complete AI Pipeline:

  1. Image Upload: Your images are stored temporarily in the cloud
  2. Model Loading: The Qwen vision-language model loads into GPU memory
  3. Image Processing: Each image is:
    • Resized for optimal AI processing
    • Fed into the vision model along with your instructions
    • Analyzed for text content and layout understanding
  4. Information Extraction: The AI:
    • Identifies text regions in the image
    • Reads the text content
    • Understands the context (what’s a name vs. organization vs. location)
    • Follows your specific formatting instructions
  5. Data Structuring: Results are organized into a clean database format
  6. Analysis Tools: Built-in functions help you explore and understand your data

Why This Matters:

  • Automation: What would take hours manually happens in minutes
  • Accuracy: AI often reads text better than humans, especially in poor lighting
  • Scale: Can process hundreds or thousands of images automatically
  • Integration: CSV output can be imported into any database or spreadsheet program
Advanced Features and Customization

Memory Management:

  • Use “Unload Model” button to free GPU memory when done
  • Smaller models (2B) use less memory but may miss some details
  • Larger models (7B) are more accurate but require more resources

Prompt Engineering: You can modify the prompt to extract different information:

  • “Extract name, job title, and company from this business card”
  • “Find the student name, ID number, and course from this ID card”
  • “Get the product name, price, and category from this label”

Image Quality Tips:

  • Clear, well-lit images work best
  • Avoid blurry or tilted photos
  • Higher resolution helps with small text
  • The AI can handle some rotation and perspective issues
Common Challenges and Solutions

“Model loading failed”

  • Check your internet connection
  • Try a smaller model (2B instead of 7B)
  • Restart the application

“Poor extraction accuracy”

  • Use higher resolution images
  • Try the larger 7B model
  • Adjust your prompt to be more specific
  • Ensure images are clear and well-lit

“Out of memory errors”

  • Use the 2B model instead of 7B
  • Process fewer images at once
  • Use the “Unload Model” button between sessions
  • Reduce max image size setting

“Processing too slow”

  • Use the 2B model for faster processing
  • Reduce image sizes
  • Process images in smaller batches
Applications You Can Build

Event Management System:

  • Process name tags from conferences
  • Create attendee databases
  • Generate networking lists by interest/location

Business Card Digitizer:

  • Scan business cards into CRM systems
  • Extract contact information automatically
  • Build professional networks digitally

Document Processing Pipeline:

  • Extract information from forms
  • Process inventory labels
  • Digitize handwritten notes

Educational Tools:

  • Grade written assignments
  • Process student registration forms
  • Extract data from research materials
Key Takeaways
  1. Vision AI Capabilities: Modern AI can “read” and understand images with human-level accuracy
  2. Automation Potential: Manual data entry tasks can often be automated with vision models
  3. Context Understanding: VLMs don’t just read text – they understand what it means
  4. Practical Implementation: You’ve built a real system that solves actual business problems
  5. Scalability: The same approach works for 10 images or 10,000 images
  6. Customization: By changing prompts, you can adapt this for completely different use cases

What You’ve Accomplished:

  • Used cutting-edge vision-language models
  • Built an automated information extraction system
  • Created data analysis and search tools
  • Gained hands-on experience with multimodal AI

Next: We’ll explore how to make AI smarter by giving it access to your specific documents with Retrieval Augmented Generation (RAG)!