Monarch Butterfly Image Classification Guide

Author

Kyle Nessen

Published

February 15, 2025

Overview

This guide explains how to use the Monarch Image Labeler tool to count butterflies in gridded photographs. The tool helps estimate butterfly populations consistently across multiple observers, focusing on efficiency and accuracy.

Image context

This project uses modified trail cameras designed for long-term outdoor deployment. These cameras are equipped with infrared filters that block visible light while allowing near-infrared light to pass through. This modification creates a stark contrast between living leaves (which appear bright) and butterflies (which appear dark), making butterfly identification easier. Due to this modification, images may sometimes appear purple (caused by white balance issues) or be converted to black and white by the camera.

Modified trail camera and wind meter observing small cluster of monarch butterflies

Here is a short video to show what I mean. Notice that the eucalyptus leaves are bright, almost glowing, while the butterflies are much darker in comparison.

And here is another video showing even more butterflies, but in black and white:

Getting started

Shared OneDrive folder

I should have shared a OneDrive link with your Cal Poly email called “Deployments.” You can find the link below. If you have trouble accessing this link, please let me know.

Everything you need to get started is in this folder, including the Monarch Image Labeler software, and all the images that need to be analyzed.

Important

Please note that there are two versions of the software available. I have labeled them with your name, so make sure to download and use the version I specified for you. If you’re unsure which version to use, please contact me.

What is a “deployment?”

Images are organized into sets called “deployments.” A deployment represents data from a single camera, positioned at a specific location and direction, over a defined time period. Each deployment has a unique identifier (e.g., “SC4”). The identifier’s prefix indicates the location - most are from Spring Canyon (SC), with some from Space Launch Complex 6 (SLC6) and UDMH. Deployments are numbered sequentially starting from the first setup at each location. You will typically be assigned one deployment to analyze using the software.

Syncing images with OneDrive

For reliable access to the images, we’ll use OneDrive’s desktop sync feature:

  1. Install OneDrive Desktop
    • Download OneDrive if not already installed
    • Sign in with your Cal Poly credentials when prompted
  2. Set Up Sync
    • Open OneDrive settings (click the cloud icon in your taskbar)
    • Choose “Settings” > “Account” > “Add a folder”
    • Navigate to the shared “Deployments” folder
    • Select it for syncing
  3. Locate Your Files
    • On Mac: Look under “OneDrive - Cal Poly” or “OneDrive - Shared Libraries - Cal Poly”
    • On Windows: Check “OneDrive - California Polytechnic State University”
    • The deployment folders should appear in your local file system
Tip

Make sure you have enough free disk space before syncing. Each deployment can contain several gigabytes of images.

Warning

If you can’t find the synchronized files on your computer (NOT in browser), please contact me. The software requires local file access to function properly.

Managing storage

Since deployments can be quite large, you can manage your local storage efficiently using OneDrive’s built-in features:

  • For your current deployment:
    • Right-click the deployment folder
    • Select “Always keep on this device” to ensure constant access

  • For completed deployments:
    • Right-click the folder
    • Choose “Free up space” to remove local copies
    • Files remain accessible in OneDrive but won’t take up local storage

Tip

Only keep the deployment you’re currently working on downloaded locally. This helps manage disk space while ensuring you have quick access to the files you need.

Installation

  1. In the Deployments folder, open the “Software” folder
  2. Find and download the DMG file that has your name on it
  3. Double-click the downloaded DMG file to open it
  4. Drag the Monarch Image Labeler icon to the Applications folder as shown below:

Note

The first time you open the app, you may need to right-click the icon in Applications and select “Open” to bypass Mac security settings. After the first launch, you can open it normally. Let me know if you have issues.

Basic controls

  • Use D or → to go to next photo
  • Use A or ← to go to previous photo
  • Use E to select next category
  • Use Q to select previous category
  • Use W or ↑ to confirm image and proceed
  • Use S or ↓ to copy classifications from previous image
  • Use N to toggle notes for unusual circumstances
  • Hold F and click to toggle sunlight for a cell
  • Hold ⌘ and click to set count for cell
  • Hold ⌘ and right-click to set cell to 0
  • Hold Space to zoom in 300% for detailed inspection
  • Press H to toggle shortcuts help display

Count categories

Each image is divided into grid cells, and our task is to categorize each cell by count. Instead of estimating exact numbers, we only need to estimate the order of magnitude of butterflies in each cell. The software makes it easy to label cells with just a few clicks. Each category corresponds to a specific color for easy visual reference:

  • 0 (Default): No butterflies (No color)
  • 1-9: Single digits (Yellow)
  • 10-99: Dozens (Orange)
  • 100-999: Hundreds (Red)
  • 1000+: Thousands (Purple)

Below, I’ll explain each category and how to determine when to apply them.

(0) No butterflies

The zero category is the default for all cells and has no color or symbol. Most cells will be in this category, and many photos will be entirely empty. A cell should only be labeled zero if it is completely free of butterflies. If even part of a butterfly extends into the cell, upgrade to the appropriate category (usually 1-9).

You can use the 0 category to “clear” a colored cell. Additionally, holding Command + right-click (two-finger click on Mac trackpad) while selecting any category will reset a cell to zero. This is useful for correcting mistakes.

Below are several examples of cells that should be classified as zero:

(1-9) Single butterflies

Use this category when you can clearly count all butterflies within a grid cell and there are fewer than 10 present. Include partial butterflies in the count, even if they extend into neighboring cells and are counted there too. If double counting causes a neighboring cell to move to a higher category, then don’t double count.

Count all butterflies in the cell, whether they are resting or in flight.

I recommend marking this category last, after handling larger clusters, as a final cleanup step.

Here are some example images:

(10-99) Dozens of butterflies

This will be one of the most common categories. Use this category when you can see that butterflies are present in decent numbers, but obviously more than you can quickly count. If you suspect the number goes over 100, then upgrade to next category. Only consider butterflies that you can actually see in the photo, and don’t try to extrapolate of what might actually be there. When in doubt, be more conservative and go lower.

Here are some example scenarios:

Tip

If you find yourself spending more than a few seconds trying to count individual butterflies, it’s probably appropriate to use this category rather than the singles (1-9) category.

Warning

Remember that overlapping butterflies in clusters can hide others behind them. However, only count what you can actually see - don’t try to estimate hidden butterflies.

(100-999) Hundreds of butterflies

This will be another very common category, especially when the camera is positioned farther from the clusters, allowing more butterflies to fit within a single cell. When classifying:

  • Only count butterflies clearly visible in the image
  • Use relative size comparisons: find what 10 butterflies look like, then scale up
  • With practice, you’ll quickly recognize what 100+ butterflies look like
  • When in doubt between dozens (10-99) and hundreds (100-999), be conservative
  • Consider density: tightly packed clusters often indicate hundreds
  • Look for overlapping layers of butterflies, which suggest higher counts

Here are some example scenarios showing the hundreds category:

(1000+) Thousands of butterflies

You likely won’t need this category, but it’s included for completeness. If you think you’ve encountered a cell with 1000+ butterflies, please contact me so we can review it together. For context, Spring Canyon’s peak count was about 3000 butterflies around Thanksgiving, though it’s unlikely any single photo captured them all in one frame.

No example photos are provided, but please let me know if you think you’ve found a case that might qualify.

Direct sunlight

When classifying butterflies, we also track whether they are in direct sunlight. To mark a cell as “in direct sun,” hold F and click the cell. Cells in direct sunlight will have a yellow border.

Direct sunlight is relatively rare in our photos. When present, it can make butterflies harder to spot because both the butterflies and leaves become bright and oversaturated. Zooming in often helps identify butterflies in these conditions, especially when you have context from previous images (before the sun hit).

We track sunlight exposure because it may influence butterfly behavior. Our hypothesis is that direct sun causes overheating, forcing butterflies to relocate for temperature regulation. This data will help us test this theory.

Below is an animation showing morning sun passing over a butterfly cluster. Notice how the cells become very bright and the butterflies appear to leave once the sunlight hits:

Here’s an example of correctly labeled sunlight exposure:

If you have any further questions on this aspect of the photo labeling, please get in touch.

Night photos

Night photos can be challenging to classify due to the trail camera’s flash. While butterflies may be harder to see at night, our observations suggest that monarchs remain stationary during nighttime hours.

If you do observe significant changes in butterfly numbers during nighttime hours, please contact me, as this would be an interesting and unusual finding.

“Night” Button Feature

To speed up the processing of these often numerous and unchanging night photos, a special “Night” button is available next to the “Confirm Image” button.

  • Purpose: This button acts as a macro to quickly apply the previous image’s classification to a night photo and move to the next one. It assumes butterflies remain stationary overnight.
  • How to Use: When you encounter the first image in a sequence of night photos, simply click the “Night” button. Continue clicking “Night” for each subsequent night photo until you reach a daylight image. Then, resume normal classification.
  • How it Works: Clicking “Night” performs three actions automatically:
    1. Copies the classification data from the previously confirmed image.
    2. Confirms the current image, specifically marking it with an internal “Night” flag (visible as a light blue border/overlay instead of the usual green).
    3. Advances to the next image.
  • Undoing Mistakes: If you accidentally click “Night” on a daylight image or need to correct a night classification, simply use the “Reset Image” button. This will clear the classification and remove the “Night” flag, allowing you to classify it normally.

Setting Grid Resolution (New Deployments Only)

When you load a deployment folder for the very first time (one that hasn’t been classified before), the application will notice that the configurations.json file is missing. Before you can start classifying, you will be prompted to set the grid resolution for this specific deployment:

  • A dialog box will appear asking you to enter the desired number of rows for the grid. The default is 9.
  • The number of columns will be calculated automatically based on your input, assuming a standard 16:9 image aspect ratio.
  • Once you confirm, the application will create the configurations.json file with these dimensions.
Warning

Important: The grid resolution (number of rows and columns) is fixed for the entire deployment once set. You cannot change it after you start classifying. If you believe the chosen resolution is incorrect or unsuitable for the images in the deployment, please stop classifying and contact me (Kyle) immediately before proceeding further. We will need to manually reset the configuration and you will likely lose your work.

Label storage

When you open a deployment folder for the first time, the program will make a file called classifications.json next to the images. This is where all of your hard earned work will be saved, so please be careful! You don’t need to actually interact with this file, but deleting it or moving it can cause unexpected behavior.

Important

It is critical that two people are not classifying the same set of images at the same time, as this can cause data loss. Please check with me before moving on to the next folder.

The program automatically saves your work after each image classification. If you need to take a break, you can simply close the program - your progress will be there when you return.

Tip

Consider making periodic backups of the classifications.json file to prevent data loss. You can do this by simply copying the file to another location.

Classification process

This section is intended to give some guidance on how I think you should approach the classification process. Please do what works best for you, however. The key to this project is that we are consisistingly labeling photos across a deployment, and we generally agree on categorizations across each other’s work.

1. Initial assessment

  1. Begin with the most densely populated cells
  2. Use Space-bar zoom (300%) to inspect unclear areas
  3. All cells start as 0 (uncolored) by default

2. Dense cluster protocol

For cells with large clusters:

  • If butterflies clearly exceed 100, classify as hundreds (red)
  • Count only butterflies that are clearly visible - do not try to estimate hidden ones

3. Medium density areas

  • If more than a few butterflies but not obviously hundreds, classify as dozens (orange)
  • No need to get exact counts - if you can quickly count <10, it’s yellow; if it takes longer, it’s likely orange

4. Scanning for singles

  • After marking dense areas, scan for isolated butterflies or small groups
  • Include both flying and roosting butterflies
  • For 1-9 butterflies, mark as yellow

5. Border cases

When clusters cross grid lines: - Only count butterflies within the current cell - Round up when in doubt - Some double-counting at borders is acceptable given the coarse estimation scale

6. Sunlight labeling

  • For cells containing butterflies, note if they are in full sun
  • Only label sun exposure for cells that contain butterflies
  • Use F + Click to toggle sunlight for a cell

Best practices

Speed vs. accuracy

  • Prioritize efficiency over precise counts
  • When uncertain between categories, round up
  • The goal is order-of-magnitude estimation
  • Don’t spend excessive time on exact counts

Required steps before moving on

  1. Ensure username is entered
  2. Complete all cell classifications
  3. Mark sunlight exposure where applicable
  4. Add notes if necessary (blue button indicates notes present)
  5. Confirm image to save and proceed