Classto is a Python library for building lightweight, browser-based tools to manually classify images into custom categories - ideal for preparing datasets or sorting visual content.
With just a few lines of Python, Classto spins up a local web interface built on Flask and styled with Tailwind CSS to let you quickly review, label, and organize images - right from your browser.
Classto in Light and Dark Mode
- Classify images with one click
- Supports custom category lists
- Images are moved into subfolders per label
- Optionally add unique filename suffixes
- CSV logging for ML dataset tracking
- Delete unwanted images during classification
- Dark mode toggle built in
You can install Classto via pip:
pip install classto
import classto as ct
app = ct.ImageLabeler(
classes=["Cat", "Dog"],
image_folder="images", # Path to your images
delete_button=True, # Optional delete button
suffix=True, # Add unique suffix to avoid conflicts
log_to_csv=True # Save results to labels.csv
)
app.launch()
Then open your browser at http://127.0.0.1:5000.
Place your images in a folder (e.g. images/) relative to your script:
project/
├── images/
│ ├── cat1.jpg
│ ├── cat2.jpg
│ ├── dog1.jpg
│ └── dog2.jpg
├── app.py
After classification, images are moved to:
project/
├── classified/
│ ├── Cat/
│ │ ├── cat1__K8dLs.jpg
│ │ └── cat2__a7JkL.jpg
│ ├── Dog/
│ │ ├── dog1__Xy4Tz.jpg
│ │ └── dog2__Zx9Pm.jpg
│ └── labels.csv
classes
(List[str]
): A list of categories for classification (e.g.["Dog", "Cat"]
).image_folder
(str
): Path to the folder containing the images to classify. Defaults to"images"
.delete_button
(bool
): IfTrue
, shows a delete button to remove images. Defaults toFalse
.suffix
(bool
): IfTrue
, appends a random suffix to filenames to avoid overwriting. Defaults toFalse
.log_to_csv
(bool
): IfTrue
, logs each classification into a CSV file. Defaults toFalse
.shuffle
(bool
): IfTrue
, images are shown in random order. Defaults toFalse
.
- Classto loads images from your specified folder (e.g.
images/
) - Each classification moves the image to
classified/<category>/
- Optionally appends a suffix to the filename
- If enabled, logs the action to a
labels.csv
file inclassified/
If log_to_csv=True
is enabled, each classification is logged to a labels.csv
file inside the classified/
directory. The file contains the following columns:
original_filename | new_filename | label | timestamp |
---|---|---|---|
img01.jpg | img01__4Fg7T.jpg | Cat | 2025-08-19T10:58:00+00:00 |
original_filename
: The name of the image before classification.new_filename
: The new name after suffixing (if enabled).label
: The category selected during classification.timestamp
: When the classification occurred, in ISO 8601 format (UTC).