Skip to content

chris-a-talbot/pyflocolor

Repository files navigation

Pyflocolor (Python Floral Color)

A graphical user interface and workflow centered around the method introduced by Perez-Udell et al. in An automated pipeline for supervised classification of petal color from citizen science photographs (2019). Substantial portions of the code associated with k-means clustering and image preparation are borrowed from this paper and associated GitHub repository, found here.

This application provides a comprehensive workflow and GUI for downloading iNaturalist occurrences with images of blooming flowers, downloading the associated images of flowers, and identifying the color values of flowers within those images.

Developed by Chris Talbot for work on a senior thesis project at the University of Michigan, 2024.

Installation

Download the latest release as a .exe from GitHub. Available for OSX and Linux by request.

Using the program

Upon running pyflocolor.exe, several new folders will be created in the directory of the executable file. You will be presented with a menu with five options:

Main menu

Downloading occurrence data

This feature is a work-in-progress (see "Get Occurrences" menu in-app). For now, occurrence data should be downloaded directly from iNaturalist.

Occurrences should be stored in separate CSV files for each species, with the file name {species_name}.csv. On first run of pyflocolor.exe, a directory will be created wherever the executable is stored. Occurrence CSVs should be placed directly into the AppData/Occurrences directory.

For best results, occurrences should be limited to those whose phenology is identified as blooming.

Downloading images from occurrences

Images can be downloaded for some or all species in the AppData/Occurrences folder from the "Get Images" menu. Images are stored in AppData/Images.

You may select a set of species from the list, or select "Do all species in list". If your files are not showing up, try hitting "Refresh List".

The number of images downloaded per species is set to 100 by default, but may be changed; species with fewer occurrences will download images for all occurrences.

If "Re-download images" is checked, images will be downloaded from the occurrences even if the image already exists in AppData/Images.

Downloads may take a while - no progress bar is implemented - please do not close the page until the status is updated from "Ready" to "Complete"!

"Get Images" menu

Training on color range

The program must be trained to identify clusters likely containing flower petals. In the "Train" menu, select the species to train for, a number of images to use for training, and a starting k value. Higher k values will create more clusters from the image, which makes it more likely a cluster will fully isolate a flower; however, more clusters means more computation time. Defaults are set to 10 images per species and a starting k of 5, but a starting k of 10 is recommended for most species.

"Train" menu

Upon beginning training, a new window will open, which will ask you to select the cluster that best represents the flower from the original image. If the flower is not separated from the background, you may increase the k value and try again. If no flower is present in the image, you may skip that image. If you feel you've trained on sufficiently many images for a species, you may force-complete the process for that species. Note that the clusters are 0-indexed, and the color tile & image for a cluster is displayed below the associated cluster number.

Train

Collecting color data

Once the program is trained to identify flowers for a species, the "Collect Data" menu may be used to identify clusters containing flowers, and their associated HSV values, for all downloaded images.

This process may take a while - no progress bar is implemented - please do not close the page until the status is updated from "Ready" to "Complete"!

"Collect Data" menu

Processing color data

Work in progress

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages