Blog/Tutorials
Tutorials4 min read

Image Classification with Potato

Learn how to set up image classification tasks with thumbnail previews, zoom controls, and multi-label support.

By Potato Team·

Image Classification with Potato

Image classification is a cornerstone of computer vision. Whether you're building a product categorization system, content moderation pipeline, or medical imaging classifier, Potato provides the tools you need for efficient image labeling.

What You'll Learn

  • Setting up image annotation tasks
  • Single-label and multi-label classification
  • Hierarchical category structures
  • Quality control for image tasks

Basic Image Classification

Let's start with a simple single-label classification task.

Configuration

annotation_task_name: "Product Image Classification"
 
# Image data
data_files:
  - data/products.json
 
item_properties:
  id_key: product_id
  text_key: image_url
 
# Classification labels
annotation_schemes:
  - annotation_type: image_annotation
    name: category
    description: "What type of product is shown?"
    labels:
      - Electronics
      - Clothing
      - Home & Garden
      - Sports & Outdoors
      - Books & Media
      - Other
    keyboard_shortcuts:
      Electronics: "1"
      Clothing: "2"
      "Home & Garden": "3"
      "Sports & Outdoors": "4"
      "Books & Media": "5"
      Other: "6"

Data Format

Create data/products.json:

{"product_id": "P001", "image_url": "/images/products/laptop.jpg"}
{"product_id": "P002", "image_url": "/images/products/tshirt.jpg"}
{"product_id": "P003", "image_url": "/images/products/garden_tools.jpg"}
{"product_id": "P004", "image_url": "https://example.com/images/basketball.jpg"}

Images can be local paths or URLs.

Multi-Label Classification

For images that belong to multiple categories:

annotation_schemes:
  - annotation_type: multiselect
    name: attributes
    description: "Select all attributes that apply to this image"
    labels:
      - Contains people
      - Outdoor scene
      - Indoor scene
      - Contains text
      - Product photo
      - Lifestyle photo
      - Close-up shot
      - Wide angle
    min_selections: 1
    max_selections: 5

Hierarchical Categories

For complex taxonomies, use nested labels:

annotation_schemes:
  - annotation_type: radio
    name: main_category
    description: "Primary category"
    labels:
      - Apparel
      - Electronics
      - Home
 
  - annotation_type: radio
    name: subcategory
    description: "Subcategory"
    conditional:
      depends_on: main_category
      options:
        Apparel:
          - Tops
          - Bottoms
          - Footwear
          - Accessories
        Electronics:
          - Phones
          - Computers
          - Audio
          - Cameras
        Home:
          - Furniture
          - Decor
          - Kitchen
          - Bedding

Image Quality Assessment

Add quality checks alongside classification:

annotation_schemes:
  - annotation_type: radio
    name: category
    description: "Product category"
    labels: [Electronics, Clothing, Home, Other]
 
  - annotation_type: radio
    name: image_quality
    description: "Is this image suitable for the product catalog?"
    labels:
      - name: Approved
        description: "Clear, well-lit, product is visible"
      - name: Needs review
        description: "Minor issues but potentially usable"
      - name: Rejected
        description: "Poor quality, wrong product, or inappropriate"
 
  - annotation_type: multiselect
    name: quality_issues
    description: "If not approved, what issues are present?"
    labels:
      - Blurry or out of focus
      - Poor lighting
      - Wrong product shown
      - Watermark or text overlay
      - Inappropriate content
      - Multiple products in frame
    conditional:
      depends_on: image_quality
      show_when: ["Needs review", "Rejected"]

Advanced Image Settings

For advanced image display customization, configure the image_annotation type in your annotation schemes and use CSS or custom styling as needed.

Complete Example

Here's a production-ready configuration:

annotation_task_name: "E-commerce Image Classification"
 
data_files:
  - data/images.json
 
item_properties:
  id_key: sku
  text_key: image_path
 
annotation_schemes:
  - annotation_type: image_annotation
    name: primary_category
    description: "Select the main product category"
    labels:
      - Electronics
      - Clothing & Accessories
      - Home & Living
      - Beauty & Personal Care
      - Sports & Fitness
      - Toys & Games
      - Other
    required: true
    keyboard_shortcuts:
      Electronics: "1"
      "Clothing & Accessories": "2"
      "Home & Living": "3"
      "Beauty & Personal Care": "4"
      "Sports & Fitness": "5"
      "Toys & Games": "6"
      Other: "7"
 
  - annotation_type: multiselect
    name: image_attributes
    description: "Select all that apply"
    labels:
      - White background
      - Lifestyle shot
      - Multiple angles
      - Model wearing/using
      - Size reference included
      - Brand visible
    required: false
 
  - annotation_type: radio
    name: listing_ready
    description: "Is this image ready for product listing?"
    labels:
      - Yes - Ready to publish
      - No - Needs editing
      - No - Reshoot required
    required: true
 
annotation_guidelines:
  title: "Image Classification Guidelines"
  content: |
    ## Category Selection
    Choose the most specific category that fits the product.
 
    ## Image Quality
    - "Ready to publish": Clear, professional, meets standards
    - "Needs editing": Good photo but needs cropping/color correction
    - "Reshoot required": Fundamentally unsuitable

Tips for Image Annotation

  1. Consistent monitor setup: Ensure annotators have calibrated displays
  2. Clear category definitions: Include example images in guidelines
  3. Handle edge cases: Document what to do with ambiguous images
  4. Regular calibration: Review samples together as a team

Next Steps


See complete image annotation documentation at /docs/features/image-annotation.